Show error messages during start up as soon as the main window is shown

When the user has setup cloud storage as their default file but didn't
store the cloud storage password an error is created but not shown until
another error happens - that's very confusing for the user.

This patch fixes that.

Fixes #938

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-05 23:52:39 +01:00
parent 05f4f9b533
commit d567859e87
3 changed files with 9 additions and 1 deletions

View file

@ -69,11 +69,13 @@ int main(int argc, char **argv)
files.push_back(cloudURL); files.push_back(cloudURL);
} }
} }
MainWindow *m = MainWindow::instance(); MainWindow *m = MainWindow::instance();
m->setLoadedWithFiles(!files.isEmpty() || !importedFiles.isEmpty()); m->setLoadedWithFiles(!files.isEmpty() || !importedFiles.isEmpty());
m->loadFiles(files); m->loadFiles(files);
m->importFiles(importedFiles); m->importFiles(importedFiles);
// in case something has gone wrong make sure we show the error message
m->showError();
if (verbose > 0) if (verbose > 0)
print_files(); print_files();
if (!quit) if (!quit)

View file

@ -1511,6 +1511,11 @@ NotificationWidget *MainWindow::getNotificationWidget()
return ui.mainErrorMessage; return ui.mainErrorMessage;
} }
void MainWindow::showError()
{
getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error);
}
QString MainWindow::displayedFilename(QString fullFilename) QString MainWindow::displayedFilename(QString fullFilename)
{ {
QFile f(fullFilename); QFile f(fullFilename);

View file

@ -98,6 +98,7 @@ public:
QUndoStack *undoStack; QUndoStack *undoStack;
NotificationWidget *getNotificationWidget(); NotificationWidget *getNotificationWidget();
void enableDisableCloudActions(); void enableDisableCloudActions();
void showError();
private private
slots: slots:
/* file menu action */ /* file menu action */