From f61b59d961a5188dde3121ce83af055421fa82b0 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 27 Feb 2015 02:57:56 +0200 Subject: Change the references to ShowError to the new notification object. Showing an Error message is better called from the Notification Object, So for consistency old references to showError is replaced by calling the notification object. Signed-off-by: Gehad elrobey Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 15 +++++---------- qt-ui/mainwindow.h | 1 - qt-ui/profile/profilewidget2.cpp | 2 +- qt-ui/subsurfacewebservices.cpp | 2 +- 4 files changed, 7 insertions(+), 13 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index de98eb08f..41669933b 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -246,7 +246,7 @@ MainWindow *MainWindow::instance() // this gets called after we download dives from a divecomputer void MainWindow::refreshDisplay(bool doRecreateDiveList) { - showError(get_error_string()); + getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); information()->reload(); TankInfoModel::instance()->update(); globe()->reload(); @@ -1266,11 +1266,11 @@ int MainWindow::file_save_as(void) information()->acceptChanges(); if (save_dives(filename.toUtf8().data())) { - showError(get_error_string()); + getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); return -1; } - showError(get_error_string()); + getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); set_filename(filename.toUtf8().data(), true); setTitle(MWTF_FILENAME); mark_divelist_changed(false); @@ -1297,20 +1297,15 @@ int MainWindow::file_save(void) current_def_dir.mkpath(current_def_dir.absolutePath()); } if (save_dives(existing_filename)) { - showError(get_error_string()); + getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); return -1; } - showError(get_error_string()); + getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); mark_divelist_changed(false); addRecentFile(QStringList() << QString(existing_filename)); return 0; } -void MainWindow::showError(QString message) -{ - ui.mainErrorMessage->showNotification(message, KMessageWidget::Error); -} - NotificationWidget *MainWindow::getNotificationWidget() { return ui.mainErrorMessage; diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 06b180a39..22fd02d4d 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -71,7 +71,6 @@ public: DivePlannerWidget *divePlannerWidget(); PlannerSettingsWidget *divePlannerSettingsWidget(); LocationInformationWidget *locationInformationWidget(); - void showError(QString message); void setTitle(enum MainWindowTitleFormat format); // Some shortcuts like "change DC" or "copy/paste dive components" diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 1de45ff9f..cfcd25dab 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -650,7 +650,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) // so if we are calculation TTS / NDL then let's force that off. if (measureDuration.elapsed() > 1000 && prefs.calcndltts) { MainWindow::instance()->turnOffNdlTts(); - MainWindow::instance()->showError(tr("Show NDL / TTS was disabled because of excessive processing time")); + MainWindow::instance()->getNotificationWidget()->showNotification(tr("Show NDL / TTS was disabled because of excessive processing time"), KMessageWidget::Error); } } diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 908747b25..fcb565f34 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -649,7 +649,7 @@ void DivelogsDeWebServices::prepareDivesForUpload(bool selected) return; } } - MainWindow::instance()->showError(get_error_string()); + MainWindow::instance()->getNotificationWidget()->showNotification(get_error_string(), KMessageWidget::Error); } void DivelogsDeWebServices::uploadDives(QIODevice *dldContent) -- cgit v1.2.3-70-g09d2