korganizer

datenavigator.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
00004     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef DATENAVIGATOR_H
00025 #define DATENAVIGATOR_H
00026 
00027 #include <libkcal/incidencebase.h>
00028 
00029 #include <qobject.h>
00030 
00036 class DateNavigator : public QObject
00037 {
00038     Q_OBJECT
00039   public:
00040     DateNavigator( QObject *parent = 0, const char *name = 0 );
00041     ~DateNavigator();
00042 
00043     KCal::DateList selectedDates();
00044 
00045     int datesCount() const;
00046 
00047   public slots:
00048     void selectDates( const KCal::DateList & );
00049     void selectDate( const QDate & );
00050 
00051     void selectDates( int count );
00052     void selectDates( const QDate &, int count, const QDate &preferredMonth = QDate() );
00053 
00054     void selectWeek();
00055     void selectWeek( const QDate &, const QDate &preferredMonth = QDate() );
00056 
00057     void selectWorkWeek();
00058     void selectWorkWeek( const QDate & );
00059 
00060     void selectWeekByDay( int weekDay, const QDate &, const QDate &preferredMonth = QDate() );
00061 
00062     void selectToday();
00063 
00064     void selectPreviousYear();
00065     void selectPreviousMonth( const QDate &currentMonth = QDate(),
00066                               const QDate &selectionLowerLimit = QDate(),
00067                               const QDate &selectionUpperLimit = QDate() );
00068     void selectPreviousWeek();
00069     void selectNextWeek();
00070     void selectNextMonth( const QDate &currentMonth = QDate(),
00071                           const QDate &selectionLowerLimit = QDate(),
00072                           const QDate &selectionUpperLimit = QDate() );
00073     void selectNextYear();
00074 
00075     void selectPrevious();
00076     void selectNext();
00077 
00078     void selectMonth( int month );
00079     void selectYear( int year );
00080 
00081   signals:
00082     /* preferredMonth is useful when the datelist crosses months,
00083        if valid, any month-like component should honour it
00084     */
00085     void datesSelected( const KCal::DateList &, const QDate &preferredMonth );
00086 
00087   protected:
00088     void emitSelected( const QDate &preferredMonth = QDate() );
00089 
00090   private:
00091 
00092     /*
00093       Selects next month if offset equals 1, or previous month
00094       if offset equals -1.
00095       Bigger offsets are accepted.
00096     */
00097     void shiftMonth( const QDate &date,
00098                      const QDate &selectionLowerLimit,
00099                      const QDate &selectionUpperLimit,
00100                      int offset );
00101 
00102     KCal::DateList mSelectedDates;
00103 };
00104 
00105 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys