[Pkg-owncloud-commits] [owncloud-client] 262/470: Merge branch 'notifications'
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:11 UTC 2016
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 6b0d535120947d6f43e85781167e58e474489790
Merge: 8b3ea7a 885f8b3
Author: Klaas Freitag <freitag at owncloud.com>
Date: Mon Apr 4 10:40:33 2016 +0200
Merge branch 'notifications'
client.qrc | 1 +
doc/conffile.rst | 5 +-
resources/bell.png | Bin 0 -> 900 bytes
src/gui/CMakeLists.txt | 6 +
src/gui/activitydata.cpp | 35 +++
src/gui/activitydata.h | 89 ++++++
src/gui/activitylistmodel.cpp | 228 ++++++++++++++
src/gui/activitylistmodel.h | 67 ++++
src/gui/activitywidget.cpp | 562 ++++++++++++++++++++--------------
src/gui/activitywidget.h | 122 +++-----
src/gui/activitywidget.ui | 43 ++-
src/gui/notificationconfirmjob.cpp | 81 +++++
src/gui/notificationconfirmjob.h | 90 ++++++
src/gui/notificationwidget.cpp | 147 +++++++++
src/gui/notificationwidget.h | 60 ++++
src/gui/notificationwidget.ui | 129 ++++++++
src/gui/ocsjob.cpp | 2 +-
src/gui/ocsjob.h | 2 +
src/gui/servernotificationhandler.cpp | 103 +++++++
src/gui/servernotificationhandler.h | 47 +++
src/gui/settingsdialog.cpp | 4 +-
src/libsync/abstractnetworkjob.cpp | 5 +
src/libsync/abstractnetworkjob.h | 1 +
src/libsync/account.cpp | 9 +
src/libsync/account.h | 1 +
src/libsync/capabilities.cpp | 10 +
src/libsync/capabilities.h | 6 +
src/libsync/configfile.cpp | 17 +
src/libsync/configfile.h | 3 +
src/libsync/utility.cpp | 2 +-
30 files changed, 1559 insertions(+), 318 deletions(-)
diff --cc doc/conffile.rst
index d4d6672,6c2cbc4..ecb1ab8
--- a/doc/conffile.rst
+++ b/doc/conffile.rst
@@@ -24,4 -24,4 +24,7 @@@ You can change the following configurat
- ``chunkSize`` (default: ``5242880``) -- Specifies the chunk size of uploaded files in bytes.
- - ``promptDeleteAllFiles`` (default: ``true``) -- If a UI prompt should ask for confirmation if it was detected that all files and folders were deleted.
++- ``promptDeleteAllFiles`` (default: ``true``) -- If a UI prompt should ask for confirmation if it was detected that all files and folders were deleted.
++
+ - ``notificationRefreshInterval`` (default``300,000``) -- Specifies the default interval of checking for new server notifications in milliseconds.
++
diff --cc src/gui/CMakeLists.txt
index 0f98ce8,6d9a3a2..93ebd20
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@@ -84,7 -87,9 +87,10 @@@ set(client_SRC
proxyauthhandler.cpp
proxyauthdialog.cpp
synclogdialog.cpp
+ tooltipupdater.cpp
+ notificationwidget.cpp
+ notificationconfirmjob.cpp
+ servernotificationhandler.cpp
creds/credentialsfactory.cpp
creds/httpcredentialsgui.cpp
creds/shibbolethcredentials.cpp
diff --cc src/gui/activitywidget.cpp
index 265ce42,eeb4dd1..ce3924e
--- a/src/gui/activitywidget.cpp
+++ b/src/gui/activitywidget.cpp
@@@ -38,224 -43,13 +43,12 @@@
#include <climits>
- namespace OCC {
-
- void ActivityList::setAccountName( const QString& name )
- {
- _accountName = name;
- }
-
- QString ActivityList::accountName() const
- {
- return _accountName;
- }
-
- /* ==================================================================== */
-
- ActivityListModel::ActivityListModel(QWidget *parent)
- :QAbstractListModel(parent)
- {
- }
-
- QVariant ActivityListModel::data(const QModelIndex &index, int role) const
- {
- Activity a;
-
- if (!index.isValid())
- return QVariant();
-
- a = _finalList.at(index.row());
- AccountStatePtr ast = AccountManager::instance()->account(a._accName);
- QStringList list;
-
- if (role == Qt::EditRole)
- return QVariant();
-
- switch (role) {
- case ActivityItemDelegate::PathRole:
- list = FolderMan::instance()->findFileInLocalFolders(a._file, ast->account());
- if( list.count() > 0 ) {
- return QVariant(list.at(0));
- }
- // File does not exist anymore? Let's try to open its path
- list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(a._file).path(), ast->account());
- if( list.count() > 0 ) {
- return QVariant(list.at(0));
- }
- return QVariant();
- break;
- case ActivityItemDelegate::ActionIconRole:
- return QVariant(); // FIXME once the action can be quantified, display on Icon
- break;
- case ActivityItemDelegate::UserIconRole:
- return QIcon(QLatin1String(":/client/resources/account.png"));
- break;
- case Qt::ToolTipRole:
- case ActivityItemDelegate::ActionTextRole:
- return a._subject;
- break;
- case ActivityItemDelegate::LinkRole:
- return a._link;
- break;
- case ActivityItemDelegate::AccountRole:
- return a._accName;
- break;
- case ActivityItemDelegate::PointInTimeRole:
- return Utility::timeAgoInWords(a._dateTime);
- break;
- case ActivityItemDelegate::AccountConnectedRole:
- return (ast && ast->isConnected());
- break;
- default:
- return QVariant();
-
- }
- return QVariant();
-
- }
-
- int ActivityListModel::rowCount(const QModelIndex&) const
- {
- return _finalList.count();
- }
-
- // current strategy: Fetch 100 items per Account
- // ATTENTION: This method is const and thus it is not possible to modify
- // the _activityLists hash or so. Doesn't make it easier...
- bool ActivityListModel::canFetchMore(const QModelIndex& ) const
- {
- if( _activityLists.count() == 0 ) return true;
-
- QMap<AccountState*, ActivityList>::const_iterator i = _activityLists.begin();
- while (i != _activityLists.end()) {
- AccountState *ast = i.key();
- if( ast && ast->isConnected() ) {
- ActivityList activities = i.value();
- if( activities.count() == 0 &&
- ! _currentlyFetching.contains(ast) ) {
- return true;
- }
- }
- ++i;
- }
-
- return false;
- }
-
- void ActivityListModel::startFetchJob(AccountState* s)
- {
- if( !s->isConnected() ) {
- return;
- }
- JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v1.php/cloud/activity"), this);
- QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)),
- this, SLOT(slotActivitiesReceived(QVariantMap, int)));
- job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(s));
-
- QList< QPair<QString,QString> > params;
- params.append(qMakePair(QString::fromLatin1("page"), QString::fromLatin1("0")));
- params.append(qMakePair(QString::fromLatin1("pagesize"), QString::fromLatin1("100")));
- job->addQueryParams(params);
-
- _currentlyFetching.insert(s);
- qDebug() << "Start fetching activities for " << s->account()->displayName();
- job->start();
- }
-
- void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int statusCode)
- {
- auto activities = json.value("ocs").toMap().value("data").toList();
- qDebug() << "*** activities" << activities;
-
- ActivityList list;
- AccountState* ast = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
- _currentlyFetching.remove(ast);
- list.setAccountName( ast->account()->displayName());
-
- foreach( auto activ, activities ) {
- auto json = activ.toMap();
-
- Activity a;
- a._accName = ast->account()->displayName();
- a._id = json.value("id").toLongLong();
- a._subject = json.value("subject").toString();
- a._message = json.value("message").toString();
- a._file = json.value("file").toString();
- a._link = json.value("link").toUrl();
- a._dateTime = json.value("date").toDateTime();
- list.append(a);
- }
-
- _activityLists[ast] = list;
-
- emit activityJobStatusCode(ast, statusCode);
+ // time span in milliseconds which has to be between two
+ // refreshes of the notifications
+ #define NOTIFICATION_REQUEST_FREE_PERIOD 15000
- combineActivityLists();
- }
-
-
- void ActivityListModel::combineActivityLists()
- {
- ActivityList resultList;
-
- foreach( ActivityList list, _activityLists.values() ) {
- resultList.append(list);
- }
-
- std::sort( resultList.begin(), resultList.end() );
-
- beginInsertRows(QModelIndex(), 0, resultList.count()-1);
- _finalList = resultList;
- endInsertRows();
- }
-
- void ActivityListModel::fetchMore(const QModelIndex &)
- {
- QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();
-
- foreach (AccountStatePtr asp, accounts) {
- bool newItem = false;
-
- if( !_activityLists.contains(asp.data()) && asp->isConnected() ) {
- _activityLists[asp.data()] = ActivityList();
- newItem = true;
- }
- if( newItem ) {
- startFetchJob(asp.data());
- }
- }
- }
-
- void ActivityListModel::slotRefreshActivity(AccountState *ast)
- {
- if(ast && _activityLists.contains(ast)) {
- qDebug() << "**** Refreshing Activity list for" << ast->account()->displayName();
- _activityLists.remove(ast);
- }
- 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);
- }
- }
+ namespace OCC {
-
/* ==================================================================== */
ActivityWidget::ActivityWidget(QWidget *parent) :
@@@ -438,13 -522,19 +521,22 @@@ ActivitySettings::ActivitySettings(QWid
_progressIndicator = new QProgressIndicator(this);
_tab->setCornerWidget(_progressIndicator);
+ connect(&_notificationCheckTimer, SIGNAL(timeout()),
+ this, SLOT(slotRegularNotificationCheck()));
+
// connect a model signal to stop the animation.
connect(_activityWidget, SIGNAL(rowsInserted()), _progressIndicator, SLOT(stopAnimation()));
+
+ // We want the protocol be the default
+ _tab->setCurrentIndex(1);
}
+ void ActivitySettings::setNotificationRefreshInterval( quint64 interval )
+ {
+ qDebug() << "Starting Notification refresh timer with " << interval/1000 << " sec interval";
+ _notificationCheckTimer.start(interval);
+ }
+
void ActivitySettings::setActivityTabHidden(bool hidden)
{
if( hidden && _activityTabId > -1 ) {
--
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