[Pkg-owncloud-commits] [owncloud-client] 70/171: Bring back the red box for errors #3796

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:50 UTC 2016


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

hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.

commit a63ebe09049c3f8108bd7af8126192583ee33ee6
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Wed Jan 6 10:56:07 2016 +0100

    Bring back the red box for errors #3796
    
    This use the previous code by resetting the progress to hide
    the progress back and then return errors in the FolderErrorMsg
    data role of the folder model.
    
    This also remove the unused FolderRemotePath role, remove FolderStatus
    in favor of invalidating all roles in dataChanged and make sure
    that the SyncRunning role is transfered properly from the SyncResult
    to show the warning icon during sync.
---
 src/gui/folderstatusdelegate.cpp | 10 +++++-----
 src/gui/folderstatusdelegate.h   |  2 --
 src/gui/folderstatusmodel.cpp    |  7 ++++---
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/gui/folderstatusdelegate.cpp b/src/gui/folderstatusdelegate.cpp
index 8c88485..a173321 100644
--- a/src/gui/folderstatusdelegate.cpp
+++ b/src/gui/folderstatusdelegate.cpp
@@ -141,10 +141,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
     QString itemString    = qvariant_cast<QString>(index.data(SyncProgressItemString));
     int warningCount      = qvariant_cast<int>(index.data(WarningCount));
     bool syncOngoing      = qvariant_cast<bool>(index.data(SyncRunning));
-
-    // QString statusText = qvariant_cast<QString>(index.data(FolderStatus));
-    bool syncEnabled = index.data(FolderAccountConnected).toBool();
-    // QString syncStatus = syncEnabled? tr( "Enabled" ) : tr( "Disabled" );
+    bool syncEnabled      = qvariant_cast<bool>(index.data(FolderAccountConnected));
 
     QRect iconRect = option.rect;
     QRect aliasRect = option.rect;
@@ -327,6 +324,9 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
     painter->restore();
 
     {
+        QRect rectWithoutErrors = option.rect;
+        rectWithoutErrors.setTop(iconRect.top());
+        rectWithoutErrors.setBottom(iconRect.bottom());
         QStyleOptionToolButton btnOpt;
         //btnOpt.text = QLatin1String("...");
         btnOpt.state = option.state;
@@ -334,7 +334,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
         btnOpt.state |= QStyle::State_Raised;
         btnOpt.arrowType = Qt::NoArrow;
         btnOpt.subControls = QStyle::SC_ToolButton;
-        btnOpt.rect = optionsButtonRect(option.rect);
+        btnOpt.rect = optionsButtonRect(rectWithoutErrors);
         btnOpt.icon = m_moreIcon;
         btnOpt.iconSize = btnOpt.rect.size();
         QApplication::style()->drawComplexControl( QStyle::CC_ToolButton, &btnOpt, painter );
diff --git a/src/gui/folderstatusdelegate.h b/src/gui/folderstatusdelegate.h
index b299a30..59acc87 100644
--- a/src/gui/folderstatusdelegate.h
+++ b/src/gui/folderstatusdelegate.h
@@ -33,8 +33,6 @@ public:
                     HeaderRole,
                     FolderPathRole,
                     FolderSecondPathRole,
-                    FolderRemotePath,
-                    FolderStatus,
                     FolderErrorMsg,
                     FolderSyncPaused,
                     FolderStatusIconRole,
diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp
index 86be5e9..fc3fc81 100644
--- a/src/gui/folderstatusmodel.cpp
+++ b/src/gui/folderstatusmodel.cpp
@@ -187,6 +187,8 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
     switch (role) {
     case FolderStatusDelegate::FolderPathRole         : return  f->shortGuiPath();
     case FolderStatusDelegate::FolderSecondPathRole   : return  f->remotePath();
+    case FolderStatusDelegate::FolderErrorMsg         : return  f->syncResult().errorStrings();
+    case FolderStatusDelegate::SyncRunning            : return  f->syncResult().status() == SyncResult::SyncRunning;
     case FolderStatusDelegate::HeaderRole             : return  f->aliasGui();
     case FolderStatusDelegate::FolderAliasRole        : return  f->alias();
     case FolderStatusDelegate::FolderSyncPaused       : return  f->syncPaused();
@@ -708,8 +710,7 @@ void FolderStatusModel::slotUpdateFolderState(Folder *folder)
     if( ! folder ) return;
     for (int i = 0; i < _folders.count(); ++i) {
         if (_folders.at(i)._folder == folder) {
-            emit dataChanged(index(i), index(i),
-                             QVector<int>() << FolderStatusDelegate::FolderStatus);
+            emit dataChanged(index(i), index(i));
         }
     }
 }
@@ -970,7 +971,7 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
         // Reset the progress info after a sync.
         _folders[folderIndex]._progress = SubFolderInfo::Progress();
     } else if (state == SyncResult::Error) {
-        _folders[folderIndex]._progress._progressString = f->syncResult().errorString();
+        _folders[folderIndex]._progress = SubFolderInfo::Progress();
     }
 
     // update the icon etc. now

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