kalarm

startdaytimer.cpp

00001 /*
00002  *  startdaytimer.cpp  -  timer triggered at the user-defined start-of-day time
00003  *  Program:  kalarm
00004  *  Copyright (C) 2004, 2005 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 
00023 #include "preferences.h"
00024 #include "startdaytimer.moc"
00025 
00026 
00027 StartOfDayTimer* StartOfDayTimer::mInstance = 0;
00028 
00029 StartOfDayTimer::StartOfDayTimer()
00030     : DailyTimer(Preferences::startOfDay(), false)
00031 {
00032     Preferences::connect(SIGNAL(startOfDayChanged(const QTime&)), this, SLOT(startOfDayChanged(const QTime&)));
00033 }
00034 
00035 StartOfDayTimer* StartOfDayTimer::instance()
00036 {
00037     if (!mInstance)
00038         mInstance = new StartOfDayTimer;    // receive notifications of change of start-of-day time
00039     return mInstance;
00040 }
00041 
00042 /******************************************************************************
00043 * Called when the start-of-day time has changed.
00044 * The timer is adjusted and if appropriate timer events are triggered now.
00045 */
00046 void StartOfDayTimer::startOfDayChanged(const QTime&)
00047 {
00048     changeTime(Preferences::startOfDay(), true);
00049 }
KDE Home | KDE Accessibility Home | Description of Access Keys