author | dwmw2 <dwmw2> | 2002-05-09 11:58:33 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2002-05-09 11:58:33 (UTC) |
commit | d9b40786a885451caf3f22612ec401df1edff983 (patch) (unidiff) | |
tree | 99d6eae63a9e61c0342485a3aa8339e4d3151d49 | |
parent | c094cc02af3a6b3f1aaec5ee8de6d377da9b8fe1 (diff) | |
download | opie-d9b40786a885451caf3f22612ec401df1edff983.zip opie-d9b40786a885451caf3f22612ec401df1edff983.tar.gz opie-d9b40786a885451caf3f22612ec401df1edff983.tar.bz2 |
qregexp.h
-rw-r--r-- | core/pim/datebook/datebook.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index c23129a..8614b3f 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -1,313 +1,314 @@ | |||
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 | ** $Id$ | 19 | ** $Id$ |
20 | ** | 20 | ** |
21 | **********************************************************************/ | 21 | **********************************************************************/ |
22 | 22 | ||
23 | #define QTOPIA_INTERNAL_FD | 23 | #define QTOPIA_INTERNAL_FD |
24 | 24 | ||
25 | #include "datebook.h" | 25 | #include "datebook.h" |
26 | #include "datebookday.h" | 26 | #include "datebookday.h" |
27 | #include "datebooksettings.h" | 27 | #include "datebooksettings.h" |
28 | #include "datebookweek.h" | 28 | #include "datebookweek.h" |
29 | #include "datebookweeklst.h" | 29 | #include "datebookweeklst.h" |
30 | #include "dateentryimpl.h" | 30 | #include "dateentryimpl.h" |
31 | 31 | ||
32 | #include <qpe/datebookmonth.h> | 32 | #include <qpe/datebookmonth.h> |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
35 | #include <qpe/qpedebug.h> | 35 | #include <qpe/qpedebug.h> |
36 | #include <qpe/event.h> | 36 | #include <qpe/event.h> |
37 | #include <qpe/finddialog.h> | 37 | #include <qpe/finddialog.h> |
38 | #include <qpe/ir.h> | 38 | #include <qpe/ir.h> |
39 | #include <qpe/qpemenubar.h> | 39 | #include <qpe/qpemenubar.h> |
40 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
41 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
42 | #include <qpe/sound.h> | 42 | #include <qpe/sound.h> |
43 | #include <qpe/timestring.h> | 43 | #include <qpe/timestring.h> |
44 | #include <qpe/qpetoolbar.h> | 44 | #include <qpe/qpetoolbar.h> |
45 | #include <qpe/tzselect.h> | 45 | #include <qpe/tzselect.h> |
46 | #include <qpe/xmlreader.h> | 46 | #include <qpe/xmlreader.h> |
47 | 47 | ||
48 | #include <qaction.h> | 48 | #include <qaction.h> |
49 | #include <qcopchannel_qws.h> | 49 | #include <qcopchannel_qws.h> |
50 | #include <qdatetime.h> | 50 | #include <qdatetime.h> |
51 | #include <qdialog.h> | 51 | #include <qdialog.h> |
52 | #include <qfile.h> | 52 | #include <qfile.h> |
53 | #include <qlabel.h> | 53 | #include <qlabel.h> |
54 | #include <qlayout.h> | 54 | #include <qlayout.h> |
55 | #include <qmessagebox.h> | 55 | #include <qmessagebox.h> |
56 | #include <qpopupmenu.h> | 56 | #include <qpopupmenu.h> |
57 | #include <qpushbutton.h> | 57 | #include <qpushbutton.h> |
58 | #include <qregexp.h> | ||
58 | #include <qtextcodec.h> | 59 | #include <qtextcodec.h> |
59 | #include <qtextstream.h> | 60 | #include <qtextstream.h> |
60 | #include <qtl.h> | 61 | #include <qtl.h> |
61 | #include <qwidgetstack.h> | 62 | #include <qwidgetstack.h> |
62 | #include <qwindowsystem_qws.h> | 63 | #include <qwindowsystem_qws.h> |
63 | 64 | ||
64 | #include <sys/stat.h> | 65 | #include <sys/stat.h> |
65 | #include <sys/types.h> | 66 | #include <sys/types.h> |
66 | #include <fcntl.h> | 67 | #include <fcntl.h> |
67 | #include <unistd.h> | 68 | #include <unistd.h> |
68 | 69 | ||
69 | #include <stdlib.h> | 70 | #include <stdlib.h> |
70 | 71 | ||
71 | #define DAY 1 | 72 | #define DAY 1 |
72 | #define WEEK 2 | 73 | #define WEEK 2 |
73 | #define WEEKLST 4 | 74 | #define WEEKLST 4 |
74 | #define MONTH 3 | 75 | #define MONTH 3 |
75 | 76 | ||
76 | 77 | ||
77 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) | 78 | DateBook::DateBook( QWidget *parent, const char *, WFlags f ) |
78 | : QMainWindow( parent, "datebook", f ), | 79 | : QMainWindow( parent, "datebook", f ), |
79 | aPreset( FALSE ), | 80 | aPreset( FALSE ), |
80 | presetTime( -1 ), | 81 | presetTime( -1 ), |
81 | startTime( 8 ), // an acceptable default | 82 | startTime( 8 ), // an acceptable default |
82 | syncing(FALSE), | 83 | syncing(FALSE), |
83 | inSearch(FALSE) | 84 | inSearch(FALSE) |
84 | { | 85 | { |
85 | QTime t; | 86 | QTime t; |
86 | t.start(); | 87 | t.start(); |
87 | db = new DateBookDBHack; | 88 | db = new DateBookDBHack; |
88 | qDebug("loading db t=%d", t.elapsed() ); | 89 | qDebug("loading db t=%d", t.elapsed() ); |
89 | loadSettings(); | 90 | loadSettings(); |
90 | setCaption( tr("Calendar") ); | 91 | setCaption( tr("Calendar") ); |
91 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); | 92 | setIcon( Resource::loadPixmap( "datebook_icon" ) ); |
92 | 93 | ||
93 | setToolBarsMovable( FALSE ); | 94 | setToolBarsMovable( FALSE ); |
94 | 95 | ||
95 | views = new QWidgetStack( this ); | 96 | views = new QWidgetStack( this ); |
96 | setCentralWidget( views ); | 97 | setCentralWidget( views ); |
97 | 98 | ||
98 | dayView = 0; | 99 | dayView = 0; |
99 | weekView = 0; | 100 | weekView = 0; |
100 | weekLstView = 0; | 101 | weekLstView = 0; |
101 | monthView = 0; | 102 | monthView = 0; |
102 | 103 | ||
103 | QPEToolBar *bar = new QPEToolBar( this ); | 104 | QPEToolBar *bar = new QPEToolBar( this ); |
104 | bar->setHorizontalStretchable( TRUE ); | 105 | bar->setHorizontalStretchable( TRUE ); |
105 | 106 | ||
106 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 107 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
107 | mb->setMargin( 0 ); | 108 | mb->setMargin( 0 ); |
108 | 109 | ||
109 | QPEToolBar *sub_bar = new QPEToolBar(this); | 110 | QPEToolBar *sub_bar = new QPEToolBar(this); |
110 | 111 | ||
111 | QPopupMenu *view = new QPopupMenu( this ); | 112 | QPopupMenu *view = new QPopupMenu( this ); |
112 | QPopupMenu *settings = new QPopupMenu( this ); | 113 | QPopupMenu *settings = new QPopupMenu( this ); |
113 | 114 | ||
114 | mb->insertItem( tr( "View" ), view ); | 115 | mb->insertItem( tr( "View" ), view ); |
115 | mb->insertItem( tr( "Settings" ), settings ); | 116 | mb->insertItem( tr( "Settings" ), settings ); |
116 | 117 | ||
117 | QActionGroup *g = new QActionGroup( this ); | 118 | QActionGroup *g = new QActionGroup( this ); |
118 | g->setExclusive( TRUE ); | 119 | g->setExclusive( TRUE ); |
119 | 120 | ||
120 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), | 121 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), |
121 | QString::null, 0, this, 0 ); | 122 | QString::null, 0, this, 0 ); |
122 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); | 123 | connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); |
123 | a->addTo( sub_bar ); | 124 | a->addTo( sub_bar ); |
124 | 125 | ||
125 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); | 126 | a = new QAction( tr( "Today" ), Resource::loadPixmap( "to_day" ), QString::null, 0, g, 0 ); |
126 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); | 127 | connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); |
127 | a->addTo( sub_bar ); | 128 | a->addTo( sub_bar ); |
128 | a->addTo( view ); | 129 | a->addTo( view ); |
129 | 130 | ||
130 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); | 131 | a = new QAction( tr( "Day" ), Resource::loadPixmap( "day" ), QString::null, 0, g, 0 ); |
131 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); | 132 | connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); |
132 | a->addTo( sub_bar ); | 133 | a->addTo( sub_bar ); |
133 | a->addTo( view ); | 134 | a->addTo( view ); |
134 | a->setToggleAction( TRUE ); | 135 | a->setToggleAction( TRUE ); |
135 | a->setOn( TRUE ); | 136 | a->setOn( TRUE ); |
136 | dayAction = a; | 137 | dayAction = a; |
137 | 138 | ||
138 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); | 139 | a = new QAction( tr( "Week" ), Resource::loadPixmap( "week" ), QString::null, 0, g, 0 ); |
139 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); | 140 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); |
140 | a->addTo( sub_bar ); | 141 | a->addTo( sub_bar ); |
141 | a->addTo( view ); | 142 | a->addTo( view ); |
142 | a->setToggleAction( TRUE ); | 143 | a->setToggleAction( TRUE ); |
143 | weekAction = a; | 144 | weekAction = a; |
144 | 145 | ||
145 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 ); | 146 | a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "weeklst" ), QString::null, 0, g, 0 ); |
146 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); | 147 | connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); |
147 | a->addTo( sub_bar ); | 148 | a->addTo( sub_bar ); |
148 | a->addTo( view ); | 149 | a->addTo( view ); |
149 | a->setToggleAction( TRUE ); | 150 | a->setToggleAction( TRUE ); |
150 | weekLstAction = a; | 151 | weekLstAction = a; |
151 | 152 | ||
152 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); | 153 | a = new QAction( tr( "Month" ), Resource::loadPixmap( "month" ), QString::null, 0, g, 0 ); |
153 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); | 154 | connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); |
154 | a->addTo( sub_bar ); | 155 | a->addTo( sub_bar ); |
155 | a->addTo( view ); | 156 | a->addTo( view ); |
156 | a->setToggleAction( TRUE ); | 157 | a->setToggleAction( TRUE ); |
157 | monthAction = a; | 158 | monthAction = a; |
158 | 159 | ||
159 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); | 160 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, g, 0 ); |
160 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); | 161 | connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); |
161 | a->addTo( sub_bar ); | 162 | a->addTo( sub_bar ); |
162 | 163 | ||
163 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); | 164 | a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); |
164 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 165 | connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
165 | a->addTo( settings ); | 166 | a->addTo( settings ); |
166 | 167 | ||
167 | QPopupMenu *default_view = new QPopupMenu(this); | 168 | QPopupMenu *default_view = new QPopupMenu(this); |
168 | settings->insertItem( tr( "Default View" ),default_view ); | 169 | settings->insertItem( tr( "Default View" ),default_view ); |
169 | default_view->setCheckable(TRUE); | 170 | default_view->setCheckable(TRUE); |
170 | 171 | ||
171 | Config config("DateBook"); | 172 | Config config("DateBook"); |
172 | config.setGroup("Main"); | 173 | config.setGroup("Main"); |
173 | int current=config.readNumEntry("defaultview", DAY); | 174 | int current=config.readNumEntry("defaultview", DAY); |
174 | 175 | ||
175 | QActionGroup *ag = new QActionGroup(this); | 176 | QActionGroup *ag = new QActionGroup(this); |
176 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); | 177 | a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); |
177 | if (current==DAY) a->setOn(true), viewDay(); | 178 | if (current==DAY) a->setOn(true), viewDay(); |
178 | ag->insert(a); | 179 | ag->insert(a); |
179 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); | 180 | a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); |
180 | if (current==WEEK) a->setOn(true), viewWeek(); | 181 | if (current==WEEK) a->setOn(true), viewWeek(); |
181 | ag->insert(a); | 182 | ag->insert(a); |
182 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); | 183 | a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); |
183 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); | 184 | if (current==WEEKLST) a->setOn(true), viewWeekLst(); |
184 | ag->insert(a); | 185 | ag->insert(a); |
185 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); | 186 | a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); |
186 | if (current==MONTH) a->setOn(true), viewMonth(); | 187 | if (current==MONTH) a->setOn(true), viewMonth(); |
187 | ag->insert(a); | 188 | ag->insert(a); |
188 | 189 | ||
189 | ag->addTo(default_view); | 190 | ag->addTo(default_view); |
190 | connect(ag, SIGNAL( selected ( QAction * ) ), | 191 | connect(ag, SIGNAL( selected ( QAction * ) ), |
191 | this, SLOT( newDefaultView(QAction *) ) | 192 | this, SLOT( newDefaultView(QAction *) ) |
192 | ); | 193 | ); |
193 | 194 | ||
194 | connect( qApp, SIGNAL(clockChanged(bool)), | 195 | connect( qApp, SIGNAL(clockChanged(bool)), |
195 | this, SLOT(changeClock(bool)) ); | 196 | this, SLOT(changeClock(bool)) ); |
196 | connect( qApp, SIGNAL(weekChanged(bool)), | 197 | connect( qApp, SIGNAL(weekChanged(bool)), |
197 | this, SLOT(changeWeek(bool)) ); | 198 | this, SLOT(changeWeek(bool)) ); |
198 | 199 | ||
199 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 200 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
200 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 201 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), |
201 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); | 202 | this, SLOT(appMessage(const QCString&, const QByteArray&)) ); |
202 | #endif | 203 | #endif |
203 | 204 | ||
204 | // listen on QPE/System | 205 | // listen on QPE/System |
205 | #if defined(Q_WS_QWS) | 206 | #if defined(Q_WS_QWS) |
206 | #if !defined(QT_NO_COP) | 207 | #if !defined(QT_NO_COP) |
207 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 208 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
208 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 209 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
209 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 210 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
210 | channel = new QCopChannel( "QPE/Datebook", this ); | 211 | channel = new QCopChannel( "QPE/Datebook", this ); |
211 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 212 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
212 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 213 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
213 | qDebug("olle\n"); | 214 | qDebug("olle\n"); |
214 | #endif | 215 | #endif |
215 | #endif | 216 | #endif |
216 | 217 | ||
217 | qDebug("done t=%d", t.elapsed() ); | 218 | qDebug("done t=%d", t.elapsed() ); |
218 | 219 | ||
219 | } | 220 | } |
220 | 221 | ||
221 | void DateBook::receive( const QCString &msg, const QByteArray &data ) | 222 | void DateBook::receive( const QCString &msg, const QByteArray &data ) |
222 | { | 223 | { |
223 | QDataStream stream( data, IO_ReadOnly ); | 224 | QDataStream stream( data, IO_ReadOnly ); |
224 | if ( msg == "timeChange(QString)" ) { | 225 | if ( msg == "timeChange(QString)" ) { |
225 | // update active view! | 226 | // update active view! |
226 | if ( dayAction->isOn() ) | 227 | if ( dayAction->isOn() ) |
227 | viewDay(); | 228 | viewDay(); |
228 | else if ( weekAction->isOn() ) | 229 | else if ( weekAction->isOn() ) |
229 | viewWeek(); | 230 | viewWeek(); |
230 | else if ( monthAction->isOn() ) | 231 | else if ( monthAction->isOn() ) |
231 | viewMonth(); | 232 | viewMonth(); |
232 | } | 233 | } |
233 | else if (msg == "editEvent(int)") { | 234 | else if (msg == "editEvent(int)") { |
234 | int uid; | 235 | int uid; |
235 | stream >> uid; | 236 | stream >> uid; |
236 | Event e=db->eventByUID(uid); | 237 | Event e=db->eventByUID(uid); |
237 | editEvent(e); | 238 | editEvent(e); |
238 | } | 239 | } |
239 | } | 240 | } |
240 | 241 | ||
241 | DateBook::~DateBook() | 242 | DateBook::~DateBook() |
242 | { | 243 | { |
243 | } | 244 | } |
244 | 245 | ||
245 | void DateBook::slotSettings() | 246 | void DateBook::slotSettings() |
246 | { | 247 | { |
247 | DateBookSettings frmSettings( ampm, this ); | 248 | DateBookSettings frmSettings( ampm, this ); |
248 | frmSettings.setStartTime( startTime ); | 249 | frmSettings.setStartTime( startTime ); |
249 | frmSettings.setAlarmPreset( aPreset, presetTime ); | 250 | frmSettings.setAlarmPreset( aPreset, presetTime ); |
250 | #if defined (Q_WS_QWS) || defined(_WS_QWS_) | 251 | #if defined (Q_WS_QWS) || defined(_WS_QWS_) |
251 | frmSettings.showMaximized(); | 252 | frmSettings.showMaximized(); |
252 | #endif | 253 | #endif |
253 | 254 | ||
254 | if ( frmSettings.exec() ) { | 255 | if ( frmSettings.exec() ) { |
255 | aPreset = frmSettings.alarmPreset(); | 256 | aPreset = frmSettings.alarmPreset(); |
256 | presetTime = frmSettings.presetTime(); | 257 | presetTime = frmSettings.presetTime(); |
257 | startTime = frmSettings.startTime(); | 258 | startTime = frmSettings.startTime(); |
258 | if ( dayView ) | 259 | if ( dayView ) |
259 | dayView->setStartViewTime( startTime ); | 260 | dayView->setStartViewTime( startTime ); |
260 | if ( weekView ) | 261 | if ( weekView ) |
261 | weekView->setStartViewTime( startTime ); | 262 | weekView->setStartViewTime( startTime ); |
262 | saveSettings(); | 263 | saveSettings(); |
263 | 264 | ||
264 | // make the change obvious | 265 | // make the change obvious |
265 | if ( views->visibleWidget() ) { | 266 | if ( views->visibleWidget() ) { |
266 | if ( views->visibleWidget() == dayView ) | 267 | if ( views->visibleWidget() == dayView ) |
267 | dayView->redraw(); | 268 | dayView->redraw(); |
268 | else if ( views->visibleWidget() == weekView ) | 269 | else if ( views->visibleWidget() == weekView ) |
269 | weekView->redraw(); | 270 | weekView->redraw(); |
270 | } | 271 | } |
271 | } | 272 | } |
272 | } | 273 | } |
273 | 274 | ||
274 | void DateBook::fileNew() | 275 | void DateBook::fileNew() |
275 | { | 276 | { |
276 | slotNewEventFromKey(""); | 277 | slotNewEventFromKey(""); |
277 | } | 278 | } |
278 | 279 | ||
279 | QString DateBook::checkEvent(const Event &e) | 280 | QString DateBook::checkEvent(const Event &e) |
280 | { | 281 | { |
281 | /* check if overlaps with itself */ | 282 | /* check if overlaps with itself */ |
282 | bool checkFailed = FALSE; | 283 | bool checkFailed = FALSE; |
283 | 284 | ||
284 | /* check the next 12 repeats. should catch most problems */ | 285 | /* check the next 12 repeats. should catch most problems */ |
285 | QDate current_date = e.start().date(); | 286 | QDate current_date = e.start().date(); |
286 | Event previous = e; | 287 | Event previous = e; |
287 | for(int i = 0; i < 12; i++) | 288 | for(int i = 0; i < 12; i++) |
288 | { | 289 | { |
289 | QDateTime next; | 290 | QDateTime next; |
290 | if (!nextOccurance(previous, current_date.addDays(1), next)) { | 291 | if (!nextOccurance(previous, current_date.addDays(1), next)) { |
291 | break; // no more repeats | 292 | break; // no more repeats |
292 | } | 293 | } |
293 | if(next < previous.end()) { | 294 | if(next < previous.end()) { |
294 | checkFailed = TRUE; | 295 | checkFailed = TRUE; |
295 | break; | 296 | break; |
296 | } | 297 | } |
297 | current_date = next.date(); | 298 | current_date = next.date(); |
298 | } | 299 | } |
299 | 300 | ||
300 | if(checkFailed) | 301 | if(checkFailed) |
301 | return tr("Event duration is potentially longer\n" | 302 | return tr("Event duration is potentially longer\n" |
302 | "than interval between repeats."); | 303 | "than interval between repeats."); |
303 | 304 | ||
304 | return QString::null; | 305 | return QString::null; |
305 | } | 306 | } |
306 | 307 | ||
307 | QDate DateBook::currentDate() | 308 | QDate DateBook::currentDate() |
308 | { | 309 | { |
309 | QDate d = QDate::currentDate(); | 310 | QDate d = QDate::currentDate(); |
310 | 311 | ||
311 | if ( dayView && views->visibleWidget() == dayView ) { | 312 | if ( dayView && views->visibleWidget() == dayView ) { |
312 | d = dayView->date(); | 313 | d = dayView->date(); |
313 | } else if ( weekView && views->visibleWidget() == weekView ) { | 314 | } else if ( weekView && views->visibleWidget() == weekView ) { |