diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2013-11-27 17:15:56 +0400 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2013-11-27 17:15:56 +0400 |
commit | 46a403eb02b6171aae0e910d2bca0bcb90942241 (patch) | |
tree | 87480bacf37136e74fcb4e6f2dd61f1a9c0ffe04 /src/mirall | |
parent | e719e80409e28e9a6c52e723a5e93238d1133130 (diff) |
Report connection errors explicitly on explicit sign in attempts
Implicit connection attempts fail silently. This is roughly what
users expect from e.g. mail clients.
Fixes #1205.
Diffstat (limited to 'src/mirall')
-rw-r--r-- | src/mirall/application.cpp | 17 | ||||
-rw-r--r-- | src/mirall/application.h | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 5454fe133..07b07a663 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -85,7 +85,8 @@ Application::Application(int &argc, char **argv) : _startupNetworkError(false), _showLogWindow(false), _logExpire(0), - _logFlush(false) + _logFlush(false), + _userTriggeredConnect(false) { setApplicationName( _theme->appNameGUI() ); setWindowIcon( _theme->applicationIcon() ); @@ -154,6 +155,7 @@ void Application::slotLogin() Account *a = AccountManager::instance()->account(); if (a) { FolderMan::instance()->setupFolders(); + _userTriggeredConnect = true; slotCheckConnection(); } } @@ -246,12 +248,25 @@ void Application::slotConnectionValidatorResult(ConnectionValidator::Status stat folderMan->setSyncEnabled(true); // queue up the sync for all folders. folderMan->slotScheduleAllFolders(); + if(!_connectionMsgBox.isNull()) { + _connectionMsgBox->close(); + } + } else { // if we have problems here, it's unlikely that syncing will work. FolderMan::instance()->setSyncEnabled(false); startupFails = _conValidator->errors(); _startupNetworkError = _conValidator->networkError(); + if (_userTriggeredConnect) { + if(_connectionMsgBox.isNull()) { + _connectionMsgBox = new QMessageBox(QMessageBox::Warning, tr("Connection failed"), + _conValidator->errors().join(". ").append('.'), QMessageBox::Ok, 0); + _connectionMsgBox->setAttribute(Qt::WA_DeleteOnClose); + _connectionMsgBox->open(); + _userTriggeredConnect = false; + } + } QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection())); } _gui->startupConnected( (status == ConnectionValidator::Connected), startupFails); diff --git a/src/mirall/application.h b/src/mirall/application.h index f64194c44..916c04069 100644 --- a/src/mirall/application.h +++ b/src/mirall/application.h @@ -27,6 +27,7 @@ #include "mirall/connectionvalidator.h" #include "mirall/progressdispatcher.h" +class QMessageBox; class QSystemTrayIcon; namespace Mirall { @@ -98,6 +99,8 @@ private: QString _logDir; int _logExpire; bool _logFlush; + bool _userTriggeredConnect; + QPointer<QMessageBox> _connectionMsgBox; friend class ownCloudGui; // for _startupNetworkError }; |