summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp33
1 files changed, 1 insertions, 32 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 77de94f..0fbaa9a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -192,291 +192,272 @@ class KOCatPrefs : public QDialog
192 new QRadioButton(i18n("Remove from Events/Todos"), format ); 192 new QRadioButton(i18n("Remove from Events/Todos"), format );
193 addCatBut->setChecked( true ); 193 addCatBut->setChecked( true );
194 QPushButton * ok = new QPushButton( i18n("OK"), this ); 194 QPushButton * ok = new QPushButton( i18n("OK"), this );
195 lay->addWidget( ok ); 195 lay->addWidget( ok );
196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 196 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
197 lay->addWidget( cancel ); 197 lay->addWidget( cancel );
198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 198 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 199 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
200 resize( 200, 200 ); 200 resize( 200, 200 );
201 } 201 }
202 202
203 bool addCat() { return addCatBut->isChecked(); } 203 bool addCat() { return addCatBut->isChecked(); }
204private: 204private:
205 QRadioButton* addCatBut; 205 QRadioButton* addCatBut;
206}; 206};
207 207
208 208
209 209
210CalendarView::CalendarView( CalendarResources *calendar, 210CalendarView::CalendarView( CalendarResources *calendar,
211 QWidget *parent, const char *name ) 211 QWidget *parent, const char *name )
212 : CalendarViewBase( parent, name ), 212 : CalendarViewBase( parent, name ),
213 mCalendar( calendar ), 213 mCalendar( calendar ),
214 mResourceManager( calendar->resourceManager() ) 214 mResourceManager( calendar->resourceManager() )
215{ 215{
216 216
217 mEventEditor = 0; 217 mEventEditor = 0;
218 mTodoEditor = 0; 218 mTodoEditor = 0;
219 219
220 init(); 220 init();
221} 221}
222 222
223CalendarView::CalendarView( Calendar *calendar, 223CalendarView::CalendarView( Calendar *calendar,
224 QWidget *parent, const char *name ) 224 QWidget *parent, const char *name )
225 : CalendarViewBase( parent, name ), 225 : CalendarViewBase( parent, name ),
226 mCalendar( calendar ), 226 mCalendar( calendar ),
227 mResourceManager( 0 ) 227 mResourceManager( 0 )
228{ 228{
229 229
230 mEventEditor = 0; 230 mEventEditor = 0;
231 mTodoEditor = 0; 231 mTodoEditor = 0;
232 init();} 232 init();}
233 233
234void CalendarView::init() 234void CalendarView::init()
235{ 235{
236 mBlockShowDates = false; 236 mBlockShowDates = false;
237 beamDialog = new KOBeamPrefs(); 237 beamDialog = new KOBeamPrefs();
238 mDatePickerMode = 0; 238 mDatePickerMode = 0;
239 mCurrentSyncDevice = ""; 239 mCurrentSyncDevice = "";
240 writeLocale(); 240 writeLocale();
241 mViewManager = new KOViewManager( this ); 241 mViewManager = new KOViewManager( this );
242 mDialogManager = new KODialogManager( this ); 242 mDialogManager = new KODialogManager( this );
243 mEventViewerDialog = 0; 243 mEventViewerDialog = 0;
244 mModified = false; 244 mModified = false;
245 mReadOnly = false; 245 mReadOnly = false;
246 mSelectedIncidence = 0; 246 mSelectedIncidence = 0;
247 mCalPrinter = 0; 247 mCalPrinter = 0;
248 mFilters.setAutoDelete(true); 248 mFilters.setAutoDelete(true);
249 249
250 mCalendar->registerObserver( this ); 250 mCalendar->registerObserver( this );
251 // TODO: Make sure that view is updated, when calendar is changed. 251 // TODO: Make sure that view is updated, when calendar is changed.
252 252
253 mStorage = new FileStorage( mCalendar ); 253 mStorage = new FileStorage( mCalendar );
254 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 254 mNavigator = new DateNavigator( this, "datevav", mViewManager );
255 255
256 QBoxLayout *topLayout = (QBoxLayout*)layout(); 256 QBoxLayout *topLayout = (QBoxLayout*)layout();
257#ifndef KORG_NOSPLITTER 257#ifndef KORG_NOSPLITTER
258 // create the main layout frames. 258 // create the main layout frames.
259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 259 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
260 topLayout->addWidget(mPanner); 260 topLayout->addWidget(mPanner);
261 261
262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 262 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
263 "CalendarView::LeftFrame"); 263 "CalendarView::LeftFrame");
264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 264 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
265 265
266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 266 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
267 "CalendarView::DateNavigator", QDate::currentDate() ); 267 "CalendarView::DateNavigator", QDate::currentDate() );
268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 268 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
269 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 269 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
270 mTodoList->setNavigator( mNavigator ); 270 mTodoList->setNavigator( mNavigator );
271 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 271 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
272 272
273#ifdef KORG_NORESOURCEVIEW 273#ifdef KORG_NORESOURCEVIEW
274 mResourceView = 0; 274 mResourceView = 0;
275#else 275#else
276 if ( mResourceManager ) { 276 if ( mResourceManager ) {
277 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 277 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
278 mResourceView->updateView(); 278 mResourceView->updateView();
279 connect( mResourceView, SIGNAL( resourcesChanged() ), 279 connect( mResourceView, SIGNAL( resourcesChanged() ),
280 SLOT( updateView() ) ); 280 SLOT( updateView() ) );
281 } else { 281 } else {
282 mResourceView = 0; 282 mResourceView = 0;
283 } 283 }
284#endif 284#endif
285 QWidget *rightBox = new QWidget( mPanner ); 285 QWidget *rightBox = new QWidget( mPanner );
286 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 286 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
287 287
288 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
289 rightLayout->addWidget( mNavigatorBar );
290
291 mRightFrame = new QWidgetStack( rightBox ); 288 mRightFrame = new QWidgetStack( rightBox );
292 rightLayout->addWidget( mRightFrame, 1 ); 289 rightLayout->addWidget( mRightFrame, 1 );
293 290
294 mLeftFrame = mLeftSplitter; 291 mLeftFrame = mLeftSplitter;
295#else 292#else
296 QWidget *mainBox = new QWidget( this ); 293 QWidget *mainBox = new QWidget( this );
297 QWidget *leftFrame = new QWidget( mainBox ); 294 QWidget *leftFrame = new QWidget( mainBox );
298 295
299 QBoxLayout * mainBoxLayout; 296 QBoxLayout * mainBoxLayout;
300 QBoxLayout * leftFrameLayout; 297 QBoxLayout * leftFrameLayout;
301 if ( KOPrefs::instance()->mVerticalScreen ) { 298 if ( KOPrefs::instance()->mVerticalScreen ) {
302 mainBoxLayout = new QVBoxLayout(mainBox); 299 mainBoxLayout = new QVBoxLayout(mainBox);
303 leftFrameLayout = new QHBoxLayout(leftFrame ); 300 leftFrameLayout = new QHBoxLayout(leftFrame );
304 } else { 301 } else {
305 mainBoxLayout = new QHBoxLayout(mainBox); 302 mainBoxLayout = new QHBoxLayout(mainBox);
306 leftFrameLayout = new QVBoxLayout(leftFrame ); 303 leftFrameLayout = new QVBoxLayout(leftFrame );
307 } 304 }
308 topLayout->addWidget( mainBox ); 305 topLayout->addWidget( mainBox );
309 mainBoxLayout->addWidget (leftFrame); 306 mainBoxLayout->addWidget (leftFrame);
310 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 307 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
311 "CalendarView::DateNavigator", QDate::currentDate()); 308 "CalendarView::DateNavigator", QDate::currentDate());
312 // mDateNavigator->blockSignals( true ); 309 // mDateNavigator->blockSignals( true );
313 leftFrameLayout->addWidget( mDateNavigator ); 310 leftFrameLayout->addWidget( mDateNavigator );
314 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 311 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
315 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 312 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
316 mTodoList->setNavigator( mNavigator ); 313 mTodoList->setNavigator( mNavigator );
317 314
318 if ( QApplication::desktop()->width() < 480 ) { 315 if ( QApplication::desktop()->width() < 480 ) {
319 leftFrameLayout->addWidget(mFilterView); 316 leftFrameLayout->addWidget(mFilterView);
320 leftFrameLayout->addWidget(mTodoList, 2 ); 317 leftFrameLayout->addWidget(mTodoList, 2 );
321 318
322 } else { 319 } else {
323 leftFrameLayout->addWidget(mTodoList,2 ); 320 leftFrameLayout->addWidget(mTodoList,2 );
324 leftFrameLayout->addWidget(mFilterView ); 321 leftFrameLayout->addWidget(mFilterView );
325 } 322 }
326 mFilterView->hide(); 323 mFilterView->hide();
327 QWidget *rightBox = new QWidget( mainBox ); 324 QWidget *rightBox = new QWidget( mainBox );
328 mainBoxLayout->addWidget ( rightBox, 10 ); 325 mainBoxLayout->addWidget ( rightBox, 10 );
329 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 326 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
330 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
331 mRightFrame = new QWidgetStack( rightBox ); 327 mRightFrame = new QWidgetStack( rightBox );
332 rightLayout->addWidget( mNavigatorBar );
333 rightLayout->addWidget( mRightFrame, 10 ); 328 rightLayout->addWidget( mRightFrame, 10 );
334 329
335 mLeftFrame = leftFrame; 330 mLeftFrame = leftFrame;
336 if ( KOPrefs::instance()->mVerticalScreen ) { 331 if ( KOPrefs::instance()->mVerticalScreen ) {
337 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 332 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
338 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 333 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
339 } else { 334 } else {
340 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 335 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
341 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 336 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
342 } 337 }
343 if ( !KOPrefs::instance()->mShowDateNavigator) 338 if ( !KOPrefs::instance()->mShowDateNavigator)
344 mDateNavigator->hide(); 339 mDateNavigator->hide();
345 //qDebug("Calendarview Size %d %d ", width(), height()); 340 //qDebug("Calendarview Size %d %d ", width(), height());
346#endif 341#endif
347 342
348 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 343 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
349 SLOT( showDates( const KCal::DateList & ) ) ); 344 SLOT( showDates( const KCal::DateList & ) ) );
350 345
351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 346 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
352 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 347 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
353 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 348
354 mNavigator, SLOT( selectPreviousYear() ) );
355 connect( mNavigatorBar, SIGNAL( goNextYear() ),
356 mNavigator, SLOT( selectNextYear() ) );
357 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
358 mNavigator, SLOT( selectPreviousMonth() ) );
359 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
360 mNavigator, SLOT( selectNextMonth() ) );
361 connect( mNavigatorBar, SIGNAL( selectWeek( int ) ),
362 mNavigator, SLOT( selectWeek( int ) ) );
363
364 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
365 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
366 349
367 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 350 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
368 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 351 mNavigator, SLOT( selectWeek( const QDate & ) ) );
369 352
370 connect( mDateNavigator, SIGNAL( goPrevYear() ), 353 connect( mDateNavigator, SIGNAL( goPrevYear() ),
371 mNavigator, SLOT( selectPreviousYear() ) ); 354 mNavigator, SLOT( selectPreviousYear() ) );
372 connect( mDateNavigator, SIGNAL( goNextYear() ), 355 connect( mDateNavigator, SIGNAL( goNextYear() ),
373 mNavigator, SLOT( selectNextYear() ) ); 356 mNavigator, SLOT( selectNextYear() ) );
374 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 357 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
375 mNavigator, SLOT( selectPreviousMonth() ) ); 358 mNavigator, SLOT( selectPreviousMonth() ) );
376 connect( mDateNavigator, SIGNAL( goNextMonth() ), 359 connect( mDateNavigator, SIGNAL( goNextMonth() ),
377 mNavigator, SLOT( selectNextMonth() ) ); 360 mNavigator, SLOT( selectNextMonth() ) );
378 361
379 connect( mDateNavigator, SIGNAL( goPrevious() ), 362 connect( mDateNavigator, SIGNAL( goPrevious() ),
380 mNavigator, SLOT( selectPrevious() ) ); 363 mNavigator, SLOT( selectPrevious() ) );
381 connect( mDateNavigator, SIGNAL( goNext() ), 364 connect( mDateNavigator, SIGNAL( goNext() ),
382 mNavigator, SLOT( selectNext() ) ); 365 mNavigator, SLOT( selectNext() ) );
383 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 366 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
384 mNavigator, SLOT( slotMonthSelect( int ) ) ); 367 mNavigator, SLOT( slotMonthSelect( int ) ) );
385 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
386 mNavigator, SLOT( slotMonthSelect( int ) ) );
387 368
388 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 369 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
389 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 370 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
390 371
391 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 372 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
392 SLOT( eventAdded( Event *) ) ); 373 SLOT( eventAdded( Event *) ) );
393 374
394 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 375 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
395 376
396 connect( this, SIGNAL( configChanged() ), 377 connect( this, SIGNAL( configChanged() ),
397 mDateNavigator, SLOT( updateConfig() ) ); 378 mDateNavigator, SLOT( updateConfig() ) );
398 379
399 connect( mTodoList, SIGNAL( newTodoSignal() ), 380 connect( mTodoList, SIGNAL( newTodoSignal() ),
400 SLOT( newTodo() ) ); 381 SLOT( newTodo() ) );
401 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 382 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
402 SLOT( newSubTodo( Todo * ) ) ); 383 SLOT( newSubTodo( Todo * ) ) );
403 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 384 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
404 SLOT( editTodo( Todo * ) ) ); 385 SLOT( editTodo( Todo * ) ) );
405 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 386 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
406 SLOT( showTodo( Todo *) ) ); 387 SLOT( showTodo( Todo *) ) );
407 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 388 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
408 SLOT( deleteTodo( Todo *) ) ); 389 SLOT( deleteTodo( Todo *) ) );
409 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 390 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
410 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 391 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
411 SLOT( purgeCompleted() ) ); 392 SLOT( purgeCompleted() ) );
412 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 393 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
413 SIGNAL( todoModified( Todo *, int ) ) ); 394 SIGNAL( todoModified( Todo *, int ) ) );
414 395
415 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 396 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
416 this, SLOT ( cloneIncidence( Incidence * ) ) ); 397 this, SLOT ( cloneIncidence( Incidence * ) ) );
417 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 398 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
418 this, SLOT (cancelIncidence( Incidence * ) ) ); 399 this, SLOT (cancelIncidence( Incidence * ) ) );
419 400
420 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 401 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
421 this, SLOT ( moveIncidence( Incidence * ) ) ); 402 this, SLOT ( moveIncidence( Incidence * ) ) );
422 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 403 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
423 this, SLOT ( beamIncidence( Incidence * ) ) ); 404 this, SLOT ( beamIncidence( Incidence * ) ) );
424 405
425 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 406 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
426 this, SLOT ( todo_unsub( Todo * ) ) ); 407 this, SLOT ( todo_unsub( Todo * ) ) );
427 408
428 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 409 connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
429 this, SLOT ( todo_resub( Todo *,Todo * ) ) ); 410 this, SLOT ( todo_resub( Todo *,Todo * ) ) );
430 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 411 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
431 SLOT( updateTodo( Todo *, int ) ) ); 412 SLOT( updateTodo( Todo *, int ) ) );
432 connect( this, SIGNAL( todoModified( Todo *, int )), this, 413 connect( this, SIGNAL( todoModified( Todo *, int )), this,
433 SLOT( changeTodoDisplay( Todo *, int ) ) ); 414 SLOT( changeTodoDisplay( Todo *, int ) ) );
434 415
435 416
436 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 417 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
437 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 418 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
438 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 419 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
439 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 420 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
440 421
441 422
442 423
443 424
444 425
445 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 426 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
446 SLOT(checkClipboard())); 427 SLOT(checkClipboard()));
447 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 428 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
448 SLOT( processTodoListSelection( Incidence * ) ) ); 429 SLOT( processTodoListSelection( Incidence * ) ) );
449 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 430 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
450 431
451 // kdDebug() << "CalendarView::CalendarView() done" << endl; 432 // kdDebug() << "CalendarView::CalendarView() done" << endl;
452 433
453 mDateFrame = new QVBox(0,0,WType_Popup); 434 mDateFrame = new QVBox(0,0,WType_Popup);
454 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 435 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
455 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 436 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
456 mDateFrame->setLineWidth(3); 437 mDateFrame->setLineWidth(3);
457 mDateFrame->hide(); 438 mDateFrame->hide();
458 mDateFrame->setCaption( i18n( "Pick a date to display")); 439 mDateFrame->setCaption( i18n( "Pick a date to display"));
459 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 440 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
460 441
461 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 442 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
462 443
463 mEventEditor = mDialogManager->getEventEditor(); 444 mEventEditor = mDialogManager->getEventEditor();
464 mTodoEditor = mDialogManager->getTodoEditor(); 445 mTodoEditor = mDialogManager->getTodoEditor();
465 446
466 mFlagEditDescription = false; 447 mFlagEditDescription = false;
467 448
468 mSuspendTimer = new QTimer( this ); 449 mSuspendTimer = new QTimer( this );
469 mAlarmTimer = new QTimer( this ); 450 mAlarmTimer = new QTimer( this );
470 mRecheckAlarmTimer = new QTimer( this ); 451 mRecheckAlarmTimer = new QTimer( this );
471 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 452 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
472 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 453 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
473 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 454 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
474 mAlarmDialog = new AlarmDialog( this ); 455 mAlarmDialog = new AlarmDialog( this );
475 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 456 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
476 mAlarmDialog->setServerNotification( false ); 457 mAlarmDialog->setServerNotification( false );
477 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 458 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
478 459
479 460
480#ifndef DESKTOP_VERSION 461#ifndef DESKTOP_VERSION
481//US listen for arriving address resultsets 462//US listen for arriving address resultsets
482 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 463 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
@@ -3775,165 +3756,153 @@ void CalendarView::deleteIncidence()
3775} 3756}
3776 3757
3777void CalendarView::showIncidence(Incidence *incidence) 3758void CalendarView::showIncidence(Incidence *incidence)
3778{ 3759{
3779 if ( incidence ) { 3760 if ( incidence ) {
3780 ShowIncidenceVisitor v; 3761 ShowIncidenceVisitor v;
3781 v.act( incidence, this ); 3762 v.act( incidence, this );
3782 } 3763 }
3783} 3764}
3784 3765
3785void CalendarView::editIncidence(Incidence *incidence) 3766void CalendarView::editIncidence(Incidence *incidence)
3786{ 3767{
3787 if ( incidence ) { 3768 if ( incidence ) {
3788 3769
3789 EditIncidenceVisitor v; 3770 EditIncidenceVisitor v;
3790 v.act( incidence, this ); 3771 v.act( incidence, this );
3791 3772
3792 } 3773 }
3793} 3774}
3794 3775
3795void CalendarView::deleteIncidence(Incidence *incidence) 3776void CalendarView::deleteIncidence(Incidence *incidence)
3796{ 3777{
3797 //qDebug(" CalendarView::deleteIncidence "); 3778 //qDebug(" CalendarView::deleteIncidence ");
3798 if ( incidence ) { 3779 if ( incidence ) {
3799 DeleteIncidenceVisitor v; 3780 DeleteIncidenceVisitor v;
3800 v.act( incidence, this ); 3781 v.act( incidence, this );
3801 } 3782 }
3802} 3783}
3803 3784
3804 3785
3805void CalendarView::lookForOutgoingMessages() 3786void CalendarView::lookForOutgoingMessages()
3806{ 3787{
3807 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 3788 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
3808 ogd->loadMessages(); 3789 ogd->loadMessages();
3809} 3790}
3810 3791
3811void CalendarView::lookForIncomingMessages() 3792void CalendarView::lookForIncomingMessages()
3812{ 3793{
3813 IncomingDialog *icd = mDialogManager->incomingDialog(); 3794 IncomingDialog *icd = mDialogManager->incomingDialog();
3814 icd->retrieve(); 3795 icd->retrieve();
3815} 3796}
3816 3797
3817bool CalendarView::removeCompletedSubTodos( Todo* t ) 3798bool CalendarView::removeCompletedSubTodos( Todo* t )
3818{ 3799{
3819 bool deleteTodo = true; 3800 bool deleteTodo = true;
3820 QPtrList<Incidence> subTodos; 3801 QPtrList<Incidence> subTodos;
3821 Incidence *aTodo; 3802 Incidence *aTodo;
3822 subTodos = t->relations(); 3803 subTodos = t->relations();
3823 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3804 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3824 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3805 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3825 deleteTodo = false; 3806 deleteTodo = false;
3826 } 3807 }
3827 if ( deleteTodo ) { 3808 if ( deleteTodo ) {
3828 if ( t->isCompleted() ) { 3809 if ( t->isCompleted() ) {
3829 checkExternalId( t ); 3810 checkExternalId( t );
3830 mCalendar->deleteTodo( t ); 3811 mCalendar->deleteTodo( t );
3831 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3812 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3832 } 3813 }
3833 else 3814 else
3834 deleteTodo = false; 3815 deleteTodo = false;
3835 } 3816 }
3836 return deleteTodo; 3817 return deleteTodo;
3837 3818
3838} 3819}
3839void CalendarView::purgeCompleted() 3820void CalendarView::purgeCompleted()
3840{ 3821{
3841 int result = KMessageBox::warningContinueCancel(this, 3822 int result = KMessageBox::warningContinueCancel(this,
3842 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3823 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3843 3824
3844 if (result == KMessageBox::Continue) { 3825 if (result == KMessageBox::Continue) {
3845 3826
3846 QPtrList<Todo> todoCal; 3827 QPtrList<Todo> todoCal;
3847 QPtrList<Todo> rootTodos; 3828 QPtrList<Todo> rootTodos;
3848 //QPtrList<Incidence> rel; 3829 //QPtrList<Incidence> rel;
3849 Todo *aTodo;//, *rTodo; 3830 Todo *aTodo;//, *rTodo;
3850 Incidence *rIncidence; 3831 Incidence *rIncidence;
3851 bool childDelete = false; 3832 bool childDelete = false;
3852 bool deletedOne = true; 3833 bool deletedOne = true;
3853 todoCal = calendar()->todos(); 3834 todoCal = calendar()->todos();
3854 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 3835 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
3855 if ( !aTodo->relatedTo() ) 3836 if ( !aTodo->relatedTo() )
3856 rootTodos.append( aTodo ); 3837 rootTodos.append( aTodo );
3857 } 3838 }
3858 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 3839 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
3859 removeCompletedSubTodos( aTodo ); 3840 removeCompletedSubTodos( aTodo );
3860 } 3841 }
3861 3842
3862 updateView(); 3843 updateView();
3863 } 3844 }
3864} 3845}
3865 3846
3866void CalendarView::slotCalendarChanged() 3847void CalendarView::slotCalendarChanged()
3867{ 3848{
3868 ; 3849 ;
3869} 3850}
3870 3851
3871NavigatorBar *CalendarView::navigatorBar()
3872{
3873 return mNavigatorBar;
3874}
3875void CalendarView::showNavigatorBar( bool b)
3876{
3877 if ( b ) mNavigatorBar->show();
3878 else mNavigatorBar->hide();
3879}
3880
3881
3882
3883void CalendarView::keyPressEvent ( QKeyEvent *e) 3852void CalendarView::keyPressEvent ( QKeyEvent *e)
3884{ 3853{
3885 //qDebug(" alendarView::keyPressEvent "); 3854 //qDebug(" alendarView::keyPressEvent ");
3886 e->ignore(); 3855 e->ignore();
3887} 3856}
3888 3857
3889 3858
3890bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 3859bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
3891{ 3860{
3892 // mSyncManager = manager; 3861 // mSyncManager = manager;
3893 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 3862 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
3894 qDebug("KO: SyncKDE request detected!"); 3863 qDebug("KO: SyncKDE request detected!");
3895 } 3864 }
3896 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3865 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3897 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3866 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3898 return syncCalendar( filename, mode ); 3867 return syncCalendar( filename, mode );
3899} 3868}
3900bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 3869bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
3901{ 3870{
3902 //mSyncManager = manager; 3871 //mSyncManager = manager;
3903 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 3872 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
3904 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 3873 mCurrentSyncName = mSyncManager->getCurrentSyncName();
3905 if ( resource == "sharp" ) 3874 if ( resource == "sharp" )
3906 syncExternal( 0 ); 3875 syncExternal( 0 );
3907 if ( resource == "phone" ) 3876 if ( resource == "phone" )
3908 syncExternal( 1 ); 3877 syncExternal( 1 );
3909 // pending setmodified 3878 // pending setmodified
3910 return true; 3879 return true;
3911} 3880}
3912void CalendarView::setSyncManager(KSyncManager* manager) 3881void CalendarView::setSyncManager(KSyncManager* manager)
3913{ 3882{
3914 mSyncManager = manager; 3883 mSyncManager = manager;
3915} 3884}
3916 3885
3917void CalendarView::removeSyncInfo( QString syncProfile) 3886void CalendarView::removeSyncInfo( QString syncProfile)
3918{ 3887{
3919 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 3888 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
3920 mCalendar->removeSyncInfo( syncProfile ); 3889 mCalendar->removeSyncInfo( syncProfile );
3921 3890
3922} 3891}
3923 3892
3924void CalendarView::undo_delete() 3893void CalendarView::undo_delete()
3925{ 3894{
3926 //qDebug("undo_delete() "); 3895 //qDebug("undo_delete() ");
3927 Incidence* undo = mCalendar->undoIncidence(); 3896 Incidence* undo = mCalendar->undoIncidence();
3928 if ( !undo ) { 3897 if ( !undo ) {
3929 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 3898 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
3930 i18n("KO/Pi")); 3899 i18n("KO/Pi"));
3931 return; 3900 return;
3932 } 3901 }
3933 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + 3902 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) +
3934 i18n("\nAre you sure you want\nto restore this?"), 3903 i18n("\nAre you sure you want\nto restore this?"),
3935 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 3904 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
3936 mCalendar->undoDeleteIncidence(); 3905 mCalendar->undoDeleteIncidence();
3937 updateView(); 3906 updateView();
3938 } 3907 }
3939} 3908}