[Pkg-owncloud-commits] [owncloud-client] 312/484: ActivityWidget: implement removeAccount.

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:57 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 aa38f7a4f222dd87644f5f9deb064f51ecdc759d
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Nov 12 15:39:07 2015 +0100

    ActivityWidget: implement removeAccount.
---
 src/gui/activitywidget.cpp | 33 ++++++++++++++++++++++++++++++++-
 src/gui/activitywidget.h   |  4 ++++
 src/gui/generalsettings.h  |  1 -
 src/gui/settingsdialog.cpp |  4 +++-
 4 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index 97c1a61..9aa5736 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -239,13 +239,34 @@ void ActivityListModel::fetchMore(const QModelIndex &)
 
 void ActivityListModel::slotRefreshActivity(AccountState *ast)
 {
-    qDebug() << "**** Refreshing" << ast->account()->displayName();
     if(ast && _activityLists.contains(ast)) {
+        qDebug() << "**** Refreshing Activity list for" << ast->account()->displayName();
         _activityLists[ast].clear();
     }
     startFetchJob(ast);
 }
 
+void ActivityListModel::slotRemoveAccount(AccountState *ast )
+{
+    if( _activityLists.contains(ast) ) {
+        int i = 0;
+        const QString accountToRemove = ast->account()->displayName();
+
+        QMutableListIterator<Activity> it(_finalList);
+
+        while (it.hasNext()) {
+            Activity activity = it.next();
+            if( activity._accName == accountToRemove ) {
+                beginRemoveRows(QModelIndex(), i, i+1);
+                it.remove();
+                endRemoveRows();
+            }
+        }
+        _activityLists.remove(ast);
+        _currentlyFetching.remove(ast);
+    }
+}
+
 /* ==================================================================== */
 
 ActivityWidget::ActivityWidget(QWidget *parent) :
@@ -285,6 +306,11 @@ void ActivityWidget::slotRefresh(AccountState *ptr)
     _model->slotRefreshActivity(ptr);
 }
 
+void ActivityWidget::slotRemoveAccount( AccountState *ptr )
+{
+    _model->slotRemoveAccount(ptr);
+}
+
 // FIXME: Reused from protocol widget. Move over to utilities.
 QString ActivityWidget::timeString(QDateTime dt, QLocale::FormatType format) const
 {
@@ -408,6 +434,11 @@ void ActivitySettings::slotCopyToClipboard()
     emit guiLog(tr("Copied to clipboard"), tr("The %1 has been copied to the clipboard.").arg(theSubject));
 }
 
+void ActivitySettings::slotRemoveAccount( AccountState *ptr )
+{
+    _activityWidget->slotRemoveAccount(ptr);
+}
+
 void ActivitySettings::slotRefresh( AccountState* ptr )
 {
     _progressIndicator->startAnimation();
diff --git a/src/gui/activitywidget.h b/src/gui/activitywidget.h
index a27fbb1..e360188 100644
--- a/src/gui/activitywidget.h
+++ b/src/gui/activitywidget.h
@@ -95,6 +95,7 @@ public:
 
 public slots:
     void slotRefreshActivity(AccountState* ast);
+    void slotRemoveAccount( AccountState *ast );
 
 private slots:
     void slotActivitiesReceived(const QVariantMap& json);
@@ -126,6 +127,7 @@ public:
 public slots:
     void slotOpenFile();
     void slotRefresh(AccountState* ptr);
+    void slotRemoveAccount( AccountState *ptr );
 
 signals:
     void guiLog(const QString&, const QString&);
@@ -151,6 +153,8 @@ public:
 
 public slots:
     void slotRefresh( AccountState* ptr );
+    void slotRemoveAccount( AccountState *ptr );
+
     void slotCopyToClipboard();
 
 signals:
diff --git a/src/gui/generalsettings.h b/src/gui/generalsettings.h
index aa28d11..6aa5445 100644
--- a/src/gui/generalsettings.h
+++ b/src/gui/generalsettings.h
@@ -45,7 +45,6 @@ private slots:
     void slotUpdateInfo();
     void slotIgnoreFilesEditor();
     void slotOpenAccountWizard();
-    void slotOpenSyncLog();
     void slotAccountAddedOrRemoved();
 
 
diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp
index 0a07c26..f086148 100644
--- a/src/gui/settingsdialog.cpp
+++ b/src/gui/settingsdialog.cpp
@@ -213,7 +213,7 @@ void SettingsDialog::accountAdded(AccountState *s)
     connect( accountSettings, SIGNAL(openFolderAlias(const QString&)),
              _gui, SLOT(slotFolderOpenAction(QString)));
 
-
+    slotRefreshActivity(s);
 }
 
 void SettingsDialog::accountRemoved(AccountState *s)
@@ -233,6 +233,8 @@ void SettingsDialog::accountRemoved(AccountState *s)
             break;
         }
     }
+
+    _activitySettings->slotRemoveAccount(s);
 }
 
 void SettingsDialog::customizeStyle()

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