From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korganizer/datechecker.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 korganizer/datechecker.h (limited to 'korganizer/datechecker.h') diff --git a/korganizer/datechecker.h b/korganizer/datechecker.h new file mode 100644 index 00000000..f2d20bf3 --- /dev/null +++ b/korganizer/datechecker.h @@ -0,0 +1,86 @@ +/* + This file is part of KOrganizer. + + Copyright (c) 2002 Adriaan de Groot + Copyright (c) 2004 Cornelius Schumacher + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ +#ifndef DATECHECKER_H +#define DATECHECKER_H + +#include +#include + +class QTimer; + +class KCalendarSystem; + +class NavigatorBar; + +class DateChecker: public QObject +{ + Q_OBJECT + public: + DateChecker( QObject *parent = 0, const char *name = 0 ); + ~DateChecker(); + + /** + The DateChecker automatically checks for + the passage of midnight. If rollover type is + set to None, no signals are emitted and no + processing is done. With rollover set to + FollowDay, the day highlighter changes at + midnight and dayPassed() is emitted. + With FollowMonth, it has the same effect + as FollowDay but also adjusts the month that is + visible and emits monthPassed() when the month changes. + */ + enum RolloverType { None, FollowDay, FollowMonth }; + void enableRollover( RolloverType ); + + signals: + // Signals emitted at midnight carrying the new date. + void dayPassed( const QDate & ); + void monthPassed( const QDate & ); + + protected slots: + /** + Called regularly to see if we need to update the view + wrt. the today box and the month box. Only important + if you leave KOrganizer idle for long periods of time. + + Until we have a reliable way of setting QTimers to go + off at a particular wall-clock time, we need this, + which calls passedMidnight() at the right moments. + */ + void possiblyPastMidnight(); + + /** + Handles updating the view when midnight has come by due to idle time. + */ + void passedMidnight(); + + private: + QTimer *mUpdateTimer; + QDate mLastDayChecked; + RolloverType mUpdateRollover; +}; + +#endif -- cgit v1.2.3