summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-19 19:11:16 (UTC)
committer zautrix <zautrix>2005-03-19 19:11:16 (UTC)
commit414b033f0c39b5122fd4899408a7045a6c29d7c9 (patch) (unidiff)
tree802d40e62d1b55e9b3a2daca2ba74fc47af15137 /korganizer
parent0aa5a7dce6ac1224395f7cb3fae488ba566f0e38 (diff)
downloadkdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.zip
kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.tar.gz
kdepimpi-414b033f0c39b5122fd4899408a7045a6c29d7c9.tar.bz2
dnc
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp72
-rw-r--r--korganizer/calendarview.h6
-rw-r--r--korganizer/datenavigatorcontainer.cpp218
-rw-r--r--korganizer/datenavigatorcontainer.h90
-rw-r--r--korganizer/kdatenavigator.cpp38
-rw-r--r--korganizer/kdatenavigator.h8
-rw-r--r--korganizer/kodaymatrix.cpp49
-rw-r--r--korganizer/kodaymatrix.h8
-rw-r--r--korganizer/korganizerE.pro4
-rw-r--r--korganizer/navigatorbar.cpp22
-rw-r--r--korganizer/navigatorbar.h1
11 files changed, 464 insertions, 52 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 6eaac1c..00285a5 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -86,48 +86,49 @@
86#include <externalapphandler.h> 86#include <externalapphandler.h>
87#endif 87#endif
88#include <libkcal/phoneformat.h> 88#include <libkcal/phoneformat.h>
89#ifndef KORG_NOMAIL 89#ifndef KORG_NOMAIL
90#include "komailclient.h" 90#include "komailclient.h"
91#endif 91#endif
92#ifndef KORG_NOPRINTER 92#ifndef KORG_NOPRINTER
93#include "calprinter.h" 93#include "calprinter.h"
94#endif 94#endif
95#ifndef KORG_NOPLUGINS 95#ifndef KORG_NOPLUGINS
96#include "kocore.h" 96#include "kocore.h"
97#endif 97#endif
98#include "koeventeditor.h" 98#include "koeventeditor.h"
99#include "kotodoeditor.h" 99#include "kotodoeditor.h"
100#include "koprefs.h" 100#include "koprefs.h"
101#include "koeventviewerdialog.h" 101#include "koeventviewerdialog.h"
102#include "publishdialog.h" 102#include "publishdialog.h"
103#include "kofilterview.h" 103#include "kofilterview.h"
104#include "koglobals.h" 104#include "koglobals.h"
105#include "koviewmanager.h" 105#include "koviewmanager.h"
106#include "koagendaview.h" 106#include "koagendaview.h"
107#include "kodialogmanager.h" 107#include "kodialogmanager.h"
108#include "outgoingdialog.h" 108#include "outgoingdialog.h"
109#include "incomingdialog.h" 109#include "incomingdialog.h"
110#include "datenavigatorcontainer.h"
110#include "statusdialog.h" 111#include "statusdialog.h"
111#include "kdatenavigator.h" 112#include "kdatenavigator.h"
112#include "kotodoview.h" 113#include "kotodoview.h"
113#include "datenavigator.h" 114#include "datenavigator.h"
114#include "resourceview.h" 115#include "resourceview.h"
115#include "navigatorbar.h" 116#include "navigatorbar.h"
116#include "searchdialog.h" 117#include "searchdialog.h"
117#include "mainwindow.h" 118#include "mainwindow.h"
118 119
119#include "calendarview.h" 120#include "calendarview.h"
120#ifndef DESKTOP_VERSION 121#ifndef DESKTOP_VERSION
121#include <qtopia/alarmserver.h> 122#include <qtopia/alarmserver.h>
122#endif 123#endif
123#ifndef _WIN32_ 124#ifndef _WIN32_
124#include <stdlib.h> 125#include <stdlib.h>
125#include <stdio.h> 126#include <stdio.h>
126#include <unistd.h> 127#include <unistd.h>
127#else 128#else
128#include <qprocess.h> 129#include <qprocess.h>
129#endif 130#endif
130 131
131#ifdef DESKTOP_VERSION 132#ifdef DESKTOP_VERSION
132#include <kabc/stdaddressbook.h> 133#include <kabc/stdaddressbook.h>
133#endif 134#endif
@@ -246,158 +247,171 @@ void CalendarView::init()
246 mDialogManager = new KODialogManager( this ); 247 mDialogManager = new KODialogManager( this );
247 mEventViewerDialog = 0; 248 mEventViewerDialog = 0;
248 mModified = false; 249 mModified = false;
249 mReadOnly = false; 250 mReadOnly = false;
250 mSelectedIncidence = 0; 251 mSelectedIncidence = 0;
251 mCalPrinter = 0; 252 mCalPrinter = 0;
252 mFilters.setAutoDelete(true); 253 mFilters.setAutoDelete(true);
253 254
254 mCalendar->registerObserver( this ); 255 mCalendar->registerObserver( this );
255 // TODO: Make sure that view is updated, when calendar is changed. 256 // TODO: Make sure that view is updated, when calendar is changed.
256 257
257 mStorage = new FileStorage( mCalendar ); 258 mStorage = new FileStorage( mCalendar );
258 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 259 mNavigator = new DateNavigator( this, "datevav", mViewManager );
259 260
260 QBoxLayout *topLayout = (QBoxLayout*)layout(); 261 QBoxLayout *topLayout = (QBoxLayout*)layout();
261#ifndef KORG_NOSPLITTER 262#ifndef KORG_NOSPLITTER
262 // create the main layout frames. 263 // create the main layout frames.
263 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 264 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
264 topLayout->addWidget(mPanner); 265 topLayout->addWidget(mPanner);
265 266
266 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 267 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
267 "CalendarView::LeftFrame"); 268 "CalendarView::LeftFrame");
268 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 269 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
269 270
270 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 271 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
271 "CalendarView::DateNavigator", QDate::currentDate() ); 272 "CalendarView::DateNavigator" );
273
272 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 274 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
273 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 275 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
274 mTodoList->setNavigator( mNavigator ); 276 mTodoList->setNavigator( mNavigator );
275 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 277 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
276 278
277#ifdef KORG_NORESOURCEVIEW 279#ifdef KORG_NORESOURCEVIEW
278 mResourceView = 0; 280 mResourceView = 0;
279#else 281#else
280 if ( mResourceManager ) { 282 if ( mResourceManager ) {
281 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 283 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
282 mResourceView->updateView(); 284 mResourceView->updateView();
283 connect( mResourceView, SIGNAL( resourcesChanged() ), 285 connect( mResourceView, SIGNAL( resourcesChanged() ),
284 SLOT( updateView() ) ); 286 SLOT( updateView() ) );
285 } else { 287 } else {
286 mResourceView = 0; 288 mResourceView = 0;
287 } 289 }
288#endif 290#endif
289 QWidget *rightBox = new QWidget( mPanner ); 291 QWidget *rightBox = new QWidget( mPanner );
290 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 292 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
291 293
292 mRightFrame = new QWidgetStack( rightBox ); 294 mRightFrame = new QWidgetStack( rightBox );
293 rightLayout->addWidget( mRightFrame, 1 ); 295 rightLayout->addWidget( mRightFrame, 1 );
294 296
295 mLeftFrame = mLeftSplitter; 297 mLeftFrame = mLeftSplitter;
296#else 298#else
297 QWidget *mainBox = new QWidget( this ); 299 QWidget *mainBox = new QWidget( this );
298 QWidget *leftFrame = new QWidget( mainBox ); 300 //QWidget *leftFrame = new QWidget( mainBox );
299
300 QBoxLayout * mainBoxLayout; 301 QBoxLayout * mainBoxLayout;
301 QBoxLayout * leftFrameLayout;
302 if ( KOPrefs::instance()->mVerticalScreen ) { 302 if ( KOPrefs::instance()->mVerticalScreen ) {
303 mainBoxLayout = new QVBoxLayout(mainBox); 303 mainBoxLayout = new QVBoxLayout(mainBox);
304 leftFrameLayout = new QHBoxLayout(leftFrame ); 304 //leftFrameLayout = new QHBoxLayout(leftFrame );
305 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mainBox);;
306 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left );
305 } else { 307 } else {
306 mainBoxLayout = new QHBoxLayout(mainBox); 308 mainBoxLayout = new QHBoxLayout(mainBox);
307 leftFrameLayout = new QVBoxLayout(leftFrame ); 309 //leftFrameLayout = new QVBoxLayout(leftFrame );
310 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mainBox);;
311 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
308 } 312 }
313 //QBoxLayout * leftFrameLayout;
309 topLayout->addWidget( mainBox ); 314 topLayout->addWidget( mainBox );
310 mainBoxLayout->addWidget (leftFrame); 315 mainBoxLayout->addWidget (mLeftFrame);
311 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 316 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
317 "CalendarView::DateNavigator" );
318#if 0
319 // FIXME
320 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
312 "CalendarView::DateNavigator", QDate::currentDate()); 321 "CalendarView::DateNavigator", QDate::currentDate());
322#endif
313 // mDateNavigator->blockSignals( true ); 323 // mDateNavigator->blockSignals( true );
314 leftFrameLayout->addWidget( mDateNavigator ); 324 //leftFrameLayout->addWidget( mDateNavigator );
315 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 325 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
316 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall"); 326 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
317 mTodoList->setNavigator( mNavigator ); 327 mTodoList->setNavigator( mNavigator );
318 328#if 0
319 if ( QApplication::desktop()->width() < 480 ) { 329 if ( QApplication::desktop()->width() < 480 ) {
320 leftFrameLayout->addWidget(mFilterView); 330 leftFrameLayout->addWidget(mFilterView);
321 leftFrameLayout->addWidget(mTodoList, 2 ); 331 leftFrameLayout->addWidget(mTodoList, 2 );
322 332
323 } else { 333 } else {
324 leftFrameLayout->addWidget(mTodoList,2 ); 334 leftFrameLayout->addWidget(mTodoList,2 );
325 leftFrameLayout->addWidget(mFilterView ); 335 leftFrameLayout->addWidget(mFilterView );
326 } 336 }
337#endif
327 mFilterView->hide(); 338 mFilterView->hide();
328 QWidget *rightBox = new QWidget( mainBox ); 339 QWidget *rightBox = new QWidget( mainBox );
329 mainBoxLayout->addWidget ( rightBox, 10 ); 340 mainBoxLayout->addWidget ( rightBox, 10 );
330 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 341 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
331 mRightFrame = new QWidgetStack( rightBox ); 342 mRightFrame = new QWidgetStack( rightBox );
332 rightLayout->addWidget( mRightFrame, 10 ); 343 rightLayout->addWidget( mRightFrame, 10 );
333 344
334 mLeftFrame = leftFrame; 345 //mLeftFrame = (QWidget *)leftFrame;
335 if ( KOPrefs::instance()->mVerticalScreen ) { 346 if ( KOPrefs::instance()->mVerticalScreen ) {
336 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 347 mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() );
337 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 348 //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() );
349 //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
350 //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
338 } else { 351 } else {
339 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 352 mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() );
340 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 353 //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
354 //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
341 } 355 }
342 if ( !KOPrefs::instance()->mShowDateNavigator) 356 if ( !KOPrefs::instance()->mShowDateNavigator)
343 mDateNavigator->hide(); 357 mLeftFrame->toggle();
344 //qDebug("Calendarview Size %d %d ", width(), height()); 358 //qDebug("Calendarview Size %d %d ", width(), height());
345#endif 359#endif
346 360
347 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 361 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
348 SLOT( showDates( const KCal::DateList & ) ) ); 362 SLOT( showDates( const KCal::DateList & ) ) );
349 363
350 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 364 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
351 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 365 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
352 366
353 367
354 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 368 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
355 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 369 mNavigator, SLOT( selectWeek( const QDate & ) ) );
356 370
357 connect( mDateNavigator, SIGNAL( goPrevYear() ), 371 connect( mDateNavigator, SIGNAL( goPrevYear() ),
358 mNavigator, SLOT( selectPreviousYear() ) ); 372 mNavigator, SLOT( selectPreviousYear() ) );
359 connect( mDateNavigator, SIGNAL( goNextYear() ), 373 connect( mDateNavigator, SIGNAL( goNextYear() ),
360 mNavigator, SLOT( selectNextYear() ) ); 374 mNavigator, SLOT( selectNextYear() ) );
361 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 375 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
362 mNavigator, SLOT( selectPreviousMonth() ) ); 376 mNavigator, SLOT( selectPreviousMonth() ) );
363 connect( mDateNavigator, SIGNAL( goNextMonth() ), 377 connect( mDateNavigator, SIGNAL( goNextMonth() ),
364 mNavigator, SLOT( selectNextMonth() ) ); 378 mNavigator, SLOT( selectNextMonth() ) );
365 379
366 connect( mDateNavigator, SIGNAL( goPrevious() ), 380 connect( mDateNavigator, SIGNAL( goPrevious() ),
367 mNavigator, SLOT( selectPrevious() ) ); 381 mNavigator, SLOT( selectPrevious() ) );
368 connect( mDateNavigator, SIGNAL( goNext() ), 382 connect( mDateNavigator, SIGNAL( goNext() ),
369 mNavigator, SLOT( selectNext() ) ); 383 mNavigator, SLOT( selectNext() ) );
370 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 384 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
371 mNavigator, SLOT( slotMonthSelect( int ) ) ); 385 mNavigator, SLOT( slotMonthSelect( int ) ) );
372 386
373 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 387 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
374 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 388 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
375 389#if 0
376 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 390 connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ),
377 SLOT( eventAdded( Event *) ) ); 391 SLOT( incidenceAdded( Incidence *) ) );
378 392#endif
379 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 393 // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
380 394
381 connect( this, SIGNAL( configChanged() ), 395 connect( this, SIGNAL( configChanged() ),
382 mDateNavigator, SLOT( updateConfig() ) ); 396 mDateNavigator, SLOT( updateConfig() ) );
383 397
384 connect( mTodoList, SIGNAL( newTodoSignal() ), 398 connect( mTodoList, SIGNAL( newTodoSignal() ),
385 SLOT( newTodo() ) ); 399 SLOT( newTodo() ) );
386 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 400 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
387 SLOT( newSubTodo( Todo * ) ) ); 401 SLOT( newSubTodo( Todo * ) ) );
388 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 402 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
389 SLOT( editTodo( Todo * ) ) ); 403 SLOT( editTodo( Todo * ) ) );
390 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 404 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
391 SLOT( showTodo( Todo *) ) ); 405 SLOT( showTodo( Todo *) ) );
392 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 406 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
393 SLOT( deleteTodo( Todo *) ) ); 407 SLOT( deleteTodo( Todo *) ) );
394 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 408 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
395 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 409 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
396 SLOT( purgeCompleted() ) ); 410 SLOT( purgeCompleted() ) );
397 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 411 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
398 SIGNAL( todoModified( Todo *, int ) ) ); 412 SIGNAL( todoModified( Todo *, int ) ) );
399 413
400 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 414 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
401 this, SLOT ( cloneIncidence( Incidence * ) ) ); 415 this, SLOT ( cloneIncidence( Incidence * ) ) );
402 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 416 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
403 this, SLOT (cancelIncidence( Incidence * ) ) ); 417 this, SLOT (cancelIncidence( Incidence * ) ) );
@@ -446,49 +460,49 @@ void CalendarView::init()
446 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 460 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
447 461
448 mEventEditor = mDialogManager->getEventEditor(); 462 mEventEditor = mDialogManager->getEventEditor();
449 mTodoEditor = mDialogManager->getTodoEditor(); 463 mTodoEditor = mDialogManager->getTodoEditor();
450 464
451 mFlagEditDescription = false; 465 mFlagEditDescription = false;
452 466
453 mSuspendTimer = new QTimer( this ); 467 mSuspendTimer = new QTimer( this );
454 mAlarmTimer = new QTimer( this ); 468 mAlarmTimer = new QTimer( this );
455 mRecheckAlarmTimer = new QTimer( this ); 469 mRecheckAlarmTimer = new QTimer( this );
456 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 470 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
457 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 471 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
458 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 472 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
459 mAlarmDialog = new AlarmDialog( this ); 473 mAlarmDialog = new AlarmDialog( this );
460 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 474 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
461 mAlarmDialog->setServerNotification( false ); 475 mAlarmDialog->setServerNotification( false );
462 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 476 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
463 477
464 478
465#ifndef DESKTOP_VERSION 479#ifndef DESKTOP_VERSION
466//US listen for arriving address resultsets 480//US listen for arriving address resultsets
467 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 481 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
468 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 482 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
469#endif 483#endif
470 484 mDateNavigator->setCalendar( mCalendar );
471} 485}
472 486
473 487
474CalendarView::~CalendarView() 488CalendarView::~CalendarView()
475{ 489{
476 // kdDebug() << "~CalendarView()" << endl; 490 // kdDebug() << "~CalendarView()" << endl;
477 //qDebug("CalendarView::~CalendarView() "); 491 //qDebug("CalendarView::~CalendarView() ");
478 delete mDialogManager; 492 delete mDialogManager;
479 delete mViewManager; 493 delete mViewManager;
480 delete mStorage; 494 delete mStorage;
481 delete mDateFrame ; 495 delete mDateFrame ;
482 delete beamDialog; 496 delete beamDialog;
483 delete mEventViewerDialog; 497 delete mEventViewerDialog;
484 //kdDebug() << "~CalendarView() done" << endl; 498 //kdDebug() << "~CalendarView() done" << endl;
485} 499}
486 500
487void CalendarView::showDay( QDate d ) 501void CalendarView::showDay( QDate d )
488{ 502{
489 dateNavigator()->blockSignals( true ); 503 dateNavigator()->blockSignals( true );
490 dateNavigator()->selectDate( d ); 504 dateNavigator()->selectDate( d );
491 dateNavigator()->blockSignals( false ); 505 dateNavigator()->blockSignals( false );
492 mViewManager->showDayView(); 506 mViewManager->showDayView();
493 //dateNavigator()->selectDate( d ); 507 //dateNavigator()->selectDate( d );
494} 508}
@@ -3664,67 +3678,71 @@ void CalendarView::takeOverCalendar()
3664 } 3678 }
3665 3679
3666 QPtrList<Journal> journals = mCalendar->journals(); 3680 QPtrList<Journal> journals = mCalendar->journals();
3667 for(uint i=0; i<journals.count(); ++i) { 3681 for(uint i=0; i<journals.count(); ++i) {
3668 journals.at(i)->setOrganizer(KOPrefs::instance()->email()); 3682 journals.at(i)->setOrganizer(KOPrefs::instance()->email());
3669 journals.at(i)->recreate(); 3683 journals.at(i)->recreate();
3670 journals.at(i)->setReadOnly(false); 3684 journals.at(i)->setReadOnly(false);
3671 } 3685 }
3672 3686
3673 updateView(); 3687 updateView();
3674} 3688}
3675 3689
3676void CalendarView::showIntro() 3690void CalendarView::showIntro()
3677{ 3691{
3678 kdDebug() << "To be implemented." << endl; 3692 kdDebug() << "To be implemented." << endl;
3679} 3693}
3680 3694
3681QWidgetStack *CalendarView::viewStack() 3695QWidgetStack *CalendarView::viewStack()
3682{ 3696{
3683 return mRightFrame; 3697 return mRightFrame;
3684} 3698}
3685 3699
3686QWidget *CalendarView::leftFrame() 3700QWidget *CalendarView::leftFrame()
3687{ 3701{
3688 return mLeftFrame; 3702 return ( QWidget *)mLeftFrame;
3689} 3703}
3690 3704
3691DateNavigator *CalendarView::dateNavigator() 3705DateNavigator *CalendarView::dateNavigator()
3692{ 3706{
3693 return mNavigator; 3707 return mNavigator;
3694} 3708}
3695 3709
3696KDateNavigator* CalendarView::dateNavigatorWidget() 3710KDateNavigator* CalendarView::dateNavigatorWidget()
3697{ 3711{
3698 return mDateNavigator; 3712 return mDateNavigator->navigatorView();
3699} 3713}
3700void CalendarView::toggleDateNavigatorWidget() 3714void CalendarView::toggleDateNavigatorWidget()
3701{ 3715{
3702 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; 3716 KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ;
3717 mLeftFrame->toggle();
3718 // FIXME mShowDateNavigator is not the toggle state of mLeftFrame
3719#if 0
3703 if (!KOPrefs::instance()->mShowDateNavigator ) 3720 if (!KOPrefs::instance()->mShowDateNavigator )
3704 mDateNavigator->hide(); 3721 mDateNavigator->hide();
3705 else 3722 else
3706 mDateNavigator->show(); 3723 mDateNavigator->show();
3724#endif
3707} 3725}
3708void CalendarView::addView(KOrg::BaseView *view) 3726void CalendarView::addView(KOrg::BaseView *view)
3709{ 3727{
3710 mViewManager->addView(view); 3728 mViewManager->addView(view);
3711} 3729}
3712 3730
3713void CalendarView::showView(KOrg::BaseView *view) 3731void CalendarView::showView(KOrg::BaseView *view)
3714{ 3732{
3715 mViewManager->showView(view, mLeftFrame->isVisible()); 3733 mViewManager->showView(view, mLeftFrame->isVisible());
3716} 3734}
3717 3735
3718Incidence *CalendarView::currentSelection() 3736Incidence *CalendarView::currentSelection()
3719{ 3737{
3720 return mViewManager->currentSelection(); 3738 return mViewManager->currentSelection();
3721} 3739}
3722void CalendarView::toggleAllDaySize() 3740void CalendarView::toggleAllDaySize()
3723{ 3741{
3724 /* 3742 /*
3725 if ( KOPrefs::instance()->mAllDaySize > 47 ) 3743 if ( KOPrefs::instance()->mAllDaySize > 47 )
3726 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; 3744 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2;
3727 else 3745 else
3728 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; 3746 KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2;
3729 */ 3747 */
3730 viewManager()->agendaView()->toggleAllDay(); 3748 viewManager()->agendaView()->toggleAllDay();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 664d700..fac9a9e 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -18,62 +18,64 @@
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/calendar.h> 38#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 39#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 40#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 41#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h>
42 43
43#include <korganizer/calendarviewbase.h> 44#include <korganizer/calendarviewbase.h>
44 45
45#include <ksyncmanager.h> 46#include <ksyncmanager.h>
46 47
47class QWidgetStack; 48class QWidgetStack;
48class QSplitter; 49class QSplitter;
49 50
50class CalPrinter; 51class CalPrinter;
51class KOFilterView; 52class KOFilterView;
52class KOViewManager; 53class KOViewManager;
53class KODialogManager; 54class KODialogManager;
54class KOTodoView; 55class KOTodoView;
55class KDateNavigator; 56class KDateNavigator;
57class DateNavigatorContainer;
56class DateNavigator; 58class DateNavigator;
57class KOIncidenceEditor; 59class KOIncidenceEditor;
58class KDatePicker; 60class KDatePicker;
59class ResourceView; 61class ResourceView;
60class KOEventEditor; 62class KOEventEditor;
61class KOTodoEditor ; 63class KOTodoEditor ;
62class KOEventViewerDialog; 64class KOEventViewerDialog;
63class KOBeamPrefs; 65class KOBeamPrefs;
64class KSyncProfile; 66class KSyncProfile;
65class AlarmDialog; 67class AlarmDialog;
66class KCal::Attendee; 68class KCal::Attendee;
67 69
68namespace KCal { class FileStorage; } 70namespace KCal { class FileStorage; }
69 71
70using namespace KCal; 72using namespace KCal;
71 73
72/** 74/**
73 This is the main calendar widget. It provides the different vies on t he 75 This is the main calendar widget. It provides the different vies on t he
74 calendar data as well as the date navigator. It also handles synchronisation 76 calendar data as well as the date navigator. It also handles synchronisation
75 of the different views and controls the different dialogs like preferences, 77 of the different views and controls the different dialogs like preferences,
76 event editor, search dialog etc. 78 event editor, search dialog etc.
77 79
78 @short main calendar view widget 80 @short main calendar view widget
79 @author Cornelius Schumacher 81 @author Cornelius Schumacher
@@ -508,55 +510,55 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
508 QTimer* mRecheckAlarmTimer; 510 QTimer* mRecheckAlarmTimer;
509 void computeAlarm( QString ); 511 void computeAlarm( QString );
510 void startAlarm( QString, QString ); 512 void startAlarm( QString, QString );
511 void setSyncEventsReadOnly(); 513 void setSyncEventsReadOnly();
512 514
513 QDateTime loadedFileVersion; 515 QDateTime loadedFileVersion;
514 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 516 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
515 void checkExternalId( Incidence * inc ); 517 void checkExternalId( Incidence * inc );
516 int mGlobalSyncMode; 518 int mGlobalSyncMode;
517 QString mCurrentSyncDevice; 519 QString mCurrentSyncDevice;
518 QString mCurrentSyncName; 520 QString mCurrentSyncName;
519 KOBeamPrefs* beamDialog; 521 KOBeamPrefs* beamDialog;
520 void init(); 522 void init();
521 int mDatePickerMode; 523 int mDatePickerMode;
522 bool mFlagEditDescription; 524 bool mFlagEditDescription;
523 QDateTime mLastCalendarSync; 525 QDateTime mLastCalendarSync;
524 void createPrinter(); 526 void createPrinter();
525 527
526 void calendarModified( bool, Calendar * ); 528 void calendarModified( bool, Calendar * );
527 529
528 CalPrinter *mCalPrinter; 530 CalPrinter *mCalPrinter;
529 531
530 QSplitter *mPanner; 532 QSplitter *mPanner;
531 QSplitter *mLeftSplitter; 533 QSplitter *mLeftSplitter;
532 QWidget *mLeftFrame; 534 KDGanttMinimizeSplitter *mLeftFrame;
533 QWidgetStack *mRightFrame; 535 QWidgetStack *mRightFrame;
534 536
535 KDatePicker* mDatePicker; 537 KDatePicker* mDatePicker;
536 QVBox* mDateFrame; 538 QVBox* mDateFrame;
537 539
538 KDateNavigator *mDateNavigator; // widget showing small month view. 540 DateNavigatorContainer *mDateNavigator; // widget showing small month view.
539 541
540 KOFilterView *mFilterView; 542 KOFilterView *mFilterView;
541 543
542 ResourceView *mResourceView; 544 ResourceView *mResourceView;
543 545
544 // calendar object for this viewing instance 546 // calendar object for this viewing instance
545 Calendar *mCalendar; 547 Calendar *mCalendar;
546 548
547 CalendarResourceManager *mResourceManager; 549 CalendarResourceManager *mResourceManager;
548 550
549 FileStorage *mStorage; 551 FileStorage *mStorage;
550 552
551 DateNavigator *mNavigator; 553 DateNavigator *mNavigator;
552 554
553 KOViewManager *mViewManager; 555 KOViewManager *mViewManager;
554 KODialogManager *mDialogManager; 556 KODialogManager *mDialogManager;
555 557
556 // Calendar filters 558 // Calendar filters
557 QPtrList<CalFilter> mFilters; 559 QPtrList<CalFilter> mFilters;
558 560
559 // various housekeeping variables. 561 // various housekeeping variables.
560 bool mModified; // flag indicating if calendar is modified 562 bool mModified; // flag indicating if calendar is modified
561 bool mReadOnly; // flag indicating if calendar is read-only 563 bool mReadOnly; // flag indicating if calendar is read-only
562 QDate mSaveSingleDate; 564 QDate mSaveSingleDate;
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
new file mode 100644
index 0000000..cbfc5b2
--- a/dev/null
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -0,0 +1,218 @@
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
24*/
25
26#include <kdebug.h>
27#include <klocale.h>
28
29//#include "koglobals.h"
30#include "navigatorbar.h"
31#include "kdatenavigator.h"
32
33#include <kcalendarsystem.h>
34
35#include "datenavigatorcontainer.h"
36
37DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
38 const char *name )
39 : QWidget( parent, name ), mCalendar( 0 ),
40 mHorizontalCount( 1 ), mVerticalCount( 1 )
41{
42 mExtraViews.setAutoDelete( true );
43
44 mNavigatorView = new KDateNavigator( this, name );
45
46 connectNavigatorView( mNavigatorView );
47}
48
49DateNavigatorContainer::~DateNavigatorContainer()
50{
51}
52
53void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
54{
55 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
56 SIGNAL( datesSelected( const KCal::DateList & ) ) );
57#if 0
58 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
59 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
60 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
61 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
62#endif
63 connect( v, SIGNAL( weekClicked( const QDate & ) ),
64 SIGNAL( weekClicked( const QDate & ) ) );
65
66 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
67 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
68
69 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
70 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
72 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
73
74 connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) );
75}
76
77void DateNavigatorContainer::setCalendar( Calendar *cal )
78{
79 mCalendar = cal;
80 mNavigatorView->setCalendar( cal );
81 KDateNavigator *n;
82 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
83 n->setCalendar( cal );
84 }
85}
86
87void DateNavigatorContainer::updateDayMatrix()
88{
89 mNavigatorView->updateDayMatrix();
90 KDateNavigator *n;
91 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
92 n->updateDayMatrix();
93 }
94}
95
96void DateNavigatorContainer::updateToday()
97{
98 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
99#if 0
100 mNavigatorView->updateToday();
101 KDateNavigator *n;
102 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
103 n->updateToday();
104 }
105#endif
106}
107
108void DateNavigatorContainer::updateView()
109{
110 mNavigatorView->updateView();
111 KDateNavigator *n;
112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
113 n->updateView();
114 }
115}
116
117void DateNavigatorContainer::updateConfig()
118{
119 mNavigatorView->updateConfig();
120 KDateNavigator *n;
121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
122 n->updateConfig();
123 }
124}
125
126void DateNavigatorContainer::selectDates( const DateList &dateList )
127{
128 mNavigatorView->selectDates( dateList );
129 setBaseDates();
130}
131
132void DateNavigatorContainer::setBaseDates()
133{
134 KCal::DateList dateList = mNavigatorView->selectedDates();
135 if ( dateList.isEmpty() ) {
136 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
137 }
138 QDate baseDate = dateList.first();
139 KDateNavigator *n;
140 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
141 baseDate = baseDate.addDays( baseDate.daysInMonth () );
142 n->setBaseDate( baseDate );
143 }
144}
145
146void DateNavigatorContainer::resizeEvent( QResizeEvent * )
147{
148#if 0
149 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
150 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
151 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
152 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
153 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
154#endif
155
156 QSize minSize = mNavigatorView->minimumSizeHint();
157
158// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
159
160 int verticalCount = size().height() / minSize.height();
161 int horizontalCount = size().width() / minSize.width();
162 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
163 if ( horizontalCount != mHorizontalCount ||
164 verticalCount != mVerticalCount ) {
165 uint count = horizontalCount * verticalCount;
166 if ( count == 0 ) return;
167
168 while ( count > ( mExtraViews.count() + 1 ) ) {
169 KDateNavigator *n = new KDateNavigator( this );
170 mExtraViews.append( n );
171 n->setCalendar( mCalendar );
172 setBaseDates();
173 connectNavigatorView( n );
174 n->show();
175 }
176
177 while ( count < ( mExtraViews.count() + 1 ) ) {
178 mExtraViews.removeLast();
179 }
180
181 mHorizontalCount = horizontalCount;
182 mVerticalCount = verticalCount;
183 }
184
185 int height = size().height() / verticalCount;
186 int width = size().width() / horizontalCount;
187
188 NavigatorBar *bar = mNavigatorView->navigatorBar();
189 if ( horizontalCount > 1 ) bar->showButtons( true, false );
190 else bar->showButtons( true, true );
191
192 mNavigatorView->setGeometry(0,
193 0, width, height );
194 for( uint i = 0; i < mExtraViews.count(); ++i ) {
195 int x = ( i + 1 ) % horizontalCount;
196 int y = ( i + 1 ) / horizontalCount;
197
198 KDateNavigator *view = mExtraViews.at( i );
199 bar = view->navigatorBar();
200 if ( y > 0 ) bar->showButtons( false, false );
201 else {
202 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
203 else bar->showButtons( false, false );
204 }
205 view->setGeometry( x * width,
206 y * height, width, height );
207 }
208}
209
210QSize DateNavigatorContainer::minimumSizeHint() const
211{
212 return mNavigatorView->minimumSizeHint();
213}
214
215QSize DateNavigatorContainer::sizeHint() const
216{
217 return mNavigatorView->sizeHint();
218}
diff --git a/korganizer/datenavigatorcontainer.h b/korganizer/datenavigatorcontainer.h
new file mode 100644
index 0000000..affa8e1
--- a/dev/null
+++ b/korganizer/datenavigatorcontainer.h
@@ -0,0 +1,90 @@
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
24*/
25#ifndef DATENAVIGATORCONTAINER_H
26#define DATENAVIGATORCONTAINER_H
27
28class KDateNavigator;
29
30#include <qwidget.h>
31#include <libkcal/calendar.h>
32using namespace KCal;
33
34class DateNavigatorContainer: public QWidget
35{
36 Q_OBJECT
37 public:
38 DateNavigatorContainer( QWidget *parent = 0, const char *name = 0 );
39 ~DateNavigatorContainer();
40
41 /**
42 Associate date navigator with a calendar. It is used by KODayMatrix.
43 */
44 void setCalendar( Calendar * );
45
46 QSize minimumSizeHint() const;
47 QSize sizeHint() const;
48 KDateNavigator * navigatorView() { return mNavigatorView;}
49
50 public slots:
51 void selectDates( const KCal::DateList & );
52 void updateView();
53 void updateConfig();
54 void updateDayMatrix();
55 void updateToday();
56
57 signals:
58 void datesSelected( const KCal::DateList & );
59 void incidenceDropped( Incidence *, const QDate & );
60 void incidenceDroppedMove( Incidence *, const QDate & );
61 void weekClicked( const QDate &);
62
63 void goPrevious();
64 void goNext();
65
66 void goNextMonth();
67 void goPrevMonth();
68 void goNextYear();
69 void goPrevYear();
70
71 void monthSelected( int month );
72
73 protected:
74 void resizeEvent( QResizeEvent * );
75
76 void setBaseDates();
77 void connectNavigatorView( KDateNavigator *v );
78
79 private:
80 KDateNavigator *mNavigatorView;
81
82 KCal::Calendar *mCalendar;
83
84 QPtrList<KDateNavigator> mExtraViews;
85
86 int mHorizontalCount;
87 int mVerticalCount;
88};
89
90#endif
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index c08f44f..e76a85a 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -24,124 +24,138 @@
24#include <qstring.h> 24#include <qstring.h>
25#include <qkeycode.h> 25#include <qkeycode.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qframe.h> 28#include <qframe.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kglobal.h> 34#include <kglobal.h>
35 35
36#include "koglobals.h" 36#include "koglobals.h"
37#include "koprefs.h" 37#include "koprefs.h"
38#ifndef KORG_NOPLUGINS 38#ifndef KORG_NOPLUGINS
39#include "kocore.h" 39#include "kocore.h"
40#endif 40#endif
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#include "navigatorbar.h" 44#include "navigatorbar.h"
45 45
46#include "kdatenavigator.h" 46#include "kdatenavigator.h"
47 47
48KDateNavigator::KDateNavigator( QWidget *parent, Calendar *calendar, 48KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
49 bool show_week_nums, const char *name,
50 QDate startDate )
51 : QFrame(parent, name), 49 : QFrame(parent, name),
52 updateTimer(0L) 50 updateTimer(0L)
53{ 51{
54 mCalendar = calendar; 52 setFrameStyle(QFrame::NoFrame);
55 53 QDate startDate = QDate::currentDate();
56 setFrameStyle(QFrame::NoFrame);
57
58 QGridLayout *topLayout = new QGridLayout(this,8,8); 54 QGridLayout *topLayout = new QGridLayout(this,8,8);
59 55
60 if (! startDate.isValid()) { 56 if (! startDate.isValid()) {
61 qDebug("KDateNavigator::invalid startdate "); 57 qDebug("KDateNavigator::invalid startdate ");
62 startDate = QDate::currentDate(); 58 startDate = QDate::currentDate();
63 } 59 }
64 60
65 mSelectedDates.append(startDate); 61 mSelectedDates.append(startDate);
66 m_MthYr = startDate; 62 m_MthYr = startDate;
67 m_bShowWeekNums = show_week_nums; 63 m_bShowWeekNums = true;
68 64
69 setFont( KOPrefs::instance()->mDateNavigatorFont ); 65 setFont( KOPrefs::instance()->mDateNavigatorFont );
70 mNavigatorBar = new NavigatorBar( startDate, this ); 66 mNavigatorBar = new NavigatorBar( startDate, this );
71 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
72 //mNavigatorBar->resize( 1,1); 68 //mNavigatorBar->resize( 1,1);
73 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
74 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
75 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
76 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
77 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); 73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) );
78 74
79 // get the day of the week on the first day 75 // get the day of the week on the first day
80 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
81 m_fstDayOfWk = dayone.dayOfWeek(); 77 m_fstDayOfWk = dayone.dayOfWeek();
82 78
83 int i; 79 int i;
84 80
85 // Set up the heading fields. 81 // Set up the heading fields.
86 for( i = 0; i < 7; i++ ) { 82 for( i = 0; i < 7; i++ ) {
87 headings[i] = new QLabel("",this); 83 headings[i] = new QLabel("",this);
88 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
89 headings[i]->setAlignment(AlignCenter); 85 headings[i]->setAlignment(AlignCenter);
90 86
91 topLayout->addWidget(headings[i],1,i+1); 87 topLayout->addWidget(headings[i],1,i+1);
92 } 88 }
93 89
94 // Create the weeknumber labels 90 // Create the weeknumber labels
95 for( i = 0; i < 6; i++ ) { 91 for( i = 0; i < 6; i++ ) {
96 weeknos[i] = new QLabel(this); 92 weeknos[i] = new QLabel(this);
97 weeknos[i]->setAlignment(AlignCenter); 93 weeknos[i]->setAlignment(AlignCenter);
98 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
99 if(!show_week_nums) { 95 if(!m_bShowWeekNums) {
100 weeknos[i]->hide(); 96 weeknos[i]->hide();
101 } 97 }
102 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
103 99
104 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
105 } 101 }
106 102
107 daymatrix = new KODayMatrix( this, mCalendar, dayone, 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
108 "KDateNavigator::DayMatrix");
109 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
110 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
111 106
112 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
113 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
114 109
115 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
116 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
117 112
118 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
119 114
120 // read settings from configuration file. 115 // read settings from configuration file.
121 updateConfig(); 116 updateConfig();
122 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
123 setFixedSize ( sizeHint() ); 118 //setFixedSize ( sizeHint() );
119}
120void KDateNavigator::setCalendar( Calendar *cal )
121{
122 daymatrix->setCalendar( cal );
123}
124
125void KDateNavigator::setBaseDate( const QDate &date )
126{
127 m_MthYr = date;
128
129 updateDates();
130 updateView();
131
132 KCal::DateList dates;
133 dates.append( date );
134 mNavigatorBar->selectDates( dates );
135
136 daymatrix->clearSelection();
137 daymatrix->repaint();
124} 138}
125 139
126void KDateNavigator::enableRollover(RolloverType r) 140void KDateNavigator::enableRollover(RolloverType r)
127{ 141{
128 switch(r) 142 switch(r)
129 { 143 {
130 case None : 144 case None :
131 if (updateTimer) 145 if (updateTimer)
132 { 146 {
133 updateTimer->stop(); 147 updateTimer->stop();
134 delete updateTimer; 148 delete updateTimer;
135 updateTimer=0L; 149 updateTimer=0L;
136 } 150 }
137 break; 151 break;
138 case FollowDay : 152 case FollowDay :
139 case FollowMonth : 153 case FollowMonth :
140 if (!updateTimer) 154 if (!updateTimer)
141 { 155 {
142 updateTimer = new QTimer(this); 156 updateTimer = new QTimer(this);
143 QObject::connect(updateTimer,SIGNAL(timeout()), 157 QObject::connect(updateTimer,SIGNAL(timeout()),
144 this,SLOT(possiblyPastMidnight())); 158 this,SLOT(possiblyPastMidnight()));
145 } 159 }
146 updateTimer->start(0,true); 160 updateTimer->start(0,true);
147 lastDayChecked = QDate::currentDate(); 161 lastDayChecked = QDate::currentDate();
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 3ae1648..0aeb77a 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -21,67 +21,69 @@
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KDATENAVIGATOR_H 23#ifndef KDATENAVIGATOR_H
24#define KDATENAVIGATOR_H 24#define KDATENAVIGATOR_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32#include "kodaymatrix.h" 32#include "kodaymatrix.h"
33 33
34class QPushButton; 34class QPushButton;
35class QTimer; 35class QTimer;
36 36
37class KCalendarSystem; 37class KCalendarSystem;
38 38
39class NavigatorBar; 39class NavigatorBar;
40 40
41class KDateNavigator: public QFrame 41class KDateNavigator: public QFrame
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0, Calendar *calendar = 0, 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 bool show_week_numbers = false, const char *name = 0,
47 QDate date = QDate::currentDate() );
48 ~KDateNavigator(); 46 ~KDateNavigator();
49 47
50 /** The DateNavigator automatically checks for 48 /** The DateNavigator automatically checks for
51 * the passage of midnight. If rollover type is 49 * the passage of midnight. If rollover type is
52 * set to None, no signals are emitted and no 50 * set to None, no signals are emitted and no
53 * processing is done. With rollover set to 51 * processing is done. With rollover set to
54 * FollowDay, the day highlighter changes at 52 * FollowDay, the day highlighter changes at
55 * midnight and dayPassed() is emitted. 53 * midnight and dayPassed() is emitted.
56 * With FollowMonth, it has the same effect 54 * With FollowMonth, it has the same effect
57 * as FollowDay but also adjusts the month that is 55 * as FollowDay but also adjusts the month that is
58 * visible and emits monthPassed() when the month changes. 56 * visible and emits monthPassed() when the month changes.
59 */ 57 */
60 enum RolloverType { None, FollowDay, FollowMonth } ; 58 enum RolloverType { None, FollowDay, FollowMonth } ;
61 void enableRollover( RolloverType ); 59 void enableRollover( RolloverType );
62 60
63 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & );
64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
64 66
65 public slots: 67 public slots:
66 void selectDates( const KCal::DateList & ); 68 void selectDates( const KCal::DateList & );
67 void updateView(); 69 void updateView();
68 void updateConfig(); 70 void updateConfig();
69 void updateDayMatrix(); 71 void updateDayMatrix();
70 72
71 signals: 73 signals:
72 void datesSelected( const KCal::DateList & ); 74 void datesSelected( const KCal::DateList & );
73 void eventDropped( Event * ); 75 void eventDropped( Event * );
74 void weekClicked( const QDate &); 76 void weekClicked( const QDate &);
75 77
76 void goPrevious(); 78 void goPrevious();
77 void goNext(); 79 void goNext();
78 80
79 void goNextMonth(); 81 void goNextMonth();
80 void goPrevMonth(); 82 void goPrevMonth();
81 void goNextYear(); 83 void goNextYear();
82 void goPrevYear(); 84 void goPrevYear();
83 void monthSelected( int ); 85 void monthSelected( int );
84 86
85 // Signals emitted at midnight carrying the new date. 87 // Signals emitted at midnight carrying the new date.
86 void dayPassed( QDate ); 88 void dayPassed( QDate );
87 void monthPassed( QDate ); 89 void monthPassed( QDate );
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 989f758..a886f4a 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -66,79 +66,92 @@ void DynamicTip::maybeTip( const QPoint &pos )
66 int dheight = sz.height()*7 / 42; 66 int dheight = sz.height()*7 / 42;
67 int dwidth = sz.width() / 7; 67 int dwidth = sz.width() / 7;
68 int row = pos.y()/dheight; 68 int row = pos.y()/dheight;
69 int col = pos.x()/dwidth; 69 int col = pos.x()/dwidth;
70 70
71 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 71 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
72 72
73// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 73// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
74// col << "][" << row << "] => " <<(col+row*7) << endl; 74// col << "][" << row << "] => " <<(col+row*7) << endl;
75 75
76 //show holiday names only 76 //show holiday names only
77 QString str = matrix->getHolidayLabel(col+row*7); 77 QString str = matrix->getHolidayLabel(col+row*7);
78 if (str.isEmpty()) return; 78 if (str.isEmpty()) return;
79 tip(rct, str); 79 tip(rct, str);
80} 80}
81 81
82 82
83// ============================================================================ 83// ============================================================================
84// K O D A Y M A T R I X 84// K O D A Y M A T R I X
85// ============================================================================ 85// ============================================================================
86 86
87const int KODayMatrix::NOSELECTION = -1000; 87const int KODayMatrix::NOSELECTION = -1000;
88const int KODayMatrix::NUMDAYS = 42; 88const int KODayMatrix::NUMDAYS = 42;
89 89
90KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
91 : QFrame( parent, name ), mCalendar( 0 )
92
93#if 0
90KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : 94KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
91 QFrame(parent, name) 95 QFrame(parent, name)
96#endif
92{ 97{
93 mCalendar = calendar; 98
94 mPendingUpdateBeforeRepaint = false; 99 mPendingUpdateBeforeRepaint = false;
95 100
96 // initialize dynamic arrays 101 // initialize dynamic arrays
97 days = new QDate[NUMDAYS]; 102 days = new QDate[NUMDAYS];
98 daylbls = new QString[NUMDAYS]; 103 daylbls = new QString[NUMDAYS];
99 events = new int[NUMDAYS]; 104 events = new int[NUMDAYS];
100 mToolTip = new DynamicTip(this); 105 mToolTip = new DynamicTip(this);
101 106
102 // set default values used for drawing the matrix 107 // set default values used for drawing the matrix
103 mDefaultBackColor = palette().active().base(); 108 mDefaultBackColor = palette().active().base();
104 mDefaultTextColor = palette().active().foreground(); 109 mDefaultTextColor = palette().active().foreground();
105 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 110 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
106 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 111 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
107 mSelectedDaysColor = QColor("white"); 112 mSelectedDaysColor = QColor("white");
108 mTodayMarginWidth = 2; 113 mTodayMarginWidth = 2;
109 mSelEnd = mSelStart = NOSELECTION; 114 mSelEnd = mSelStart = NOSELECTION;
110 115
111 setAcceptDrops(true); 116 setAcceptDrops(true);
112 //setFont( QFont("Arial", 10) ); 117 //setFont( QFont("Arial", 10) );
113 118
114 mUpdateTimer = new QTimer( this ); 119 mUpdateTimer = new QTimer( this );
115 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 120 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
116 mRepaintTimer = new QTimer( this ); 121 mRepaintTimer = new QTimer( this );
117 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 122 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
118 mDayChanged = false; 123 mDayChanged = false;
119 updateView(); 124 updateView();
120} 125}
126void KODayMatrix::setCalendar( Calendar *cal )
127{
128 mCalendar = cal;
129
130 setAcceptDrops( mCalendar );
131
132 updateEvents();
133}
121 134
122QColor KODayMatrix::getShadedColor(QColor color) 135QColor KODayMatrix::getShadedColor(QColor color)
123{ 136{
124 QColor shaded; 137 QColor shaded;
125 int h=0; 138 int h=0;
126 int s=0; 139 int s=0;
127 int v=0; 140 int v=0;
128 color.hsv(&h,&s,&v); 141 color.hsv(&h,&s,&v);
129 s = s/4; 142 s = s/4;
130 v = 192+v/4; 143 v = 192+v/4;
131 shaded.setHsv(h,s,v); 144 shaded.setHsv(h,s,v);
132 145
133 return shaded; 146 return shaded;
134} 147}
135 148
136KODayMatrix::~KODayMatrix() 149KODayMatrix::~KODayMatrix()
137{ 150{
138 delete [] days; 151 delete [] days;
139 delete [] daylbls; 152 delete [] daylbls;
140 delete [] events; 153 delete [] events;
141 delete mToolTip; 154 delete mToolTip;
142} 155}
143 156
144/* 157/*
@@ -165,81 +178,89 @@ void KODayMatrix::addSelectedDaysTo(DateList& selDays)
165 } 178 }
166 179
167 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 180 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
168 if (mSelEnd > NUMDAYS-1) { 181 if (mSelEnd > NUMDAYS-1) {
169 for (int i = i0; i <= NUMDAYS-1; i++) { 182 for (int i = i0; i <= NUMDAYS-1; i++) {
170 selDays.append(days[i]); 183 selDays.append(days[i]);
171 } 184 }
172 for (int i = NUMDAYS; i < mSelEnd; i++) { 185 for (int i = NUMDAYS; i < mSelEnd; i++) {
173 selDays.append(days[0].addDays(i)); 186 selDays.append(days[0].addDays(i));
174 } 187 }
175 188
176 // apply normal routine to selection being entirely within matrix limits 189 // apply normal routine to selection being entirely within matrix limits
177 } else { 190 } else {
178 for (int i = i0; i <= mSelEnd; i++) { 191 for (int i = i0; i <= mSelEnd; i++) {
179 selDays.append(days[i]); 192 selDays.append(days[i]);
180 } 193 }
181 } 194 }
182} 195}
183 196
184void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 197void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
185{ 198{
186 mSelStart = startdate.daysTo(start); 199 mSelStart = startdate.daysTo(start);
187 mSelEnd = startdate.daysTo(end); 200 mSelEnd = startdate.daysTo(end);
188} 201}
202void KODayMatrix::clearSelection()
203{
204 mSelEnd = mSelStart = NOSELECTION;
205}
189 206
190 207
191void KODayMatrix::recalculateToday() 208void KODayMatrix::recalculateToday()
192{ 209{
193 today = -1; 210 today = -1;
194 for (int i=0; i<NUMDAYS; i++) { 211 for (int i=0; i<NUMDAYS; i++) {
195 events[i] = 0; 212 events[i] = 0;
196 days[i] = startdate.addDays(i); 213 days[i] = startdate.addDays(i);
197 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 214 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
198 215
199 // if today is in the currently displayed month, hilight today 216 // if today is in the currently displayed month, hilight today
200 if (days[i].year() == QDate::currentDate().year() && 217 if (days[i].year() == QDate::currentDate().year() &&
201 days[i].month() == QDate::currentDate().month() && 218 days[i].month() == QDate::currentDate().month() &&
202 days[i].day() == QDate::currentDate().day()) { 219 days[i].day() == QDate::currentDate().day()) {
203 today = i; 220 today = i;
204 } 221 }
205 } 222 }
206 // qDebug(QString("Today is visible at %1.").arg(today)); 223 // qDebug(QString("Today is visible at %1.").arg(today));
207} 224}
208 225
209void KODayMatrix::updateView() 226void KODayMatrix::updateView()
210{ 227{
211 updateView(startdate); 228 updateView(startdate);
212} 229}
213void KODayMatrix::repaintViewTimed() 230void KODayMatrix::repaintViewTimed()
214{ 231{
215 mRepaintTimer->stop(); 232 mRepaintTimer->stop();
216 repaint(false); 233 repaint(false);
217} 234}
218void KODayMatrix::updateViewTimed() 235void KODayMatrix::updateViewTimed()
219{ 236{
220
221 mUpdateTimer->stop(); 237 mUpdateTimer->stop();
238 if ( !mCalendar ) {
239 qDebug("NOT CAL ");
240 return;
241 }
242 //qDebug("KODayMatrix::updateViewTimed ");
222 for(int i = 0; i < NUMDAYS; i++) { 243 for(int i = 0; i < NUMDAYS; i++) {
223 // if events are set for the day then remember to draw it bold 244 // if events are set for the day then remember to draw it bold
224 QPtrList<Event> eventlist = mCalendar->events(days[i]); 245 QPtrList<Event> eventlist = mCalendar->events(days[i]);
225 Event *event; 246 Event *event;
226 int numEvents = eventlist.count(); 247 int numEvents = eventlist.count();
227 QString holiStr = ""; 248 QString holiStr = "";
228 for(event=eventlist.first();event != 0;event=eventlist.next()) { 249 for(event=eventlist.first();event != 0;event=eventlist.next()) {
229 ushort recurType = event->recurrence()->doesRecur(); 250 ushort recurType = event->recurrence()->doesRecur();
230 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 251 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
231 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 252 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
232 numEvents--; 253 numEvents--;
233 } 254 }
234 if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { 255 if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) {
235 if ( !holiStr.isEmpty() ) 256 if ( !holiStr.isEmpty() )
236 holiStr += "\n"; 257 holiStr += "\n";
237 holiStr += event->summary(); 258 holiStr += event->summary();
238 } 259 }
239 } 260 }
240 events[i] = numEvents; 261 events[i] = numEvents;
241 //if it is a holy day then draw it red. Sundays are consider holidays, too 262 //if it is a holy day then draw it red. Sundays are consider holidays, too
242 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 263 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
243 !holiStr.isEmpty()) { 264 !holiStr.isEmpty()) {
244 mHolidays[i] = holiStr; 265 mHolidays[i] = holiStr;
245 } else { 266 } else {
@@ -273,48 +294,70 @@ void KODayMatrix::updateView(QDate actdate)
273 // otherwise, for month forward and backward, it must be avoided 294 // otherwise, for month forward and backward, it must be avoided
274 if( mSelStart > NUMDAYS || mSelStart < 0 ) 295 if( mSelStart > NUMDAYS || mSelStart < 0 )
275 mSelStart = mSelStart + tmp; 296 mSelStart = mSelStart + tmp;
276 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 297 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
277 mSelEnd = mSelEnd + tmp; 298 mSelEnd = mSelEnd + tmp;
278 } 299 }
279 } 300 }
280 startdate = actdate; 301 startdate = actdate;
281 mDayChanged = true; 302 mDayChanged = true;
282 recalculateToday(); 303 recalculateToday();
283 } 304 }
284 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 305 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
285 if ( !isVisible() ) { 306 if ( !isVisible() ) {
286 mPendingUpdateBeforeRepaint = true; 307 mPendingUpdateBeforeRepaint = true;
287 } else { 308 } else {
288#ifdef DESKTOP_VERSION 309#ifdef DESKTOP_VERSION
289 //mRepaintTimer->start( 250 ); 310 //mRepaintTimer->start( 250 );
290 mUpdateTimer->start( 250 ); 311 mUpdateTimer->start( 250 );
291#else 312#else
292 mRepaintTimer->start( 350 ); 313 mRepaintTimer->start( 350 );
293 mUpdateTimer->start( 2000 ); 314 mUpdateTimer->start( 2000 );
294#endif 315#endif
295 } 316 }
296} 317}
318void KODayMatrix::updateEvents()
319{
320 if ( !mCalendar ) return;
321
322 for( int i = 0; i < NUMDAYS; i++ ) {
323 // if events are set for the day then remember to draw it bold
324 QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
325 int numEvents = eventlist.count();
326 Event *event;
327 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
328 ushort recurType = event->doesRecur();
329
330 if ( ( recurType == Recurrence::rDaily &&
331 !KOPrefs::instance()->mDailyRecur ) ||
332 ( recurType == Recurrence::rWeekly &&
333 !KOPrefs::instance()->mWeeklyRecur ) ) {
334 numEvents--;
335 }
336 }
337 events[ i ] = numEvents;
338 }
339}
297 340
298const QDate& KODayMatrix::getDate(int offset) 341const QDate& KODayMatrix::getDate(int offset)
299{ 342{
300 if (offset < 0 || offset > NUMDAYS-1) { 343 if (offset < 0 || offset > NUMDAYS-1) {
301 qDebug("Wrong offset2 "); 344 qDebug("Wrong offset2 ");
302 return days[0]; 345 return days[0];
303 } 346 }
304 return days[offset]; 347 return days[offset];
305} 348}
306 349
307QString KODayMatrix::getHolidayLabel(int offset) 350QString KODayMatrix::getHolidayLabel(int offset)
308{ 351{
309 if (offset < 0 || offset > NUMDAYS-1) { 352 if (offset < 0 || offset > NUMDAYS-1) {
310 qDebug("Wrong offset1 "); 353 qDebug("Wrong offset1 ");
311 return 0; 354 return 0;
312 } 355 }
313 return mHolidays[offset]; 356 return mHolidays[offset];
314} 357}
315 358
316int KODayMatrix::getDayIndexFrom(int x, int y) 359int KODayMatrix::getDayIndexFrom(int x, int y)
317{ 360{
318 return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? 361 return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ?
319 6 - x/daysize.width() : x/daysize.width()); 362 6 - x/daysize.width() : x/daysize.width());
320} 363}
@@ -407,49 +450,49 @@ void KODayMatrix::dragMoveEvent(QDragMoveEvent *e)
407{ 450{
408#ifndef KORG_NODND 451#ifndef KORG_NODND
409 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 452 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
410 e->ignore(); 453 e->ignore();
411 return; 454 return;
412 } 455 }
413 456
414 e->accept(); 457 e->accept();
415#endif 458#endif
416} 459}
417 460
418void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) 461void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/)
419{ 462{
420#ifndef KORG_NODND 463#ifndef KORG_NODND
421// setPalette(oldPalette); 464// setPalette(oldPalette);
422// update(); 465// update();
423#endif 466#endif
424} 467}
425 468
426void KODayMatrix::dropEvent(QDropEvent *e) 469void KODayMatrix::dropEvent(QDropEvent *e)
427{ 470{
428#ifndef KORG_NODND 471#ifndef KORG_NODND
429// kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; 472// kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl;
430 473
431 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { 474 if (!mCalendar || !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) {
432 e->ignore(); 475 e->ignore();
433 return; 476 return;
434 } 477 }
435 478
436 DndFactory factory( mCalendar ); 479 DndFactory factory( mCalendar );
437 Event *event = factory.createDrop(e); 480 Event *event = factory.createDrop(e);
438 481
439 if (event) { 482 if (event) {
440 e->acceptAction(); 483 e->acceptAction();
441 484
442 Event *existingEvent = mCalendar->event(event->uid()); 485 Event *existingEvent = mCalendar->event(event->uid());
443 486
444 if(existingEvent) { 487 if(existingEvent) {
445 // uniquify event 488 // uniquify event
446 event->recreate(); 489 event->recreate();
447/* 490/*
448 KMessageBox::sorry(this, 491 KMessageBox::sorry(this,
449 i18n("Event already exists in this calendar."), 492 i18n("Event already exists in this calendar."),
450 i18n("Drop Event")); 493 i18n("Drop Event"));
451 delete event; 494 delete event;
452 return; 495 return;
453*/ 496*/
454 } 497 }
455// kdDebug() << "Drop new Event" << endl; 498// kdDebug() << "Drop new Event" << endl;
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 2dd112a..ba4853f 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -96,84 +96,86 @@ private:
96 * two distinct groups of date selections as in the old class) 96 * two distinct groups of date selections as in the old class)
97 * o now that you can select more then a week it can happen that not all selected days are 97 * o now that you can select more then a week it can happen that not all selected days are
98 * displayed in the matrix. However this is preferred to the alternative which would mean to 98 * displayed in the matrix. However this is preferred to the alternative which would mean to
99 * adjust the selection and leave some days undisplayed while scrolling through the months 99 * adjust the selection and leave some days undisplayed while scrolling through the months
100 * 100 *
101 * @short day matrix widget of the KDateNavigator 101 * @short day matrix widget of the KDateNavigator
102 * 102 *
103 * @author Eitzenberger Thomas 103 * @author Eitzenberger Thomas
104 */ 104 */
105class KODayMatrix: public QFrame { 105class KODayMatrix: public QFrame {
106 106
107 Q_OBJECT 107 Q_OBJECT
108 108
109public: 109public:
110 110
111 /** constructor to create a day matrix widget. 111 /** constructor to create a day matrix widget.
112 * 112 *
113 * @param parent widget that is the parent of the day matrix. Normally this should 113 * @param parent widget that is the parent of the day matrix. Normally this should
114 * be a KDateNavigator 114 * be a KDateNavigator
115 * @param calendar instance of a calendar on which all calculations are based 115 * @param calendar instance of a calendar on which all calculations are based
116 * @param date start date of the matrix (is expected to be already fixed). It is 116 * @param date start date of the matrix (is expected to be already fixed). It is
117 * assumed that this date is the first week day to be shown in the matrix. 117 * assumed that this date is the first week day to be shown in the matrix.
118 * @param name name of the widget 118 * @param name name of the widget
119 */ 119 */
120 KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); 120 KODayMatrix( QWidget *parent, const char *name );
121 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
121 122
122 /** destructor that deallocates all dynamically allocated private members. 123 /** destructor that deallocates all dynamically allocated private members.
123 */ 124 */
124 ~KODayMatrix(); 125 ~KODayMatrix();
125 126
126 /** updates the day matrix to start with the given date. Does all the necessary 127 /** updates the day matrix to start with the given date. Does all the necessary
127 * checks for holidays or events on a day and stores them for display later on. 128 * checks for holidays or events on a day and stores them for display later on.
128 * Does NOT update the view visually. Call repaint() for this. 129 * Does NOT update the view visually. Call repaint() for this.
129 * 130 *
130 * @param actdate recalculates the day matrix to show NUMDAYS starting from this 131 * @param actdate recalculates the day matrix to show NUMDAYS starting from this
131 * date. 132 * date.
132 */ 133 */
133 void updateView(QDate actdate); 134 void updateView(QDate actdate);
135 void updateEvents();
134 136
135 /** returns the QDate object associated with day indexed by the 137 /** returns the QDate object associated with day indexed by the
136 * supplied offset. 138 * supplied offset.
137 */ 139 */
138 const QDate& getDate(int offset); 140 const QDate& getDate(int offset);
139 141 void setCalendar( Calendar * );
140 /** returns the official name of this holy day or 0 if there is no label 142 /** returns the official name of this holy day or 0 if there is no label
141 * for this day. 143 * for this day.
142 */ 144 */
143 QString getHolidayLabel(int offset); 145 QString getHolidayLabel(int offset);
144 146
145 /** adds all actual selected days from mSelStart to mSelEnd to the supplied 147 /** adds all actual selected days from mSelStart to mSelEnd to the supplied
146 * DateList. 148 * DateList.
147 */ 149 */
148 void addSelectedDaysTo(DateList&); 150 void addSelectedDaysTo(DateList&);
149 151
150 /** sets the actual to be displayed selection in the day matrix starting from 152 /** sets the actual to be displayed selection in the day matrix starting from
151 * start and ending with end. Theview must be manually updated by calling 153 * start and ending with end. Theview must be manually updated by calling
152 * repaint. (?) 154 * repaint. (?)
153 */ 155 */
154 void setSelectedDaysFrom(const QDate& start, const QDate& end); 156 void setSelectedDaysFrom(const QDate& start, const QDate& end);
155 157 void clearSelection();
156 158
157 /** Is today visible in the view? Keep this in sync with 159 /** Is today visible in the view? Keep this in sync with
158 * the values today (below) can take. 160 * the values today (below) can take.
159 */ 161 */
160 bool isTodayVisible() const { return today>=0; } ; 162 bool isTodayVisible() const { return today>=0; } ;
161 163
162 /** If today is visible, then we can find out if today is 164 /** If today is visible, then we can find out if today is
163 * near the beginning or the end of the month. 165 * near the beginning or the end of the month.
164 * This is dependent on today remaining the index 166 * This is dependent on today remaining the index
165 * in the array of visible dates and going from 167 * in the array of visible dates and going from
166 * top left (0) to bottom right (41). 168 * top left (0) to bottom right (41).
167 */ 169 */
168 bool isBeginningOfMonth() const { return today<=8; } ; 170 bool isBeginningOfMonth() const { return today<=8; } ;
169 bool isEndOfMonth() const { return today>=27; } ; 171 bool isEndOfMonth() const { return today>=27; } ;
170 172
171public slots: 173public slots:
172 /** Recalculates all the flags of the days in the matrix like holidays or events 174 /** Recalculates all the flags of the days in the matrix like holidays or events
173 * on a day (Actually calls above method with the actual startdate). 175 * on a day (Actually calls above method with the actual startdate).
174 */ 176 */
175 void updateView(); 177 void updateView();
176 void updateViewTimed(); 178 void updateViewTimed();
177 void repaintViewTimed(); 179 void repaintViewTimed();
178 180
179 /** 181 /**
diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro
index e6c3f8d..91b5a01 100644
--- a/korganizer/korganizerE.pro
+++ b/korganizer/korganizerE.pro
@@ -7,49 +7,49 @@ DESTDIR=$(QPEDIR)/bin
7 7
8INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include 8INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include
9 9
10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 10DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 11DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
12DEFINES += KORG_NOLVALTERNATION 12DEFINES += KORG_NOLVALTERNATION
13#KORG_NOKABC 13#KORG_NOKABC
14LIBS += -lmicrokdepim 14LIBS += -lmicrokdepim
15LIBS += -lmicrokcal 15LIBS += -lmicrokcal
16LIBS += -lmicrokde 16LIBS += -lmicrokde
17LIBS += -lmicroqtcompat 17LIBS += -lmicroqtcompat
18 18
19LIBS += $(GCC3EXTRALIB1) 19LIBS += $(GCC3EXTRALIB1)
20LIBS += $(GCC3EXTRALIB2) 20LIBS += $(GCC3EXTRALIB2)
21 21
22 22
23LIBS += -lqpe 23LIBS += -lqpe
24LIBS += -ljpeg 24LIBS += -ljpeg
25LIBS += $(QTOPIALIB) 25LIBS += $(QTOPIALIB)
26LIBS += -L$(QPEDIR)/lib 26LIBS += -L$(QPEDIR)/lib
27 27
28INTERFACES = kofilterview_base.ui 28INTERFACES = kofilterview_base.ui
29#filteredit_base.ui 29#filteredit_base.ui
30 30
31HEADERS = \ 31HEADERS = datenavigatorcontainer.h \
32 wordsgerman.h \ 32 wordsgerman.h \
33 filteredit_base.h \ 33 filteredit_base.h \
34 alarmclient.h \ 34 alarmclient.h \
35 calendarview.h \ 35 calendarview.h \
36 customlistviewitem.h \ 36 customlistviewitem.h \
37 datenavigator.h \ 37 datenavigator.h \
38 docprefs.h \ 38 docprefs.h \
39 filtereditdialog.h \ 39 filtereditdialog.h \
40 incomingdialog.h \ 40 incomingdialog.h \
41 incomingdialog_base.h \ 41 incomingdialog_base.h \
42 interfaces/korganizer/baseview.h \ 42 interfaces/korganizer/baseview.h \
43 interfaces/korganizer/calendarviewbase.h \ 43 interfaces/korganizer/calendarviewbase.h \
44 journalentry.h \ 44 journalentry.h \
45 kdateedit.h \ 45 kdateedit.h \
46 kdatenavigator.h \ 46 kdatenavigator.h \
47 koagenda.h \ 47 koagenda.h \
48 koagendaitem.h \ 48 koagendaitem.h \
49 koagendaview.h \ 49 koagendaview.h \
50 kocounterdialog.h \ 50 kocounterdialog.h \
51 kodaymatrix.h \ 51 kodaymatrix.h \
52 kodialogmanager.h \ 52 kodialogmanager.h \
53 koeditordetails.h \ 53 koeditordetails.h \
54 koeditorgeneral.h \ 54 koeditorgeneral.h \
55 koeditorgeneralevent.h \ 55 koeditorgeneralevent.h \
@@ -71,49 +71,49 @@ HEADERS = \
71 koprefsdialog.h \ 71 koprefsdialog.h \
72 kotimespanview.h \ 72 kotimespanview.h \
73 kotodoeditor.h \ 73 kotodoeditor.h \
74 kotodoview.h \ 74 kotodoview.h \
75 kotodoviewitem.h \ 75 kotodoviewitem.h \
76 koviewmanager.h \ 76 koviewmanager.h \
77 kowhatsnextview.h \ 77 kowhatsnextview.h \
78 ktimeedit.h \ 78 ktimeedit.h \
79 lineview.h \ 79 lineview.h \
80 mainwindow.h \ 80 mainwindow.h \
81 navigatorbar.h \ 81 navigatorbar.h \
82 outgoingdialog.h \ 82 outgoingdialog.h \
83 outgoingdialog_base.h \ 83 outgoingdialog_base.h \
84 publishdialog.h \ 84 publishdialog.h \
85 publishdialog_base.h \ 85 publishdialog_base.h \
86 savetemplatedialog.h \ 86 savetemplatedialog.h \
87 searchdialog.h \ 87 searchdialog.h \
88 simplealarmclient.h \ 88 simplealarmclient.h \
89 statusdialog.h \ 89 statusdialog.h \
90 timeline.h \ 90 timeline.h \
91 timespanview.h \ 91 timespanview.h \
92 version.h \ 92 version.h \
93 ../kalarmd/alarmdialog.h 93 ../kalarmd/alarmdialog.h
94 94
95SOURCES = \ 95SOURCES = datenavigatorcontainer.cpp \
96 filteredit_base.cpp \ 96 filteredit_base.cpp \
97 calendarview.cpp \ 97 calendarview.cpp \
98 datenavigator.cpp \ 98 datenavigator.cpp \
99 docprefs.cpp \ 99 docprefs.cpp \
100 filtereditdialog.cpp \ 100 filtereditdialog.cpp \
101 incomingdialog.cpp \ 101 incomingdialog.cpp \
102 incomingdialog_base.cpp \ 102 incomingdialog_base.cpp \
103 journalentry.cpp \ 103 journalentry.cpp \
104 kdatenavigator.cpp \ 104 kdatenavigator.cpp \
105 koagenda.cpp \ 105 koagenda.cpp \
106 koagendaitem.cpp \ 106 koagendaitem.cpp \
107 koagendaview.cpp \ 107 koagendaview.cpp \
108 kocounterdialog.cpp \ 108 kocounterdialog.cpp \
109 kodaymatrix.cpp \ 109 kodaymatrix.cpp \
110 kodialogmanager.cpp \ 110 kodialogmanager.cpp \
111 koeditordetails.cpp \ 111 koeditordetails.cpp \
112 koeditorgeneral.cpp \ 112 koeditorgeneral.cpp \
113 koeditorgeneralevent.cpp \ 113 koeditorgeneralevent.cpp \
114 koeditorgeneraltodo.cpp \ 114 koeditorgeneraltodo.cpp \
115 koeditorrecurrence.cpp \ 115 koeditorrecurrence.cpp \
116 koeventeditor.cpp \ 116 koeventeditor.cpp \
117 koeventpopupmenu.cpp \ 117 koeventpopupmenu.cpp \
118 koeventview.cpp \ 118 koeventview.cpp \
119 koeventviewer.cpp \ 119 koeventviewer.cpp \
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 934e153..27d4d17 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -163,48 +163,70 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
163 ctrlLayout->addWidget( mNextMonth, 3 ); 163 ctrlLayout->addWidget( mNextMonth, 3 );
164 ctrlLayout->addWidget( mNextYear, 3 ); 164 ctrlLayout->addWidget( mNextYear, 3 );
165 165
166 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 166 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
167 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 167 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
168 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 168 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
169 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); 169 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
170 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); 170 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
171 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 171 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
172 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 172 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
173 mPrevYear->setFocusPolicy(NoFocus); 173 mPrevYear->setFocusPolicy(NoFocus);
174 mPrevMonth->setFocusPolicy(NoFocus); 174 mPrevMonth->setFocusPolicy(NoFocus);
175 mNextMonth->setFocusPolicy(NoFocus); 175 mNextMonth->setFocusPolicy(NoFocus);
176 mPrevWeek->setFocusPolicy(NoFocus); 176 mPrevWeek->setFocusPolicy(NoFocus);
177 mNextWeek->setFocusPolicy(NoFocus); 177 mNextWeek->setFocusPolicy(NoFocus);
178 mNextYear->setFocusPolicy(NoFocus); 178 mNextYear->setFocusPolicy(NoFocus);
179 mSelectMonth->setFocusPolicy(NoFocus); 179 mSelectMonth->setFocusPolicy(NoFocus);
180 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 180 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
181 181
182} 182}
183 183
184NavigatorBar::~NavigatorBar() 184NavigatorBar::~NavigatorBar()
185{ 185{
186} 186}
187void NavigatorBar::showButtons( bool left, bool right )
188{
189 if ( left ) {
190 mPrevYear->show();
191 mPrevMonth->show();
192 } else {
193 mPrevYear->hide();
194 mPrevMonth->hide();
195 }
196
197 if ( right ) {
198 mNextYear->show();
199 mNextMonth->show();
200 } else {
201 mNextYear->hide();
202 mNextMonth->hide();
203 }
204 if ( !left && !right ) {
205 mSelectMonth->setMaximumWidth( 1024 );
206 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
207 }
208}
187 209
188void NavigatorBar::selectMonth() 210void NavigatorBar::selectMonth()
189{ 211{
190 212
191 int month; 213 int month;
192 KPopupFrame* popup = new KPopupFrame(this); 214 KPopupFrame* popup = new KPopupFrame(this);
193 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup); 215 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
194 // ----- 216 // -----
195 picker->resize(picker->sizeHint()); 217 picker->resize(picker->sizeHint());
196 popup->setMainWidget(picker); 218 popup->setMainWidget(picker);
197 picker->setFocus(); 219 picker->setFocus();
198 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 220 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
199 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 221 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
200 { 222 {
201 month = picker->getResult(); 223 month = picker->getResult();
202 emit monthSelected ( month ); 224 emit monthSelected ( month );
203 } else { 225 } else {
204 KNotifyClient::beep(); 226 KNotifyClient::beep();
205 } 227 }
206 delete popup; 228 delete popup;
207} 229}
208void NavigatorBar::selectDates( const KCal::DateList &dateList ) 230void NavigatorBar::selectDates( const KCal::DateList &dateList )
209{ 231{
210 if (dateList.count() > 0) { 232 if (dateList.count() > 0) {
diff --git a/korganizer/navigatorbar.h b/korganizer/navigatorbar.h
index 803c817..4442caa 100644
--- a/korganizer/navigatorbar.h
+++ b/korganizer/navigatorbar.h
@@ -17,48 +17,49 @@
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef NAVIGATORBAR_H 24#ifndef NAVIGATORBAR_H
25#define NAVIGATORBAR_H 25#define NAVIGATORBAR_H
26 26
27#include <libkcal/incidencebase.h> 27#include <libkcal/incidencebase.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30 30
31class QPushButton; 31class QPushButton;
32class QFrame; 32class QFrame;
33class QLabel; 33class QLabel;
34 34
35class NavigatorBar: public QWidget 35class NavigatorBar: public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 ); 39 NavigatorBar( const QDate & date, QWidget *parent = 0, const char *name = 0 );
40 ~NavigatorBar(); 40 ~NavigatorBar();
41 void showButtons( bool left, bool right );
41 42
42 public slots: 43 public slots:
43 void selectDates( const KCal::DateList & ); 44 void selectDates( const KCal::DateList & );
44 void selectMonth(); 45 void selectMonth();
45 46
46 signals: 47 signals:
47 void goNextMonth(); 48 void goNextMonth();
48 void goPrevMonth(); 49 void goPrevMonth();
49 void goNextWeek(); 50 void goNextWeek();
50 void goPrevWeek(); 51 void goPrevWeek();
51 void goNextYear(); 52 void goNextYear();
52 void goPrevYear(); 53 void goPrevYear();
53 void monthSelected( int ); 54 void monthSelected( int );
54 55
55 private: 56 private:
56 QFrame *mCtrlFrame; 57 QFrame *mCtrlFrame;
57 58
58 QPushButton *mPrevYear; 59 QPushButton *mPrevYear;
59 QPushButton *mPrevMonth; 60 QPushButton *mPrevMonth;
60 QPushButton *mNextMonth; 61 QPushButton *mNextMonth;
61 QPushButton *mPrevWeek; 62 QPushButton *mPrevWeek;
62 QPushButton *mNextWeek; 63 QPushButton *mNextWeek;
63 QPushButton *mNextYear; 64 QPushButton *mNextYear;
64 QPushButton *mSelectMonth; 65 QPushButton *mSelectMonth;