summaryrefslogtreecommitdiff
authorwaspe <waspe>2003-11-03 18:28:50 (UTC)
committer waspe <waspe>2003-11-03 18:28:50 (UTC)
commit87a9d6badcf518ffd14559ef886ff7729b63b73b (patch) (unidiff)
tree05af57bcebb8a124c2561336e4ff3dfdd52aeccb
parent9ce566fd5b280622670cf7b0e158f9d9c54e6e9a (diff)
downloadopie-87a9d6badcf518ffd14559ef886ff7729b63b73b.zip
opie-87a9d6badcf518ffd14559ef886ff7729b63b73b.tar.gz
opie-87a9d6badcf518ffd14559ef886ff7729b63b73b.tar.bz2
resolved merge conflict
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp24
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp11
-rw-r--r--core/pim/datebook/datebookweeklst.cpp43
-rw-r--r--core/pim/datebook/datebookweeklst.h1
-rw-r--r--core/pim/osearch/datebooksearch.cpp2
-rw-r--r--core/pim/osearch/mainwindow.cpp10
-rw-r--r--core/pim/osearch/mainwindow.h14
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.cpp10
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp12
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h12
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h9
-rw-r--r--core/settings/security/security.cpp27
-rw-r--r--noncore/apps/confedit/main.cpp15
-rw-r--r--noncore/games/tictac/main.cpp24
14 files changed, 118 insertions, 96 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index 10a9b59..07d7164 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -99,192 +99,194 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
99 weekView = 0; 99 weekView = 0;
100 weekLstView = 0; 100 weekLstView = 0;
101 monthView = 0; 101 monthView = 0;
102 102
103// QPEToolBar *bar = new QPEToolBar( this ); 103// QPEToolBar *bar = new QPEToolBar( this );
104// bar->setHorizontalStretchable( TRUE ); 104// bar->setHorizontalStretchable( TRUE );
105 105
106// QPEMenuBar *mb = new QPEMenuBar( bar ); 106// QPEMenuBar *mb = new QPEMenuBar( bar );
107// mb->setMargin( 0 ); 107// mb->setMargin( 0 );
108 108
109// QPopupMenu *view = new QPopupMenu( this ); 109// QPopupMenu *view = new QPopupMenu( this );
110// mb->insertItem( tr( "View" ), view ); 110// mb->insertItem( tr( "View" ), view );
111 111
112 QPEToolBar *sub_bar = new QPEToolBar(this); 112 QPEToolBar *sub_bar = new QPEToolBar(this);
113 sub_bar->setHorizontalStretchable(TRUE); 113 sub_bar->setHorizontalStretchable(TRUE);
114 114
115 QActionGroup *g = new QActionGroup( this ); 115 QActionGroup *g = new QActionGroup( this );
116 g->setExclusive( TRUE ); 116 g->setExclusive( TRUE );
117 117
118 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 118 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
119 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) ); 119 connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
120 a->addTo( sub_bar ); 120 a->addTo( sub_bar );
121 121
122 sub_bar->addSeparator(); 122 sub_bar->addSeparator();
123 123
124 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 ); 124 a = new QAction( tr( "Today" ), Resource::loadPixmap( "datebook/to_day" ), QString::null, 0, g, 0 );
125 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) ); 125 connect( a, SIGNAL( activated() ), this, SLOT( slotToday() ) );
126 a->addTo( sub_bar ); 126 a->addTo( sub_bar );
127 //a->addTo( view ); 127 //a->addTo( view );
128 128
129 sub_bar->addSeparator(); 129 sub_bar->addSeparator();
130 130
131 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 );
132 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) ); 132 connect( a, SIGNAL( activated() ), this, SLOT( viewDay() ) );
133 a->addTo( sub_bar ); 133 a->addTo( sub_bar );
134// a->addTo( view ); 134// a->addTo( view );
135 a->setToggleAction( TRUE ); 135 a->setToggleAction( TRUE );
136 a->setOn( TRUE ); 136 a->setOn( TRUE );
137 dayAction = a; 137 dayAction = a;
138 138
139 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 );
140 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) ); 140 connect( a, SIGNAL( activated() ), this, SLOT( viewWeek() ) );
141 a->addTo( sub_bar ); 141 a->addTo( sub_bar );
142// a->addTo( view ); 142// a->addTo( view );
143 a->setToggleAction( TRUE ); 143 a->setToggleAction( TRUE );
144 weekAction = a; 144 weekAction = a;
145 145
146 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 ); 146 a = new QAction( tr( "WeekLst" ), Resource::loadPixmap( "datebook/weeklst" ), QString::null, 0, g, 0 );
147 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) ); 147 connect( a, SIGNAL( activated() ), this, SLOT( viewWeekLst() ) );
148 a->addTo( sub_bar ); 148 a->addTo( sub_bar );
149// a->addTo( view ); 149// a->addTo( view );
150 a->setToggleAction( TRUE ); 150 a->setToggleAction( TRUE );
151 weekLstAction = a; 151 weekLstAction = a;
152 152
153 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 );
154 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) ); 154 connect( a, SIGNAL( activated() ), this, SLOT( viewMonth() ) );
155 a->addTo( sub_bar ); 155 a->addTo( sub_bar );
156// a->addTo( view ); 156// a->addTo( view );
157 a->setToggleAction( TRUE ); 157 a->setToggleAction( TRUE );
158 monthAction = a; 158 monthAction = a;
159 159
160 sub_bar->addSeparator(); 160 sub_bar->addSeparator();
161 161
162 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 ); 162 a = new QAction( tr( "Find" ), Resource::loadPixmap( "mag" ), QString::null, 0, this, 0 );
163 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) ); 163 connect( a, SIGNAL(activated()), this, SLOT(slotFind()) );
164 a->addTo( sub_bar ); 164 a->addTo( sub_bar );
165 165
166 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 ); 166 a = new QAction( tr( "Edit..." ), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0 );
167 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 167 connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
168 a->addTo( sub_bar ); 168 a->addTo( sub_bar );
169 169
170 if(defaultView==DAY) viewDay(); 170 if(defaultView==DAY) viewDay();
171 if(defaultView==WEEK) needEvilHack=true;// viewWeek(); 171 if(defaultView==WEEK) needEvilHack=true;// viewWeek();
172 if(defaultView==WEEKLST) viewWeekLst(); 172 if(defaultView==WEEKLST) viewWeekLst();
173 if(defaultView==MONTH) viewMonth(); 173 if(defaultView==MONTH) viewMonth();
174 174
175 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); 175 connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) );
176 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); 176 connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) );
177 177
178#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 178#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
179 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); 179 connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) );
180#endif 180#endif
181 181
182 // listen on QPE/System 182 // listen on QPE/System
183#if defined(Q_WS_QWS) 183#if defined(Q_WS_QWS)
184#if !defined(QT_NO_COP) 184#if !defined(QT_NO_COP)
185 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 185 QCopChannel *channel = new QCopChannel( "QPE/System", this );
186 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 186 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) );
187 channel = new QCopChannel( "QPE/Datebook", this ); 187 channel = new QCopChannel( "QPE/Datebook", this );
188 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); 188 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) );
189 qDebug("olle\n"); 189 qDebug("olle\n");
190#endif 190#endif
191#endif 191#endif
192 192
193 qDebug("done t=%d", t.elapsed() ); 193 qDebug("done t=%d", t.elapsed() );
194 194
195 connect( qApp, SIGNAL( flush() ), this, SLOT( flush() ) );
196 connect( qApp, SIGNAL( reload()), this, SLOT( reload() ) );
195 /* 197 /*
196 * Here is a problem description: 198 * Here is a problem description:
197 * When Weekview is the default view 199 * When Weekview is the default view
198 * a DateBookWeekView get's created 200 * a DateBookWeekView get's created
199 * redraw() get's called. So what? 201 * redraw() get's called. So what?
200 * Remember that we're still in the c'tor 202 * Remember that we're still in the c'tor
201 * and no final layout has happened? Ok 203 * and no final layout has happened? Ok
202 * now all Events get arranged. Their x 204 * now all Events get arranged. Their x
203 * position get's determined by a QHeader 205 * position get's determined by a QHeader
204 * position. But the QHeader isn't layouted or 206 * position. But the QHeader isn't layouted or
205 * at the right position. redraw() is a slot 207 * at the right position. redraw() is a slot
206 * so we'll call it then via a singleShot 208 * so we'll call it then via a singleShot
207 * from view() 209 * from view()
208 */ 210 */
209 if( needEvilHack ){ 211 if( needEvilHack ){
210 QTimer::singleShot( 500, this, SLOT(viewWeek()) ); 212 QTimer::singleShot( 500, this, SLOT(viewWeek()) );
211 } 213 }
212} 214}
213 215
214void DateBook::receive( const QCString &msg, const QByteArray &data ) 216void DateBook::receive( const QCString &msg, const QByteArray &data )
215{ 217{
216 QDataStream stream( data, IO_ReadOnly ); 218 QDataStream stream( data, IO_ReadOnly );
217 if ( msg == "timeChange(QString)" ) { 219 if ( msg == "timeChange(QString)" ) {
218 // update active view! 220 // update active view!
219 if ( dayAction->isOn() ) 221 if ( dayAction->isOn() )
220 viewDay(); 222 viewDay();
221 else if ( weekAction->isOn() ) 223 else if ( weekAction->isOn() )
222 viewWeek(); 224 viewWeek();
223 else if ( monthAction->isOn() ) 225 else if ( monthAction->isOn() )
224 viewMonth(); 226 viewMonth();
225 } 227 }
226 else if (msg == "editEvent(int)") { 228 else if (msg == "editEvent(int)") {
227 int uid; 229 int uid;
228 stream >> uid; 230 stream >> uid;
229 Event e=db->eventByUID(uid); 231 Event e=db->eventByUID(uid);
230 editEvent(e); 232 editEvent(e);
231 }else if (msg == "viewDefault(QDate)"){ 233 }else if (msg == "viewDefault(QDate)"){
232 QDate day; 234 QDate day;
233 stream >> day; 235 stream >> day;
234 viewDefault(day); 236 viewDefault(day);
235 } 237 }
236} 238}
237 239
238DateBook::~DateBook() 240DateBook::~DateBook()
239{ 241{
240} 242}
241 243
242void DateBook::slotSettings() 244void DateBook::slotSettings()
243{ 245{
244 DateBookSettings frmSettings( ampm, this ); 246 DateBookSettings frmSettings( ampm, this );
245 frmSettings.setStartTime( startTime ); 247 frmSettings.setStartTime( startTime );
246 frmSettings.setAlarmPreset( aPreset, presetTime ); 248 frmSettings.setAlarmPreset( aPreset, presetTime );
247 frmSettings.setJumpToCurTime( bJumpToCurTime ); 249 frmSettings.setJumpToCurTime( bJumpToCurTime );
248 frmSettings.setRowStyle( rowStyle ); 250 frmSettings.setRowStyle( rowStyle );
249 frmSettings.comboDefaultView->setCurrentItem(defaultView-1); 251 frmSettings.comboDefaultView->setCurrentItem(defaultView-1);
250 frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); 252 frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig);
251 253
252 bool found=false; 254 bool found=false;
253 for (int i=0; i<(frmSettings.comboLocation->count()); i++) { 255 for (int i=0; i<(frmSettings.comboLocation->count()); i++) {
254 if ( frmSettings.comboLocation->text(i) == defaultLocation ) { 256 if ( frmSettings.comboLocation->text(i) == defaultLocation ) {
255 frmSettings.comboLocation->setCurrentItem(i); 257 frmSettings.comboLocation->setCurrentItem(i);
256 found=true; 258 found=true;
257 break; 259 break;
258 } 260 }
259 } 261 }
260 if(!found) { 262 if(!found) {
261 frmSettings.comboLocation->insertItem(defaultLocation); 263 frmSettings.comboLocation->insertItem(defaultLocation);
262 frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); 264 frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1);
263 } 265 }
264 frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); 266 frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar"));
265 267
266#if defined (Q_WS_QWS) || defined(_WS_QWS_) 268#if defined (Q_WS_QWS) || defined(_WS_QWS_)
267 frmSettings.showMaximized(); 269 frmSettings.showMaximized();
268#endif 270#endif
269 271
270 if ( frmSettings.exec() ) { 272 if ( frmSettings.exec() ) {
271 273
272 aPreset = frmSettings.alarmPreset(); 274 aPreset = frmSettings.alarmPreset();
273 presetTime = frmSettings.presetTime(); 275 presetTime = frmSettings.presetTime();
274 startTime = frmSettings.startTime(); 276 startTime = frmSettings.startTime();
275 bJumpToCurTime = frmSettings.jumpToCurTime(); 277 bJumpToCurTime = frmSettings.jumpToCurTime();
276 rowStyle = frmSettings.rowStyle(); 278 rowStyle = frmSettings.rowStyle();
277 defaultView=frmSettings.comboDefaultView->currentItem()+1; 279 defaultView=frmSettings.comboDefaultView->currentItem()+1;
278 weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); 280 weeklistviewconfig=frmSettings.comboWeekListView->currentItem();
279 defaultLocation=frmSettings.comboLocation->currentText(); 281 defaultLocation=frmSettings.comboLocation->currentText();
280 defaultCategories=frmSettings.comboCategory->currentCategories(); 282 defaultCategories=frmSettings.comboCategory->currentCategories();
281 283
282 if ( dayView ) { 284 if ( dayView ) {
283 dayView->setStartViewTime( startTime ); 285 dayView->setStartViewTime( startTime );
284 dayView->setJumpToCurTime( bJumpToCurTime ); 286 dayView->setJumpToCurTime( bJumpToCurTime );
285 dayView->setRowStyle( rowStyle ); 287 dayView->setRowStyle( rowStyle );
286 } 288 }
287 if ( weekView ) { 289 if ( weekView ) {
288 weekView->setStartViewTime( startTime ); 290 weekView->setStartViewTime( startTime );
289 } 291 }
290 saveSettings(); 292 saveSettings();
@@ -309,242 +311,246 @@ void DateBook::fileNew()
309QString DateBook::checkEvent(const Event &e) 311QString DateBook::checkEvent(const Event &e)
310{ 312{
311 /* check if overlaps with itself */ 313 /* check if overlaps with itself */
312 bool checkFailed = FALSE; 314 bool checkFailed = FALSE;
313 315
314 /* check the next 12 repeats. should catch most problems */ 316 /* check the next 12 repeats. should catch most problems */
315 QDate current_date = e.start().date(); 317 QDate current_date = e.start().date();
316 Event previous = e; 318 Event previous = e;
317 for(int i = 0; i < 12; i++) 319 for(int i = 0; i < 12; i++)
318 { 320 {
319 QDateTime next; 321 QDateTime next;
320 if (!nextOccurance(previous, current_date.addDays(1), next)) { 322 if (!nextOccurance(previous, current_date.addDays(1), next)) {
321 break; // no more repeats 323 break; // no more repeats
322 } 324 }
323 if(next < previous.end()) { 325 if(next < previous.end()) {
324 checkFailed = TRUE; 326 checkFailed = TRUE;
325 break; 327 break;
326 } 328 }
327 current_date = next.date(); 329 current_date = next.date();
328 } 330 }
329 331
330 if(checkFailed) 332 if(checkFailed)
331 return tr("Event duration is potentially longer\n" 333 return tr("Event duration is potentially longer\n"
332 "than interval between repeats."); 334 "than interval between repeats.");
333 335
334 return QString::null; 336 return QString::null;
335} 337}
336 338
337QDate DateBook::currentDate() 339QDate DateBook::currentDate()
338{ 340{
339 QDate d = QDate::currentDate(); 341 QDate d = QDate::currentDate();
340 342
341 if ( dayView && views->visibleWidget() == dayView ) { 343 if ( dayView && views->visibleWidget() == dayView ) {
342 d = dayView->date(); 344 d = dayView->date();
343 } else if ( weekView && views->visibleWidget() == weekView ) { 345 } else if ( weekView && views->visibleWidget() == weekView ) {
344 d = weekView->date(); 346 d = weekView->date();
345 } else if ( weekLstView && views->visibleWidget() == weekLstView ) { 347 } else if ( weekLstView && views->visibleWidget() == weekLstView ) {
346 d = weekLstView->date(); 348 d = weekLstView->date();
347 } else if ( monthView && views->visibleWidget() == monthView ) { 349 } else if ( monthView && views->visibleWidget() == monthView ) {
348 d = monthView->selectedDate(); 350 d = monthView->selectedDate();
349 } 351 }
350 352
351 return d; 353 return d;
352} 354}
353 355
354void DateBook::view(int v, const QDate &d) { 356void DateBook::view(int v, const QDate &d) {
355 if (v==DAY) { 357 if (v==DAY) {
356 initDay(); 358 initDay();
357 dayAction->setOn( TRUE ); 359 dayAction->setOn( TRUE );
358 dayView->setDate( d ); 360 dayView->setDate( d );
359 views->raiseWidget( dayView ); 361 views->raiseWidget( dayView );
360 dayView->redraw(); 362 dayView->redraw();
361 } else if (v==WEEK) { 363 } else if (v==WEEK) {
362 initWeek(); 364 initWeek();
363 weekAction->setOn( TRUE ); 365 weekAction->setOn( TRUE );
364 weekView->setDate( d ); 366 weekView->setDate( d );
365 views->raiseWidget( weekView ); 367 views->raiseWidget( weekView );
366 weekView->redraw(); 368 weekView->redraw();
367 } else if (v==WEEKLST) { 369 } else if (v==WEEKLST) {
368 initWeekLst(); 370 initWeekLst();
369 weekLstAction->setOn( TRUE ); 371 weekLstAction->setOn( TRUE );
370 weekLstView->setDate(d); 372 weekLstView->setDate(d);
371 views->raiseWidget( weekLstView ); 373 views->raiseWidget( weekLstView );
372 weekLstView->redraw(); 374 weekLstView->redraw();
373 } else if (v==MONTH) { 375 } else if (v==MONTH) {
374 initMonth(); 376 initMonth();
375 monthAction->setOn( TRUE ); 377 monthAction->setOn( TRUE );
376 monthView->setDate( d.year(), d.month(), d.day() ); 378 monthView->setDate( d.year(), d.month(), d.day() );
377 views->raiseWidget( monthView ); 379 views->raiseWidget( monthView );
378 monthView->redraw(); 380 monthView->redraw();
379 } 381 }
380} 382}
381 383
382void DateBook::viewDefault(const QDate &d) { 384void DateBook::viewDefault(const QDate &d) {
383 view(defaultView,d); 385 view(defaultView,d);
384} 386}
385 387
386void DateBook::viewDay() { 388void DateBook::viewDay() {
387 view(DAY,currentDate()); 389 view(DAY,currentDate());
388} 390}
389 391
390void DateBook::viewWeek() { 392void DateBook::viewWeek() {
391 view(WEEK,currentDate()); 393 view(WEEK,currentDate());
392} 394}
393 395
394void DateBook::viewWeekLst() { 396void DateBook::viewWeekLst() {
395 view(WEEKLST,currentDate()); 397 view(WEEKLST,currentDate());
396} 398}
397 399
398void DateBook::viewMonth() { 400void DateBook::viewMonth() {
399 view(MONTH,currentDate()); 401 view(MONTH,currentDate());
400} 402}
401 403
402void DateBook::insertEvent( const Event &e ) 404void DateBook::insertEvent( const Event &e )
403{ 405{
404 Event dupEvent=e; 406 Event dupEvent=e;
407 if(!dupEvent.isValidUid() ) // tkcRom seems to be different
408 dupEvent.assignUid();
405 dupEvent.setLocation(defaultLocation); 409 dupEvent.setLocation(defaultLocation);
406 dupEvent.setCategories(defaultCategories); 410 dupEvent.setCategories(defaultCategories);
407 db->addEvent(dupEvent); 411 db->addEvent(dupEvent);
408 emit newEvent(); 412 emit newEvent();
409} 413}
410 414
411void DateBook::duplicateEvent( const Event &e ) 415void DateBook::duplicateEvent( const Event &e )
412{ 416{
413 qWarning("Hmmm..."); 417 qWarning("Hmmm...");
414 // Alot of code duplication, as this is almost like editEvent(); 418 // Alot of code duplication, as this is almost like editEvent();
415 if (syncing) { 419 if (syncing) {
416 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); 420 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
417 return; 421 return;
418 } 422 }
419 423
420 Event dupevent(e);// Make a duplicate. 424 Event dupevent(e);// Make a duplicate.
421 425
422 // workaround added for text input. 426 // workaround added for text input.
423 QDialog editDlg( this, 0, TRUE ); 427 QDialog editDlg( this, 0, TRUE );
424 DateEntry *entry; 428 DateEntry *entry;
425 editDlg.setCaption( tr("Duplicate Event") ); 429 editDlg.setCaption( tr("Duplicate Event") );
426 QVBoxLayout *vb = new QVBoxLayout( &editDlg ); 430 QVBoxLayout *vb = new QVBoxLayout( &editDlg );
427 QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); 431 QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
428 sv->setResizePolicy( QScrollView::AutoOneFit ); 432 sv->setResizePolicy( QScrollView::AutoOneFit );
429 // KLUDGE!!! 433 // KLUDGE!!!
430 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 434 sv->setHScrollBarMode( QScrollView::AlwaysOff );
431 vb->addWidget( sv ); 435 vb->addWidget( sv );
432 entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" ); 436 entry = new DateEntry( onMonday, dupevent, ampm, &editDlg, "editor" );
433 entry->timezone->setEnabled( FALSE ); 437 entry->timezone->setEnabled( FALSE );
434 sv->addChild( entry ); 438 sv->addChild( entry );
435 439
436#if defined(Q_WS_QWS) || defined(_WS_QWS_) 440#if defined(Q_WS_QWS) || defined(_WS_QWS_)
437 editDlg.showMaximized(); 441 editDlg.showMaximized();
438#endif 442#endif
439 while (editDlg.exec() ) { 443 while (editDlg.exec() ) {
440 Event newEv = entry->event(); 444 Event newEv = entry->event();
441 QString error = checkEvent(newEv); 445 QString error = checkEvent(newEv);
442 if (!error.isNull()) { 446 if (!error.isNull()) {
443 if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) 447 if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0)
444 continue; 448 continue;
445 } 449 }
446 /* 450 /*
447 * The problem: 451 * The problem:
448 * DateBookDB does remove repeating events not by uid but by the time 452 * DateBookDB does remove repeating events not by uid but by the time
449 * the recurrence was created 453 * the recurrence was created
450 * so we need to update that time as well 454 * so we need to update that time as well
451 */ 455 */
452 Event::RepeatPattern rp = newEv.repeatPattern(); 456 Event::RepeatPattern rp = newEv.repeatPattern();
453 rp.createTime = ::time( NULL ); 457 rp.createTime = ::time( NULL );
454 newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern... 458 newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern...
459 if( newEv.uid() == e.uid() || !newEv.isValidUid() )
460 newEv.assignUid();
455 461
456 db->addEvent(newEv); 462 db->addEvent(newEv);
457 emit newEvent(); 463 emit newEvent();
458 break; 464 break;
459 } 465 }
460} 466}
461 467
462void DateBook::editEvent( const Event &e ) 468void DateBook::editEvent( const Event &e )
463{ 469{
464 if (syncing) { 470 if (syncing) {
465 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); 471 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
466 return; 472 return;
467 } 473 }
468 474
469 // workaround added for text input. 475 // workaround added for text input.
470 QDialog editDlg( this, 0, TRUE ); 476 QDialog editDlg( this, 0, TRUE );
471 DateEntry *entry; 477 DateEntry *entry;
472 editDlg.setCaption( tr("Edit Event") ); 478 editDlg.setCaption( tr("Edit Event") );
473 QVBoxLayout *vb = new QVBoxLayout( &editDlg ); 479 QVBoxLayout *vb = new QVBoxLayout( &editDlg );
474 QScrollView *sv = new QScrollView( &editDlg, "scrollview" ); 480 QScrollView *sv = new QScrollView( &editDlg, "scrollview" );
475 sv->setResizePolicy( QScrollView::AutoOneFit ); 481 sv->setResizePolicy( QScrollView::AutoOneFit );
476 // KLUDGE!!! 482 // KLUDGE!!!
477 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 483 sv->setHScrollBarMode( QScrollView::AlwaysOff );
478 vb->addWidget( sv ); 484 vb->addWidget( sv );
479 entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" ); 485 entry = new DateEntry( onMonday, e, ampm, &editDlg, "editor" );
480 entry->timezone->setEnabled( FALSE ); 486 entry->timezone->setEnabled( FALSE );
481 sv->addChild( entry ); 487 sv->addChild( entry );
482 488
483#if defined(Q_WS_QWS) || defined(_WS_QWS_) 489#if defined(Q_WS_QWS) || defined(_WS_QWS_)
484 editDlg.showMaximized(); 490 editDlg.showMaximized();
485#endif 491#endif
486 while (editDlg.exec() ) { 492 while (editDlg.exec() ) {
487 Event newEv = entry->event(); 493 Event newEv = entry->event();
488 if(newEv.description().isEmpty() && newEv.notes().isEmpty() ) 494 if(newEv.description().isEmpty() && newEv.notes().isEmpty() )
489 break; 495 break;
490 newEv.setUid(e.uid()); // FIXME: Hack not to clear uid 496 newEv.setUid(e.uid()); // FIXME: Hack not to clear uid
491 QString error = checkEvent(newEv); 497 QString error = checkEvent(newEv);
492 if (!error.isNull()) { 498 if (!error.isNull()) {
493 if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue; 499 if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue;
494 } 500 }
495 db->editEvent(e, newEv); 501 db->editEvent(e, newEv);
496 emit newEvent(); 502 emit newEvent();
497 break; 503 break;
498 } 504 }
499} 505}
500 506
501void DateBook::removeEvent( const Event &e ) 507void DateBook::removeEvent( const Event &e )
502{ 508{
503 if (syncing) { 509 if (syncing) {
504 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") ); 510 QMessageBox::warning( this, tr("Calendar"), tr( "Can not edit data, currently syncing") );
505 return; 511 return;
506 } 512 }
507 513
508 QString strName = e.description(); 514 QString strName = e.description();
509 515
510 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) ) 516 if ( !QPEMessageBox::confirmDelete( this, tr( "Calendar" ),strName ) )
511 return; 517 return;
512 518
513 db->removeEvent( e ); 519 db->removeEvent( e );
514 if ( views->visibleWidget() == dayView && dayView ) 520 if ( views->visibleWidget() == dayView && dayView )
515 dayView->redraw(); 521 dayView->redraw();
516} 522}
517 523
518void DateBook::addEvent( const Event &e ) 524void DateBook::addEvent( const Event &e )
519{ 525{
520 QDate d = e.start().date(); 526 QDate d = e.start().date();
521 initDay(); 527 initDay();
522 dayView->setDate( d ); 528 dayView->setDate( d );
523} 529}
524 530
525void DateBook::showDay( int year, int month, int day ) 531void DateBook::showDay( int year, int month, int day )
526{ 532{
527 QDate d(year, month, day); 533 QDate d(year, month, day);
528 view(DAY,d); 534 view(DAY,d);
529} 535}
530 536
531void DateBook::initDay() 537void DateBook::initDay()
532{ 538{
533 if ( !dayView ) { 539 if ( !dayView ) {
534 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); 540 dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
535 views->addWidget( dayView, DAY ); 541 views->addWidget( dayView, DAY );
536 dayView->setJumpToCurTime( bJumpToCurTime ); 542 dayView->setJumpToCurTime( bJumpToCurTime );
537 dayView->setStartViewTime( startTime ); 543 dayView->setStartViewTime( startTime );
538 dayView->setRowStyle( rowStyle ); 544 dayView->setRowStyle( rowStyle );
539 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); 545 connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) );
540 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); 546 connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) );
541 connect( dayView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); 547 connect( dayView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) );
542 connect( dayView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) ); 548 connect( dayView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) );
543 connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) ); 549 connect( dayView, SIGNAL( duplicateEvent( const Event & ) ), this, SLOT( duplicateEvent( const Event & ) ) );
544 connect( dayView, SIGNAL( beamEvent( const Event & ) ), this, SLOT( beamEvent( const Event & ) ) ); 550 connect( dayView, SIGNAL( beamEvent( const Event & ) ), this, SLOT( beamEvent( const Event & ) ) );
545 connect( dayView, SIGNAL(sigNewEvent(const QString &)), this, SLOT(slotNewEventFromKey(const QString &)) ); 551 connect( dayView, SIGNAL(sigNewEvent(const QString &)), this, SLOT(slotNewEventFromKey(const QString &)) );
546 } 552 }
547} 553}
548 554
549void DateBook::initWeek() 555void DateBook::initWeek()
550{ 556{
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index 770410e..84b4f1b 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -5,119 +5,120 @@
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#include "datebookweekheaderimpl.h" 20#include "datebookweekheaderimpl.h"
21#include "datebookweekheader.h" 21#include "datebookweekheader.h"
22#include "datebookweek.h" 22#include "datebookweek.h"
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qspinbox.h> 24#include <qspinbox.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/datebookmonth.h> 27#include <qpe/datebookmonth.h>
28 28
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30 30
31/* 31/*
32 * Constructs a DateBookWeekHeader which is a child of 'parent', with the 32 * Constructs a DateBookWeekHeader which is a child of 'parent', with the
33 * name 'name' and widget flags set to 'f' 33 * name 'name' and widget flags set to 'f'
34 */ 34 */
35DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl ) 35DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent, const char* name, WFlags fl )
36 : DateBookWeekHeaderBase( parent, name, fl ), 36 : DateBookWeekHeaderBase( parent, name, fl ),
37 bStartOnMonday( startOnMonday ) 37 bStartOnMonday( startOnMonday )
38{ 38{
39 setBackgroundMode( PaletteButton ); 39 setBackgroundMode( PaletteButton );
40 labelDate->setBackgroundMode( PaletteButton ); 40 labelDate->setBackgroundMode( PaletteButton );
41 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 41 backmonth->setPixmap( Resource::loadPixmap("fastback") );
42 backweek->setPixmap( Resource::loadPixmap("back") ); 42 backweek->setPixmap( Resource::loadPixmap("back") );
43 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 43 forwardweek->setPixmap( Resource::loadPixmap("forward") );
44 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 44 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
45} 45}
46 46
47/* 47/*
48 * Destroys the object and frees any allocated resources 48 * Destroys the object and frees any allocated resources
49 */ 49 */
50DateBookWeekHeader::~DateBookWeekHeader() 50DateBookWeekHeader::~DateBookWeekHeader()
51{ 51{
52 // no need to delete child widgets, Qt does it all for us 52 // no need to delete child widgets, Qt does it all for us
53} 53}
54 54
55void DateBookWeekHeader::pickDate() 55void DateBookWeekHeader::pickDate()
56{ 56{
57 static QPopupMenu *m1 = 0; 57 static QPopupMenu *m1 = 0;
58 static DateBookMonth *picker = 0; 58 static DateBookMonth *picker = 0;
59 if ( !m1 ) { 59 if ( !m1 ) {
60 m1 = new QPopupMenu( this ); 60 m1 = new QPopupMenu( this );
61 picker = new DateBookMonth( m1, 0, TRUE ); 61 picker = new DateBookMonth( m1, 0, TRUE );
62 m1->insertItem( picker ); 62 m1->insertItem( picker );
63 connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) ); 63 connect( picker, SIGNAL( dateClicked( int, int, int ) ), this, SLOT( setDate( int, int, int ) ) );
64 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); 64 // connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) );
65 } 65 }
66 picker->setDate( date.year(), date.month(), date.day() ); 66 picker->setDate( date.year(), date.month(), date.day() );
67 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 67 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
68 picker->setFocus(); 68 picker->setFocus();
69} 69}
70 70
71void DateBookWeekHeader::nextMonth() 71void DateBookWeekHeader::nextMonth()
72{ 72{
73 qWarning("nextMonth() " ); 73 qWarning("nextMonth() " );
74 setDate(date.addDays(28)); 74 setDate(date.addDays(28));
75} 75}
76void DateBookWeekHeader::prevMonth() 76void DateBookWeekHeader::prevMonth()
77{ 77{
78 qWarning("prevMonth() " ); 78 qWarning("prevMonth() " );
79 setDate(date.addDays(-28)); 79 setDate(date.addDays(-28));
80} 80}
81void DateBookWeekHeader::nextWeek() 81void DateBookWeekHeader::nextWeek()
82{ 82{
83 qWarning("nextWeek() " ); 83 qWarning("nextWeek() " );
84 setDate(date.addDays(7)); 84 setDate(date.addDays(7));
85} 85}
86void DateBookWeekHeader::prevWeek() 86void DateBookWeekHeader::prevWeek()
87{ 87{
88 qWarning("prevWeek() "); 88 qWarning("prevWeek() ");
89 setDate(date.addDays(-7)); 89 setDate(date.addDays(-7));
90} 90}
91 91
92void DateBookWeekHeader::setDate( int y, int m, int d ) 92void DateBookWeekHeader::setDate( int y, int m, int d )
93{ 93{
94 setDate(QDate(y,m,d)); 94 setDate(QDate(y,m,d));
95} 95}
96 96
97void DateBookWeekHeader::setDate(const QDate &d) { 97void DateBookWeekHeader::setDate(const QDate &d) {
98 int year,week,dayofweek; 98 int year,week,dayofweek;
99 date=d; 99 date=d;
100 dayofweek=d.dayOfWeek(); 100 dayofweek=d.dayOfWeek();
101 if(bStartOnMonday) 101 if(bStartOnMonday)
102 dayofweek--; 102 dayofweek--;
103 else if( dayofweek == 7 ) 103 else if( dayofweek == 7 )
104 /* we already have the right day -7 would lead to the current week..*/ 104 // we already have the right day -7 would lead to the current week..
105 dayofweek = 0; 105 dayofweek = 0;
106 106
107 date=date.addDays(-dayofweek); 107 date=date.addDays(-dayofweek);
108 calcWeek(date,week,year,bStartOnMonday); 108 calcWeek(date,week,year,bStartOnMonday);
109 QDate start=date; 109 QDate start=date;
110 QDate stop=start.addDays(6); 110 QDate stop=start.addDays(6);
111 labelDate->setText( QString::number(start.day()) + "." + 111 labelDate->setText( QString::number(start.day()) + "." +
112 start.monthName(start.month()) + "-" + 112 Calendar::nameOfMonth( start.month()) + "-" +
113 QString::number(stop.day()) + "." + 113 QString::number(stop.day()) + "." +
114 start.monthName(stop.month()) +" ("+ 114 Calendar::nameOfMonth( stop.month()) +" ("+
115 tr("w")+":"+QString::number( week ) +")"); 115 tr("w")+":"+QString::number( week ) +")");
116 date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
116 emit dateChanged(date); 117 emit dateChanged(date);
117} 118}
118 119
119void DateBookWeekHeader::setStartOfWeek( bool onMonday ) 120void DateBookWeekHeader::setStartOfWeek( bool onMonday )
120{ 121{
121 bStartOnMonday = onMonday; 122 bStartOnMonday = onMonday;
122 setDate( date ); 123 setDate( date );
123} 124}
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index aad1f3a..24fb0ba 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -1,225 +1,213 @@
1#include "datebookweeklst.h" 1#include "datebookweeklst.h"
2 2
3#include "datebookweekheaderimpl.h"
4 3
5#include "datebook.h" 4#include "datebook.h"
6 5
7#include <qpe/calendar.h>
8#include <qpe/datebookdb.h>
9#include <qpe/event.h>
10#include <qpe/qpeapplication.h>
11#include <qpe/timestring.h>
12#include <qpe/datebookmonth.h> 6#include <qpe/datebookmonth.h>
13#include <qpe/config.h> 7#include <qpe/config.h>
14#include <qpe/resource.h> 8#include <qpe/resource.h>
9#include <qpe/calendar.h>
15 10
16#include <qdatetime.h>
17#include <qheader.h>
18#include <qlabel.h>
19#include <qlayout.h> 11#include <qlayout.h>
20#include <qpainter.h>
21#include <qpopupmenu.h>
22#include <qtimer.h>
23#include <qstyle.h>
24#include <qtoolbutton.h> 12#include <qtoolbutton.h>
25#include <qvbox.h>
26#include <qsizepolicy.h>
27#include <qabstractlayout.h>
28#include <qtl.h> 13#include <qtl.h>
29 14
30bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false); 15bool calcWeek(const QDate &d, int &week, int &year,bool startOnMonday = false);
31 16
32DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl) 17DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, const char* name, WFlags fl)
33 : DateBookWeekLstHeaderBase(parent, name, fl) 18 : DateBookWeekLstHeaderBase(parent, name, fl)
34{ 19{
35 setBackgroundMode( PaletteButton ); 20 setBackgroundMode( PaletteButton );
36 labelDate->setBackgroundMode( PaletteButton ); 21 labelDate->setBackgroundMode( PaletteButton );
37 forwardweek->setBackgroundMode( PaletteButton ); 22 forwardweek->setBackgroundMode( PaletteButton );
38 forwardweek->setPixmap( Resource::loadPixmap("forward") ); 23 forwardweek->setPixmap( Resource::loadPixmap("forward") );
39 forwardmonth->setBackgroundMode( PaletteButton ); 24 forwardmonth->setBackgroundMode( PaletteButton );
40 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") ); 25 forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
41 backweek->setBackgroundMode( PaletteButton ); 26 backweek->setBackgroundMode( PaletteButton );
42 backweek->setPixmap( Resource::loadPixmap("back") ); 27 backweek->setPixmap( Resource::loadPixmap("back") );
43 backmonth->setBackgroundMode( PaletteButton ); 28 backmonth->setBackgroundMode( PaletteButton );
44 backmonth->setPixmap( Resource::loadPixmap("fastback") ); 29 backmonth->setPixmap( Resource::loadPixmap("fastback") );
45 DateBookWeekLstHeaderBaseLayout->setSpacing(0); 30 DateBookWeekLstHeaderBaseLayout->setSpacing(0);
46 DateBookWeekLstHeaderBaseLayout->setMargin(0); 31 DateBookWeekLstHeaderBaseLayout->setMargin(0);
47 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding)); 32 //setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding));
48 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 33 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
49 34
50 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth())); 35 connect(backmonth, SIGNAL(clicked()), this, SLOT(prevMonth()));
51 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek())); 36 connect(backweek, SIGNAL(clicked()), this, SLOT(prevWeek()));
52 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek())); 37 connect(forwardweek, SIGNAL(clicked()), this, SLOT(nextWeek()));
53 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth())); 38 connect(forwardmonth, SIGNAL(clicked()), this, SLOT(nextMonth()));
54 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate())); 39 connect(labelDate, SIGNAL(clicked()), this, SLOT(pickDate()));
55 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool))); 40 connect(dbl, SIGNAL(toggled(bool)), this, SIGNAL(setDbl(bool)));
56 bStartOnMonday=onM; 41 bStartOnMonday=onM;
57} 42}
58DateBookWeekLstHeader::~DateBookWeekLstHeader(){} 43DateBookWeekLstHeader::~DateBookWeekLstHeader(){}
59 44
60void DateBookWeekLstHeader::setDate(const QDate &d) { 45void DateBookWeekLstHeader::setDate(const QDate &d) {
61 int year,week,dayofweek; 46 int year,week,dayofweek;
62 date=d; 47 date=d;
63 dayofweek=d.dayOfWeek(); 48 dayofweek=d.dayOfWeek();
64 if(bStartOnMonday) 49 if(bStartOnMonday)
65 dayofweek--; 50 dayofweek--;
66 else if( dayofweek == 7 ) 51 else if( dayofweek == 7 )
67 /* we already have the right day -7 would lead to the same week */ 52 /* we already have the right day -7 would lead to the same week */
68 dayofweek = 0; 53 dayofweek = 0;
69 54
70 date=date.addDays(-dayofweek); 55 date=date.addDays(-dayofweek);
71 56
72 calcWeek(date,week,year,bStartOnMonday); 57 calcWeek(date,week,year,bStartOnMonday);
73 QDate start=date; 58 QDate start=date;
74 QDate stop=start.addDays(6); 59 QDate stop=start.addDays(6);
75 labelDate->setText( QString::number(start.day()) + "." + 60 labelDate->setText( QString::number(start.day()) + "." +
76 start.monthName(start.month()) + "-" + 61 Calendar::nameOfMonth( start.month() ) + "-" +
77 QString::number(stop.day()) + "." + 62 QString::number(stop.day()) + "." +
78 start.monthName(stop.month()) +" ("+ 63 Calendar::nameOfMonth( stop.month()) +" ("+
79 tr("w")+":"+QString::number( week ) +")"); 64 tr("w")+":"+QString::number( week ) +")");
65 date = d; // bugfix: 0001126 - date has to be the selected date, not monday!
80 emit dateChanged(date); 66 emit dateChanged(date);
81} 67}
82 68
83void DateBookWeekLstHeader::pickDate() { 69void DateBookWeekLstHeader::pickDate() {
84 static QPopupMenu *m1 = 0; 70 static QPopupMenu *m1 = 0;
85 static DateBookMonth *picker = 0; 71 static DateBookMonth *picker = 0;
86 if ( !m1 ) { 72 if ( !m1 ) {
87 m1 = new QPopupMenu( this ); 73 m1 = new QPopupMenu( this );
88 picker = new DateBookMonth( m1, 0, TRUE ); 74 picker = new DateBookMonth( m1, 0, TRUE );
89 m1->insertItem( picker ); 75 m1->insertItem( picker );
90 connect( picker, SIGNAL( dateClicked( int, int, int ) ),this, SLOT( setDate( int, int, int ) ) ); 76 connect( picker, SIGNAL( dateClicked( int, int, int ) ),this, SLOT( setDate( int, int, int ) ) );
91 //connect( m1, SIGNAL( aboutToHide() ), 77 //connect( m1, SIGNAL( aboutToHide() ),
92 //this, SLOT( gotHide() ) ); 78 //this, SLOT( gotHide() ) );
93 } 79 }
94 picker->setDate( date.year(), date.month(), date.day() ); 80 picker->setDate( date.year(), date.month(), date.day() );
95 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height()))); 81 m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
96 picker->setFocus(); 82 picker->setFocus();
97} 83}
98void DateBookWeekLstHeader::setDate(int y, int m, int d) { 84void DateBookWeekLstHeader::setDate(int y, int m, int d) {
99 setDate(QDate(y,m,d)); 85 setDate(QDate(y,m,d));
100} 86}
101 87
102void DateBookWeekLstHeader::nextWeek() { 88void DateBookWeekLstHeader::nextWeek() {
103 setDate(date.addDays(7)); 89 setDate(date.addDays(7));
104} 90}
105void DateBookWeekLstHeader::prevWeek() { 91void DateBookWeekLstHeader::prevWeek() {
106 setDate(date.addDays(-7)); 92 setDate(date.addDays(-7));
107} 93}
108void DateBookWeekLstHeader::nextMonth() 94void DateBookWeekLstHeader::nextMonth()
109{ 95{
110 setDate(date.addDays(28)); 96 setDate(date.addDays(28));
111} 97}
112void DateBookWeekLstHeader::prevMonth() 98void DateBookWeekLstHeader::prevMonth()
113{ 99{
114 setDate(date.addDays(-28)); 100 setDate(date.addDays(-28));
115} 101}
116 102
117DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, 103DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */,
118 QWidget* parent, 104 QWidget* parent,
119 const char* name, 105 const char* name,
120 WFlags fl ) 106 WFlags fl )
121 : DateBookWeekLstDayHdrBase(parent, name, fl) { 107 : DateBookWeekLstDayHdrBase(parent, name, fl) {
122 108
123 date=d; 109 date=d;
124 110
125 static const QString wdays=tr("MTWTFSSM", "Week days"); 111 static const QString wdays=tr("MTWTFSSM", "Week days");
126 char day=wdays[d.dayOfWeek()-1]; 112 char day=wdays[d.dayOfWeek()-1];
127 113
114 //dont use dayOfWeek() to save space !
128 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); 115 label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) );
129 add->setText("+"); 116
117 add->setText("+");
130 118
131 if (d == QDate::currentDate()) { 119 if (d == QDate::currentDate()) {
132 QPalette pal=label->palette(); 120 QPalette pal=label->palette();
133 pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); 121 pal.setColor(QColorGroup::Foreground, QColor(0,0,255));
134 label->setPalette(pal); 122 label->setPalette(pal);
135 123
136 /* 124 /*
137 QFont f=label->font(); 125 QFont f=label->font();
138 f.setItalic(true); 126 f.setItalic(true);
139 label->setFont(f); 127 label->setFont(f);
140 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); 128 label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor()));
141 */ 129 */
142 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday 130 } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday
143 QPalette pal=label->palette(); 131 QPalette pal=label->palette();
144 pal.setColor(QColorGroup::Foreground, QColor(255,0,0)); 132 pal.setColor(QColorGroup::Foreground, QColor(255,0,0));
145 label->setPalette(pal); 133 label->setPalette(pal);
146 } 134 }
147 135
148 connect (label, SIGNAL(clicked()), this, SLOT(showDay())); 136 connect (label, SIGNAL(clicked()), this, SLOT(showDay()));
149 connect (add, SIGNAL(clicked()), this, SLOT(newEvent())); 137 connect (add, SIGNAL(clicked()), this, SLOT(newEvent()));
150} 138}
151 139
152void DateBookWeekLstDayHdr::showDay() { 140void DateBookWeekLstDayHdr::showDay() {
153 emit showDate(date.year(), date.month(), date.day()); 141 emit showDate(date.year(), date.month(), date.day());
154} 142}
155 143
156void DateBookWeekLstDayHdr::newEvent() { 144void DateBookWeekLstDayHdr::newEvent() {
157 QDateTime start, stop; 145 QDateTime start, stop;
158 start=stop=date; 146 start=stop=date;
159 start.setTime(QTime(10,0)); 147 start.setTime(QTime(10,0));
160 stop.setTime(QTime(12,0)); 148 stop.setTime(QTime(12,0));
161 149
162 emit addEvent(start,stop,"",0); 150 emit addEvent(start,stop,"",0);
163} 151}
164DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, 152DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
165 int weeklistviewconfig, 153 int weeklistviewconfig,
166 QWidget* parent, 154 QWidget* parent,
167 const char* name, 155 const char* name,
168 WFlags fl ) : OClickableLabel(parent,name,fl), event(ev) 156 WFlags fl ) : OClickableLabel(parent,name,fl), event(ev)
169{ 157{
170 // old values... lastday = "__|__", middle=" |---", Firstday="00:00", 158 // old values... lastday = "__|__", middle=" |---", Firstday="00:00",
171 QString s,start,middle,end,day; 159 QString s,start,middle,end,day;
172 160
173 qDebug("weeklistviewconfig=%d",weeklistviewconfig); 161 qDebug("weeklistviewconfig=%d",weeklistviewconfig);
174 if(weeklistviewconfig==NONE) {// No times displayed. 162 if(weeklistviewconfig==NONE) {// No times displayed.
175 // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); 163 // start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
176 // middle.sprintf("<--->"); 164 // middle.sprintf("<--->");
177 // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); 165 // end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
178 // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); 166 // day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
179 } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time. 167 } else if(weeklistviewconfig==NORMAL) {// "Normal", only display start time.
180 start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); 168 start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
181 middle.sprintf(" |---"); 169 middle.sprintf(" |---");
182 end.sprintf("__|__"); 170 end.sprintf("__|__");
183 day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute()); 171 day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
184 } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times. 172 } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times.
185 start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute()); 173 start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
186 middle.sprintf("<--->"); 174 middle.sprintf("<--->");
187 end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute()); 175 end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
188 day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute()); 176 day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
189 } 177 }
190 178
191 if(ev.event().type() == Event::Normal) { 179 if(ev.event().type() == Event::Normal) {
192 if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event. 180 if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) {// day event.
193 s=day; 181 s=day;
194 } else if(ev.startDate()==ev.date()) {// start event. 182 } else if(ev.startDate()==ev.date()) {// start event.
195 s=start; 183 s=start;
196 } else if(ev.endDate()==ev.date()) { // end event. 184 } else if(ev.endDate()==ev.date()) { // end event.
197 s=end; 185 s=end;
198 } else {// middle day. 186 } else {// middle day.
199 s=middle; 187 s=middle;
200 } 188 }
201 } else { 189 } else {
202 s=""; 190 s="";
203 } 191 }
204 setText(QString(s) + " " + ev.description()); 192 setText(QString(s) + " " + ev.description());
205 connect(this, SIGNAL(clicked()), this, SLOT(editMe())); 193 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
206 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); 194 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
207} 195}
208void DateBookWeekLstEvent::editMe() { 196void DateBookWeekLstEvent::editMe() {
209 emit editEvent(event.event()); 197 emit editEvent(event.event());
210} 198}
211 199
212 200
213DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 201DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
214 const QDate &d, bool onM, 202 const QDate &d, bool onM,
215 QWidget* parent, 203 QWidget* parent,
216 const char* name, WFlags fl) 204 const char* name, WFlags fl)
217 : QWidget( parent, name, fl ) 205 : QWidget( parent, name, fl )
218{ 206{
219 Config config("DateBook"); 207 Config config("DateBook");
220 config.setGroup("Main"); 208 config.setGroup("Main");
221 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); 209 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
222 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig); 210 qDebug("Read weeklistviewconfig: %d",weeklistviewconfig);
223 211
224 bStartOnMonday=onM; 212 bStartOnMonday=onM;
225 setPalette(white); 213 setPalette(white);
@@ -248,145 +236,160 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
248 // Header 236 // Header
249 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); 237 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this);
250 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 238 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
251 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 239 connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
252 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 240 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
253 layout->addWidget(hdr); 241 layout->addWidget(hdr);
254 242
255 // Events 243 // Events
256 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 244 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
257 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day. 245 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) {// Skip events ending at 00:00 starting at another day.
258 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); 246 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
259 layout->addWidget(l); 247 layout->addWidget(l);
260 connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 248 connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
261 } 249 }
262 it++; 250 it++;
263 } 251 }
264 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 252 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
265 } 253 }
266} 254}
267DateBookWeekLstView::~DateBookWeekLstView(){} 255DateBookWeekLstView::~DateBookWeekLstView(){}
268void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} 256void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}
269 257
270DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 258DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
271 QValueList<EffectiveEvent> &ev2, 259 QValueList<EffectiveEvent> &ev2,
272 QDate &d, bool onM, 260 QDate &d, bool onM,
273 QWidget* parent, 261 QWidget* parent,
274 const char* name, WFlags fl) 262 const char* name, WFlags fl)
275 : QWidget( parent, name, fl ) 263 : QWidget( parent, name, fl )
276{ 264{
277 QHBoxLayout *layout = new QHBoxLayout( this ); 265 QHBoxLayout *layout = new QHBoxLayout( this );
278 266
279 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); 267 DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this);
280 layout->addWidget(w); 268 layout->addWidget(w);
281 connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 269 connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
282 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 270 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
283 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &,const QString &)), 271 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &,const QString &)),
284 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 272 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
285 273
286 274
287 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this); 275 w=new DateBookWeekLstView(ev2,d.addDays(7),onM,this);
288 layout->addWidget(w); 276 layout->addWidget(w);
289 connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 277 connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
290 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 278 connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
291 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 279 connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
292 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 280 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
293} 281}
294 282
295DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, 283DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
296 QWidget *parent, 284 QWidget *parent,
297 const char *name ) 285 const char *name )
298 : QWidget( parent, name ), 286 : QWidget( parent, name ),
299 db( newDB ), 287 db( newDB ),
300 startTime( 0 ), 288 startTime( 0 ),
301 ampm( ap ), 289 ampm( ap ),
302 bStartOnMonday(onM) 290 bStartOnMonday(onM)
303{ 291{
304 setFocusPolicy(StrongFocus); 292 setFocusPolicy(StrongFocus);
305 layout = new QVBoxLayout( this ); 293 layout = new QVBoxLayout( this );
306 layout->setMargin(0); 294 layout->setMargin(0);
307 295
308 header=new DateBookWeekLstHeader(onM, this); 296 header=new DateBookWeekLstHeader(onM, this);
309 layout->addWidget( header ); 297 layout->addWidget( header );
310 connect(header, SIGNAL(dateChanged(QDate &)), this, SLOT(dateChanged(QDate &))); 298 connect(header, SIGNAL(dateChanged(QDate &)), this, SLOT(dateChanged(QDate &)));
311 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool))); 299 connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool)));
312 300
313 scroll=new QScrollView(this); 301 scroll=new QScrollView(this);
314 scroll->setResizePolicy(QScrollView::AutoOneFit); 302 scroll->setResizePolicy(QScrollView::AutoOneFit);
315 layout->addWidget(scroll); 303 layout->addWidget(scroll);
316 304
317 view=NULL; 305 view=NULL;
318 Config config("DateBook"); 306 Config config("DateBook");
319 config.setGroup("Main"); 307 config.setGroup("Main");
320 dbl=config.readBoolEntry("weeklst_dbl", false); 308 dbl=config.readBoolEntry("weeklst_dbl", false);
321 header->dbl->setOn(dbl); 309 header->dbl->setOn(dbl);
322} 310}
323DateBookWeekLst::~DateBookWeekLst(){ 311DateBookWeekLst::~DateBookWeekLst(){
324 Config config("DateBook"); 312 Config config("DateBook");
325 config.setGroup("Main"); 313 config.setGroup("Main");
326 config.writeEntry("weeklst_dbl", dbl); 314 config.writeEntry("weeklst_dbl", dbl);
327} 315}
328 316
329void DateBookWeekLst::setDate(const QDate &d) { 317void DateBookWeekLst::setDate(const QDate &d) {
330 bdate=d; 318 bdate=d;
331 header->setDate(d); 319 header->setDate(d);
332} 320}
333 321
334void DateBookWeekLst::setDbl(bool on) { 322void DateBookWeekLst::setDbl(bool on) {
335 dbl=on; 323 dbl=on;
336 redraw(); 324 redraw();
337} 325}
338void DateBookWeekLst::redraw() {getEvents();} 326void DateBookWeekLst::redraw() {getEvents();}
339 327
340QDate DateBookWeekLst::date() { 328QDate DateBookWeekLst::date() {
341 return bdate; 329 return bdate;
342} 330}
343 331
332// return the date at the beginning of the week...
333// copied from DateBookWeek
334QDate DateBookWeekLst::weekDate() const
335{
336 QDate d=bdate;
337
338 // Calculate offset to first day of week.
339 int dayoffset=d.dayOfWeek();
340 if(bStartOnMonday) dayoffset--;
341 else if( dayoffset == 7 )
342 dayoffset = 0;
343
344 return d.addDays(-dayoffset);
345}
346
344void DateBookWeekLst::getEvents() { 347void DateBookWeekLst::getEvents() {
345 QDate start = date(); 348 QDate start = weekDate(); //date();
346 QDate stop = start.addDays(6); 349 QDate stop = start.addDays(6);
347 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); 350 QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop);
348 351
349 if (view) delete view; 352 if (view) delete view;
350 if (dbl) { 353 if (dbl) {
351 QDate start2=start.addDays(7); 354 QDate start2=start.addDays(7);
352 stop=start2.addDays(6); 355 stop=start2.addDays(6);
353 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop); 356 QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
354 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll); 357 view=new DateBookWeekLstDblView(el,el2,start,bStartOnMonday,scroll);
355 } else { 358 } else {
356 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll); 359 view=new DateBookWeekLstView(el,start,bStartOnMonday,scroll);
357 } 360 }
358 361
359 connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); 362 connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
360 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 363 connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
361 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)), 364 connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
362 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &))); 365 this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
363 366
364 scroll->addChild(view); 367 scroll->addChild(view);
365 view->show(); 368 view->show();
366 scroll->updateScrollBars(); 369 scroll->updateScrollBars();
367} 370}
368 371
369void DateBookWeekLst::dateChanged(QDate &newdate) { 372void DateBookWeekLst::dateChanged(QDate &newdate) {
370 bdate=newdate; 373 bdate=newdate;
371 getEvents(); 374 getEvents();
372} 375}
373 376
374void DateBookWeekLst::keyPressEvent(QKeyEvent *e) 377void DateBookWeekLst::keyPressEvent(QKeyEvent *e)
375{ 378{
376 switch(e->key()) { 379 switch(e->key()) {
377 case Key_Up: 380 case Key_Up:
378 scroll->scrollBy(0, -20); 381 scroll->scrollBy(0, -20);
379 break; 382 break;
380 case Key_Down: 383 case Key_Down:
381 scroll->scrollBy(0, 20); 384 scroll->scrollBy(0, 20);
382 break; 385 break;
383 case Key_Left: 386 case Key_Left:
384 header->prevWeek(); 387 header->prevWeek();
385 break; 388 break;
386 case Key_Right: 389 case Key_Right:
387 header->nextWeek(); 390 header->nextWeek();
388 break; 391 break;
389 default: 392 default:
390 e->ignore(); 393 e->ignore();
391 } 394 }
392} 395}
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index 0bfbcda..f683ce7 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -27,129 +27,130 @@ public:
27public slots: 27public slots:
28 void nextWeek(); 28 void nextWeek();
29 void prevWeek(); 29 void prevWeek();
30 void nextMonth(); 30 void nextMonth();
31 void prevMonth(); 31 void prevMonth();
32 void pickDate(); 32 void pickDate();
33 void setDate(int y, int m, int d); 33 void setDate(int y, int m, int d);
34signals: 34signals:
35 void dateChanged(QDate &newdate); 35 void dateChanged(QDate &newdate);
36 void setDbl(bool on); 36 void setDbl(bool on);
37private: 37private:
38 QDate date; 38 QDate date;
39 //bool onMonday; 39 //bool onMonday;
40 bool bStartOnMonday; 40 bool bStartOnMonday;
41}; 41};
42 42
43class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase 43class DateBookWeekLstDayHdr: public DateBookWeekLstDayHdrBase
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46public: 46public:
47 DateBookWeekLstDayHdr(const QDate &d, bool onM, 47 DateBookWeekLstDayHdr(const QDate &d, bool onM,
48 QWidget* parent = 0, const char* name = 0, 48 QWidget* parent = 0, const char* name = 0,
49 WFlags fl = 0 ); 49 WFlags fl = 0 );
50public slots: 50public slots:
51 void showDay(); 51 void showDay();
52 void newEvent(); 52 void newEvent();
53signals: 53signals:
54 void showDate(int y, int m, int d); 54 void showDate(int y, int m, int d);
55 void addEvent(const QDateTime &start, const QDateTime &stop, 55 void addEvent(const QDateTime &start, const QDateTime &stop,
56 const QString &str, const QString &location); 56 const QString &str, const QString &location);
57private: 57private:
58 QDate date; 58 QDate date;
59}; 59};
60 60
61class DateBookWeekLstEvent: public OClickableLabel 61class DateBookWeekLstEvent: public OClickableLabel
62{ 62{
63 Q_OBJECT 63 Q_OBJECT
64public: 64public:
65 DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1, 65 DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1,
66 QWidget* parent = 0, const char* name = 0, 66 QWidget* parent = 0, const char* name = 0,
67 WFlags fl = 0); 67 WFlags fl = 0);
68signals: 68signals:
69 void editEvent(const Event &e); 69 void editEvent(const Event &e);
70private slots: 70private slots:
71 void editMe(); 71 void editMe();
72private: 72private:
73 const EffectiveEvent event; 73 const EffectiveEvent event;
74}; 74};
75 75
76class DateBookWeekLstView: public QWidget 76class DateBookWeekLstView: public QWidget
77{ 77{
78 Q_OBJECT 78 Q_OBJECT
79public: 79public:
80 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, 80 DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM,
81 QWidget* parent = 0, const char* name = 0, 81 QWidget* parent = 0, const char* name = 0,
82 WFlags fl = 0 ); 82 WFlags fl = 0 );
83 ~DateBookWeekLstView(); 83 ~DateBookWeekLstView();
84signals: 84signals:
85 void editEvent(const Event &e); 85 void editEvent(const Event &e);
86 void showDate(int y, int m, int d); 86 void showDate(int y, int m, int d);
87 void addEvent(const QDateTime &start, const QDateTime &stop, 87 void addEvent(const QDateTime &start, const QDateTime &stop,
88 const QString &str, const QString &location); 88 const QString &str, const QString &location);
89private: 89private:
90 bool bStartOnMonday; 90 bool bStartOnMonday;
91protected slots: 91protected slots:
92 void keyPressEvent(QKeyEvent *); 92 void keyPressEvent(QKeyEvent *);
93}; 93};
94 94
95class DateBookWeekLstDblView: public QWidget { 95class DateBookWeekLstDblView: public QWidget {
96 Q_OBJECT 96 Q_OBJECT
97public: 97public:
98 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, 98 DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
99 QValueList<EffectiveEvent> &ev2, 99 QValueList<EffectiveEvent> &ev2,
100 QDate &d, bool onM, 100 QDate &d, bool onM,
101 QWidget* parent = 0, const char* name = 0, 101 QWidget* parent = 0, const char* name = 0,
102 WFlags fl = 0 ); 102 WFlags fl = 0 );
103signals: 103signals:
104 void editEvent(const Event &e); 104 void editEvent(const Event &e);
105 void showDate(int y, int m, int d); 105 void showDate(int y, int m, int d);
106 void addEvent(const QDateTime &start, const QDateTime &stop, 106 void addEvent(const QDateTime &start, const QDateTime &stop,
107 const QString &str, const QString &location); 107 const QString &str, const QString &location);
108}; 108};
109 109
110class DateBookWeekLst : public QWidget 110class DateBookWeekLst : public QWidget
111{ 111{
112 Q_OBJECT 112 Q_OBJECT
113 113
114public: 114public:
115 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB, 115 DateBookWeekLst( bool ampm, bool onM, DateBookDB *newDB,
116 QWidget *parent = 0, 116 QWidget *parent = 0,
117 const char *name = 0 ); 117 const char *name = 0 );
118 ~DateBookWeekLst(); 118 ~DateBookWeekLst();
119 void setDate( int y, int w ); 119 void setDate( int y, int w );
120 void setDate(const QDate &d ); 120 void setDate(const QDate &d );
121 int week() const { return _week; }; 121 int week() const { return _week; };
122 QDate date(); 122 QDate date();
123 QDate weekDate() const;
123 124
124public slots: 125public slots:
125 void redraw(); 126 void redraw();
126 void dateChanged(QDate &date); 127 void dateChanged(QDate &date);
127 128
128protected slots: 129protected slots:
129 void keyPressEvent(QKeyEvent *); 130 void keyPressEvent(QKeyEvent *);
130 void setDbl(bool on); 131 void setDbl(bool on);
131 132
132signals: 133signals:
133 void showDate(int y, int m, int d); 134 void showDate(int y, int m, int d);
134 void addEvent(const QDateTime &start, const QDateTime &stop, 135 void addEvent(const QDateTime &start, const QDateTime &stop,
135 const QString &str, const QString &location); 136 const QString &str, const QString &location);
136 void editEvent(const Event &e); 137 void editEvent(const Event &e);
137 138
138private: 139private:
139 DateBookDB *db; 140 DateBookDB *db;
140 int startTime; 141 int startTime;
141 bool ampm; 142 bool ampm;
142 bool bStartOnMonday; 143 bool bStartOnMonday;
143 bool dbl; 144 bool dbl;
144 QDate bdate; 145 QDate bdate;
145 int year, _week,dow; 146 int year, _week,dow;
146 DateBookWeekLstHeader *header; 147 DateBookWeekLstHeader *header;
147 QWidget *view; 148 QWidget *view;
148 QVBoxLayout *layout; 149 QVBoxLayout *layout;
149 QScrollView *scroll; 150 QScrollView *scroll;
150 151
151 void getEvents(); 152 void getEvents();
152}; 153};
153 154
154#endif 155#endif
155 156
diff --git a/core/pim/osearch/datebooksearch.cpp b/core/pim/osearch/datebooksearch.cpp
index be2bf25..5da7ae9 100644
--- a/core/pim/osearch/datebooksearch.cpp
+++ b/core/pim/osearch/datebooksearch.cpp
@@ -1,92 +1,92 @@
1// 1//
2// 2//
3// C++ Implementation: $MODULE$ 3// C++ Implementation: $MODULE$
4// 4//
5// Description: 5// Description:
6// 6//
7// 7//
8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003 8// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
9// 9//
10// Copyright: See COPYING file that comes with this distribution 10// Copyright: See COPYING file that comes with this distribution
11// 11//
12// 12//
13#include "datebooksearch.h" 13#include "datebooksearch.h"
14 14
15#include "eventitem.h" 15#include "eventitem.h"
16 16
17#include <qpe/resource.h> 17#include <qpe/resource.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <opie/oevent.h> 19#include <opie/oevent.h>
20#include <opie/orecur.h> 20#include <opie/orecur.h>
21#include <opie/odatebookaccess.h> 21#include <opie/odatebookaccess.h>
22#include <qiconset.h> 22#include <qiconset.h>
23#include <qaction.h> 23#include <qaction.h>
24#include <qdatetime.h> 24#include <qdatetime.h>
25#include <qpopupmenu.h> 25#include <qpopupmenu.h>
26 26
27DatebookSearch::DatebookSearch(QListView* parent, QString name) 27DatebookSearch::DatebookSearch(QListView* parent, QString name)
28: SearchGroup(parent, name), _dates(0), _popupMenu(0) 28: SearchGroup(parent, name), _dates(0), _popupMenu(0)
29{ 29{
30 QIconSet is = Resource::loadIconSet( "datebook/DateBook" ); 30 QIconSet is = Resource::loadIconSet( "datebook/DateBook" );
31 setPixmap( 0, is.pixmap( QIconSet::Small, true ) ); 31 setPixmap( 0, is.pixmap( QIconSet::Small, true ) );
32 actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true ); 32 actionShowPastEvents = new QAction( QObject::tr("show past events"),QString::null, 0, 0, 0, true );
33 actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true ); 33 actionSearchInDates = new QAction( QObject::tr("search in dates"),QString::null, 0, 0, 0, true );
34 Config cfg( "osearch", Config::User ); 34 Config cfg( "osearch", Config::User );
35 cfg.setGroup( "datebook_settings" ); 35 cfg.setGroup( "datebook_settings" );
36 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) ); 36 actionShowPastEvents->setOn( cfg.readBoolEntry( "show_past_events", false ) );
37 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) ); 37 actionSearchInDates->setOn( cfg.readBoolEntry( "search_in_dates", true ) );
38} 38}
39 39
40DatebookSearch::~DatebookSearch() 40DatebookSearch::~DatebookSearch()
41{ 41{
42 qDebug("SAVE DATEBOOK SEARCH CONFIG"); 42 qDebug("SAVE DATEBOOK SEARCH CONFIG");
43 Config cfg( "osearch", Config::User ); 43 Config cfg( "osearch", Config::User );
44 cfg.setGroup( "datebook_settings" ); 44 cfg.setGroup( "datebook_settings" );
45 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() ); 45 cfg.writeEntry( "show_past_events", actionShowPastEvents->isOn() );
46 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() ); 46 cfg.writeEntry( "search_in_dates", actionSearchInDates->isOn() );
47 delete _dates; 47 delete _dates;
48 delete _popupMenu; 48 delete _popupMenu;
49 delete actionShowPastEvents; 49 delete actionShowPastEvents;
50 delete actionSearchInDates; 50 delete actionSearchInDates;
51} 51}
52 52
53 53
54void DatebookSearch::load() 54void DatebookSearch::load()
55{ 55{
56 _dates = new ODateBookAccess(); 56 _dates = new ODateBookAccess();
57 _dates->load(); 57 _dates->load();
58} 58}
59 59
60int DatebookSearch::search() 60int DatebookSearch::search()
61{ 61{
62 ORecordList<OEvent> results = _dates->matchRegexp(_search); 62 ORecordList<OEvent> results = _dates->matchRegexp(_search);
63 for (uint i = 0; i < results.count(); i++) 63 for (uint i = 0; i < results.count(); i++)
64 insertItem( new OEvent( results[i] ) ); 64 insertItem( new OEvent( results[i] ) );
65 return _resultCount; 65 return _resultCount;
66} 66}
67 67
68void DatebookSearch::insertItem( void *rec ) 68void DatebookSearch::insertItem( void *rec )
69{ 69{
70 OEvent *ev = (OEvent*)rec; 70 OEvent *ev = (OEvent*)rec;
71 if ( !actionShowPastEvents->isOn() && 71 if ( !actionShowPastEvents->isOn() &&
72 ev->endDateTime() < QDateTime::currentDateTime() && 72 ev->endDateTime() < QDateTime::currentDateTime() &&
73 !ev->recurrence().doesRecur() 73 !ev->recurrence().doesRecur()
74 ) return; 74 ) return;
75 if ( !actionSearchInDates->isOn() && ( 75 if ( !actionSearchInDates->isOn() && (
76 ev->lastHitField() == Qtopia::StartDateTime || 76 ev->lastHitField() == Qtopia::StartDateTime ||
77 ev->lastHitField() == Qtopia::EndDateTime ) 77 ev->lastHitField() == Qtopia::EndDateTime )
78 ) return; 78 ) return;
79 (void)new EventItem( this, ev ); 79 new EventItem( this, ev );
80 _resultCount++; 80 _resultCount++;
81} 81}
82 82
83QPopupMenu* DatebookSearch::popupMenu() 83QPopupMenu* DatebookSearch::popupMenu()
84{ 84{
85 if (!_popupMenu){ 85 if (!_popupMenu){
86 _popupMenu = new QPopupMenu( 0 ); 86 _popupMenu = new QPopupMenu( 0 );
87 actionShowPastEvents->addTo( _popupMenu ); 87 actionShowPastEvents->addTo( _popupMenu );
88 actionSearchInDates->addTo( _popupMenu ); 88 actionSearchInDates->addTo( _popupMenu );
89 } 89 }
90 return _popupMenu; 90 return _popupMenu;
91} 91}
92 92
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp
index aa52061..f768d81 100644
--- a/core/pim/osearch/mainwindow.cpp
+++ b/core/pim/osearch/mainwindow.cpp
@@ -1,185 +1,185 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
11 11
12 12
13 13
14#include <qaction.h> 14#include <qaction.h>
15#include <qmessagebox.h> 15#include <qmessagebox.h>
16#include <qpopupmenu.h> 16#include <qpopupmenu.h>
17#include <qtoolbutton.h> 17#include <qtoolbutton.h>
18#include <qstring.h> 18#include <qstring.h>
19#include <qlabel.h> 19#include <qlabel.h>
20#include <qfile.h> 20#include <qfile.h>
21#include <qhbuttongroup.h> 21#include <qhbuttongroup.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qintdict.h> 24#include <qintdict.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qsignalmapper.h> 27#include <qsignalmapper.h>
28#include <qtextbrowser.h> 28#include <qtextbrowser.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31#include <qpe/qpemenubar.h> 31#include <qpe/qpemenubar.h>
32#include <qpe/qpemessagebox.h> 32#include <qpe/qpemessagebox.h>
33#include <qpe/resource.h> 33#include <qpe/resource.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpetoolbar.h> 35#include <qpe/qpetoolbar.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/config.h> 37#include <qpe/config.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <opie/owait.h> 39#include <opie/owait.h>
40 40
41#include "olistview.h" 41#include "olistview.h"
42#include "olistviewitem.h" 42#include "olistviewitem.h"
43#include "resultitem.h" 43#include "resultitem.h"
44#include "adresssearch.h" 44#include "adresssearch.h"
45#include "todosearch.h" 45#include "todosearch.h"
46#include "datebooksearch.h" 46#include "datebooksearch.h"
47#include "applnksearch.h" 47#include "applnksearch.h"
48#include "doclnksearch.h" 48#include "doclnksearch.h"
49#include "mainwindow.h" 49#include "mainwindow.h"
50 50
51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : 51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
52 QMainWindow( parent, name, f ), _currentItem(0) 52 QMainWindow( parent, name, f ), _currentItem(0)
53{ 53{
54 setCaption( tr("OSearch") ); 54 setCaption( tr("OSearch") );
55 55
56 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 56 setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
57 57
58 QFrame *mainFrame = new QFrame( this, "mainFrame" ); 58 QFrame *mainFrame = new QFrame( this, "mainFrame" );
59 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 59 mainFrame->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
60 60
61 mainLayout = new QVBoxLayout( mainFrame ); 61 mainLayout = new QVBoxLayout( mainFrame );
62 mainLayout->setSpacing( 0 ); 62 mainLayout->setSpacing( 0 );
63 mainLayout->setMargin( 0 ); 63 mainLayout->setMargin( 0 );
64 64
65 resultsList = new OListView( mainFrame ); 65 resultsList = new OListView( mainFrame );
66 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 66 resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
67 mainLayout->addWidget( resultsList ); 67 mainLayout->addWidget( resultsList );
68 68
69 detailsFrame = new QFrame( mainFrame, "detailsFrame" ); 69 detailsFrame = new QFrame( mainFrame, "detailsFrame" );
70 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); 70 QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame );
71 richEdit = new QTextView( detailsFrame ); 71 richEdit = new QTextView( detailsFrame );
72 QWhatsThis::add( richEdit, tr("The details of the current result") ); 72 QWhatsThis::add( richEdit, tr("The details of the current result") );
73 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); 73 richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
74 detailsLayout->addWidget( richEdit ); 74 detailsLayout->addWidget( richEdit );
75 75
76 buttonBox = new QHBox( mainFrame, "Button Box" ); 76 buttonBox = new QHBox( mainFrame, "Button Box" );
77 77
78 _buttonCount = 0; 78 _buttonCount = 0;
79 79
80 mainLayout->addWidget( detailsFrame ); 80 mainLayout->addWidget( detailsFrame );
81 mainLayout->addWidget( buttonBox ); 81 mainLayout->addWidget( buttonBox );
82 detailsFrame->hide(); 82 detailsFrame->hide();
83 buttonBox->hide(); 83 buttonBox->hide();
84 84
85 searches.append( new AppLnkSearch( resultsList, tr("applications") ) ); 85 searches.append( new AppLnkSearch( resultsList, tr("Applications") ) );
86 searches.append( new DocLnkSearch( resultsList, tr("documents") ) ); 86 searches.append( new DocLnkSearch( resultsList, tr("Documents") ) );
87 searches.append( new TodoSearch( resultsList, tr("todo") ) ); 87 searches.append( new TodoSearch( resultsList, tr("Todo List") ) );
88 searches.append( new DatebookSearch( resultsList, tr("datebook") ) ); 88 searches.append( new DatebookSearch( resultsList, tr("Calendar") ) );
89 searches.append( new AdressSearch( resultsList, tr("adressbook") ) ); 89 searches.append( new AdressSearch( resultsList, tr("Contacts") ) );
90 90
91 setCentralWidget( mainFrame ); 91 setCentralWidget( mainFrame );
92 92
93 popupTimer = new QTimer(); 93 popupTimer = new QTimer();
94 searchTimer = new QTimer(); 94 searchTimer = new QTimer();
95 95
96 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); 96 connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup()));
97 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged())); 97 connect(searchTimer, SIGNAL(timeout()), SLOT(searchStringChanged()));
98 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); 98 connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*)));
99 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); 99 connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*)));
100 100
101 signalMapper = new QSignalMapper( this ); 101 signalMapper = new QSignalMapper( this );
102 102
103 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) ); 103 connect(signalMapper, SIGNAL(mapped(int)), SLOT( slotAction(int) ) );
104 104
105 makeMenu(); 105 makeMenu();
106 106
107 Config cfg( "osearch", Config::User ); 107 Config cfg( "osearch", Config::User );
108 cfg.setGroup( "search_settings" ); 108 cfg.setGroup( "search_settings" );
109 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) ); 109 actionCaseSensitiv->setOn( cfg.readBoolEntry( "caseSensitiv", false ) );
110 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) ); 110 actionWildcards->setOn( cfg.readBoolEntry( "wildcards", false ) );
111// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) ); 111// actionWholeWordsOnly->setOn( cfg.readBoolEntry( "whole_words_only", false ) );
112} 112}
113 113
114void MainWindow::makeMenu() 114void MainWindow::makeMenu()
115{ 115{
116 QPEToolBar *toolBar = new QPEToolBar( this ); 116 QPEToolBar *toolBar = new QPEToolBar( this );
117 QPEToolBar *searchBar = new QPEToolBar(this); 117 QPEToolBar *searchBar = new QPEToolBar(this);
118 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 118 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
119 QPopupMenu *searchMenu = new QPopupMenu( menuBar ); 119 QPopupMenu *searchMenu = new QPopupMenu( menuBar );
120// QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 120// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
121 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 121 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
122 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu ); 122 QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
123 123
124 setToolBarsMovable( false ); 124 setToolBarsMovable( false );
125 toolBar->setHorizontalStretchable( true ); 125 toolBar->setHorizontalStretchable( true );
126 menuBar->insertItem( tr( "Search" ), searchMenu ); 126 menuBar->insertItem( tr( "Search" ), searchMenu );
127 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 127 menuBar->insertItem( tr( "Settings" ), cfgMenu );
128 128
129 //SETTINGS MENU 129 //SETTINGS MENU
130 cfgMenu->insertItem( tr( "Search" ), searchOptions ); 130 cfgMenu->insertItem( tr( "Search" ), searchOptions );
131 QPopupMenu *pop; 131 QPopupMenu *pop;
132 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){ 132 for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
133 pop = s->popupMenu(); 133 pop = s->popupMenu();
134 if (pop){ 134 if (pop){
135 cfgMenu->insertItem( s->text(0), pop ); 135 cfgMenu->insertItem( s->text(0), pop );
136 } 136 }
137 } 137 }
138 138
139 139
140 //SEARCH 140 //SEARCH
141 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 ); 141 SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
142 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) ); 142 SearchAllAction->setIconSet( Resource::loadIconSet( "find" ) );
143 // QWhatsThis::add( SearchAllAction, tr("Search everything...") ); 143 // QWhatsThis::add( SearchAllAction, tr("Search everything...") );
144 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) ); 144 connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
145 SearchAllAction->addTo( searchMenu ); 145 SearchAllAction->addTo( searchMenu );
146 searchMenu->insertItem( tr( "Options" ), searchOptions ); 146 searchMenu->insertItem( tr( "Options" ), searchOptions );
147 147
148 //SEARCH OPTIONS 148 //SEARCH OPTIONS
149 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true ); 149 //actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
150 //actionWholeWordsOnly->addTo( searchOptions ); 150 //actionWholeWordsOnly->addTo( searchOptions );
151 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true ); 151 actionCaseSensitiv = new QAction( tr("Case sensitiv"),QString::null, 0, this, 0, true );
152 actionCaseSensitiv->addTo( searchOptions ); 152 actionCaseSensitiv->addTo( searchOptions );
153 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true ); 153 actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
154 actionWildcards->addTo( searchOptions ); 154 actionWildcards->addTo( searchOptions );
155 155
156 //SEARCH BAR 156 //SEARCH BAR
157 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); 157 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
158 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" ); 158 QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
159 QWhatsThis::add( searchEdit, tr("Enter your search terms here") ); 159 QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
160 searchEdit->setFocus(); 160 searchEdit->setFocus();
161 searchBar->setHorizontalStretchable( TRUE ); 161 searchBar->setHorizontalStretchable( TRUE );
162 searchBar->setStretchableWidget( searchEdit ); 162 searchBar->setStretchableWidget( searchEdit );
163 SearchAllAction->addTo( searchBar ); 163 SearchAllAction->addTo( searchBar );
164 connect( searchEdit, SIGNAL( textChanged( const QString & ) ), 164 connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
165 this, SLOT( setSearch( const QString & ) ) ); 165 this, SLOT( setSearch( const QString & ) ) );
166 166
167} 167}
168 168
169MainWindow::~MainWindow() 169MainWindow::~MainWindow()
170{ 170{
171 Config cfg( "osearch", Config::User ); 171 Config cfg( "osearch", Config::User );
172 cfg.setGroup( "search_settings" ); 172 cfg.setGroup( "search_settings" );
173 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() ); 173 cfg.writeEntry( "caseSensitiv", actionCaseSensitiv->isOn() );
174 cfg.writeEntry( "wildcards", actionWildcards->isOn() ); 174 cfg.writeEntry( "wildcards", actionWildcards->isOn() );
175 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() ); 175 //cfg.writeEntry( "whole_words_only", actionWholeWordsOnly->isOn() );
176} 176}
177 177
178void MainWindow::setCurrent(QListViewItem *item) 178void MainWindow::setCurrent(QListViewItem *item)
179{ 179{
180 if (!item) return; 180 if (!item) return;
181 _currentItem = (OListViewItem*)item; 181 _currentItem = (OListViewItem*)item;
182 //_currentItem = dynamic_cast<OListViewItem*>(item); 182 //_currentItem = dynamic_cast<OListViewItem*>(item);
183 if (_currentItem->rtti() == OListViewItem::Result){ 183 if (_currentItem->rtti() == OListViewItem::Result){
184 ResultItem *res = (ResultItem*)item; 184 ResultItem *res = (ResultItem*)item;
185 // ResultItem *res = dynamic_cast<ResultItem*>(item); 185 // ResultItem *res = dynamic_cast<ResultItem*>(item);
diff --git a/core/pim/osearch/mainwindow.h b/core/pim/osearch/mainwindow.h
index 1f5c4bb..75054f0 100644
--- a/core/pim/osearch/mainwindow.h
+++ b/core/pim/osearch/mainwindow.h
@@ -1,78 +1,86 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 10// (c) 2002-2003 Patrick S. Vogt <tille@handhelds.org>
11 11
12#ifndef MAINWINDOW_H 12#ifndef MAINWINDOW_H
13#define MAINWINDOW_H 13#define MAINWINDOW_H
14 14
15#include <qmainwindow.h> 15#include <qmainwindow.h>
16#include <qdialog.h>
17#include <qaction.h>
16#include <qlist.h> 18#include <qlist.h>
19
17#include <qmap.h> 20#include <qmap.h>
21#include <qtimer.h>
22#include <qpopupmenu.h>
18 23
19class QAction; 24class QAction;
20class QPEToolBar; 25class QPEToolBar;
21class QHBox; 26class QHBox;
22class QVBoxLayout; 27class QVBoxLayout;
23class QTextView; 28class QTextView;
24class QFrame; 29class QFrame;
25class OListView; 30class OListView;
26class OListViewItem; 31class OListViewItem;
27class QListViewItem; 32class QListViewItem;
28class QPopupMenu; 33class QPopupMenu;
29class QSignalMapper;
30class QTimer; 34class QTimer;
35
36class QSignalMapper;
37class QButton;
38
31class SearchGroup; 39class SearchGroup;
32 40
33class MainWindow : public QMainWindow 41class MainWindow : public QMainWindow
34{ 42{
35 Q_OBJECT 43 Q_OBJECT
36 44
37 45
38public: 46public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 47 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
40 ~MainWindow(); 48 ~MainWindow();
41 49 static QString appName() { return QString::fromLatin1("osearch"); }
42 50
43public slots: 51public slots:
44 void setCurrent(QListViewItem*); 52 void setCurrent(QListViewItem*);
45 void setSearch( const QString& ); 53 void setSearch( const QString& );
46 void searchAll(); 54 void searchAll();
47 55
48protected slots: 56protected slots:
49 void slotAction(int); 57 void slotAction(int);
50 void showPopup(); 58 void showPopup();
51 void stopTimer( QListViewItem* ); 59 void stopTimer( QListViewItem* );
52 void searchStringChanged(); 60 void searchStringChanged();
53 void optionChanged(int); 61 void optionChanged(int);
54 62
55private: 63private:
56 QHBox *buttonBox; 64 QHBox *buttonBox;
57 QMap<int, QButton*> buttonMap; 65 QMap<int, QButton*> buttonMap;
58 QSignalMapper* signalMapper; 66 QSignalMapper* signalMapper;
59 OListView *resultsList; 67 OListView *resultsList;
60 QTextView *richEdit; 68 QTextView *richEdit;
61 OListViewItem *_currentItem; 69 OListViewItem *_currentItem;
62 QVBoxLayout *mainLayout; 70 QVBoxLayout *mainLayout;
63 QFrame *detailsFrame; 71 QFrame *detailsFrame;
64 QTimer *popupTimer; 72 QTimer *popupTimer;
65 QTimer *searchTimer; 73 QTimer *searchTimer;
66 74
67 QString _searchString; 75 QString _searchString;
68 QList<SearchGroup> searches; 76 QList<SearchGroup> searches;
69 QAction *SearchAllAction; 77 QAction *SearchAllAction;
70 QAction *actionCaseSensitiv; 78 QAction *actionCaseSensitiv;
71 QAction *actionWildcards; 79 QAction *actionWildcards;
72 //QAction *actionWholeWordsOnly; 80 //QAction *actionWholeWordsOnly;
73 uint _buttonCount; 81 uint _buttonCount;
74 void makeMenu(); 82 void makeMenu();
75}; 83};
76 84
77#endif 85#endif
78 86
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
index b79c679..8863192 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
@@ -1,173 +1,179 @@
1/* 1/*
2 * addresspluginconfig.cpp 2 * addresspluginconfig.cpp
3 * 3 *
4 * copyright : (c) 2003 by Stefan Eilers 4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de 5 * email : eilers.stefan@epost.de
6 * 6 *
7 * This implementation was derived from the todolist plugin implementation 7 * This implementation was derived from the todolist plugin implementation
8 * 8 *
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "addresspluginconfig.h" 19#include "addresspluginconfig.h"
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22 22
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qtoolbutton.h> 25#include <qtoolbutton.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qvgroupbox.h> 28#include <qvgroupbox.h>
29 29
30 30
31AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) 31AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name)
32 : TodayConfigWidget(parent, name ) { 32 : TodayConfigWidget(parent, name ) {
33 33
34 QVBoxLayout * layout = new QVBoxLayout( this ); 34 QVBoxLayout * layout = new QVBoxLayout( this );
35 layout->setMargin( 20 ); 35 layout->setMargin( 20 );
36 36
37#if 0 37#if 0
38 // Informational stuff 38 // Informational stuff
39 QHBox *box4 = new QHBox( this ); 39 QHBox *box4 = new QHBox( this );
40 QLabel* colorLabel = new QLabel( box4, "" ); 40 QLabel* colorLabel = new QLabel( box4, "" );
41 colorLabel->setText( tr( "To activate settings: Restart application !" ) ); 41 colorLabel->setText( tr( "To activate settings: Restart application !" ) );
42#endif 42#endif
43 43
44 // Buttongroup to enable/disable shown stuff 44 // Buttongroup to enable/disable shown stuff
45 QVGroupBox* b_group = new QVGroupBox( this, "name" ); 45 QVGroupBox* b_group = new QVGroupBox( this, "name" );
46 b_group -> setTitle( tr("Enable/Disable Views") ); 46 b_group -> setTitle( tr("Enable/Disable Views") );
47 m_showBirthdayButton = new QRadioButton( b_group ); 47 m_showBirthdayButton = new QRadioButton( b_group );
48 m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); 48 m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) );
49 m_showAnniversaryButton = new QRadioButton( b_group ); 49 m_showAnniversaryButton = new QRadioButton( b_group );
50 m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); 50 m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) );
51 51
52 QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); 52 QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) );
53 QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); 53 QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) );
54 54
55 // Max lines settings 55 // Max lines settings
56 QHBox *box1 = new QHBox( this ); 56 QHBox *box1 = new QHBox( this );
57 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); 57 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" );
58 TextLabel6->setText( tr( "Max Lines: " ) ); 58 TextLabel6->setText( tr( "Max Lines: " ) );
59 SpinBox2 = new QSpinBox( box1, "SpinBox2" ); 59 SpinBox2 = new QSpinBox( box1, "SpinBox2" );
60 SpinBox2->setMaxValue( 40 ); 60 SpinBox2->setMaxValue( 40 );
61 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); 61 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) );
62 62
63#if 0 63#if 0
64 // Clip settings (currently not used) 64 // Clip settings (currently not used)
65 QHBox *box2 = new QHBox( this ); 65 QHBox *box2 = new QHBox( this );
66 QLabel* clipLabel = new QLabel( box2, "" ); 66 QLabel* clipLabel = new QLabel( box2, "" );
67 clipLabel->setText( tr( "Clip line after X chars: " ) ); 67 clipLabel->setText( tr( "Clip line after X chars: " ) );
68 SpinBoxClip = new QSpinBox( box2, "SpinClip" ); 68 SpinBoxClip = new QSpinBox( box2, "SpinClip" );
69 SpinBoxClip->setMaxValue( 200 ); 69 SpinBoxClip->setMaxValue( 200 );
70 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); 70 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) );
71#endif 71#endif
72 72
73 // Look ahead settings 73 // Look ahead settings
74 QHBox *box3 = new QHBox( this ); 74 QHBox *box3 = new QHBox( this );
75 QLabel* daysLabel = new QLabel( box3, "" ); 75 QLabel* daysLabel = new QLabel( box3, "" );
76 daysLabel->setText( tr( "Days look ahead: " ) ); 76 daysLabel->setText( tr( "Days look ahead: " ) );
77 SpinDaysClip = new QSpinBox( box3, "SpinDays" ); 77 SpinDaysClip = new QSpinBox( box3, "SpinDays" );
78 SpinDaysClip->setMaxValue( 200 ); 78 SpinDaysClip->setMaxValue( 200 );
79 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); 79 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
80 80
81// QHBox *box4 = new QHBox( this );
82
83// QLabel* colorLabel = new QLabel( box4, "" );
84// colorLabel->setText( tr( "To activate settings: Restart application !" ) );
85
86
81 QHBox *box5 = new QHBox( this ); 87 QHBox *box5 = new QHBox( this );
82 QLabel* colorLabel2 = new QLabel( box5, "" ); 88 QLabel* colorLabel2 = new QLabel( box5, "" );
83 colorLabel2->setText( tr( "Set Headline Color: " ) ); 89 colorLabel2->setText( tr( "Set Headline Color: " ) );
84 headlineColor = new OColorButton( box5, black , "headlineColor" ); 90 headlineColor = new OColorButton( box5, black , "headlineColor" );
85 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); 91 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) );
86 QHBox *box6 = new QHBox( this ); 92 QHBox *box6 = new QHBox( this );
87 93
88 // Entry color settings 94 // Entry color settings
89 QLabel* colorLabel3= new QLabel( box6, "" ); 95 QLabel* colorLabel3= new QLabel( box6, "" );
90 colorLabel3->setText( tr( "Set Entry Color: " ) ); 96 colorLabel3->setText( tr( "Set Entry Color: " ) );
91 entryColor = new OColorButton( box6, black , "entryColor" ); 97 entryColor = new OColorButton( box6, black , "entryColor" );
92 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); 98 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) );
93 99
94 // Urgent color settings 100 // Urgent color settings
95 QHBox *box7 = new QHBox( this ); 101 QHBox *box7 = new QHBox( this );
96 QLabel* colorLabel5 = new QLabel( box7, "" ); 102 QLabel* colorLabel5 = new QLabel( box7, "" );
97 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); 103 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) );
98 SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); 104 SpinUrgentClip = new QSpinBox( box7, "SpinDays" );
99 SpinUrgentClip->setMaxValue( 200 ); 105 SpinUrgentClip->setMaxValue( 200 );
100 QLabel* colorLabel6 = new QLabel( box7, "" ); 106 QLabel* colorLabel6 = new QLabel( box7, "" );
101 colorLabel6->setText( tr( " days: " ) ); 107 colorLabel6->setText( tr( " days: " ) );
102 urgentColor = new OColorButton( box7, red , "urgentColor" ); 108 urgentColor = new OColorButton( box7, red , "urgentColor" );
103 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); 109 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) );
104 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); 110 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) );
105 111
106 112
107 layout->addWidget( b_group ); 113 //layout->addWidget( box4 );
108 layout->addWidget( box1 ); 114 layout->addWidget( box1 );
109 // layout->addWidget( box2 ); 115 //layout->addWidget( box2 );
110 layout->addWidget( box3 ); 116 layout->addWidget( box3 );
111 layout->addWidget( box5 ); 117 layout->addWidget( box5 );
112 layout->addWidget( box6 ); 118 layout->addWidget( box6 );
113 layout->addWidget( box7 ); 119 layout->addWidget( box7 );
114 120
115 readConfig(); 121 readConfig();
116 122
117} 123}
118 124
119void AddressBookPluginConfig::readConfig() { 125void AddressBookPluginConfig::readConfig() {
120 Config cfg( "todayaddressplugin" ); 126 Config cfg( "todayaddressplugin" );
121 cfg.setGroup( "config" ); 127 cfg.setGroup( "config" );
122 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); 128 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
123 SpinBox2->setValue( m_max_lines_task ); 129 SpinBox2->setValue( m_max_lines_task );
124// m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 130// m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
125// SpinBoxClip->setValue( m_maxCharClip ); 131// SpinBoxClip->setValue( m_maxCharClip );
126 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 132 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
127 SpinDaysClip->setValue( m_daysLookAhead ); 133 SpinDaysClip->setValue( m_daysLookAhead );
128 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 134 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
129 SpinUrgentClip->setValue( m_urgentDays ); 135 SpinUrgentClip->setValue( m_urgentDays );
130 136
131 m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); 137 m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() );
132 entryColor->setColor( QColor( m_entryColor ) ); 138 entryColor->setColor( QColor( m_entryColor ) );
133 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 139 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
134 headlineColor->setColor( QColor( m_headlineColor ) ); 140 headlineColor->setColor( QColor( m_headlineColor ) );
135 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 141 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
136 urgentColor->setColor( QColor( m_urgentColor ) ); 142 urgentColor->setColor( QColor( m_urgentColor ) );
137 143
138 m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); 144 m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) );
139 m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); 145 m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) );
140 146
141} 147}
142 148
143 149
144void AddressBookPluginConfig::writeConfig() { 150void AddressBookPluginConfig::writeConfig() {
145 Config cfg( "todayaddressplugin" ); 151 Config cfg( "todayaddressplugin" );
146 cfg.setGroup( "config" ); 152 cfg.setGroup( "config" );
147 m_max_lines_task = SpinBox2->value(); 153 m_max_lines_task = SpinBox2->value();
148 cfg.writeEntry( "maxlinestask", m_max_lines_task ); 154 cfg.writeEntry( "maxlinestask", m_max_lines_task );
149// m_maxCharClip = SpinBoxClip->value(); 155// m_maxCharClip = SpinBoxClip->value();
150// cfg.writeEntry( "maxcharclip", m_maxCharClip ); 156// cfg.writeEntry( "maxcharclip", m_maxCharClip );
151 m_daysLookAhead = SpinDaysClip->value(); 157 m_daysLookAhead = SpinDaysClip->value();
152 cfg.writeEntry( "dayslookahead", m_daysLookAhead ); 158 cfg.writeEntry( "dayslookahead", m_daysLookAhead );
153 m_urgentDays = SpinUrgentClip->value(); 159 m_urgentDays = SpinUrgentClip->value();
154 if ( m_urgentDays > m_daysLookAhead ) 160 if ( m_urgentDays > m_daysLookAhead )
155 m_urgentDays = m_daysLookAhead; 161 m_urgentDays = m_daysLookAhead;
156 cfg.writeEntry( "urgentdays", m_urgentDays ); 162 cfg.writeEntry( "urgentdays", m_urgentDays );
157 163
158 m_entryColor = entryColor->color().name(); 164 m_entryColor = entryColor->color().name();
159 cfg.writeEntry( "entrycolor", m_entryColor ); 165 cfg.writeEntry( "entrycolor", m_entryColor );
160 m_headlineColor = headlineColor->color().name(); 166 m_headlineColor = headlineColor->color().name();
161 cfg.writeEntry( "headlinecolor", m_headlineColor ); 167 cfg.writeEntry( "headlinecolor", m_headlineColor );
162 m_urgentColor = urgentColor->color().name(); 168 m_urgentColor = urgentColor->color().name();
163 cfg.writeEntry( "urgentcolor", m_urgentColor ); 169 cfg.writeEntry( "urgentcolor", m_urgentColor );
164 170
165 cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); 171 cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() );
166 cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); 172 cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() );
167 173
168 cfg.write(); 174 cfg.write();
169} 175}
170 176
171 177
172AddressBookPluginConfig::~AddressBookPluginConfig() { 178AddressBookPluginConfig::~AddressBookPluginConfig() {
173} 179}
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index dad09db..d47bc0b 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -9,206 +9,210 @@
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by * 13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "addresspluginwidget.h" 19#include "addresspluginwidget.h"
20 20
21#include <qvaluelist.h> 21#include <qvaluelist.h>
22#include <qtl.h> 22#include <qtl.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qscrollview.h> 24#include <qscrollview.h>
25#include <qobject.h> 25#include <qobject.h>
26#include <qdatetime.h> 26#include <qdatetime.h>
27 27
28#include <qpe/config.h> 28#include <qpe/config.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
31 31
32#include <opie/ocontact.h> 32#include <opie/ocontact.h>
33 33
34AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) 34AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name )
35 : QWidget( parent, name ) { 35 : QWidget( parent, name ) {
36 36
37 addressLabel = 0l; 37 addressLabel = 0l;
38 m_contactdb = 0l; 38 m_contactdb = 0l;
39 layoutTodo = 0l; 39 layoutTodo = 0l;
40 40
41 // Hä ? Nonsense ! (se) 41 // Hä ? Nonsense ! (se)
42 if ( m_contactdb ) { 42 if ( m_contactdb ) {
43 delete m_contactdb; 43 delete m_contactdb;
44 } 44 }
45 45
46 m_contactdb = new OContactAccess("addressplugin"); 46 m_contactdb = new OContactAccess("addressplugin");
47 47
48 connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), 48 connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ),
49 this, SLOT( refresh( const OContactAccess * ) ) ); 49 this, SLOT( refresh( const OContactAccess * ) ) );
50 50
51 51
52 readConfig(); 52 readConfig();
53 getAddress(); 53 getAddress();
54} 54}
55 55
56AddressBookPluginWidget::~AddressBookPluginWidget() { 56AddressBookPluginWidget::~AddressBookPluginWidget() {
57 delete m_contactdb; 57 delete m_contactdb;
58} 58}
59 59
60void AddressBookPluginWidget::refresh( const OContactAccess* ) 60void AddressBookPluginWidget::refresh( const OContactAccess* )
61{ 61{
62 qWarning(" AddressBookPluginWidget::Database was changed externally ! "); 62 qWarning(" AddressBookPluginWidget::Database was changed externally ! ");
63 m_contactdb->reload(); 63 m_contactdb->reload();
64 getAddress(); 64 getAddress();
65} 65}
66 66
67void AddressBookPluginWidget::reinitialize() { 67void AddressBookPluginWidget::reinitialize() {
68 readConfig(); 68 readConfig();
69 getAddress(); 69 getAddress();
70} 70}
71 71
72void AddressBookPluginWidget::readConfig() { 72void AddressBookPluginWidget::readConfig() {
73 Config cfg( "todayaddressplugin" ); 73 Config cfg( "todayaddressplugin" );
74 cfg.setGroup( "config" ); 74 cfg.setGroup( "config" );
75 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 75 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
76 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 76 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
77 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 77 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
78 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 78 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
79 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); 79 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() );
80 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 80 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
81 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 81 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
82 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); 82 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true );
83 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); 83 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true );
84} 84}
85 85
86 86
87/** 87/**
88 * Get the addresss 88 * Get the addresss
89 */ 89 */
90void AddressBookPluginWidget::getAddress() { 90void AddressBookPluginWidget::getAddress() {
91 91
92 if ( ! layoutTodo ){ 92 if ( ! layoutTodo ){
93 layoutTodo = new QVBoxLayout( this ); 93 layoutTodo = new QVBoxLayout( this );
94 } 94 }
95 95
96 if ( ! addressLabel ) { 96 if ( ! addressLabel ) {
97 addressLabel = new OClickableLabel( this ); 97 addressLabel = new OClickableLabel( this );
98 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); 98 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) );
99 layoutTodo->addWidget( addressLabel ); 99 layoutTodo->addWidget( addressLabel );
100 } 100 }
101 101
102 QString output; 102 QString output;
103 103
104 // Check whether the database provide the search option.. 104 // Check whether the database provide the search option..
105 if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ 105 if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
106 // Libopie seems to be old.. 106 // Libopie seems to be old..
107 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); 107 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" );
108 addressLabel->setText( output ); 108 addressLabel->setText( output );
109 return; 109 return;
110 } 110 }
111 111
112 // Define the query for birthdays and start search.. 112 // Define the query for birthdays and start search..
113 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); 113 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
114 int ammount = 0; 114 int ammount = 0;
115 if ( m_showBirthdays ){ 115 if ( m_showBirthdays ){
116 qWarning("Searching from now (%s) until %s ! ", 116 qWarning("Searching from now (%s) until %s ! ",
117 QDate::currentDate().toString().latin1(), 117 QDate::currentDate().toString().latin1(),
118 lookAheadDate.toString().latin1() ); 118 lookAheadDate.toString().latin1() );
119 }
120
121 if ( m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
122
119 123
120 OContact querybirthdays; 124 OContact querybirthdays;
121 querybirthdays.setBirthday( lookAheadDate ); 125 querybirthdays.setBirthday( lookAheadDate );
122 126
123 m_list = m_contactdb->queryByExample( querybirthdays, 127 m_list = m_contactdb->queryByExample( querybirthdays,
124 OContactAccess::DateDiff ); 128 OContactAccess::DateDiff );
125 if ( m_list.count() > 0 ){ 129 if ( m_list.count() > 0 ){
126 output = "<font color=" + m_headlineColor + ">" 130 output = "<font color=" + m_headlineColor + ">"
127 + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) 131 + QObject::tr( "Next birthdays in <b> %1 </b> days:" )
128 .arg( m_daysLookAhead ) 132 .arg( m_daysLookAhead )
129 + "</font> <br>"; 133 + "</font> <br>";
130 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 134 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
131 if ( ammount++ < m_maxLinesTask ){ 135 if ( ammount++ < m_maxLinesTask ){
132 // Now we want to calculate how many days 136 // Now we want to calculate how many days
133 //until birthday. We have to set 137 //until birthday. We have to set
134 // the correct year to calculate the day diff... 138 // the correct year to calculate the day diff...
135 QDate destdate = (*m_it).birthday(); 139 QDate destdate = (*m_it).birthday();
136 destdate.setYMD( QDate::currentDate().year(), 140 destdate.setYMD( QDate::currentDate().year(),
137 destdate.month(), destdate.day() ); 141 destdate.month(), destdate.day() );
138 if ( QDate::currentDate().daysTo(destdate) < 0 ) 142 if ( QDate::currentDate().daysTo(destdate) < 0 )
139 destdate.setYMD( QDate::currentDate().year()+1, 143 destdate.setYMD( QDate::currentDate().year()+1,
140 destdate.month(), destdate.day() ); 144 destdate.month(), destdate.day() );
141 145
142 146
143 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 147 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
144 output += "<font color=" + m_urgentColor + "><b>-" 148 output += "<font color=" + m_urgentColor + "><b>-"
145 + (*m_it).fullName() 149 + (*m_it).fullName()
146 + " (" 150 + " ("
147 + QString::number(QDate::currentDate() 151 + QString::number(QDate::currentDate()
148 .daysTo(destdate)) 152 .daysTo(destdate))
149 + " Days) </b></font><br>"; 153 + " Days) </b></font><br>";
150 154
151 else 155 else
152 output += "<font color=" + m_entryColor + "><b>-" 156 output += "<font color=" + m_entryColor + "><b>-"
153 + (*m_it).fullName() 157 + (*m_it).fullName()
154 + " (" 158 + " ("
155 + QString::number(QDate::currentDate() 159 + QString::number(QDate::currentDate()
156 .daysTo(destdate)) 160 .daysTo(destdate))
157 + " Days) </b></font><br>"; 161 + " Days) </b></font><br>";
158 } 162 }
159 } 163 }
160 } else { 164 } else {
161 output = "<font color=" + m_headlineColor + ">" 165 output = "<font color=" + m_headlineColor + ">"
162 + QObject::tr( "No birthdays in <b> %1 </b> days!" ) 166 + QObject::tr( "No birthdays in <b> %1 </b> days!" )
163 .arg( m_daysLookAhead ) 167 .arg( m_daysLookAhead )
164 + "</font> <br>"; 168 + "</font> <br>";
165 } 169 }
166 } 170 }
167 171
168 if ( m_showAnniversaries ){ 172 if ( m_showAnniversaries ){
169 // Define the query for anniversaries and start search.. 173 // Define the query for anniversaries and start search..
170 OContact queryanniversaries; 174 OContact queryanniversaries;
171 queryanniversaries.setAnniversary( lookAheadDate ); 175 queryanniversaries.setAnniversary( lookAheadDate );
172 176
173 m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); 177 m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff );
174 178
175 ammount = 0; 179 ammount = 0;
176 if ( m_list.count() > 0 ){ 180 if ( m_list.count() > 0 ){
177 output += "<font color=" + m_headlineColor + ">" 181 output += "<font color=" + m_headlineColor + ">"
178 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) 182 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" )
179 .arg( m_daysLookAhead ) 183 .arg( m_daysLookAhead )
180 + "</font> <br>"; 184 + "</font> <br>";
181 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 185 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
182 if ( ammount++ < m_maxLinesTask ){ 186 if ( ammount++ < m_maxLinesTask ){
183 // Now we want to calculate how many days until anniversary. 187 // Now we want to calculate how many days until anniversary.
184 // We have to set the correct year to calculate the day diff... 188 // We have to set the correct year to calculate the day diff...
185 QDate destdate = (*m_it).anniversary(); 189 QDate destdate = (*m_it).anniversary();
186 destdate.setYMD( QDate::currentDate().year(), destdate.month(), 190 destdate.setYMD( QDate::currentDate().year(), destdate.month(),
187 destdate.day() ); 191 destdate.day() );
188 if ( QDate::currentDate().daysTo(destdate) < 0 ) 192 if ( QDate::currentDate().daysTo(destdate) < 0 )
189 destdate.setYMD( QDate::currentDate().year()+1, 193 destdate.setYMD( QDate::currentDate().year()+1,
190 destdate.month(), destdate.day() ); 194 destdate.month(), destdate.day() );
191 195
192 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 196 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
193 output += "<font color=" + m_urgentColor + "><b>-" 197 output += "<font color=" + m_urgentColor + "><b>-"
194 + (*m_it).fullName() 198 + (*m_it).fullName()
195 + " (" 199 + " ("
196 + QString::number(QDate::currentDate() 200 + QString::number(QDate::currentDate()
197 .daysTo( destdate ) ) 201 .daysTo( destdate ) )
198 + " Days) </b></font><br>"; 202 + " Days) </b></font><br>";
199 else 203 else
200 output += "<font color=" + m_entryColor + "><b>-" 204 output += "<font color=" + m_entryColor + "><b>-"
201 + (*m_it).fullName() 205 + (*m_it).fullName()
202 + " (" 206 + " ("
203 + QString::number(QDate::currentDate() 207 + QString::number(QDate::currentDate()
204 .daysTo( destdate ) ) 208 .daysTo( destdate ) )
205 + " Days) </b></font><br>"; 209 + " Days) </b></font><br>";
206 } 210 }
207 } 211 }
208 } else { 212 } else {
209 output += "<font color=" + m_headlineColor + ">" 213 output += "<font color=" + m_headlineColor + ">"
210 + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) 214 + QObject::tr( "No anniversaries in <b> %1 </b> days!" )
211 .arg( m_daysLookAhead ) 215 .arg( m_daysLookAhead )
212 + "</font> <br>"; 216 + "</font> <br>";
213 } 217 }
214 } 218 }
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
index bc412dd..2d303fc 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.h
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -1,62 +1,60 @@
1/* 1/*
2 * datebookpluginconfig.h 2 * datebookpluginconfig.h
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef DATEBOOK_PLUGIN_CONFIG_H 17#ifndef DATEBOOK_PLUGIN_CONFIG_H
18#define DATEBOOK_PLUGIN_CONFIG_H 18#define DATEBOOK_PLUGIN_CONFIG_H
19 19
20 20
21#include <qcheckbox.h> 21#include <qcheckbox.h>
22#include <qspinbox.h> 22#include <qspinbox.h>
23 23
24#include <opie/todayconfigwidget.h> 24#include <opie/todayconfigwidget.h>
25 25
26class DatebookPluginConfig : public TodayConfigWidget { 26#include "datebookpluginconfigbase.h"
27
28class DatebookPluginConfig : public TodayConfigWidget {
27 29
28 Q_OBJECT 30 Q_OBJECT
29 31
32
30public: 33public:
31 DatebookPluginConfig( QWidget *parent, const char *name ); 34 DatebookPluginConfig( QWidget *parent, const char *name );
32 ~DatebookPluginConfig(); 35 ~DatebookPluginConfig();
33 36
34 void writeConfig(); 37 void writeConfig();
35private: 38private:
36 /** 39 /**
37 * if changed then save 40 * if changed then save
38 */ 41 */
39 bool changed(); 42 bool changed();
40 void readConfig(); 43 void readConfig();
41 44
42 QCheckBox* CheckBox2;
43 QCheckBox* CheckBox1;
44 QCheckBox* CheckBox3;
45 QSpinBox* SpinBox1;
46 QSpinBox* SpinBox2;
47
48 45
46 DatebookPluginConfigBase *m_gui;
49 // how many lines should be showed in the datebook section 47 // how many lines should be showed in the datebook section
50 int m_max_lines_meet; 48 int m_max_lines_meet;
51 // If location is to be showed too, 1 to activate it. 49 // If location is to be showed too, 1 to activate it.
52 int m_show_location; 50 int m_show_location;
53 // if notes should be shown 51 // if notes should be shown
54 int m_show_notes; 52 int m_show_notes;
55 // should only later appointments be shown or all for the current day. 53 // should only later appointments be shown or all for the current day.
56 int m_only_later; 54 int m_only_later;
57 int m_more_days; 55 int m_more_days;
58 56
59}; 57};
60 58
61 59
62#endif 60#endif
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h
index e09251c..54d35cf 100644
--- a/core/pim/today/plugins/todolist/todopluginconfig.h
+++ b/core/pim/today/plugins/todolist/todopluginconfig.h
@@ -1,58 +1,59 @@
1/* 1/*
2 * todopluginconfig.h 2 * todopluginconfig.h
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef TODOLIST_PLUGIN_CONFIG_H 17#ifndef TODOLIST_PLUGIN_CONFIG_H
18#define TODOLIST_PLUGIN_CONFIG_H 18#define TODOLIST_PLUGIN_CONFIG_H
19 19
20//#include <qwidget.h>
21#include <qspinbox.h> 20#include <qspinbox.h>
22 21
23#include <opie/todayconfigwidget.h> 22#include <opie/todayconfigwidget.h>
24 23
24#include "todopluginconfigbase.h"
25
25class TodolistPluginConfig : public TodayConfigWidget { 26class TodolistPluginConfig : public TodayConfigWidget {
26 27
27Q_OBJECT 28 Q_OBJECT
28 29
29public: 30public:
30 31
31 TodolistPluginConfig( QWidget *parent, const char *name ); 32 TodolistPluginConfig( QWidget *parent, const char *name );
32 ~TodolistPluginConfig(); 33 ~TodolistPluginConfig();
33 34
34private: 35private:
35 /** 36 /**
36 * if changed then save 37 * if changed then save
37 */ 38 */
38 bool changed(); 39 bool changed();
39 void readConfig(); 40 void readConfig();
40 void writeConfig(); 41 void writeConfig();
42
43 TodoPluginConfigBase *m_gui;
41 44
42 QSpinBox* SpinBox2;
43 QSpinBox* SpinBoxClip;
44 45
45 // how many lines should be showed in the todolist section 46 // how many lines should be showed in the todolist section
46 int m_max_lines_task; 47 int m_max_lines_task;
47 // clip the lines after X chars 48 // clip the lines after X chars
48 int m_maxCharClip; 49 int m_maxCharClip;
49 50
50 51
51 52
52}; 53};
53 54
54 55
55 56
56 57
57 58
58#endif 59#endif
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp
index c4726b3..00ea105 100644
--- a/core/settings/security/security.cpp
+++ b/core/settings/security/security.cpp
@@ -18,297 +18,308 @@
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20#include "security.h" 20#include "security.h"
21 21
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/password.h> 24#include <qpe/password.h>
25#include <qpe/qpedialog.h> 25#include <qpe/qpedialog.h>
26#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
27 27
28#include <qcheckbox.h> 28#include <qcheckbox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qlistview.h> 33#include <qlistview.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35 35
36 Security::Security( QWidget* parent, const char* name, WFlags fl ) 36 Security::Security( QWidget* parent, const char* name, WFlags fl )
37: SecurityBase( parent, name, TRUE, fl ) 37: SecurityBase( parent, name, TRUE, fl )
38{ 38{
39 valid=FALSE; 39 valid=FALSE;
40 Config cfg("Security"); 40 Config cfg("Security");
41 cfg.setGroup("Passcode"); 41 cfg.setGroup("Passcode");
42 passcode = cfg.readEntry("passcode"); 42 passcode = cfg.readEntry("passcode");
43 passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); 43 passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE));
44 cfg.setGroup("Sync"); 44 cfg.setGroup("Sync");
45 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 45 int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24
46 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); 46 int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24);
47 selectNet(auth_peer,auth_peer_bits); 47 selectNet(auth_peer,auth_peer_bits);
48 connect(syncnet, SIGNAL(textChanged(const QString&)), 48 connect(syncnet, SIGNAL(textChanged(const QString&)),
49 this, SLOT(setSyncNet(const QString&))); 49 this, SLOT(setSyncNet(const QString&)));
50 50
51 /* 51 /*
52 cfg.setGroup("Remote"); 52 cfg.setGroup("Remote");
53 if ( telnetAvailable() ) 53 if ( telnetAvailable() )
54 telnet->setChecked(cfg.readEntry("allow_telnet")); 54 telnet->setChecked(cfg.readEntry("allow_telnet"));
55 else 55 else
56 telnet->hide(); 56 telnet->hide();
57 57
58 if ( sshAvailable() ) 58 if ( sshAvailable() )
59 ssh->setChecked(cfg.readEntry("allow_ssh")); 59 ssh->setChecked(cfg.readEntry("allow_ssh"));
60 else 60 else
61 ssh->hide(); 61 ssh->hide();
62 */ 62 */
63 63
64 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 64 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
65 Config loginCfg(configFile,Config::File); 65 Config loginCfg(configFile,Config::File);
66 66
67 loginCfg.setGroup("General"); 67 loginCfg.setGroup("General");
68 autoLoginName=loginCfg.readEntry("AutoLogin",""); 68 autoLoginName=loginCfg.readEntry("AutoLogin","");
69 69
70 if (autoLoginName.stripWhiteSpace().isEmpty()) { 70 if (autoLoginName.stripWhiteSpace().isEmpty()) {
71 autoLogin=false; 71 autoLogin=false;
72 } else { 72 } else {
73 autoLogin=true; 73 autoLogin=true;
74 } 74 }
75 75
76 cfg.setGroup("SyncMode"); 76 cfg.setGroup("SyncMode");
77 int mode = cfg.readNumEntry("Mode",2); // Default to Sharp 77 int mode = cfg.readNumEntry("Mode",2); // Default to Sharp
78 syncModeCombo->setCurrentItem( mode - 1 ); 78 syncModeCombo->setCurrentItem( mode - 1 );
79 79
80 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); 80 connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool)));
81 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); 81 connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int)));
82 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); 82 connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode()));
83 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); 83 connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode()));
84 84
85 loadUsers(); 85 loadUsers();
86 updateGUI(); 86 updateGUI();
87 87
88 dl = new QPEDialogListener(this); 88 dl = new QPEDialogListener(this);
89 showMaximized(); 89 showMaximized();
90} 90}
91 91
92Security::~Security() 92Security::~Security()
93{ 93{
94} 94}
95 95
96 96
97void Security::updateGUI() 97void Security::updateGUI()
98{ 98{
99 bool empty = passcode.isEmpty(); 99 bool empty = passcode.isEmpty();
100 100
101 changepasscode->setText( empty ? tr("Set passcode" ) 101 changepasscode->setText( empty ? tr("Set passcode" )
102 : tr("Change passcode" ) ); 102 : tr("Change passcode" ) );
103 passcode_poweron->setEnabled( !empty ); 103 passcode_poweron->setEnabled( !empty );
104 clearpasscode->setEnabled( !empty ); 104 clearpasscode->setEnabled( !empty );
105 105
106 autologinToggle->setChecked(autoLogin); 106 autologinToggle->setChecked(autoLogin);
107 userlist->setEnabled(autoLogin); 107 userlist->setEnabled(autoLogin);
108 108
109} 109}
110 110
111 111
112void Security::show() 112void Security::show()
113{ 113{
114 valid=FALSE; 114 //valid=FALSE;
115 setEnabled(FALSE); 115 setEnabled(FALSE);
116 SecurityBase::show(); 116 SecurityBase::show();
117 if ( passcode.isEmpty() ) { 117 if ( passcode.isEmpty() ) {
118 // could insist... 118 // could insist...
119 //changePassCode(); 119 //changePassCode();
120 //if ( passcode.isEmpty() ) 120 //if ( passcode.isEmpty() )
121 //reject(); 121 //reject();
122 } else { 122 } else {
123 QString pc = enterPassCode(tr("Enter passcode")); 123
124 if ( pc != passcode ) { 124 if (!valid) // security passcode was not asked yet, so ask now
125 QMessageBox::critical(this, tr("Passcode incorrect"), 125 {
126 tr("The passcode entered is incorrect.\nAccess denied")); 126 QString pc = enterPassCode(tr("Enter passcode"));
127 reject(); 127 if ( pc != passcode ) {
128 return; 128 QMessageBox::critical(this, tr("Passcode incorrect"),
129 } 129 tr("The passcode entered is incorrect.\nAccess denied"));
130 reject();
131 return;
132 }
133 }
130 } 134 }
131 setEnabled(TRUE); 135 setEnabled(TRUE);
132 valid=TRUE; 136 valid=TRUE;
133} 137}
134 138
135void Security::accept() 139void Security::accept()
136{ 140{
137 applySecurity(); 141 applySecurity();
138 QDialog::accept(); 142 QDialog::accept();
139 QCopEnvelope env("QPE/System", "securityChanged()" ); 143 QCopEnvelope env("QPE/System", "securityChanged()" );
140} 144}
141 145
142void Security::done(int r) 146void Security::done(int r)
143{ 147{
144 QDialog::done(r); 148 QDialog::done(r);
145 close(); 149 close();
146} 150}
147 151
148void Security::selectNet(int auth_peer,int auth_peer_bits) 152void Security::selectNet(int auth_peer,int auth_peer_bits)
149{ 153{
150 QString sn; 154 QString sn;
151 if ( auth_peer_bits == 0 && auth_peer == 0 ) { 155 if ( auth_peer_bits == 0 && auth_peer == 0 ) {
152 sn = tr("Any"); 156 sn = tr("Any");
153 } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { 157 } else if ( auth_peer_bits == 32 && auth_peer == 0 ) {
154 sn = tr("None"); 158 sn = tr("None");
155 } else { 159 } else {
156 sn = 160 sn =
157 QString::number((auth_peer>>24)&0xff) + "." 161 QString::number((auth_peer>>24)&0xff) + "."
158 + QString::number((auth_peer>>16)&0xff) + "." 162 + QString::number((auth_peer>>16)&0xff) + "."
159 + QString::number((auth_peer>>8)&0xff) + "." 163 + QString::number((auth_peer>>8)&0xff) + "."
160 + QString::number((auth_peer>>0)&0xff) + "/" 164 + QString::number((auth_peer>>0)&0xff) + "/"
161 + QString::number(auth_peer_bits); 165 + QString::number(auth_peer_bits);
162 } 166 }
163 for (int i=0; i<syncnet->count(); i++) { 167 for (int i=0; i<syncnet->count(); i++) {
164 if ( syncnet->text(i).left(sn.length()) == sn ) { 168 if ( syncnet->text(i).left(sn.length()) == sn ) {
165 syncnet->setCurrentItem(i); 169 syncnet->setCurrentItem(i);
166 return; 170 return;
167 } 171 }
168 } 172 }
169 qDebug("No match for \"%s\"",sn.latin1()); 173 qDebug("No match for \"%s\"",sn.latin1());
170} 174}
171 175
172void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) 176void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits)
173{ 177{
174 auth_peer=0; 178 auth_peer=0;
175 if ( sn == tr("Any") ) { 179 if ( sn == tr("Any") ) {
176 auth_peer = 0; 180 auth_peer = 0;
177 auth_peer_bits = 0; 181 auth_peer_bits = 0;
178 } else if ( sn == tr("None") ) { 182 } else if ( sn == tr("None") ) {
179 auth_peer = 0; 183 auth_peer = 0;
180 auth_peer_bits = 32; 184 auth_peer_bits = 32;
181 } else { 185 } else {
182 int x=0; 186 int x=0;
183 for (int i=0; i<4; i++) { 187 for (int i=0; i<4; i++) {
184 int nx = sn.find(QChar(i==3 ? '/' : '.'),x); 188 int nx = sn.find(QChar(i==3 ? '/' : '.'),x);
185 auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); 189 auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt();
186 x = nx+1; 190 x = nx+1;
187 } 191 }
188 uint n = (uint)sn.find(' ',x)-x; 192 uint n = (uint)sn.find(' ',x)-x;
189 auth_peer_bits = sn.mid(x,n).toInt(); 193 auth_peer_bits = sn.mid(x,n).toInt();
190 } 194 }
191} 195}
192 196
193void Security::loadUsers ( void ) 197void Security::loadUsers ( void )
194{ 198{
195 QFile passwd("/etc/passwd"); 199 QFile passwd("/etc/passwd");
196 if ( passwd.open(IO_ReadOnly) ) { 200 if ( passwd.open(IO_ReadOnly) ) {
197 QTextStream t( &passwd ); 201 QTextStream t( &passwd );
198 QString s; 202 QString s;
199 QStringList account; 203 QStringList account;
200 while ( !t.eof() ) { 204 while ( !t.eof() ) {
201 account = QStringList::split(':',t.readLine()); 205 account = QStringList::split(':',t.readLine());
202 206
203 // Hide disabled accounts 207 // Hide disabled accounts
204 if (*account.at(1)!="*") { 208 if (*account.at(1)!="*") {
205 209
206 userlist->insertItem(*account.at(0)); 210 userlist->insertItem(*account.at(0));
207 // Highlight this item if it is set to autologinToggle 211 // Highlight this item if it is set to autologinToggle
208 if ( *account.at(0) == autoLoginName) 212 if ( *account.at(0) == autoLoginName)
209 userlist->setCurrentItem(userlist->count()-1); 213 userlist->setCurrentItem(userlist->count()-1);
210 } 214 }
211 } 215 }
212 passwd.close(); 216 passwd.close();
213 } 217 }
214 218
215} 219}
220
216void Security::toggleAutoLogin(bool val) 221void Security::toggleAutoLogin(bool val)
217{ 222{
218 autoLogin=val; 223 autoLogin=val;
219 userlist->setEnabled(val); 224 userlist->setEnabled(val);
220 if (!autoLogin) 225 if (!autoLogin)
221 autoLoginName=userlist->currentText(); 226 autoLoginName=userlist->currentText();
222} 227}
228
229
230
231
223void Security::setSyncNet(const QString& sn) 232void Security::setSyncNet(const QString& sn)
224{ 233{
225 int auth_peer,auth_peer_bits; 234 int auth_peer,auth_peer_bits;
226 parseNet(sn,auth_peer,auth_peer_bits); 235 parseNet(sn,auth_peer,auth_peer_bits);
227 selectNet(auth_peer,auth_peer_bits); 236 selectNet(auth_peer,auth_peer_bits);
228} 237}
229 238
230void Security::applySecurity() 239void Security::applySecurity()
231{ 240{
232 if ( valid ) { 241 if ( valid ) {
242<<<<<<< security.cpp
233 Config cfg("Security"); 243 Config cfg("Security");
234 cfg.setGroup("Passcode"); 244 cfg.setGroup("Passcode");
235 cfg.writeEntry("passcode",passcode); 245 cfg.writeEntry("passcode",passcode);
236 cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); 246 cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked());
237 cfg.setGroup("Sync"); 247 cfg.setGroup("Sync");
238 int auth_peer=0; 248 int auth_peer=0;
239 int auth_peer_bits; 249 int auth_peer_bits;
240 QString sn = syncnet->currentText(); 250 QString sn = syncnet->currentText();
241 parseNet(sn,auth_peer,auth_peer_bits); 251 parseNet(sn,auth_peer,auth_peer_bits);
242 cfg.writeEntry("auth_peer",auth_peer); 252 cfg.writeEntry("auth_peer",auth_peer);
243 cfg.writeEntry("auth_peer_bits",auth_peer_bits); 253 cfg.writeEntry("auth_peer_bits",auth_peer_bits);
244 /* 254 /*
245 cfg.setGroup("Remote"); 255 cfg.setGroup("Remote");
246 if ( telnetAvailable() ) 256 if ( telnetAvailable() )
247 cfg.writeEntry("allow_telnet",telnet->isChecked()); 257 cfg.writeEntry("allow_telnet",telnet->isChecked());
248 if ( sshAvailable() ) 258 if ( sshAvailable() )
249 cfg.writeEntry("allow_ssh",ssh->isChecked()); 259 cfg.writeEntry("allow_ssh",ssh->isChecked());
250 // ### write ssh/telnet sys config files 260 // ### write ssh/telnet sys config files
251 */ 261 */
252 262
253 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; 263 QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf";
254 Config loginCfg(configFile,Config::File); 264 Config loginCfg(configFile,Config::File);
255 loginCfg.setGroup("General"); 265 loginCfg.setGroup("General");
256 266
257 if (autoLogin) { 267 if (autoLogin) {
258 loginCfg.writeEntry("AutoLogin",autoLoginName); 268 loginCfg.writeEntry("AutoLogin",autoLoginName);
259 } else { 269 } else {
260 loginCfg.removeEntry("AutoLogin"); 270 loginCfg.removeEntry("AutoLogin");
261 } 271 }
262 272
263 cfg.setGroup("SyncMode"); 273 cfg.setGroup("SyncMode");
264 cfg.writeEntry("Mode", syncModeCombo->currentItem()+1 ); 274 cfg.writeEntry("Mode", syncModeCombo->currentItem()+1 );
275
265 } 276 }
266} 277}
267 278
268void Security::changeLoginName( int idx ) 279void Security::changeLoginName( int idx )
269{ 280{
270 autoLoginName = userlist->text(idx);; 281 autoLoginName = userlist->text(idx);;
271 updateGUI(); 282 updateGUI();
272} 283}
273 284
274void Security::changePassCode() 285void Security::changePassCode()
275{ 286{
276 QString new1; 287 QString new1;
277 QString new2; 288 QString new2;
278 289
279 do { 290 do {
280 new1 = enterPassCode(tr("Enter new passcode")); 291 new1 = enterPassCode(tr("Enter new passcode"));
281 if ( new1.isNull() ) 292 if ( new1.isNull() )
282 return; 293 return;
283 new2 = enterPassCode(tr("Re-enter new passcode")); 294 new2 = enterPassCode(tr("Re-enter new passcode"));
284 if ( new2.isNull() ) 295 if ( new2.isNull() )
285 return; 296 return;
286 } while (new1 != new2); 297 } while (new1 != new2);
287 298
288 passcode = new1; 299 passcode = new1;
289 updateGUI(); 300 updateGUI();
290} 301}
291 302
292void Security::clearPassCode() 303void Security::clearPassCode()
293{ 304{
294 passcode = QString::null; 305 passcode = QString::null;
295 updateGUI(); 306 updateGUI();
296} 307}
297 308
298 309
299QString Security::enterPassCode(const QString& prompt) 310QString Security::enterPassCode(const QString& prompt)
300{ 311{
301 return Password::getPassword(prompt); 312 return Password::getPassword(prompt);
302} 313}
303 314
304bool Security::telnetAvailable() const 315bool Security::telnetAvailable() const
305{ 316{
306 // ### not implemented 317 // ### not implemented
307 return FALSE; 318 return FALSE;
308} 319}
309 320
310bool Security::sshAvailable() const 321bool Security::sshAvailable() const
311{ 322{
312 // ### not implemented 323 // ### not implemented
313 return FALSE; 324 return FALSE;
314} 325}
diff --git a/noncore/apps/confedit/main.cpp b/noncore/apps/confedit/main.cpp
index 7e7f064..74923c8 100644
--- a/noncore/apps/confedit/main.cpp
+++ b/noncore/apps/confedit/main.cpp
@@ -1,13 +1,8 @@
1 1
2#include "mainwindow.h" 2#include "mainwindow.h"
3 3
4#include <opie2/oapplication.h> 4#include <qpe/qpeapplication.h>
5 5#include <opie/oapplicationfactory.h>
6int main( int argc, char ** argv ) 6
7{ 7OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
8 OApplication a( argc, argv, "confedit" ); 8
9 MainWindow mw;
10 mw.showMaximized();
11 a.showMainDocumentWidget( &mw );
12 return a.exec();
13}
diff --git a/noncore/games/tictac/main.cpp b/noncore/games/tictac/main.cpp
index 78fb3b7..0185b8c 100644
--- a/noncore/games/tictac/main.cpp
+++ b/noncore/games/tictac/main.cpp
@@ -1,31 +1,19 @@
1/**************************************************************************** 1/****************************************************************************
2<<<<<<< main.cpp
2** $Id$ 3** $Id$
4=======
5** $Id$
6>>>>>>> 1.1.8.1.2.1
3** 7**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5** 9**
6** This file is part of an example program for Qt. This example 10** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation. 11** program may be used, distributed and modified without limitation.
8** 12**
9*****************************************************************************/ 13*****************************************************************************/
10 14
11#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
12#include <stdlib.h> 16#include <opie/oapplicationfactory.h>
13#include "tictac.h" 17#include "tictac.h"
14 18
15 19OPIE_EXPORT_APP( OApplicationFactory<TicTacToe> )
16int main( int argc, char **argv )
17{
18 QPEApplication a( argc, argv );
19 int n = 3;
20 if ( argc == 2 ) // get board size n
21 n = atoi(argv[1]);
22 if ( n < 3 || n > 10 ) { // out of range
23 qWarning( "%s: Board size must be from 3x3 to 10x10", argv[0] );
24 return 1;
25 }
26 TicTacToe ttt( n ); // create game
27 a.setMainWidget( &ttt );
28 ttt.setCaption( QObject::tr("TicTac") );
29 ttt.show(); // show widget
30 return a.exec(); // go
31}