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);
}
}
MainWindow *m = MainWindow::instance();
m->setLoadedWithFiles(!files.isEmpty() || !importedFiles.isEmpty());
m->loadFiles(files);
m->importFiles(importedFiles);
// in case something has gone wrong make sure we show the error message
m->showError();
if (verbose > 0)
print_files();
if (!quit)

View file

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

View file

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