From 1c7e0dbcde19170d0700e4b1c601c108985dac3f Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Thu, 28 Aug 2014 10:04:41 +0200 Subject: [PATCH] close on reject, fold onClose into its only remaining usage in closeEvent --- .../interactiveconsole/interactiveconsole.cpp | 16 +++++----------- .../interactiveconsole/interactiveconsole.h | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/components/interactiveconsole/interactiveconsole.cpp b/components/interactiveconsole/interactiveconsole.cpp index 81a08e848..b63df9c95 100644 --- a/components/interactiveconsole/interactiveconsole.cpp +++ b/components/interactiveconsole/interactiveconsole.cpp @@ -284,23 +284,17 @@ void InteractiveConsole::showEvent(QShowEvent *) void InteractiveConsole::closeEvent(QCloseEvent *event) { - onClose(); + // need to save first! + const QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + s_autosaveFileName; + m_closeWhenCompleted = true; + saveScript(QUrl::fromLocalFile(path)); QDialog::closeEvent(event); } void InteractiveConsole::reject() { - onClose(); QDialog::reject(); -} - -void InteractiveConsole::onClose() -{ - // need to save first! - const QString path = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + s_autosaveFileName; - m_closeWhenCompleted = true; - saveScript(QUrl::fromLocalFile(path)); - emit visibilityChanged(); + close(); } void InteractiveConsole::print(const QString &string) diff --git a/components/interactiveconsole/interactiveconsole.h b/components/interactiveconsole/interactiveconsole.h index 853da7b99..6b4b0f37f 100644 --- a/components/interactiveconsole/interactiveconsole.h +++ b/components/interactiveconsole/interactiveconsole.h @@ -105,7 +105,6 @@ private Q_SLOTS: void modeSelectionChanged(); private: - void onClose(); void saveScript(const QUrl &url); ShellCorona *m_corona;