From: Michael Schuster Date: Sun, 22 Dec 2019 05:16:27 +0000 (+0100) Subject: Fix folder opening in ActivityListModel X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~464 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c03bc8540c3554bbff92fb10c95c5d3bd117d6a7;p=nextcloud-desktop.git Fix folder opening in ActivityListModel After fixing the crash in the previous commit, double-clicking on Activity list rows still didn't work. This fix partly reverts commit 8546d53b05a76271e245f085d1caa5d405dadb8d in ActivityItemDelegate::PathRole of ActivityListModel::data, but adds a new check for relPath's existence in line 74. I'm assuming the previous change there has been done to shorten the code and avoid opening the user's home folder upon clicking entries which file value is "App Password". The new path-check takes care of that too now. Signed-off-by: Michael Schuster --- diff --git a/src/gui/activitylistmodel.cpp b/src/gui/activitylistmodel.cpp index 59598c71b..eeb0cc836 100644 --- a/src/gui/activitylistmodel.cpp +++ b/src/gui/activitylistmodel.cpp @@ -64,12 +64,19 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const case ActivityItemDelegate::PathRole: if(!a._file.isEmpty()){ auto folder = FolderMan::instance()->folder(a._folder); - if(!folder) - return QVariant(); - list = FolderMan::instance()->findFileInLocalFolders(folder->remotePath(), ast->account()); + QString relPath(a._file); + if(folder) relPath.prepend(folder->remotePath()); + list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account()); if (list.count() > 0) { return QVariant(list.at(0)); } + // File does not exist anymore? Let's try to open its path + if(QFileInfo(relPath).exists()) { + list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(relPath).path(), ast->account()); + if (list.count() > 0) { + return QVariant(list.at(0)); + } + } } return QVariant(); case ActivityItemDelegate::ActionsLinksRole:{