kalarm

mainwindowbase.cpp

00001 /*
00002  *  mainwindowbase.cpp  -  base class for main application windows
00003  *  Program:  kalarm
00004  *  Copyright (C) 2002, 2003 by David Jarvie  software@astrojar.org.uk
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #include "kalarm.h"
00022 #include <kdeversion.h>
00023 #include "kalarmapp.h"
00024 #include "mainwindowbase.moc"
00025 
00026 
00027 /******************************************************************************
00028 *  Called when a close event is received.
00029 *  Only quits the application if there is no system tray icon displayed.
00030 */
00031 void MainWindowBase::closeEvent(QCloseEvent* ce)
00032 {
00033     disableQuit = theApp()->trayIconDisplayed();
00034     KMainWindow::closeEvent(ce);
00035     disableQuit = false;
00036     ce->accept();           // allow window to close even if it's the last main window
00037 }
00038 
00039 /******************************************************************************
00040 *  Called when the window is being closed.
00041 *  Returns true if the application should quit.
00042 */
00043 bool MainWindowBase::queryExit()
00044 {
00045 #if KDE_IS_VERSION(3,1,90)
00046     if (kapp->sessionSaving())
00047         return true;
00048 #endif
00049     return disableQuit ? false : KMainWindow::queryExit();
00050 }
KDE Home | KDE Accessibility Home | Description of Access Keys