[Pkg-owncloud-commits] [owncloud-client] 08/120: Account setting: properly disable the 'add account' button #3571

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Aug 24 00:02:36 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 b967359a7442e3b981469326a1112c2950f1ac3d
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Fri Aug 7 14:32:51 2015 +0200

    Account setting: properly disable the 'add account' button #3571
    
    When upgrading from 1.8 and syncing the whole account, then the
    remote folder is empty
---
 src/gui/folderstatusmodel.cpp | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 4943c60..ec7e8f9 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -75,11 +75,14 @@ Qt::ItemFlags FolderStatusModel::flags ( const QModelIndex &index  ) const
 #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
             ret = Qt::ItemNeverHasChildren;
 #endif
-            if (_folders.count() == 1 && _folders.at(0)._folder->remotePath() == QLatin1String("/")) {
-                // special case when syncing the entire owncloud: disable the add folder button (#3438)
-                return ret;
-            } else if (!_accountState->isConnected()) {
+            if (!_accountState->isConnected()) {
                 return ret;
+            } else if (_folders.count() == 1) {
+                auto remotePath = _folders.at(0)._folder->remotePath();
+                // special case when syncing the entire owncloud: disable the add folder button (#3438)
+                if (remotePath.isEmpty() || remotePath == QLatin1String("/")) {
+                    return ret;
+                }
             }
             return Qt::ItemIsEnabled | ret;
         }
@@ -106,12 +109,14 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
         } else if (role == Qt::ToolTipRole) {
             if (!_accountState->isConnected()) {
                 return tr("You need to be connected to add a folder");
-            } else if (_folders.count() == 1
-                        && _folders.at(0)._folder->remotePath() == QLatin1String("/")) {
-                // Syncing the entire owncloud: disable the add folder button (#3438)
-                return tr("Adding folder is disabled because your are already syncing all your files. "
-                          "If you want to sync multiple folders, please remove the currently "
-                          "configured root folder.");
+            } if (_folders.count() == 1) {
+                auto remotePath = _folders.at(0)._folder->remotePath();
+                if (remotePath.isEmpty() || remotePath == QLatin1String("/")) {
+                    // Syncing the entire owncloud: disable the add folder button (#3438)
+                    return tr("Adding folder is disabled because your are already syncing all your files. "
+                            "If you want to sync multiple folders, please remove the currently "
+                            "configured root folder.");
+                }
             }
             return tr("Click this button to add a folder to synchronize.");
         }

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