Fixes the url for the button 'more information'.

- The url for the browser was not full path to the file.

Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
Camila San 2018-07-04 21:33:22 +02:00 committed by Roeland Jago Douma
parent 64d635a046
commit ec51428e4d
No known key found for this signature in database
GPG key ID: F941078878347C0C
2 changed files with 14 additions and 9 deletions

View file

@ -120,6 +120,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
return a._message;
break;
case ActivityItemDelegate::LinkRole:
qDebug() << "Link Role!" << a._link;
return a._link;
break;
case ActivityItemDelegate::AccountRole:

View file

@ -119,6 +119,7 @@ void ActivityWidget::slotProgressInfo(const QString &folder, const ProgressInfo
void ActivityWidget::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item){
auto folderInstance = FolderMan::instance()->folder(folder);
if (!folderInstance)
return;
@ -128,16 +129,18 @@ void ActivityWidget::slotItemCompleted(const QString &folder, const SyncFileItem
activity._type = Activity::ErrorType;
activity._dateTime = QDateTime::fromString(QDateTime::currentDateTime().toString(), Qt::ISODate);
activity._subject = item->_errorString;
qDebug() << "TOTAL " << folder;
activity._message = item->_originalFile;
activity._link = folderInstance->remotePath();
// TODO: use the full path to the file
activity._link = folderInstance->accountState()->account()->url();
activity._status = item->_status;
activity._accName = folderInstance->accountState()->account()->displayName();
activity._file = item->_file;
ActivityLink al;
QFileInfo file(item->_file);
al._label = tr("Open Folder");
al._link = folderInstance->path();
al._link = QString("%1/%2").arg(folderInstance->cleanPath(), file.path());
qDebug() << "FULLPATH:" << al._link;
al._verb = "";
al._isPrimary = true;
activity._links.append(al);
@ -180,6 +183,7 @@ void ActivityWidget::addError(const QString &folderAlias, const QString &message
void ActivityWidget::slotPrimaryButtonClickedOnListView(const QModelIndex &index){
QUrl link = qvariant_cast<QString>(index.data(ActivityItemDelegate::LinkRole));
qDebug() << "Tyring to open link: " << link;
if(!link.isEmpty())
Utility::openBrowser(link, this);
}
@ -211,10 +215,10 @@ void ActivityWidget::slotSecondaryButtonClickedOnListView(const QModelIndex &ind
if(qvariant_cast<Activity::Type>(index.data(ActivityItemDelegate::ActionRole)) == Activity::Type::ErrorType){
QString fileName = index.data(ActivityItemDelegate::PathRole).toString();
if (Folder *folder = FolderMan::instance()->folderForPath(actionLinks.first()._link)) {
QString fullPath = folder->path() + fileName;
if (QFile(fullPath).exists()) {
showInFileManager(fullPath);
// check if this is actually a folder
if (FolderMan::instance()->folderForPath(actionLinks.first()._link)) {
if (QFile(actionLinks.first()._link).exists()) {
showInFileManager(actionLinks.first()._link);
}
}
}
@ -356,7 +360,7 @@ void ActivityWidget::slotOpenFile(QModelIndex indx)
qCDebug(lcActivity) << indx.isValid() << indx.data(ActivityItemDelegate::PathRole).toString() << QFile::exists(indx.data(ActivityItemDelegate::PathRole).toString());
if (indx.isValid()) {
QString fullPath = indx.data(ActivityItemDelegate::PathRole).toString();
// TO DO: use full path to file
if (QFile::exists(fullPath)) {
showInFileManager(fullPath);
}