[Pkg-owncloud-commits] [owncloud-client] 37/120: UI: Avoid showing folder alias #783 #3576

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Aug 24 00:02:41 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 6152ce4187d253fc2495e5d87093df3ca18be582
Author: Markus Goetz <markus at woboq.com>
Date:   Tue Aug 11 15:12:43 2015 +0200

    UI: Avoid showing folder alias #783 #3576
---
 src/gui/folder.cpp            | 13 +++++++++++++
 src/gui/folder.h              |  1 +
 src/gui/folderstatusmodel.cpp |  2 +-
 src/gui/owncloudgui.cpp       |  2 +-
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp
index f7a6448..9e02e98 100644
--- a/src/gui/folder.cpp
+++ b/src/gui/folder.cpp
@@ -177,6 +177,19 @@ void Folder::checkLocalPath()
     }
 }
 
+QString Folder::aliasGui() const
+{
+    if (remotePath().length() > 0 && remotePath() != QLatin1String("/")) {
+        QString a = QFile(remotePath()).fileName();
+        if (a.startsWith('/')) {
+            a = a.remove(0, 1);
+        }
+        return a;
+    } else {
+        return Theme::instance()->appNameGUI();
+    }
+}
+
 QString Folder::alias() const
 {
     return _definition.alias;
diff --git a/src/gui/folder.h b/src/gui/folder.h
index fa48973..49ae3b5 100644
--- a/src/gui/folder.h
+++ b/src/gui/folder.h
@@ -101,6 +101,7 @@ public:
      * alias or nickname
      */
     QString alias() const;
+    QString aliasGui() const; // since 2.0 we don't want to show aliases anymore, show the path instead
 
     /**
      * local folder path
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index ec7e8f9..b9ec109 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -156,7 +156,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
     switch (role) {
     case FolderStatusDelegate::FolderPathRole         : return  f->nativePath();
     case FolderStatusDelegate::FolderSecondPathRole   : return  f->remotePath();
-    case FolderStatusDelegate::FolderAliasRole        : return  f->alias();
+    case FolderStatusDelegate::FolderAliasRole        : return  f->aliasGui();
     case FolderStatusDelegate::FolderSyncPaused       : return  f->syncPaused();
     case FolderStatusDelegate::FolderAccountConnected : return  accountConnected;
     case Qt::ToolTipRole:
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 16cd535..4579563 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -342,7 +342,7 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men
             folderName = Theme::instance()->appNameGUI();
         }
 
-        QAction *action = new QAction( tr("Open folder '%1'").arg(folder->alias()), this );
+        QAction *action = new QAction( tr("Open folder '%1'").arg(folder->path()), this );
         connect(action, SIGNAL(triggered()),_folderOpenActionMapper, SLOT(map()));
         _folderOpenActionMapper->setMapping( action, folder->alias() );
         menu->addAction(action);

-- 
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