mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
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 8546d53b05
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 <michael@schuster.ms>
This commit is contained in:
parent
003acb7254
commit
c03bc8540c
1 changed files with 10 additions and 3 deletions
|
@ -64,12 +64,19 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
||||||
case ActivityItemDelegate::PathRole:
|
case ActivityItemDelegate::PathRole:
|
||||||
if(!a._file.isEmpty()){
|
if(!a._file.isEmpty()){
|
||||||
auto folder = FolderMan::instance()->folder(a._folder);
|
auto folder = FolderMan::instance()->folder(a._folder);
|
||||||
if(!folder)
|
QString relPath(a._file);
|
||||||
return QVariant();
|
if(folder) relPath.prepend(folder->remotePath());
|
||||||
list = FolderMan::instance()->findFileInLocalFolders(folder->remotePath(), ast->account());
|
list = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
|
||||||
if (list.count() > 0) {
|
if (list.count() > 0) {
|
||||||
return QVariant(list.at(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();
|
return QVariant();
|
||||||
case ActivityItemDelegate::ActionsLinksRole:{
|
case ActivityItemDelegate::ActionsLinksRole:{
|
||||||
|
|
Loading…
Reference in a new issue