From d567859e87983f89859576e745f2678806875ecb Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 5 Oct 2015 23:52:39 +0100 Subject: [PATCH] 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 --- main.cpp | 4 +++- qt-ui/mainwindow.cpp | 5 +++++ qt-ui/mainwindow.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index c288f68dc..6c5e16928 100644 --- a/main.cpp +++ b/main.cpp @@ -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) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 104dfee04..8f2f7cd23 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -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); diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 25c9b3eba..14aa22f0e 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -98,6 +98,7 @@ public: QUndoStack *undoStack; NotificationWidget *getNotificationWidget(); void enableDisableCloudActions(); + void showError(); private slots: /* file menu action */