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