File indexing completed on 2024-05-12 05:14:58
0001 /* 0002 * startdaytimer.cpp - timer triggered at the user-defined start-of-day time 0003 * Program: kalarm 0004 * SPDX-FileCopyrightText: 2004-2020 David Jarvie <djarvie@kde.org> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "startdaytimer.h" 0010 0011 #include "preferences.h" 0012 0013 0014 StartOfDayTimer* StartOfDayTimer::mInstance = nullptr; 0015 0016 StartOfDayTimer::StartOfDayTimer() 0017 : DailyTimer(Preferences::startOfDay(), false) 0018 { 0019 Preferences::connect(&Preferences::startOfDayChanged, this, &StartOfDayTimer::startOfDayChanged); 0020 } 0021 0022 StartOfDayTimer* StartOfDayTimer::instance() 0023 { 0024 if (!mInstance) 0025 mInstance = new StartOfDayTimer; // receive notifications of change of start-of-day time 0026 return mInstance; 0027 } 0028 0029 /****************************************************************************** 0030 * Called when the start-of-day time has changed. 0031 * The timer is adjusted and if appropriate timer events are triggered now. 0032 */ 0033 void StartOfDayTimer::startOfDayChanged() 0034 { 0035 changeTime(Preferences::startOfDay(), true); 0036 } 0037 0038 #include "moc_startdaytimer.cpp" 0039 0040 // vim: et sw=4: