[Pkg-owncloud-commits] [owncloud-client] 225/498: Improve account connectivity tooltips. #3200
Sandro Knauß
hefee-guest at moszumanska.debian.org
Tue Aug 11 14:48:52 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 8aeb3cc8d20ae18492c4316a6d3067c303508af2
Author: Christian Kamm <kamm at incasoftware.de>
Date: Wed Jul 1 12:30:18 2015 +0200
Improve account connectivity tooltips. #3200
* Show connection errors for all failing accounts in the tooltip.
* Don't hide the 'service unavailable' state. We don't want intrusive
pop ups, but we don't want to pretend we're syncing when we aren't.
* Show sync-running icon also for SyncPrepare state. In my tests I
very rarely saw the sync-running icon before.
---
src/gui/accountstate.cpp | 14 ++++-----
src/gui/accountstate.h | 2 +-
src/gui/application.cpp | 46 +++++-----------------------
src/gui/application.h | 5 ----
src/gui/folderman.cpp | 2 +-
src/gui/owncloudgui.cpp | 78 +++++++++++++++++++++++-------------------------
src/gui/owncloudgui.h | 3 --
7 files changed, 54 insertions(+), 96 deletions(-)
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index c8d3ea9..4bf8ecd 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -91,19 +91,19 @@ QString AccountState::stateString(State state)
switch (state)
{
case SignedOut:
- return QLatin1String("SignedOut");
+ return tr("Signed out");
case Disconnected:
- return QLatin1String("Disconnected");
+ return tr("Disconnected");
case Connected:
- return QLatin1String("Connected");
+ return tr("Connected");
case ServiceUnavailable:
- return QLatin1String("ServiceUnavailable");
+ return tr("Service unavailable");
case NetworkError:
- return QLatin1String("NetworkError");
+ return tr("Network error");
case ConfigurationError:
- return QLatin1String("ConfigurationError");
+ return tr("Configuration error");
}
- return QLatin1String("Unknown");
+ return tr("Unknown account state");
}
bool AccountState::isSignedOut() const
diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h
index b778dda..d7eaf4f 100644
--- a/src/gui/accountstate.h
+++ b/src/gui/accountstate.h
@@ -74,7 +74,7 @@ public:
static QString connectionStatusString(ConnectionStatus status);
State state() const;
- static QString stateString(State status);
+ static QString stateString(State state);
bool isSignedOut() const;
void setSignedOut(bool signedOut);
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index f4682fa..bdb6405 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -89,7 +89,6 @@ Application::Application(int &argc, char **argv) :
_gui(0),
_theme(Theme::instance()),
_helpOnly(false),
- _startupNetworkError(false),
_showLogWindow(false),
_logExpire(0),
_logFlush(false),
@@ -218,8 +217,6 @@ void Application::slotLogout()
void Application::slotAccountStateRemoved(AccountState *accountState)
{
- disconnect(accountState, SIGNAL(stateChanged(int)),
- this, SLOT(slotAccountStateChanged(int)));
if (_gui) {
disconnect(accountState, SIGNAL(stateChanged(int)),
_gui, SLOT(slotAccountStateChanged()));
@@ -233,8 +230,6 @@ void Application::slotAccountStateRemoved(AccountState *accountState)
void Application::slotAccountStateAdded(AccountState *accountState)
{
connect(accountState, SIGNAL(stateChanged(int)),
- this, SLOT(slotAccountStateChanged(int)));
- connect(accountState, SIGNAL(stateChanged(int)),
_gui, SLOT(slotAccountStateChanged()));
connect(accountState, SIGNAL(stateChanged(int)),
_folderManager.data(), SLOT(slotAccountStateChanged()));
@@ -259,7 +254,14 @@ void Application::slotCheckConnection()
{
auto list = AccountManager::instance()->accounts();
foreach (const auto &accountState , list) {
- accountState->checkConnectivity();
+ AccountState::State state = accountState->state();
+
+ // Don't check if we're manually signed out or
+ // when the error is permanent.
+ if (state != AccountState::SignedOut
+ && state != AccountState::ConfigurationError) {
+ accountState->checkConnectivity();
+ }
}
if (list.isEmpty()) {
@@ -270,43 +272,11 @@ void Application::slotCheckConnection()
}
}
-void Application::slotAccountStateChanged(int state)
-{
- // THE FOLLOWING STILL NEEDS FIXING!
-
- // Stop checking the connection if we're manually signed out or
- // when the error is permanent.
- if (state == AccountState::SignedOut
- || state == AccountState::ConfigurationError) {
- _checkConnectionTimer.stop();
- } else if (! _checkConnectionTimer.isActive()) {
- _checkConnectionTimer.start();
- }
-
- slotUpdateConnectionErrors(state);
-}
-
void Application::slotCrash()
{
Utility::crash();
}
-void Application::slotUpdateConnectionErrors(int accountState)
-{
- bool isConnected = accountState == AccountState::Connected;
- if( !isConnected ) {
- _startupNetworkError = accountState == AccountState::NetworkError;
- }
-
-#warning FIXME: connection errors should be shown per account
-#if 0
- AccountState *as = AccountStateManager::instance()->accountState();
- if (as) {
- _gui->setConnectionErrors( isConnected, as->connectionErrors() );
- }
-#endif
-}
-
void Application::slotownCloudWizardDone( int res )
{
FolderMan *folderMan = FolderMan::instance();
diff --git a/src/gui/application.h b/src/gui/application.h
index 56fcc12..dddedff 100644
--- a/src/gui/application.h
+++ b/src/gui/application.h
@@ -78,7 +78,6 @@ signals:
protected slots:
void slotParseMessage(const QString&, QObject*);
void slotCheckConnection();
- void slotUpdateConnectionErrors(int accountState);
void slotStartUpdateDetector();
void slotUseMonoIconsChanged( bool );
void slotLogin();
@@ -86,7 +85,6 @@ protected slots:
void slotCleanup();
void slotAccountStateAdded(AccountState *accountState);
void slotAccountStateRemoved(AccountState *accountState);
- void slotAccountStateChanged(int state);
void slotCrash();
private:
@@ -97,7 +95,6 @@ private:
Theme *_theme;
bool _helpOnly;
- bool _startupNetworkError;
// options from command line:
bool _showLogWindow;
@@ -116,8 +113,6 @@ private:
QScopedPointer<CrashReporter::Handler> _crashHandler;
#endif
QScopedPointer<FolderMan> _folderManager;
-
- friend class ownCloudGui; // for _startupNetworkError
};
} // namespace OCC
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 2c27745..552a9a7 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -1010,9 +1010,9 @@ SyncResult FolderMan::accountStatus(const QList<Folder*> &folders)
switch( syncStatus ) {
case SyncResult::Undefined:
case SyncResult::NotYetStarted:
- case SyncResult::SyncPrepare:
various++;
break;
+ case SyncResult::SyncPrepare:
case SyncResult::SyncRunning:
runSeen++;
break;
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 5a14665..2a5780d 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -205,25 +205,34 @@ void ownCloudGui::slotAccountStateChanged()
slotComputeOverallSyncStatus();
}
-void ownCloudGui::setConnectionErrors( bool /*connected*/, const QStringList& fails )
-{
- _startupFails = fails; // store that for the settings dialog once it appears.
-
- slotComputeOverallSyncStatus();
-}
-
void ownCloudGui::slotComputeOverallSyncStatus()
{
bool allSignedOut = true;
+ QVector<AccountStatePtr> problemAccounts;
foreach (auto a, AccountManager::instance()->accounts()) {
if (!a->isSignedOut()) {
allSignedOut = false;
}
- if (!a->isConnectedOrTemporarilyUnavailable()) {
- _tray->setIcon(Theme::instance()->folderOfflineIcon(true));
- _tray->setToolTip(tr("Disconnected from server"));
- return;
+ if (!a->isConnected()) {
+ problemAccounts.append(a);
+ }
+ }
+
+ if (!problemAccounts.empty()) {
+ _tray->setIcon(Theme::instance()->folderOfflineIcon(true));
+ QStringList messages;
+ messages.append(tr("Disconnected from accounts:"));
+ foreach (AccountStatePtr a, problemAccounts) {
+ QString message = tr("Account %1: %2").arg(
+ a->account()->displayName(), a->stateString(a->state()));
+ if (! a->connectionErrors().empty()) {
+ message += QLatin1String("\n");
+ message += a->connectionErrors().join(QLatin1String("\n"));
+ }
+ messages.append(message);
}
+ _tray->setToolTip(messages.join(QLatin1String("\n\n")));
+ return;
}
if (allSignedOut) {
@@ -238,42 +247,29 @@ void ownCloudGui::slotComputeOverallSyncStatus()
Folder::Map map = folderMan->map();
SyncResult overallResult = FolderMan::accountStatus(map.values());
- if( !_startupFails.isEmpty() ) {
- trayMessage = _startupFails.join(QLatin1String("\n"));
- QIcon statusIcon;
- if (_app->_startupNetworkError) {
- statusIcon = Theme::instance()->syncStateIcon( SyncResult::NotYetStarted, true );
+ // create the tray blob message, check if we have an defined state
+ if( overallResult.status() != SyncResult::Undefined ) {
+ QStringList allStatusStrings;
+ if( map.count() > 0 ) {
+ foreach(Folder* folder, map.values()) {
+ qDebug() << "Folder in overallStatus Message: " << folder << " with name " << folder->alias();
+ QString folderMessage = folderMan->statusToString(folder->syncResult().status(), folder->syncPaused());
+ allStatusStrings += tr("Folder %1: %2").arg(folder->alias(), folderMessage);
+ }
+
+ trayMessage = allStatusStrings.join(QLatin1String("\n"));
} else {
- statusIcon = Theme::instance()->syncStateIcon( SyncResult::Error, true );
+ trayMessage = tr("No sync folders configured.");
}
+ QIcon statusIcon = Theme::instance()->syncStateIcon( overallResult.status(), true);
_tray->setIcon( statusIcon );
_tray->setToolTip(trayMessage);
} else {
- // create the tray blob message, check if we have an defined state
- if( overallResult.status() != SyncResult::Undefined ) {
- QStringList allStatusStrings;
- if( map.count() > 0 ) {
- foreach(Folder* folder, map.values()) {
- qDebug() << "Folder in overallStatus Message: " << folder << " with name " << folder->alias();
- QString folderMessage = folderMan->statusToString(folder->syncResult().status(), folder->syncPaused());
- allStatusStrings += tr("Folder %1: %2").arg(folder->alias(), folderMessage);
- }
-
- trayMessage = allStatusStrings.join(QLatin1String("\n"));
- } else {
- trayMessage = tr("No sync folders configured.");
- }
-
- QIcon statusIcon = Theme::instance()->syncStateIcon( overallResult.status(), true);
- _tray->setIcon( statusIcon );
- _tray->setToolTip(trayMessage);
- } else {
- // undefined because there are no folders.
- QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Problem, true);
- _tray->setIcon( icon );
- _tray->setToolTip(tr("There are no sync folders configured."));
- }
+ // undefined because there are no folders.
+ QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Problem, true);
+ _tray->setIcon( icon );
+ _tray->setToolTip(tr("There are no sync folders configured."));
}
}
diff --git a/src/gui/owncloudgui.h b/src/gui/owncloudgui.h
index d609bcd..72b3657 100644
--- a/src/gui/owncloudgui.h
+++ b/src/gui/owncloudgui.h
@@ -44,7 +44,6 @@ public:
explicit ownCloudGui(Application *parent = 0);
void setupContextMenu();
- void setConnectionErrors(bool connected , const QStringList &fails);
bool checkAccountExists(bool openSettings);
@@ -110,8 +109,6 @@ private:
QSignalMapper *_recentItemsMapper;
Application *_app;
-
- QStringList _startupFails;
};
} // namespace OCC
--
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