mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: remove unused virtual KMainWindow::queryExit() method
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
22c93570a2
commit
3c110d1c62
6 changed files with 6 additions and 110 deletions
|
@ -172,10 +172,9 @@ public:
|
|||
/**
|
||||
* Returns true if the application is currently saving its session
|
||||
* data (most probably before KDE logout). This is intended for use
|
||||
* mainly in KMainWindow::queryClose() and KMainWindow::queryExit().
|
||||
* mainly in KMainWindow::queryClose().
|
||||
*
|
||||
* @see KMainWindow::queryClose
|
||||
* @see KMainWindow::queryExit
|
||||
*/
|
||||
bool sessionSaving() const;
|
||||
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
base.
|
||||
|
||||
KSessionManager makes it possible to provide implementations for
|
||||
QApplication::commitData() and QApplication::saveState(), without
|
||||
QApplication::commitData() and QApplication::saveState(), without
|
||||
subclassing KApplication. KMainWindow internally makes use of this.
|
||||
|
||||
You don't need to do anything with this class when using
|
||||
KMainWindow. Instead, use KMainWindow::saveProperties(),
|
||||
KMainWindow::readProperties(), KMainWindow::queryClose(),
|
||||
KMainWindow::queryExit() and friends.
|
||||
KMainWindow::readProperties(), KMainWindow::queryClose(),
|
||||
and friends.
|
||||
|
||||
@short Highlevel access to session management.
|
||||
@author Matthias Ettrich <ettrich@kde.org>
|
||||
|
|
|
@ -93,23 +93,17 @@ class MyMainWindow : public KMainWindow
|
|||
{
|
||||
public:
|
||||
MyMainWindow() : KMainWindow(),
|
||||
m_queryClosedCalled( false ),
|
||||
m_queryExitCalled( false )
|
||||
m_queryClosedCalled( false )
|
||||
{
|
||||
}
|
||||
/*reimp*/ bool queryClose() {
|
||||
m_queryClosedCalled = true;
|
||||
return true;
|
||||
}
|
||||
/*reimp*/ bool queryExit() {
|
||||
m_queryExitCalled = true;
|
||||
return true;
|
||||
}
|
||||
~MyMainWindow() {
|
||||
s_mainWindowDeleted = true;
|
||||
}
|
||||
bool m_queryClosedCalled;
|
||||
bool m_queryExitCalled;
|
||||
|
||||
void reallyResize(int width, int height) {
|
||||
const QSize oldSize = size();
|
||||
|
@ -124,7 +118,6 @@ public:
|
|||
|
||||
// Here we test
|
||||
// - that queryClose is called
|
||||
// - that queryExit is called
|
||||
// - that autodeletion happens
|
||||
void KMainWindow_UnitTest::testDeleteOnClose()
|
||||
{
|
||||
|
@ -134,7 +127,6 @@ void KMainWindow_UnitTest::testDeleteOnClose()
|
|||
QVERIFY( mw->testAttribute( Qt::WA_DeleteOnClose ) );
|
||||
mw->close();
|
||||
QVERIFY( mw->m_queryClosedCalled );
|
||||
QVERIFY( mw->m_queryExitCalled );
|
||||
qApp->sendPostedEvents( mw, QEvent::DeferredDelete );
|
||||
QVERIFY( s_mainWindowDeleted );
|
||||
}
|
||||
|
|
|
@ -72,8 +72,6 @@
|
|||
|
||||
#include <config.h>
|
||||
|
||||
static bool no_query_exit = false;
|
||||
|
||||
static KStatusBar *internalStatusBar(KMainWindow *mw)
|
||||
{
|
||||
// Don't use qFindChild here, it's recursive!
|
||||
|
@ -160,7 +158,6 @@ public:
|
|||
// not really a fast method but the only compatible one
|
||||
if ( sm.allowsInteraction() ) {
|
||||
bool canceled = false;
|
||||
::no_query_exit = true;
|
||||
|
||||
foreach (KMainWindow *window, KMainWindow::memberList()) {
|
||||
if ( !window->testAttribute( Qt::WA_WState_Hidden ) ) {
|
||||
|
@ -185,18 +182,9 @@ public:
|
|||
*/
|
||||
}
|
||||
}
|
||||
::no_query_exit = false;
|
||||
if (canceled)
|
||||
return false;
|
||||
|
||||
KMainWindow* last = 0;
|
||||
foreach (KMainWindow *window, KMainWindow::memberList()) {
|
||||
if ( !window->testAttribute( Qt::WA_WState_Hidden ) ) {
|
||||
last = window;
|
||||
}
|
||||
}
|
||||
if ( last )
|
||||
return last->queryExit();
|
||||
// else
|
||||
return true;
|
||||
}
|
||||
|
@ -249,7 +237,6 @@ void KMainWindowPrivate::init(KMainWindow *_q)
|
|||
helpMenu = 0;
|
||||
|
||||
//actionCollection()->setWidget( this );
|
||||
QObject::connect(qApp, SIGNAL(aboutToQuit()), q, SLOT(_k_shuttingDown()));
|
||||
QObject::connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)),
|
||||
q, SLOT(_k_slotSettingsChanged(int)));
|
||||
|
||||
|
@ -264,7 +251,6 @@ void KMainWindowPrivate::init(KMainWindow *_q)
|
|||
//d->kaccel = actionCollection()->kaccel();
|
||||
settingsTimer = 0;
|
||||
sizeTimer = 0;
|
||||
shuttingDown = false;
|
||||
if ((care_about_geometry = being_first)) {
|
||||
being_first = false;
|
||||
|
||||
|
@ -584,27 +570,9 @@ void KMainWindow::closeEvent ( QCloseEvent *e )
|
|||
|
||||
if (queryClose()) {
|
||||
e->accept();
|
||||
|
||||
int not_withdrawn = 0;
|
||||
foreach (KMainWindow* mw, KMainWindow::memberList()) {
|
||||
if ( !mw->isHidden() && mw->isTopLevel() && mw != this )
|
||||
not_withdrawn++;
|
||||
}
|
||||
|
||||
if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted?
|
||||
if (!( queryExit() && ( !kapp || !kapp->sessionSaving() ) && !d->shuttingDown )) {
|
||||
// cancel closing, it's stupid to end up with no windows at all....
|
||||
e->ignore();
|
||||
}
|
||||
}
|
||||
} else e->ignore(); //if the window should not be closed, don't close it
|
||||
}
|
||||
|
||||
bool KMainWindow::queryExit()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool KMainWindow::queryClose()
|
||||
{
|
||||
return true;
|
||||
|
@ -1045,21 +1013,6 @@ KStatusBar *KMainWindow::statusBar()
|
|||
return sb;
|
||||
}
|
||||
|
||||
void KMainWindowPrivate::_k_shuttingDown()
|
||||
{
|
||||
// Needed for Qt <= 3.0.3 at least to prevent reentrancy
|
||||
// when queryExit() shows a dialog. Check before removing!
|
||||
static bool reentrancy_protection = false;
|
||||
if (!reentrancy_protection)
|
||||
{
|
||||
reentrancy_protection = true;
|
||||
shuttingDown = true;
|
||||
// call the virtual queryExit
|
||||
q->queryExit();
|
||||
reentrancy_protection = false;
|
||||
}
|
||||
}
|
||||
|
||||
void KMainWindowPrivate::_k_slotSettingsChanged(int category)
|
||||
{
|
||||
Q_UNUSED(category);
|
||||
|
|
|
@ -467,54 +467,10 @@ protected:
|
|||
virtual bool event( QEvent * event );
|
||||
|
||||
/**
|
||||
* Reimplemented to call the queryClose() and queryExit() handlers.
|
||||
* Reimplemented to call the queryClose() handlers.
|
||||
*/
|
||||
virtual void closeEvent ( QCloseEvent *);
|
||||
|
||||
// KDE4 This seems to be flawed to me. Either the app has only one
|
||||
// mainwindow, so queryClose() is enough, or if it can have more of them,
|
||||
// then the windows should take care of themselves, and queryExit()
|
||||
// would be useful only for the annoying 'really quit' dialog, which
|
||||
// also doesn't make sense in apps with multiple mainwindows.
|
||||
// And saving configuration in something called queryExit()? IMHO
|
||||
// one can e.g. use QCoreApplication::aboutToQuit(), which if nothing else
|
||||
// has at least better fitting name.
|
||||
// See also KApplication::sessionSaving().
|
||||
// This stuff should get changed somehow, so that it at least doesn't
|
||||
// mess with session management.
|
||||
/**
|
||||
Called before the very last window is closed, either by the
|
||||
user or indirectly by the session manager.
|
||||
|
||||
It is not recommended to do any user interaction in this
|
||||
function other than indicating severe errors. Better ask the
|
||||
user on queryClose() (see below).
|
||||
|
||||
A typical usage of queryExit() is to write configuration data back.
|
||||
Note that the application may continue to run after queryExit()
|
||||
(the user may have canceled a shutdown), so you should not do any cleanups
|
||||
here. The purpose of queryExit() is purely to prepare the application
|
||||
(with possible user interaction) so it can safely be closed later (without
|
||||
user interaction).
|
||||
|
||||
If you need to do serious things on exit (like shutting a
|
||||
dial-up connection down), connect to the signal
|
||||
QCoreApplication::aboutToQuit().
|
||||
|
||||
Default implementation returns @p true. Returning @p false will
|
||||
cancel the exiting. In the latter case, the last window will
|
||||
remain visible. If KApplication::sessionSaving() is true, refusing
|
||||
the exit will also cancel KDE logout.
|
||||
|
||||
@see queryClose()
|
||||
@see KApplication::sessionSaving()
|
||||
|
||||
@deprecated since 4.14 Do not reimplement queryExit. Either reimplement queryClose
|
||||
(called for every window) or connect QCoreApplication::aboutToQuit() into a slot
|
||||
of a non-gui object (not a KMainWindow, it will be deleted before that!).
|
||||
*/
|
||||
virtual bool queryExit();
|
||||
|
||||
/**
|
||||
Called before the window is closed, either by the user or indirectly by
|
||||
the session manager.
|
||||
|
@ -546,7 +502,6 @@ protected:
|
|||
its location might not be properly saved. In addition, the session shutdown
|
||||
may be canceled, in which case the document should remain open.
|
||||
|
||||
@see queryExit()
|
||||
@see KApplication::sessionSaving()
|
||||
*/
|
||||
virtual bool queryClose();
|
||||
|
@ -670,7 +625,6 @@ protected:
|
|||
|
||||
KMainWindowPrivate * const k_ptr;
|
||||
private:
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_shuttingDown())
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_slotSettingsChanged(int))
|
||||
Q_PRIVATE_SLOT(k_func(), void _k_slotSaveAutoSaveSize())
|
||||
};
|
||||
|
|
|
@ -46,7 +46,6 @@ public:
|
|||
bool autoSaveWindowSize:1;
|
||||
bool care_about_geometry:1;
|
||||
bool sizeApplied:1;
|
||||
bool shuttingDown:1;
|
||||
KConfigGroup autoSaveGroup;
|
||||
QTimer *settingsTimer;
|
||||
QTimer *sizeTimer;
|
||||
|
@ -57,7 +56,6 @@ public:
|
|||
QString dbusName;
|
||||
bool letDirtySettings;
|
||||
|
||||
void _k_shuttingDown();
|
||||
// This slot will be called when the style KCM changes settings that need
|
||||
// to be set on the already running applications.
|
||||
void _k_slotSettingsChanged(int category);
|
||||
|
|
Loading…
Add table
Reference in a new issue