mainwindowbase.cpp
00001 /* 00002 * mainwindowbase.cpp - base class for main application windows 00003 * Program: kalarm 00004 * (C) 2002 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 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #include "kalarm.h" 00022 #include "kalarmapp.h" 00023 #include "mainwindowbase.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 return disableQuit ? false : KMainWindow::queryExit(); 00046 }