[Pkg-owncloud-commits] [owncloud-client] 407/484: Activity List: Improve double click handling on filenames #4168

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:38:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 76ce9ff8c4bd5e88bab5ea724c9d5b68d5ade383
Author: Markus Goetz <markus at woboq.com>
Date:   Tue Nov 24 14:24:18 2015 +0100

    Activity List: Improve double click handling on filenames #4168
---
 src/gui/activitywidget.cpp | 8 +++++++-
 src/gui/folderman.cpp      | 7 +++++--
 src/gui/folderman.h        | 2 +-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index 67f8db9..cd40c9a 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -73,7 +73,12 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
 
     switch (role) {
     case ActivityItemDelegate::PathRole:
-        list = FolderMan::instance()->findFileInLocalFolders(a._file);
+        list = FolderMan::instance()->findFileInLocalFolders(a._file, ast->account());
+        if( list.count() > 0 ) {
+            return QVariant(list.at(0));
+        }
+        // File does not exist anymore? Let's try to open its path
+        list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(a._file).path(), ast->account());
         if( list.count() > 0 ) {
             return QVariant(list.at(0));
         }
@@ -366,6 +371,7 @@ void ActivityWidget::storeActivityList( QTextStream& ts )
 
 void ActivityWidget::slotOpenFile(QModelIndex indx)
 {
+    qDebug() << indx.isValid() << indx.data(ActivityItemDelegate::PathRole).toString() << QFile::exists(indx.data(ActivityItemDelegate::PathRole).toString());
     if( indx.isValid() ) {
         QString fullPath = indx.data(ActivityItemDelegate::PathRole).toString();
 
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 8400c4d..18759a6 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -815,17 +815,20 @@ Folder *FolderMan::folderForPath(const QString &path)
     return 0;
 }
 
-QStringList FolderMan::findFileInLocalFolders( const QString& relPath )
+QStringList FolderMan::findFileInLocalFolders( const QString& relPath, const AccountPtr acc )
 {
     QStringList re;
 
     foreach(Folder* folder, this->map().values()) {
+        if (acc != 0 && folder->accountState()->account() != acc) {
+            continue;
+        }
         QString path = folder->cleanPath();
         QString remRelPath;
         // cut off the remote path from the server path.
         remRelPath = relPath.mid(folder->remotePath().length());
+        path += "/";
         path += remRelPath;
-
         if( QFile::exists(path) ) {
             re.append( path );
         }
diff --git a/src/gui/folderman.h b/src/gui/folderman.h
index eb9a3e3..b63e750 100644
--- a/src/gui/folderman.h
+++ b/src/gui/folderman.h
@@ -62,7 +62,7 @@ public:
       * incoming relative server path. The method checks with all existing sync
       * folders.
       */
-    QStringList findFileInLocalFolders( const QString& relPath );
+    QStringList findFileInLocalFolders( const QString& relPath, const AccountPtr acc );
 
     /** Returns the folder by alias or NULL if no folder with the alias exists. */
     Folder *folder( const QString& );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list