[Pkg-owncloud-commits] [owncloud-client] 379/484: ActivityWidget: display if the server does not support acitivities.

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:38:08 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 94e7c762bf1e728c25474ffcc3dbf3d5c5b77f6b
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Thu Nov 19 16:00:22 2015 +0100

    ActivityWidget: display if the server does not support acitivities.
    
    If the server does not have the activities app enabled, it says so now.
    Fix for #4163
---
 src/gui/activitywidget.cpp | 33 ++++++++++++++++++++++++++++++++-
 src/gui/activitywidget.h   |  7 +++++++
 src/gui/activitywidget.ui  |  7 +++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp
index 4cb8cf2..ab9c1e5 100644
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@ -182,6 +182,10 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int stat
 
     _activityLists[ai] = list;
 
+    if( statusCode == 999 ) {
+        emit accountWithoutActivityApp(ai);
+    }
+
     combineActivityLists();
 }
 
@@ -269,7 +273,10 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
     _ui->_activityList->setAlternatingRowColors(true);
     _ui->_activityList->setModel(_model);
 
-    _ui->_headerLabel->setText(tr("Server Activities"));
+    showLabels();
+
+    connect(_model, SIGNAL(accountWithoutActivityApp(AccountState*)),
+            this, SLOT(slotAccountWithoutActivityApp(AccountState*)));
 
     _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
     _copyBtn->setToolTip( tr("Copy the activity list to the clipboard."));
@@ -296,6 +303,30 @@ void ActivityWidget::slotRemoveAccount( AccountState *ptr )
     _model->slotRemoveAccount(ptr);
 }
 
+void ActivityWidget::showLabels()
+{
+    QString t = tr("Server Activities");
+    _ui->_headerLabel->setTextFormat(Qt::RichText);
+    _ui->_headerLabel->setText(t);
+
+    t.clear();
+    QSetIterator<QString> i(_accountsWithoutActivities);
+    while (i.hasNext() ) {
+        t.append( tr("<br/>Account %1 does not have activities enabled.").arg(i.next()));
+    }
+    _ui->_bottomLabel->setTextFormat(Qt::RichText);
+    _ui->_bottomLabel->setText(t);
+}
+
+void ActivityWidget::slotAccountWithoutActivityApp(AccountState *ast)
+{
+    if( ast && ast->account() ) {
+        _accountsWithoutActivities.insert(ast->account()->displayName());
+    }
+
+    showLabels();
+}
+
 // FIXME: Reused from protocol widget. Move over to utilities.
 QString ActivityWidget::timeString(QDateTime dt, QLocale::FormatType format) const
 {
diff --git a/src/gui/activitywidget.h b/src/gui/activitywidget.h
index 0158233..03836d0 100644
--- a/src/gui/activitywidget.h
+++ b/src/gui/activitywidget.h
@@ -112,6 +112,9 @@ public slots:
 private slots:
     void slotActivitiesReceived(const QVariantMap& json, int statusCode);
 
+signals:
+    void accountWithoutActivityApp(AccountState* ast);
+
 private:
     void startFetchJob(AccountState* s);
     void combineActivityLists();
@@ -142,6 +145,7 @@ public slots:
     void slotOpenFile(QModelIndex indx);
     void slotRefresh(AccountState* ptr);
     void slotRemoveAccount( AccountState *ptr );
+    void slotAccountWithoutActivityApp(AccountState *ast);
 
 signals:
     void guiLog(const QString&, const QString&);
@@ -149,10 +153,13 @@ signals:
     void rowsInserted();
 
 private:
+    void showLabels();
     QString timeString(QDateTime dt, QLocale::FormatType format) const;
     Ui::ActivityWidget *_ui;
     QPushButton *_copyBtn;
 
+    QSet<QString> _accountsWithoutActivities;
+
     ActivityListModel *_model;
 };
 
diff --git a/src/gui/activitywidget.ui b/src/gui/activitywidget.ui
index ddce3e5..eb48941 100644
--- a/src/gui/activitywidget.ui
+++ b/src/gui/activitywidget.ui
@@ -25,6 +25,13 @@
     <widget class="QListView" name="_activityList"/>
    </item>
    <item row="2" column="0">
+    <widget class="QLabel" name="_bottomLabel">
+     <property name="text">
+      <string>TextLabel</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0">
     <widget class="QDialogButtonBox" name="_dialogButtonBox"/>
    </item>
   </layout>

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