Diffstat (limited to 'core/pim/datebook/datebook.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.h | 87 |
1 files changed, 58 insertions, 29 deletions
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index d7cfb33..54ffcfb 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -1,139 +1,168 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOK_H | 20 | #ifndef DATEBOOK_H |
21 | #define DATEBOOK_H | 21 | #define DATEBOOK_H |
22 | 22 | ||
23 | #include <qpe/datebookdb.h> | 23 | #include <qpe/datebookdb.h> |
24 | 24 | ||
25 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
26 | 26 | ||
27 | enum { DAY=1,WEEK,WEEKLST,MONTH };// defaultView values | 27 | enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values |
28 | enum { NONE=0,NORMAL,EXTENDED };// WeekLstView's modes. | 28 | enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes. |
29 | 29 | ||
30 | class QAction; | 30 | class QAction; |
31 | class QWidgetStack; | 31 | class QWidgetStack; |
32 | class DateBookDay; | 32 | class DateBookDay; |
33 | class DateBookWeek; | 33 | class DateBookWeek; |
34 | class DateBookWeekLst; | 34 | class DateBookWeekLst; |
35 | class DateBookMonth; | 35 | class DateBookMonth; |
36 | class Event; | 36 | class Event; |
37 | class QDate; | 37 | class QDate; |
38 | class Ir; | 38 | class Ir; |
39 | class QLibrary; | ||
40 | |||
41 | namespace Opie { | ||
42 | namespace Datebook { | ||
43 | class HolidayPlugin; | ||
44 | class HolidayPluginIf; | ||
45 | } | ||
46 | } | ||
39 | 47 | ||
40 | class DateBookDBHack : public DateBookDB { | 48 | class DateBookDBHack : public DateBookDB { |
41 | public: | 49 | public: |
42 | Event eventByUID(int id); | 50 | Event eventByUID(int id); |
43 | }; | 51 | }; |
44 | 52 | ||
53 | class DateBookHoliday | ||
54 | { | ||
55 | public: | ||
56 | DateBookHoliday(); | ||
57 | virtual ~DateBookHoliday(); | ||
58 | |||
59 | QStringList holidaylist(const QDate&); | ||
60 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); | ||
61 | protected: | ||
62 | void init(); | ||
63 | void deinit(); | ||
64 | |||
65 | struct HPlugin { | ||
66 | Opie::Datebook::HolidayPlugin*_plugin; | ||
67 | QLibrary*_lib; | ||
68 | Opie::Datebook::HolidayPluginIf*_if; | ||
69 | }; | ||
70 | QValueList<HPlugin*>_pluginlist; | ||
71 | }; | ||
72 | |||
45 | class DateBook : public QMainWindow | 73 | class DateBook : public QMainWindow |
46 | { | 74 | { |
47 | Q_OBJECT | 75 | Q_OBJECT |
48 | 76 | ||
49 | public: | 77 | public: |
50 | static QString appName() { return QString::fromLatin1("datebook"); } | 78 | static QString appName() { return QString::fromLatin1("datebook"); } |
51 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 79 | DateBook( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
52 | ~DateBook(); | 80 | ~DateBook(); |
53 | 81 | ||
54 | signals: | 82 | signals: |
55 | void newEvent(); | 83 | void newEvent(); |
56 | void signalNotFound(); | 84 | void signalNotFound(); |
57 | void signalWrapAround(); | 85 | void signalWrapAround(); |
58 | 86 | ||
59 | protected: | 87 | protected: |
60 | QDate currentDate(); | 88 | QDate currentDate(); |
61 | void timerEvent( QTimerEvent *e ); | 89 | void timerEvent( QTimerEvent *e ); |
62 | void closeEvent( QCloseEvent *e ); | 90 | void closeEvent( QCloseEvent *e ); |
63 | 91 | ||
64 | void view(int v, const QDate &d); | 92 | void view(int v, const QDate &d); |
65 | 93 | ||
66 | public slots: | 94 | public slots: |
67 | void flush(); | 95 | void flush(); |
68 | void reload(); | 96 | void reload(); |
69 | 97 | ||
70 | private slots: | 98 | private slots: |
71 | void fileNew(); | 99 | void fileNew(); |
72 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location=0); | 100 | void slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location=0); |
73 | void slotSettings(); | 101 | void slotSettings(); |
74 | void slotToday();// view today | 102 | void slotToday(); // view today |
75 | void changeClock( bool newClock ); | 103 | void changeClock( bool newClock ); |
76 | void changeWeek( bool newDay ); | 104 | void changeWeek( bool newDay ); |
77 | void appMessage(const QCString& msg, const QByteArray& data); | 105 | void appMessage(const QCString& msg, const QByteArray& data); |
78 | // handle key events in the day view... | 106 | // handle key events in the day view... |
79 | void slotNewEventFromKey( const QString &str ); | 107 | void slotNewEventFromKey( const QString &str ); |
80 | void slotFind(); | 108 | void slotFind(); |
81 | void slotDoFind( const QString &, const QDate &, bool, bool, int ); | 109 | void slotDoFind( const QString &, const QDate &, bool, bool, int ); |
82 | 110 | ||
83 | void viewDefault(const QDate &d); | 111 | void viewDefault(const QDate &d); |
84 | 112 | ||
85 | void viewDay(); | 113 | void viewDay(); |
86 | void viewWeek(); | 114 | void viewWeek(); |
87 | void viewWeekLst(); | 115 | void viewWeekLst(); |
88 | void viewMonth(); | 116 | void viewMonth(); |
89 | 117 | ||
90 | void showDay( int y, int m, int d ); | 118 | void showDay( int y, int m, int d ); |
91 | 119 | ||
92 | void insertEvent( const Event &e ); | 120 | void insertEvent( const Event &e ); |
93 | void editEvent( const Event &e ); | 121 | void editEvent( const Event &e ); |
94 | void duplicateEvent( const Event &e ); | 122 | void duplicateEvent( const Event &e ); |
95 | void removeEvent( const Event &e ); | 123 | void removeEvent( const Event &e ); |
96 | 124 | ||
97 | void receive( const QCString &msg, const QByteArray &data ); | 125 | void receive( const QCString &msg, const QByteArray &data ); |
98 | void setDocument( const QString & ); | 126 | void setDocument( const QString & ); |
99 | void beamEvent( const Event &e ); | 127 | void beamEvent( const Event &e ); |
100 | void beamDone( Ir *ir ); | 128 | void beamDone( Ir *ir ); |
101 | 129 | ||
102 | private: | 130 | private: |
103 | void addEvent( const Event &e ); | 131 | void addEvent( const Event &e ); |
104 | void initDay(); | 132 | void initDay(); |
105 | void initWeek(); | 133 | void initWeek(); |
106 | void initWeekLst(); | 134 | void initWeekLst(); |
107 | void initMonth(); | 135 | void initMonth(); |
108 | void loadSettings(); | 136 | void loadSettings(); |
109 | void saveSettings(); | 137 | void saveSettings(); |
110 | 138 | ||
111 | private: | 139 | private: |
112 | DateBookDBHack *db; | 140 | DateBookDBHack *db; |
113 | QWidgetStack *views; | 141 | DateBookHoliday*db_holiday; |
114 | DateBookDay *dayView; | 142 | QWidgetStack *views; |
115 | DateBookWeek *weekView; | 143 | DateBookDay *dayView; |
116 | DateBookMonth *monthView; | 144 | DateBookWeek *weekView; |
117 | DateBookWeekLst *weekLstView; | 145 | DateBookMonth *monthView; |
118 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; | 146 | DateBookWeekLst *weekLstView; |
119 | int weeklistviewconfig; | 147 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; |
120 | bool aPreset; // have everything set to alarm? | 148 | int weeklistviewconfig; |
121 | int presetTime; // the standard time for the alarm | 149 | bool aPreset; // have everything set to alarm? |
122 | int startTime; | 150 | int presetTime; // the standard time for the alarm |
123 | int rowStyle; | 151 | int startTime; |
124 | int defaultView; | 152 | int rowStyle; |
125 | QArray<int> defaultCategories; | 153 | int defaultView; |
126 | QString defaultLocation; | 154 | QArray<int> defaultCategories; |
127 | bool bJumpToCurTime; //should jump to current time in dayview? | 155 | QString defaultLocation; |
128 | bool ampm; | 156 | bool bJumpToCurTime; //should jump to current time in dayview? |
129 | bool onMonday; | 157 | bool ampm; |
130 | 158 | bool onMonday; | |
131 | bool syncing; | 159 | |
132 | bool inSearch; | 160 | bool syncing; |
133 | 161 | bool inSearch; | |
134 | int alarmCounter; | 162 | |
163 | int alarmCounter; | ||
135 | 164 | ||
136 | QString checkEvent(const Event &); | 165 | QString checkEvent(const Event &); |
137 | }; | 166 | }; |
138 | 167 | ||
139 | #endif | 168 | #endif |