mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Fix/enhance user information about problems on startup.
Pass the error conditions to the gui class.
This commit is contained in:
parent
ea1c951006
commit
2149814428
@ -219,8 +219,6 @@ void Application::slotCredentialsFetched()
|
||||
|
||||
void Application::runValidator()
|
||||
{
|
||||
_startupFail.clear();
|
||||
|
||||
_conValidator = new ConnectionValidator();
|
||||
connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
|
||||
this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
|
||||
@ -230,24 +228,21 @@ void Application::runValidator()
|
||||
void Application::slotConnectionValidatorResult(ConnectionValidator::Status status)
|
||||
{
|
||||
qDebug() << "Connection Validator Result: " << _conValidator->statusString(status);
|
||||
|
||||
_gui->startupConnected(status);
|
||||
QStringList startupFails;
|
||||
|
||||
if( status == ConnectionValidator::Connected ) {
|
||||
|
||||
FolderMan *folderMan = FolderMan::instance();
|
||||
qDebug() << "######## Connection and Credentials are ok!";
|
||||
folderMan->setSyncEnabled(true);
|
||||
// queue up the sync for all folders.
|
||||
folderMan->slotScheduleAllFolders();
|
||||
|
||||
} else {
|
||||
// if we have problems here, it's unlikely that syncing will work.
|
||||
FolderMan::instance()->setSyncEnabled(false);
|
||||
|
||||
_startupFail = _conValidator->errors();
|
||||
startupFails = _conValidator->errors();
|
||||
}
|
||||
_gui->computeOverallSyncStatus(_startupFail);
|
||||
_gui->startupConnected( (status == ConnectionValidator::Connected), startupFails);
|
||||
|
||||
_conValidator->deleteLater();
|
||||
}
|
||||
@ -410,7 +405,7 @@ void Application::slotSetupProxy()
|
||||
|
||||
void Application::slotUseMonoIconsChanged(bool)
|
||||
{
|
||||
_gui->computeOverallSyncStatus(_startupFail);
|
||||
_gui->computeOverallSyncStatus();
|
||||
}
|
||||
|
||||
void Application::slotOpenLogBrowser()
|
||||
|
||||
@ -105,7 +105,6 @@ private:
|
||||
|
||||
QString _logFile;
|
||||
QString _logDirectory;
|
||||
QStringList _startupFail;
|
||||
|
||||
int _logExpire;
|
||||
bool _showLogWindow;
|
||||
|
||||
@ -30,6 +30,7 @@ namespace Mirall {
|
||||
|
||||
ownCloudGui::ownCloudGui(Application *parent) :
|
||||
QObject(parent),
|
||||
_settingsDialog(0),
|
||||
_contextMenu(0),
|
||||
_recentActionsMenu(0),
|
||||
_app(parent)
|
||||
@ -96,7 +97,7 @@ void ownCloudGui::slotSyncStateChange( const QString& alias )
|
||||
FolderMan *folderMan = FolderMan::instance();
|
||||
const SyncResult& result = folderMan->syncResult( alias );
|
||||
|
||||
computeOverallSyncStatus(_startupFail);
|
||||
computeOverallSyncStatus();
|
||||
|
||||
qDebug() << "Sync state changed for folder " << alias << ": " << result.statusString();
|
||||
|
||||
@ -105,10 +106,9 @@ void ownCloudGui::slotSyncStateChange( const QString& alias )
|
||||
}
|
||||
}
|
||||
|
||||
// c
|
||||
void ownCloudGui::slotFoldersChanged()
|
||||
{
|
||||
computeOverallSyncStatus(_startupFail);
|
||||
computeOverallSyncStatus();
|
||||
setupContextMenu();
|
||||
}
|
||||
|
||||
@ -117,24 +117,27 @@ void ownCloudGui::slotOpenLogBrowser()
|
||||
// REFACTOR: do somehting useful.
|
||||
}
|
||||
|
||||
void ownCloudGui::startupConnected( ConnectionValidator::Status /* status */ )
|
||||
void ownCloudGui::startupConnected( bool connected, const QStringList& fails )
|
||||
{
|
||||
FolderMan *folderMan = FolderMan::instance();
|
||||
qDebug() << "######## Connection and Credentials are ok!";
|
||||
folderMan->setSyncEnabled(true);
|
||||
_tray->setIcon( Theme::instance()->syncStateIcon( SyncResult::NotYetStarted, true ) );
|
||||
_tray->show();
|
||||
|
||||
int cnt = folderMan->map().size();
|
||||
slotShowOptionalTrayMessage(tr("%1 Sync Started").arg(Theme::instance()->appNameGUI()),
|
||||
tr("Sync started for %n configured sync folder(s).","", cnt));
|
||||
if( connected ) {
|
||||
qDebug() << "######## connected to ownCloud Server!";
|
||||
folderMan->setSyncEnabled(true);
|
||||
_tray->setIcon( Theme::instance()->syncStateIcon( SyncResult::NotYetStarted, true ) );
|
||||
_tray->show();
|
||||
} else {
|
||||
int cnt = folderMan->map().size();
|
||||
slotShowOptionalTrayMessage(tr("%1 Sync Started").arg(Theme::instance()->appNameGUI()),
|
||||
tr("Sync started for %n configured sync folder(s).","", cnt));
|
||||
}
|
||||
|
||||
_startupFails = fails; // store that for the settings dialog once it appears.
|
||||
|
||||
}
|
||||
|
||||
void ownCloudGui::computeOverallSyncStatus( const QStringList& startupFails )
|
||||
void ownCloudGui::computeOverallSyncStatus()
|
||||
{
|
||||
|
||||
// display the info of the least successful sync (eg. not just display the result of the latest sync
|
||||
QString trayMessage;
|
||||
FolderMan *folderMan = FolderMan::instance();
|
||||
@ -142,8 +145,11 @@ void ownCloudGui::computeOverallSyncStatus( const QStringList& startupFails )
|
||||
SyncResult overallResult = FolderMan::accountStatus(map.values());
|
||||
|
||||
// if there have been startup problems, show an error message.
|
||||
if( !startupFails.isEmpty() ) {
|
||||
trayMessage = startupFails.join(QLatin1String("\n"));
|
||||
if( !_settingsDialog.isNull() )
|
||||
_settingsDialog->setGeneralErrors( _startupFails );
|
||||
|
||||
if( !_startupFails.isEmpty() ) {
|
||||
trayMessage = _startupFails.join(QLatin1String("\n"));
|
||||
QIcon statusIcon = Theme::instance()->syncStateIcon( SyncResult::Error, true );
|
||||
_tray->setIcon( statusIcon );
|
||||
_tray->setToolTip(trayMessage);
|
||||
@ -399,7 +405,7 @@ void ownCloudGui::slotSettings()
|
||||
_settingsDialog->show();
|
||||
}
|
||||
|
||||
_settingsDialog->setGeneralErrors( _startupFail );
|
||||
_settingsDialog->setGeneralErrors( _startupFails );
|
||||
Utility::raiseDialog(_settingsDialog.data());
|
||||
}
|
||||
|
||||
|
||||
@ -37,14 +37,14 @@ public:
|
||||
explicit ownCloudGui(Application *parent = 0);
|
||||
|
||||
void setupContextMenu();
|
||||
void startupConnected( ConnectionValidator::Status status );
|
||||
void startupConnected(bool connected , const QStringList &fails);
|
||||
|
||||
bool checkConfigExists(bool openSettings);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void computeOverallSyncStatus( const QStringList& startupFails );
|
||||
void computeOverallSyncStatus();
|
||||
void slotShowTrayMessage(const QString &title, const QString &msg);
|
||||
void slotShowOptionalTrayMessage(const QString &title, const QString &msg);
|
||||
void slotFolderOpenAction( const QString& alias );
|
||||
@ -87,7 +87,7 @@ private:
|
||||
|
||||
QSignalMapper *_folderOpenActionMapper;
|
||||
|
||||
QStringList _startupFail;
|
||||
QStringList _startupFails;
|
||||
};
|
||||
|
||||
} // namespace Mirall
|
||||
|
||||
@ -144,7 +144,9 @@ void SettingsDialog::slotSyncStateChange(const QString& alias)
|
||||
|
||||
void SettingsDialog::setGeneralErrors(const QStringList &errors)
|
||||
{
|
||||
_accountSettings->setGeneralErrors(errors);
|
||||
if( _accountSettings ) {
|
||||
_accountSettings->setGeneralErrors(errors);
|
||||
}
|
||||
}
|
||||
|
||||
// close event is not being called here
|
||||
|
||||
Loading…
Reference in New Issue
Block a user