aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coreplugin/icore.cpp
diff options
context:
space:
mode:
authorhjk <hjk@theqtcompany.com>2015-08-26 14:39:15 +0200
committerhjk <hjk@theqtcompany.com>2015-11-04 17:52:20 +0000
commite6a98f368e54fbd067083635b511f333341ef9b6 (patch)
tree952881963a03512f7b98ab9ee056f442fb7cb583 /src/plugins/coreplugin/icore.cpp
parented25b429f684e4a1cebb3df4252160ffe98e75ed (diff)
Core: Replace ICoreListener by std::functions
ICoreListener::coreAboutToClose() remains in the core, ICoreListener::editorAboutToClose() is handled by a new EditorManager::addCloseEditorListener() function. This removes the need for some boiler plate code resulting from the need to implement the interface in custom classes (DesignModeCoreListener, EditorClosingCoreListener, PojectEplorer::CoreListener and VcsBase::CoreListener). EditorManager::addCloseEditorListener Change-Id: Ie554c987b5455b555be6d77b77e4013639201d22 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/plugins/coreplugin/icore.cpp')
-rw-r--r--src/plugins/coreplugin/icore.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index c2d1826140..070f384548 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -564,6 +564,23 @@ void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags)
m_mainwindow->openFiles(arguments, flags);
}
+
+/*!
+ \fn ICore::addCloseCoreListener
+
+ \brief The \c ICore::addCloseCoreListener function provides a hook for plugins
+ to veto on closing the application.
+
+ When the application window requests a close, all listeners are called.
+ If one if these calls returns \c false, the process is aborted and the
+ event is ignored. If all calls return \c true, \c ICore::coreAboutToClose()
+ is emitted and the event is accepted or performed..
+*/
+void ICore::addPreCloseListener(const std::function<bool ()> &listener)
+{
+ m_mainwindow->addPreCloseListener(listener);
+}
+
void ICore::saveSettings()
{
emit m_instance->saveSettingsRequested();