summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-07 13:03:38 (UTC)
committer zautrix <zautrix>2005-02-07 13:03:38 (UTC)
commit7de846e9f01ce27b622541493e6a02e26e37bf2c (patch) (unidiff)
treedf59c7803b1e171b08d3c387f49b1239d1adc3b5 /korganizer
parentafc19166fcdc09d3d5b757a84abfeb0b2746f35f (diff)
downloadkdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.zip
kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.tar.gz
kdepimpi-7de846e9f01ce27b622541493e6a02e26e37bf2c.tar.bz2
fixxxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp33
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/komonthview.cpp55
-rw-r--r--korganizer/komonthview.h6
-rw-r--r--korganizer/koviewmanager.cpp41
-rw-r--r--korganizer/navigatorbar.cpp1
6 files changed, 55 insertions, 85 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}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 8d7ff36..731298d 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -1,275 +1,272 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 3 Copyright (c) 2000, 2001
4 Cornelius Schumacher <schumacher@kde.org> 4 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
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 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 42
43#include <korganizer/calendarviewbase.h> 43#include <korganizer/calendarviewbase.h>
44 44
45#include <ksyncmanager.h> 45#include <ksyncmanager.h>
46 46
47class QWidgetStack; 47class QWidgetStack;
48class QSplitter; 48class QSplitter;
49 49
50class CalPrinter; 50class CalPrinter;
51class KOFilterView; 51class KOFilterView;
52class KOViewManager; 52class KOViewManager;
53class KODialogManager; 53class KODialogManager;
54class KOTodoView; 54class KOTodoView;
55class KDateNavigator; 55class KDateNavigator;
56class DateNavigator; 56class DateNavigator;
57class KOIncidenceEditor; 57class KOIncidenceEditor;
58class KDatePicker; 58class KDatePicker;
59class ResourceView; 59class ResourceView;
60class NavigatorBar;
61class KOEventEditor; 60class KOEventEditor;
62class KOTodoEditor ; 61class KOTodoEditor ;
63class KOEventViewerDialog; 62class KOEventViewerDialog;
64class KOBeamPrefs; 63class KOBeamPrefs;
65class KSyncProfile; 64class KSyncProfile;
66class AlarmDialog; 65class AlarmDialog;
67class KCal::Attendee; 66class KCal::Attendee;
68 67
69namespace KCal { class FileStorage; } 68namespace KCal { class FileStorage; }
70 69
71using namespace KCal; 70using namespace KCal;
72 71
73/** 72/**
74 This is the main calendar widget. It provides the different vies on t he 73 This is the main calendar widget. It provides the different vies on t he
75 calendar data as well as the date navigator. It also handles synchronisation 74 calendar data as well as the date navigator. It also handles synchronisation
76 of the different views and controls the different dialogs like preferences, 75 of the different views and controls the different dialogs like preferences,
77 event editor, search dialog etc. 76 event editor, search dialog etc.
78 77
79 @short main calendar view widget 78 @short main calendar view widget
80 @author Cornelius Schumacher 79 @author Cornelius Schumacher
81*/ 80*/
82class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 81class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
83{ 82{
84 Q_OBJECT 83 Q_OBJECT
85 public: 84 public:
86 /** 85 /**
87 Constructs a new calendar view widget. 86 Constructs a new calendar view widget.
88 87
89 @param calendar calendar document 88 @param calendar calendar document
90 @param parent parent window 89 @param parent parent window
91 @param name Qt internal widget object name 90 @param name Qt internal widget object name
92 */ 91 */
93 CalendarView( CalendarResources *calendar, QWidget *parent = 0, 92 CalendarView( CalendarResources *calendar, QWidget *parent = 0,
94 const char *name = 0 ); 93 const char *name = 0 );
95 CalendarView( Calendar *calendar, QWidget *parent = 0, 94 CalendarView( Calendar *calendar, QWidget *parent = 0,
96 const char *name = 0 ); 95 const char *name = 0 );
97 virtual ~CalendarView(); 96 virtual ~CalendarView();
98 97
99 Calendar *calendar() { return mCalendar; } 98 Calendar *calendar() { return mCalendar; }
100 99
101 KOViewManager *viewManager(); 100 KOViewManager *viewManager();
102 KODialogManager *dialogManager(); 101 KODialogManager *dialogManager();
103 102
104 QDate startDate(); 103 QDate startDate();
105 QDate endDate(); 104 QDate endDate();
106 105
107 QWidgetStack *viewStack(); 106 QWidgetStack *viewStack();
108 QWidget *leftFrame(); 107 QWidget *leftFrame();
109 NavigatorBar *navigatorBar();
110 108
111 DateNavigator *dateNavigator(); 109 DateNavigator *dateNavigator();
112 KDateNavigator *dateNavigatorWidget(); 110 KDateNavigator *dateNavigatorWidget();
113 111
114 void addView(KOrg::BaseView *); 112 void addView(KOrg::BaseView *);
115 void showView(KOrg::BaseView *); 113 void showView(KOrg::BaseView *);
116 KOEventViewerDialog* getEventViewerDialog(); 114 KOEventViewerDialog* getEventViewerDialog();
117 Incidence *currentSelection(); 115 Incidence *currentSelection();
118 116
119 signals: 117 signals:
120 void save (); 118 void save ();
121 void saveStopTimer (); 119 void saveStopTimer ();
122 void tempDisableBR(bool); 120 void tempDisableBR(bool);
123 /** This todo has been modified */ 121 /** This todo has been modified */
124 void todoModified(Todo *, int); 122 void todoModified(Todo *, int);
125 123
126 /** when change is made to options dialog, the topwidget will catch this 124 /** when change is made to options dialog, the topwidget will catch this
127 * and emit this signal which notifies all widgets which have registered 125 * and emit this signal which notifies all widgets which have registered
128 * for notification to update their settings. */ 126 * for notification to update their settings. */
129 void configChanged(); 127 void configChanged();
130 /** emitted when the topwidget is closing down, so that any attached 128 /** emitted when the topwidget is closing down, so that any attached
131 child windows can also close. */ 129 child windows can also close. */
132 void closingDown(); 130 void closingDown();
133 /** emitted right before we die */ 131 /** emitted right before we die */
134 void closed(QWidget *); 132 void closed(QWidget *);
135 133
136 /** Emitted when state of modified flag changes */ 134 /** Emitted when state of modified flag changes */
137 void modifiedChanged(bool); 135 void modifiedChanged(bool);
138 void signalmodified(); 136 void signalmodified();
139 137
140 /** Emitted when state of read-only flag changes */ 138 /** Emitted when state of read-only flag changes */
141 void readOnlyChanged(bool); 139 void readOnlyChanged(bool);
142 140
143 /** Emitted when the unit of navigation changes */ 141 /** Emitted when the unit of navigation changes */
144 void changeNavStringPrev(const QString &); 142 void changeNavStringPrev(const QString &);
145 void changeNavStringNext(const QString &); 143 void changeNavStringNext(const QString &);
146 144
147 /** Emitted when state of events selection has changed and user is organizer*/ 145 /** Emitted when state of events selection has changed and user is organizer*/
148 void organizerEventsSelected(bool); 146 void organizerEventsSelected(bool);
149 /** Emitted when state of events selection has changed and user is attendee*/ 147 /** Emitted when state of events selection has changed and user is attendee*/
150 void groupEventsSelected(bool); 148 void groupEventsSelected(bool);
151 /** 149 /**
152 Emitted when an incidence gets selected. If the selection is cleared the 150 Emitted when an incidence gets selected. If the selection is cleared the
153 signal is emitted with 0 as argument. 151 signal is emitted with 0 as argument.
154 */ 152 */
155 void incidenceSelected( Incidence * ); 153 void incidenceSelected( Incidence * );
156 /** Emitted, when a todoitem is selected or deselected. */ 154 /** Emitted, when a todoitem is selected or deselected. */
157 void todoSelected( bool ); 155 void todoSelected( bool );
158 156
159 /** 157 /**
160 Emitted, when clipboard content changes. Parameter indicates if paste 158 Emitted, when clipboard content changes. Parameter indicates if paste
161 is possible or not. 159 is possible or not.
162 */ 160 */
163 void pasteEnabled(bool); 161 void pasteEnabled(bool);
164 162
165 /** Emitted, when the number of incoming messages has changed. */ 163 /** Emitted, when the number of incoming messages has changed. */
166 void numIncomingChanged(int); 164 void numIncomingChanged(int);
167 165
168 /** Emitted, when the number of outgoing messages has changed. */ 166 /** Emitted, when the number of outgoing messages has changed. */
169 void numOutgoingChanged(int); 167 void numOutgoingChanged(int);
170 168
171 /** Send status message, which can e.g. be displayed in the status bar. */ 169 /** Send status message, which can e.g. be displayed in the status bar. */
172 void statusMessage(const QString &); 170 void statusMessage(const QString &);
173 171
174 void calendarViewExpanded( bool ); 172 void calendarViewExpanded( bool );
175 void updateSearchDialog(); 173 void updateSearchDialog();
176 174
177 175
178 public slots: 176 public slots:
179 void showNavigatorBar(bool);
180 void showOpenError(); 177 void showOpenError();
181 void watchSavedFile(); 178 void watchSavedFile();
182 void recheckTimerAlarm(); 179 void recheckTimerAlarm();
183 void checkNextTimerAlarm(); 180 void checkNextTimerAlarm();
184 void addAlarm(const QDateTime &qdt, const QString &noti ); 181 void addAlarm(const QDateTime &qdt, const QString &noti );
185 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 182 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
186 void removeAlarm(const QDateTime &qdt, const QString &noti ); 183 void removeAlarm(const QDateTime &qdt, const QString &noti );
187 184
188 /** options dialog made a changed to the configuration. we catch this 185 /** options dialog made a changed to the configuration. we catch this
189 * and notify all widgets which need to update their configuration. */ 186 * and notify all widgets which need to update their configuration. */
190 void updateConfig(); 187 void updateConfig();
191 188
192 void insertBirthdays(const QString& uid, const QStringList& birthdayList, 189 void insertBirthdays(const QString& uid, const QStringList& birthdayList,
193 const QStringList& anniversaryList, const QStringList& realNameList, 190 const QStringList& anniversaryList, const QStringList& realNameList,
194 const QStringList& emailList, const QStringList& assembledNameList, 191 const QStringList& emailList, const QStringList& assembledNameList,
195 const QStringList& uidList); 192 const QStringList& uidList);
196 193
197 /** 194 /**
198 Load calendar from file \a filename. If \a merge is true, load 195 Load calendar from file \a filename. If \a merge is true, load
199 calendar into existing one, if it is false, clear calendar, before 196 calendar into existing one, if it is false, clear calendar, before
200 loading. Return true, if calendar could be successfully loaded. 197 loading. Return true, if calendar could be successfully loaded.
201 */ 198 */
202 bool openCalendar(QString filename, bool merge=false); 199 bool openCalendar(QString filename, bool merge=false);
203 bool syncCalendar(QString filename,int mode = 0 ); 200 bool syncCalendar(QString filename,int mode = 0 );
204 201
205 /** 202 /**
206 Save calendar data to file. Return true if calendar could be 203 Save calendar data to file. Return true if calendar could be
207 successfully saved. 204 successfully saved.
208 */ 205 */
209 bool saveCalendar(QString filename); 206 bool saveCalendar(QString filename);
210 207
211 /** 208 /**
212 Close calendar. Clear calendar data and reset views to display an empty 209 Close calendar. Clear calendar data and reset views to display an empty
213 calendar. 210 calendar.
214 */ 211 */
215 void closeCalendar(); 212 void closeCalendar();
216 213
217 /** Archive old events of calendar */ 214 /** Archive old events of calendar */
218 void archiveCalendar(); 215 void archiveCalendar();
219 216
220 void showIncidence(); 217 void showIncidence();
221 void editIncidence(); 218 void editIncidence();
222 void editIncidenceDescription(); 219 void editIncidenceDescription();
223 void deleteIncidence(); 220 void deleteIncidence();
224 void cloneIncidence(); 221 void cloneIncidence();
225 void moveIncidence(); 222 void moveIncidence();
226 void beamIncidence(); 223 void beamIncidence();
227 void toggleCancelIncidence(); 224 void toggleCancelIncidence();
228 225
229 /** create an editeventwin with supplied date/time, and if bool is true, 226 /** create an editeventwin with supplied date/time, and if bool is true,
230 * make the event take all day. */ 227 * make the event take all day. */
231 void newEvent(QDateTime, QDateTime, bool allDay ); 228 void newEvent(QDateTime, QDateTime, bool allDay );
232 void newEvent(QDateTime, QDateTime); 229 void newEvent(QDateTime, QDateTime);
233 void newEvent(QDateTime fh); 230 void newEvent(QDateTime fh);
234 void newEvent(QDate dt); 231 void newEvent(QDate dt);
235 /** create new event without having a date hint. Takes current date as 232 /** create new event without having a date hint. Takes current date as
236 default hint. */ 233 default hint. */
237 void newEvent(); 234 void newEvent();
238 void newFloatingEvent(); 235 void newFloatingEvent();
239 236
240 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 237 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
241 void showIncidence(Incidence *); 238 void showIncidence(Incidence *);
242 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 239 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
243 void editIncidence(Incidence *); 240 void editIncidence(Incidence *);
244 /** Delete the supplied incidence. It calls the correct deleteXXX method*/ 241 /** Delete the supplied incidence. It calls the correct deleteXXX method*/
245 void deleteIncidence(Incidence *); 242 void deleteIncidence(Incidence *);
246 void cloneIncidence(Incidence *); 243 void cloneIncidence(Incidence *);
247 void cancelIncidence(Incidence *); 244 void cancelIncidence(Incidence *);
248 /** Create an editor for the supplied event. */ 245 /** Create an editor for the supplied event. */
249 void editEvent(Event *); 246 void editEvent(Event *);
250 /** Delete the supplied event. */ 247 /** Delete the supplied event. */
251 void deleteEvent(Event *); 248 void deleteEvent(Event *);
252 /** Delete the event with the given unique ID. Returns false, if event wasn't 249 /** Delete the event with the given unique ID. Returns false, if event wasn't
253 found. */ 250 found. */
254 bool deleteEvent(const QString &uid); 251 bool deleteEvent(const QString &uid);
255 /** Create a read-only viewer dialog for the supplied event. */ 252 /** Create a read-only viewer dialog for the supplied event. */
256 void showEvent(Event *); 253 void showEvent(Event *);
257 254
258 void editJournal(Journal *); 255 void editJournal(Journal *);
259 void showJournal(Journal *); 256 void showJournal(Journal *);
260 void deleteJournal(Journal *); 257 void deleteJournal(Journal *);
261 /** Create an editor dialog for a todo */ 258 /** Create an editor dialog for a todo */
262 void editTodo(Todo *); 259 void editTodo(Todo *);
263 /** Create a read-only viewer dialog for the supplied todo */ 260 /** Create a read-only viewer dialog for the supplied todo */
264 void showTodo(Todo *); 261 void showTodo(Todo *);
265 /** create new todo */ 262 /** create new todo */
266 void newTodo(); 263 void newTodo();
267 void newTodoDateTime(QDateTime, bool allday); 264 void newTodoDateTime(QDateTime, bool allday);
268 /** create new todo with a parent todo */ 265 /** create new todo with a parent todo */
269 void newSubTodo(); 266 void newSubTodo();
270 /** create new todo with a parent todo */ 267 /** create new todo with a parent todo */
271 void newSubTodo(Todo *); 268 void newSubTodo(Todo *);
272 /** Delete todo */ 269 /** Delete todo */
273 void deleteTodo(Todo *); 270 void deleteTodo(Todo *);
274 271
275 272
@@ -440,176 +437,175 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
440 bool importBday(); 437 bool importBday();
441 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); 438 bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday );
442 bool importQtopia( const QString &categoriesFile, 439 bool importQtopia( const QString &categoriesFile,
443 const QString &datebookFile, 440 const QString &datebookFile,
444 const QString &tasklistFile ); 441 const QString &tasklistFile );
445 void syncExternal( int mode ); 442 void syncExternal( int mode );
446 void slotSelectPickerDate( QDate ) ; 443 void slotSelectPickerDate( QDate ) ;
447 void showDatePicker( ) ; 444 void showDatePicker( ) ;
448 void moveIncidence(Incidence *) ; 445 void moveIncidence(Incidence *) ;
449 void beamIncidence(Incidence *) ; 446 void beamIncidence(Incidence *) ;
450 void beamCalendar() ; 447 void beamCalendar() ;
451 void beamFilteredCalendar() ; 448 void beamFilteredCalendar() ;
452 void beamIncidenceList(QPtrList<Incidence>) ; 449 void beamIncidenceList(QPtrList<Incidence>) ;
453 void manageCategories(); 450 void manageCategories();
454 int addCategories(); 451 int addCategories();
455 void removeCategories(); 452 void removeCategories();
456 void setSyncDevice( QString ); 453 void setSyncDevice( QString );
457 void setSyncName( QString ); 454 void setSyncName( QString );
458 void showDay( QDate ); 455 void showDay( QDate );
459 void undo_delete(); 456 void undo_delete();
460 protected slots: 457 protected slots:
461 void timerAlarm(); 458 void timerAlarm();
462 void suspendAlarm(); 459 void suspendAlarm();
463 void beamDone( Ir *ir ); 460 void beamDone( Ir *ir );
464 /** Select a view or adapt the current view to display the specified dates. */ 461 /** Select a view or adapt the current view to display the specified dates. */
465 void showDates( const KCal::DateList & ); 462 void showDates( const KCal::DateList & );
466 void selectWeekNum ( int ); 463 void selectWeekNum ( int );
467 464
468 public: 465 public:
469 // show a standard warning 466 // show a standard warning
470 // returns KMsgBox::yesNoCancel() 467 // returns KMsgBox::yesNoCancel()
471 int msgCalModified(); 468 int msgCalModified();
472 virtual bool sync(KSyncManager* manager, QString filename, int mode); 469 virtual bool sync(KSyncManager* manager, QString filename, int mode);
473 470
474 virtual bool syncExternal(KSyncManager* manager, QString resource); 471 virtual bool syncExternal(KSyncManager* manager, QString resource);
475 virtual void removeSyncInfo( QString syncProfile); 472 virtual void removeSyncInfo( QString syncProfile);
476 void setSyncManager(KSyncManager* manager); 473 void setSyncManager(KSyncManager* manager);
477 void setLoadedFileVersion(QDateTime); 474 void setLoadedFileVersion(QDateTime);
478 bool checkFileVersion(QString fn); 475 bool checkFileVersion(QString fn);
479 bool checkFileChanged(QString fn); 476 bool checkFileChanged(QString fn);
480 Event* getLastSyncEvent(); 477 Event* getLastSyncEvent();
481 /** Adapt navigation units correpsonding to step size of navigation of the 478 /** Adapt navigation units correpsonding to step size of navigation of the
482 * current view. 479 * current view.
483 */ 480 */
484 void adaptNavigationUnits(); 481 void adaptNavigationUnits();
485 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 482 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
486 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 483 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
487 //Attendee* getYourAttendee(Event *event); 484 //Attendee* getYourAttendee(Event *event);
488 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 485 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
489 protected: 486 protected:
490 void schedule(Scheduler::Method, Incidence *incidence = 0); 487 void schedule(Scheduler::Method, Incidence *incidence = 0);
491 488
492 // returns KMsgBox::OKCandel() 489 // returns KMsgBox::OKCandel()
493 int msgItemDelete(const QString name); 490 int msgItemDelete(const QString name);
494 void showEventEditor(); 491 void showEventEditor();
495 void showTodoEditor(); 492 void showTodoEditor();
496 void writeLocale(); 493 void writeLocale();
497 Todo *selectedTodo(); 494 Todo *selectedTodo();
498 495
499 private: 496 private:
500 bool mBlockShowDates; 497 bool mBlockShowDates;
501 KSyncManager* mSyncManager; 498 KSyncManager* mSyncManager;
502 AlarmDialog * mAlarmDialog; 499 AlarmDialog * mAlarmDialog;
503 QString mAlarmNotification; 500 QString mAlarmNotification;
504 QString mSuspendAlarmNotification; 501 QString mSuspendAlarmNotification;
505 QTimer* mSuspendTimer; 502 QTimer* mSuspendTimer;
506 QTimer* mAlarmTimer; 503 QTimer* mAlarmTimer;
507 QTimer* mRecheckAlarmTimer; 504 QTimer* mRecheckAlarmTimer;
508 void computeAlarm( QString ); 505 void computeAlarm( QString );
509 void startAlarm( QString, QString ); 506 void startAlarm( QString, QString );
510 void setSyncEventsReadOnly(); 507 void setSyncEventsReadOnly();
511 508
512 QDateTime loadedFileVersion; 509 QDateTime loadedFileVersion;
513 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 510 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
514 void checkExternalId( Incidence * inc ); 511 void checkExternalId( Incidence * inc );
515 int mGlobalSyncMode; 512 int mGlobalSyncMode;
516 QString mCurrentSyncDevice; 513 QString mCurrentSyncDevice;
517 QString mCurrentSyncName; 514 QString mCurrentSyncName;
518 KOBeamPrefs* beamDialog; 515 KOBeamPrefs* beamDialog;
519 void init(); 516 void init();
520 int mDatePickerMode; 517 int mDatePickerMode;
521 bool mFlagEditDescription; 518 bool mFlagEditDescription;
522 QDateTime mLastCalendarSync; 519 QDateTime mLastCalendarSync;
523 void createPrinter(); 520 void createPrinter();
524 521
525 void calendarModified( bool, Calendar * ); 522 void calendarModified( bool, Calendar * );
526 523
527 CalPrinter *mCalPrinter; 524 CalPrinter *mCalPrinter;
528 525
529 QSplitter *mPanner; 526 QSplitter *mPanner;
530 QSplitter *mLeftSplitter; 527 QSplitter *mLeftSplitter;
531 QWidget *mLeftFrame; 528 QWidget *mLeftFrame;
532 QWidgetStack *mRightFrame; 529 QWidgetStack *mRightFrame;
533 530
534 KDatePicker* mDatePicker; 531 KDatePicker* mDatePicker;
535 QVBox* mDateFrame; 532 QVBox* mDateFrame;
536 NavigatorBar *mNavigatorBar;
537 533
538 KDateNavigator *mDateNavigator; // widget showing small month view. 534 KDateNavigator *mDateNavigator; // widget showing small month view.
539 535
540 KOFilterView *mFilterView; 536 KOFilterView *mFilterView;
541 537
542 ResourceView *mResourceView; 538 ResourceView *mResourceView;
543 539
544 // calendar object for this viewing instance 540 // calendar object for this viewing instance
545 Calendar *mCalendar; 541 Calendar *mCalendar;
546 542
547 CalendarResourceManager *mResourceManager; 543 CalendarResourceManager *mResourceManager;
548 544
549 FileStorage *mStorage; 545 FileStorage *mStorage;
550 546
551 DateNavigator *mNavigator; 547 DateNavigator *mNavigator;
552 548
553 KOViewManager *mViewManager; 549 KOViewManager *mViewManager;
554 KODialogManager *mDialogManager; 550 KODialogManager *mDialogManager;
555 551
556 // Calendar filters 552 // Calendar filters
557 QPtrList<CalFilter> mFilters; 553 QPtrList<CalFilter> mFilters;
558 554
559 // various housekeeping variables. 555 // various housekeeping variables.
560 bool mModified; // flag indicating if calendar is modified 556 bool mModified; // flag indicating if calendar is modified
561 bool mReadOnly; // flag indicating if calendar is read-only 557 bool mReadOnly; // flag indicating if calendar is read-only
562 QDate mSaveSingleDate; 558 QDate mSaveSingleDate;
563 559
564 Incidence *mSelectedIncidence; 560 Incidence *mSelectedIncidence;
565 Incidence *mMoveIncidence; 561 Incidence *mMoveIncidence;
566 QDate mMoveIncidenceOldDate; 562 QDate mMoveIncidenceOldDate;
567 KOTodoView *mTodoList; 563 KOTodoView *mTodoList;
568 KOEventEditor * mEventEditor; 564 KOEventEditor * mEventEditor;
569 KOTodoEditor * mTodoEditor; 565 KOTodoEditor * mTodoEditor;
570 KOEventViewerDialog * mEventViewerDialog; 566 KOEventViewerDialog * mEventViewerDialog;
571 void keyPressEvent ( QKeyEvent *e) ; 567 void keyPressEvent ( QKeyEvent *e) ;
572 //QMap<Incidence*,KOIncidenceEditor*> mDialogList; 568 //QMap<Incidence*,KOIncidenceEditor*> mDialogList;
573}; 569};
574 570
575 571
576class CalendarViewVisitor : public Incidence::Visitor 572class CalendarViewVisitor : public Incidence::Visitor
577{ 573{
578 public: 574 public:
579 CalendarViewVisitor() : mView( 0 ) {} 575 CalendarViewVisitor() : mView( 0 ) {}
580 576
581 bool act( Incidence *incidence, CalendarView *view ) 577 bool act( Incidence *incidence, CalendarView *view )
582 { 578 {
583 mView = view; 579 mView = view;
584 return incidence->accept( *this ); 580 return incidence->accept( *this );
585 } 581 }
586 582
587 protected: 583 protected:
588 CalendarView *mView; 584 CalendarView *mView;
589}; 585};
590 586
591class ShowIncidenceVisitor : public CalendarViewVisitor 587class ShowIncidenceVisitor : public CalendarViewVisitor
592{ 588{
593 protected: 589 protected:
594 bool visit( Event *event ) { mView->showEvent( event ); return true; } 590 bool visit( Event *event ) { mView->showEvent( event ); return true; }
595 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } 591 bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
596 bool visit( Journal * j ) { mView->showJournal( j );return true; } 592 bool visit( Journal * j ) { mView->showJournal( j );return true; }
597}; 593};
598 594
599class EditIncidenceVisitor : public CalendarViewVisitor 595class EditIncidenceVisitor : public CalendarViewVisitor
600{ 596{
601 protected: 597 protected:
602 bool visit( Event *event ) { mView->editEvent( event ); return true; } 598 bool visit( Event *event ) { mView->editEvent( event ); return true; }
603 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } 599 bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
604 bool visit( Journal *j ) { mView->editJournal( j); return true; } 600 bool visit( Journal *j ) { mView->editJournal( j); return true; }
605}; 601};
606 602
607class DeleteIncidenceVisitor : public CalendarViewVisitor 603class DeleteIncidenceVisitor : public CalendarViewVisitor
608{ 604{
609 protected: 605 protected:
610 bool visit( Event *event ) { mView->deleteEvent( event ); return true; } 606 bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
611 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } 607 bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
612 bool visit( Journal * j) {mView->deleteJournal( j ); return true; } 608 bool visit( Journal * j) {mView->deleteJournal( j ); return true; }
613}; 609};
614 610
615#endif 611#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 234375b..7ba0b2f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -700,343 +700,349 @@ QDate MonthViewCell::selectedIncidenceDate()
700 return item->incidenceDate(); 700 return item->incidenceDate();
701} 701}
702 702
703void MonthViewCell::deselect() 703void MonthViewCell::deselect()
704{ 704{
705 mItemList->clearSelection(); 705 mItemList->clearSelection();
706 enableScrollBars( false ); 706 enableScrollBars( false );
707 // updateCell(); 707 // updateCell();
708} 708}
709void MonthViewCell::select() 709void MonthViewCell::select()
710{ 710{
711 ;// updateCell(); 711 ;// updateCell();
712} 712}
713 713
714void MonthViewCell::resizeEvent ( QResizeEvent * ) 714void MonthViewCell::resizeEvent ( QResizeEvent * )
715{ 715{
716 if ( !mMonthView->isUpdatePossible() ) 716 if ( !mMonthView->isUpdatePossible() )
717 return; 717 return;
718 718
719 int size = height() - mLabel->height() - 2; 719 int size = height() - mLabel->height() - 2;
720 if ( size > 0 ) 720 if ( size > 0 )
721 mItemList->verticalScrollBar()->setMaximumHeight( size ); 721 mItemList->verticalScrollBar()->setMaximumHeight( size );
722 size = width() - mLabel->width() -2; 722 size = width() - mLabel->width() -2;
723 if ( size > 0 ) 723 if ( size > 0 )
724 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 724 mItemList->horizontalScrollBar()->setMaximumWidth( size );
725 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 725 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
726 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 726 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
727} 727}
728 728
729void MonthViewCell::defaultAction( QListBoxItem *item ) 729void MonthViewCell::defaultAction( QListBoxItem *item )
730{ 730{
731 if ( !item ) return; 731 if ( !item ) return;
732 732
733 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 733 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
734 Incidence *incidence = eventItem->incidence(); 734 Incidence *incidence = eventItem->incidence();
735 if ( incidence ) mMonthView->defaultAction( incidence ); 735 if ( incidence ) mMonthView->defaultAction( incidence );
736} 736}
737void MonthViewCell::showDay() 737void MonthViewCell::showDay()
738{ 738{
739 emit showDaySignal( date() ); 739 emit showDaySignal( date() );
740} 740}
741void MonthViewCell::newEvent() 741void MonthViewCell::newEvent()
742{ 742{
743 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 743 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
744 emit newEventSignal( dt ); 744 emit newEventSignal( dt );
745} 745}
746void MonthViewCell::cellClicked( QListBoxItem *item ) 746void MonthViewCell::cellClicked( QListBoxItem *item )
747{ 747{
748 static QListBoxItem * lastClicked = 0; 748 static QListBoxItem * lastClicked = 0;
749 if ( item == 0 ) { 749 if ( item == 0 ) {
750 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 750 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
751 emit newEventSignal( dt ); 751 emit newEventSignal( dt );
752 return; 752 return;
753 } 753 }
754 /* 754 /*
755 if ( lastClicked ) 755 if ( lastClicked )
756 if ( ! item ) { 756 if ( ! item ) {
757 if ( lastClicked->listBox() != item->listBox() ) 757 if ( lastClicked->listBox() != item->listBox() )
758 lastClicked->listBox()->clearSelection(); 758 lastClicked->listBox()->clearSelection();
759 } 759 }
760 */ 760 */
761 761
762 mMonthView->setSelectedCell( this ); 762 mMonthView->setSelectedCell( this );
763 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); 763 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
764 select(); 764 select();
765} 765}
766 766
767void MonthViewCell::contextMenu( QListBoxItem *item ) 767void MonthViewCell::contextMenu( QListBoxItem *item )
768{ 768{
769 if ( !item ) return; 769 if ( !item ) return;
770 770
771 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 771 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
772 Incidence *incidence = eventItem->incidence(); 772 Incidence *incidence = eventItem->incidence();
773 if ( incidence ) mMonthView->showContextMenu( incidence ); 773 if ( incidence ) mMonthView->showContextMenu( incidence );
774} 774}
775 775
776void MonthViewCell::selection( QListBoxItem *item ) 776void MonthViewCell::selection( QListBoxItem *item )
777{ 777{
778 if ( !item ) return; 778 if ( !item ) return;
779 779
780 mMonthView->setSelectedCell( this ); 780 mMonthView->setSelectedCell( this );
781} 781}
782 782
783 783
784// ******************************************************************************* 784// *******************************************************************************
785// ******************************************************************************* 785// *******************************************************************************
786// ******************************************************************************* 786// *******************************************************************************
787 787
788 788
789KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 789KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
790 : KOEventView( calendar, parent, name ), 790 : KOEventView( calendar, parent, name ),
791 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 791 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
792 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 792 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
793{ 793{
794 skipResize = false; 794 skipResize = false;
795 clPending = true; 795 clPending = true;
796 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
796 mWidStack = new QWidgetStack( this ); 797 mWidStack = new QWidgetStack( this );
797 QHBoxLayout* hb = new QHBoxLayout( this ); 798 QVBoxLayout* hb = new QVBoxLayout( this );
798 mMonthView = new QWidget( mWidStack ); 799 mMonthView = new QWidget( mWidStack );
799 mWeekView = new QWidget( mWidStack ); 800 mWeekView = new QWidget( mWidStack );
800#if QT_VERSION >= 0x030000 801#if QT_VERSION >= 0x030000
801 mWidStack->addWidget(mMonthView ); 802 mWidStack->addWidget(mMonthView );
802 mWidStack->addWidget(mWeekView ); 803 mWidStack->addWidget(mWeekView );
803#else 804#else
804 mWidStack->addWidget( mMonthView, 1 ); 805 mWidStack->addWidget( mMonthView, 1 );
805 mWidStack->addWidget( mWeekView , 1 ); 806 mWidStack->addWidget( mWeekView , 1 );
806#endif 807#endif
808 hb->addWidget( mNavigatorBar );
807 hb->addWidget( mWidStack ); 809 hb->addWidget( mWidStack );
808 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 810 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
809 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 811 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
810 if ( mShowWeekView ) 812 if ( mShowWeekView )
811 mWeekStartsMonday = true; 813 mWeekStartsMonday = true;
812 updatePossible = false; 814 updatePossible = false;
815 //updatePossible = true;
813 mCells.setAutoDelete( true ); 816 mCells.setAutoDelete( true );
814 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 817 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
815 mDayLabels.resize( mDaysPerWeek ); 818 mDayLabels.resize( mDaysPerWeek );
816 mDayLabelsW.resize( mDaysPerWeek ); 819 mDayLabelsW.resize( mDaysPerWeek );
817 QFont bfont = font(); 820 QFont bfont = font();
818 if ( QApplication::desktop()->width() < 650 ) { 821 if ( QApplication::desktop()->width() < 650 ) {
819 bfont.setPointSize( bfont.pointSize() - 2 ); 822 bfont.setPointSize( bfont.pointSize() - 2 );
820 } 823 }
821 bfont.setBold( true ); 824 bfont.setBold( true );
822 int i; 825 int i;
823 826
824 for( i = 0; i < mDaysPerWeek; i++ ) { 827 for( i = 0; i < mDaysPerWeek; i++ ) {
825 QLabel *label = new QLabel( mMonthView ); 828 QLabel *label = new QLabel( mMonthView );
826 label->setFont(bfont); 829 label->setFont(bfont);
827 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 830 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
828 label->setLineWidth(1); 831 label->setLineWidth(1);
829 label->setAlignment(AlignCenter); 832 label->setAlignment(AlignCenter);
830 mDayLabels.insert( i, label ); 833 mDayLabels.insert( i, label );
831 label = new QLabel( mWeekView ); 834 label = new QLabel( mWeekView );
832 label->setFont(bfont); 835 label->setFont(bfont);
833 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 836 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
834 label->setLineWidth(1); 837 label->setLineWidth(1);
835 label->setAlignment(AlignCenter); 838 label->setAlignment(AlignCenter);
836 mDayLabelsW.insert( i, label ); 839 mDayLabelsW.insert( i, label );
837 } 840 }
838 841
839 bfont.setBold( false ); 842 bfont.setBold( false );
840 mWeekLabels.resize( mNumWeeks+1 ); 843 mWeekLabels.resize( mNumWeeks+1 );
841 mWeekLabelsW.resize( 2 ); 844 mWeekLabelsW.resize( 2 );
842 for( i = 0; i < mNumWeeks+1; i++ ) { 845 for( i = 0; i < mNumWeeks+1; i++ ) {
843 KOWeekButton *label = new KOWeekButton( mMonthView ); 846 KOWeekButton *label = new KOWeekButton( mMonthView );
844 label->setFocusPolicy(NoFocus); 847 label->setFocusPolicy(NoFocus);
845 label->setFont(bfont); 848 label->setFont(bfont);
846 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 849 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
847 label->setFlat(true); 850 label->setFlat(true);
848 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 851 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
849 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 852 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
850 //label->setLineWidth(1); 853 //label->setLineWidth(1);
851 //label->setAlignment(AlignCenter); 854 //label->setAlignment(AlignCenter);
852 mWeekLabels.insert( i, label ); 855 mWeekLabels.insert( i, label );
853 } 856 }
854 mWeekLabels[mNumWeeks]->setText( i18n("W")); 857 mWeekLabels[mNumWeeks]->setText( i18n("W"));
855 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 858 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
856 859
857 for( i = 0; i < 1+1; i++ ) { 860 for( i = 0; i < 1+1; i++ ) {
858 KOWeekButton *label = new KOWeekButton( mWeekView ); 861 KOWeekButton *label = new KOWeekButton( mWeekView );
859 label->setFocusPolicy(NoFocus); 862 label->setFocusPolicy(NoFocus);
860 label->setFont(bfont); 863 label->setFont(bfont);
861 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 864 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
862 label->setFlat(true); 865 label->setFlat(true);
863 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 866 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
864 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 867 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
865 //label->setLineWidth(1); 868 //label->setLineWidth(1);
866 //label->setAlignment(AlignCenter); 869 //label->setAlignment(AlignCenter);
867 mWeekLabelsW.insert( i, label ); 870 mWeekLabelsW.insert( i, label );
868 } 871 }
869 mWeekLabelsW[1]->setText( i18n("W")); 872 mWeekLabelsW[1]->setText( i18n("W"));
870 873
871 874
872 int row, col; 875 int row, col;
873 mCells.resize( mNumCells ); 876 mCells.resize( mNumCells );
874 for( row = 0; row < mNumWeeks; ++row ) { 877 for( row = 0; row < mNumWeeks; ++row ) {
875 for( col = 0; col < mDaysPerWeek; ++col ) { 878 for( col = 0; col < mDaysPerWeek; ++col ) {
876 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 879 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
877 mCells.insert( row * mDaysPerWeek + col, cell ); 880 mCells.insert( row * mDaysPerWeek + col, cell );
878 881
879 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 882 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
880 SLOT( defaultAction( Incidence * ) ) ); 883 SLOT( defaultAction( Incidence * ) ) );
881 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 884 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
882 SIGNAL( newEventSignal( QDateTime ) ) ); 885 SIGNAL( newEventSignal( QDateTime ) ) );
883 connect( cell, SIGNAL( showDaySignal( QDate ) ), 886 connect( cell, SIGNAL( showDaySignal( QDate ) ),
884 SIGNAL( showDaySignal( QDate ) ) ); 887 SIGNAL( showDaySignal( QDate ) ) );
885 } 888 }
886 } 889 }
887 mCellsW.resize( mDaysPerWeek ); 890 mCellsW.resize( mDaysPerWeek );
888 for( col = 0; col < mDaysPerWeek; ++col ) { 891 for( col = 0; col < mDaysPerWeek; ++col ) {
889 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 892 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
890 mCellsW.insert( col, cell ); 893 mCellsW.insert( col, cell );
891 894
892 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 895 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
893 SLOT( defaultAction( Incidence * ) ) ); 896 SLOT( defaultAction( Incidence * ) ) );
894 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 897 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
895 SIGNAL( newEventSignal( QDateTime ) ) ); 898 SIGNAL( newEventSignal( QDateTime ) ) );
896 connect( cell, SIGNAL( showDaySignal( QDate ) ), 899 connect( cell, SIGNAL( showDaySignal( QDate ) ),
897 SIGNAL( showDaySignal( QDate ) ) ); 900 SIGNAL( showDaySignal( QDate ) ) );
898 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 901 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
899 } 902 }
900 903
901 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 904 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
902 mContextMenu = eventPopup(); 905 mContextMenu = eventPopup();
903 // updateConfig(); //useless here... 906 // updateConfig(); //useless here...
904 // ... but we need mWidthLongDayLabel computed 907 // ... but we need mWidthLongDayLabel computed
905 QFontMetrics fontmetric(mDayLabels[0]->font()); 908 QFontMetrics fontmetric(mDayLabels[0]->font());
906 mWidthLongDayLabel = 0; 909 mWidthLongDayLabel = 0;
907 for (int i = 0; i < 7; i++) { 910 for (int i = 0; i < 7; i++) {
908 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 911 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
909 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 912 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
910 } 913 }
911 914
912 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 915 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
913 916
914 if ( mShowWeekView ) 917 if ( mShowWeekView )
915 mWidStack->raiseWidget( mWeekView ); 918 mWidStack->raiseWidget( mWeekView );
916 else 919 else
917 mWidStack->raiseWidget( mMonthView ); 920 mWidStack->raiseWidget( mMonthView );
918 921
919 emit incidenceSelected( 0 ); 922 emit incidenceSelected( 0 );
923#ifndef DESKTOP_VERSION
924 resize( QApplication::desktop()->size() );
925 computeLayout();
926#endif
920} 927}
921 928
922KOMonthView::~KOMonthView() 929KOMonthView::~KOMonthView()
923{ 930{
924 delete mContextMenu; 931 delete mContextMenu;
925} 932}
926 933
927void KOMonthView::selectInternalWeekNum ( int n ) 934void KOMonthView::selectInternalWeekNum ( int n )
928{ 935{
929 switchView(); 936 switchView();
930 emit selectWeekNum ( n ); 937 emit selectWeekNum ( n );
931} 938}
932 939
933int KOMonthView::currentWeek() 940int KOMonthView::currentWeek()
934{ 941{
935 if ( mShowWeekView ) 942 if ( mShowWeekView )
936 return mWeekLabelsW[0]->getWeekNum(); 943 return mWeekLabelsW[0]->getWeekNum();
937 return mWeekLabels[0]->getWeekNum(); 944 return mWeekLabels[0]->getWeekNum();
938} 945}
939void KOMonthView::switchView() 946void KOMonthView::switchView()
940{ 947{
941 948
942 if ( selectedCell( ) ) 949 if ( selectedCell( ) )
943 selectedCell()->deselect(); 950 selectedCell()->deselect();
944 mShowWeekView = !mShowWeekView; 951 mShowWeekView = !mShowWeekView;
945 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 952 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
946 //emit showNavigator( !mShowWeekView );
947 if ( clPending ) { 953 if ( clPending ) {
948 computeLayout(); 954 computeLayout();
949 updateConfig(); 955 updateConfig();
950 } 956 }
951 if ( mShowWeekView ) 957 if ( mShowWeekView )
952 mWidStack->raiseWidget( mWeekView ); 958 mWidStack->raiseWidget( mWeekView );
953 else 959 else
954 mWidStack->raiseWidget( mMonthView ); 960 mWidStack->raiseWidget( mMonthView );
955 clPending = false; 961 clPending = false;
956} 962}
957 963
958int KOMonthView::maxDatesHint() 964int KOMonthView::maxDatesHint()
959{ 965{
960 return mNumCells; 966 return mNumCells;
961} 967}
962 968
963int KOMonthView::currentDateCount() 969int KOMonthView::currentDateCount()
964{ 970{
965 return mNumCells; 971 return mNumCells;
966} 972}
967 973
968QPtrList<Incidence> KOMonthView::selectedIncidences() 974QPtrList<Incidence> KOMonthView::selectedIncidences()
969{ 975{
970 QPtrList<Incidence> selected; 976 QPtrList<Incidence> selected;
971 977
972 if ( mSelectedCell ) { 978 if ( mSelectedCell ) {
973 Incidence *incidence = mSelectedCell->selectedIncidence(); 979 Incidence *incidence = mSelectedCell->selectedIncidence();
974 if ( incidence ) selected.append( incidence ); 980 if ( incidence ) selected.append( incidence );
975 } 981 }
976 982
977 return selected; 983 return selected;
978} 984}
979 985
980DateList KOMonthView::selectedDates() 986DateList KOMonthView::selectedDates()
981{ 987{
982 DateList selected; 988 DateList selected;
983 989
984 if ( mSelectedCell ) { 990 if ( mSelectedCell ) {
985 QDate qd = mSelectedCell->selectedIncidenceDate(); 991 QDate qd = mSelectedCell->selectedIncidenceDate();
986 if ( qd.isValid() ) selected.append( qd ); 992 if ( qd.isValid() ) selected.append( qd );
987 } 993 }
988 994
989 return selected; 995 return selected;
990} 996}
991 997
992void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 998void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
993 const QDate &td) 999 const QDate &td)
994{ 1000{
995#ifndef KORG_NOPRINTER 1001#ifndef KORG_NOPRINTER
996 calPrinter->preview(CalPrinter::Month, fd, td); 1002 calPrinter->preview(CalPrinter::Month, fd, td);
997#endif 1003#endif
998} 1004}
999 1005
1000void KOMonthView::updateConfig() 1006void KOMonthView::updateConfig()
1001{ 1007{
1002 1008
1003 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1009 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1004 1010
1005 if ( mShowWeekView ) { 1011 if ( mShowWeekView ) {
1006 mWeekStartsMonday = true; 1012 mWeekStartsMonday = true;
1007 } 1013 }
1008 QFontMetrics fontmetric(mDayLabels[0]->font()); 1014 QFontMetrics fontmetric(mDayLabels[0]->font());
1009 mWidthLongDayLabel = 0; 1015 mWidthLongDayLabel = 0;
1010 1016
1011 for (int i = 0; i < 7; i++) { 1017 for (int i = 0; i < 7; i++) {
1012 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1018 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1013 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1019 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1014 } 1020 }
1015 bool temp = mShowSatSunComp ; 1021 bool temp = mShowSatSunComp ;
1016 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1022 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1017 if ( ! mShowWeekView ) { 1023 if ( ! mShowWeekView ) {
1018 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1024 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1019 computeLayout(); 1025 computeLayout();
1020 } 1026 }
1021 updateDayLabels(); 1027 updateDayLabels();
1022 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1028 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1023 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1029 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1024 //resizeEvent( 0 ); 1030 //resizeEvent( 0 );
1025 for (uint i = 0; i < mCells.count(); ++i) { 1031 for (uint i = 0; i < mCells.count(); ++i) {
1026 mCells[i]->updateConfig(); 1032 mCells[i]->updateConfig();
1027 } 1033 }
1028 1034
1029 for (uint i = 0; i < mCellsW.count(); ++i) { 1035 for (uint i = 0; i < mCellsW.count(); ++i) {
1030 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1036 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1031 } 1037 }
1032#ifdef DESKTOP_VERSION 1038#ifdef DESKTOP_VERSION
1033 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1039 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1034#endif 1040#endif
1035 updateView(); 1041 updateView();
1036} 1042}
1037 1043
1038void KOMonthView::updateDayLabels() 1044void KOMonthView::updateDayLabels()
1039{ 1045{
1040 1046
1041 QPtrVector<QLabel> *mDayLabelsT; 1047 QPtrVector<QLabel> *mDayLabelsT;
1042 1048
@@ -1167,430 +1173,425 @@ void KOMonthView::updateView()
1167 QDate endDate = mStartDate.addDays( timeSpan ); 1173 QDate endDate = mStartDate.addDays( timeSpan );
1168 for( event = events.first(); event; event = events.next() ) { // for event 1174 for( event = events.first(); event; event = events.next() ) { // for event
1169 if ( event->doesRecur() ) { 1175 if ( event->doesRecur() ) {
1170 bool last; 1176 bool last;
1171 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1177 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1172 QDateTime incidenceEnd; 1178 QDateTime incidenceEnd;
1173 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1179 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1174 bool invalid = false; 1180 bool invalid = false;
1175 while( true ) { 1181 while( true ) {
1176 if ( incidenceStart.isValid() ) { 1182 if ( incidenceStart.isValid() ) {
1177 incidenceEnd = incidenceStart.addDays( eventlen ); 1183 incidenceEnd = incidenceStart.addDays( eventlen );
1178 int st = incidenceStart.date().daysTo( endDate ); 1184 int st = incidenceStart.date().daysTo( endDate );
1179 if ( st >= 0 ) { // start before timeend 1185 if ( st >= 0 ) { // start before timeend
1180 int end = mStartDate.daysTo( incidenceEnd.date() ); 1186 int end = mStartDate.daysTo( incidenceEnd.date() );
1181 if ( end >= 0 ) { // end after timestart --- got one! 1187 if ( end >= 0 ) { // end after timestart --- got one!
1182 //normalize 1188 //normalize
1183 st = timeSpan - st; 1189 st = timeSpan - st;
1184 if ( st < 0 ) st = 0; 1190 if ( st < 0 ) st = 0;
1185 if ( end > timeSpan ) end = timeSpan; 1191 if ( end > timeSpan ) end = timeSpan;
1186 int iii; 1192 int iii;
1187 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1193 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1188 for ( iii = st;iii<= end;++iii) 1194 for ( iii = st;iii<= end;++iii)
1189 (*cells)[iii]->insertEvent( event ); 1195 (*cells)[iii]->insertEvent( event );
1190 } 1196 }
1191 } 1197 }
1192 } else { 1198 } else {
1193 if ( invalid ) 1199 if ( invalid )
1194 break; 1200 break;
1195 invalid = true; 1201 invalid = true;
1196 //qDebug("invalid %s", event->summary().latin1()); 1202 //qDebug("invalid %s", event->summary().latin1());
1197 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1203 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1198 } 1204 }
1199 if ( last ) 1205 if ( last )
1200 break; 1206 break;
1201 bool ok; 1207 bool ok;
1202 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1208 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1203 if ( ! ok ) 1209 if ( ! ok )
1204 break; 1210 break;
1205 if ( incidenceStart.date() > endDate ) 1211 if ( incidenceStart.date() > endDate )
1206 break; 1212 break;
1207 } 1213 }
1208 } else { // no recur 1214 } else { // no recur
1209 int st = event->dtStart().date().daysTo( endDate ); 1215 int st = event->dtStart().date().daysTo( endDate );
1210 if ( st >= 0 ) { // start before timeend 1216 if ( st >= 0 ) { // start before timeend
1211 int end = mStartDate.daysTo( event->dtEnd().date() ); 1217 int end = mStartDate.daysTo( event->dtEnd().date() );
1212 if ( end >= 0 ) { // end after timestart --- got one! 1218 if ( end >= 0 ) { // end after timestart --- got one!
1213 //normalize 1219 //normalize
1214 st = timeSpan - st; 1220 st = timeSpan - st;
1215 if ( st < 0 ) st = 0; 1221 if ( st < 0 ) st = 0;
1216 if ( end > timeSpan ) end = timeSpan; 1222 if ( end > timeSpan ) end = timeSpan;
1217 int iii; 1223 int iii;
1218 for ( iii = st;iii<= end;++iii) 1224 for ( iii = st;iii<= end;++iii)
1219 (*cells)[iii]->insertEvent( event ); 1225 (*cells)[iii]->insertEvent( event );
1220 } 1226 }
1221 } 1227 }
1222 } 1228 }
1223 } 1229 }
1224 // insert due todos 1230 // insert due todos
1225 QPtrList<Todo> todos = calendar()->todos( ); 1231 QPtrList<Todo> todos = calendar()->todos( );
1226 Todo *todo; 1232 Todo *todo;
1227 for(todo = todos.first(); todo; todo = todos.next()) { 1233 for(todo = todos.first(); todo; todo = todos.next()) {
1228 //insertTodo( todo ); 1234 //insertTodo( todo );
1229 if ( todo->hasDueDate() ) { 1235 if ( todo->hasDueDate() ) {
1230 int day = mStartDate.daysTo( todo->dtDue().date() ); 1236 int day = mStartDate.daysTo( todo->dtDue().date() );
1231 if ( day >= 0 && day < timeSpan + 1) { 1237 if ( day >= 0 && day < timeSpan + 1) {
1232 (*cells)[day]->insertTodo( todo ); 1238 (*cells)[day]->insertTodo( todo );
1233 } 1239 }
1234 } 1240 }
1235 } 1241 }
1236 1242
1237 for( i = 0; i < timeSpan+1; ++i ) { 1243 for( i = 0; i < timeSpan+1; ++i ) {
1238 (*cells)[i]->finishUpdateCell(); 1244 (*cells)[i]->finishUpdateCell();
1239 } 1245 }
1240 processSelectionChange(); 1246 processSelectionChange();
1241 (*cells)[0]->setFocus(); 1247 (*cells)[0]->setFocus();
1242 1248
1243 1249
1244#else 1250#else
1245 // old code 1251 // old code
1246 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1252 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1247 int i; 1253 int i;
1248 for( i = 0; i < (*cells).count(); ++i ) { 1254 for( i = 0; i < (*cells).count(); ++i ) {
1249 (*cells)[i]->updateCell(); 1255 (*cells)[i]->updateCell();
1250 } 1256 }
1251 1257
1252 //qDebug("KOMonthView::updateView() "); 1258 //qDebug("KOMonthView::updateView() ");
1253 processSelectionChange(); 1259 processSelectionChange();
1254 // qDebug("---------------------------------------------------------------------+ "); 1260 // qDebug("---------------------------------------------------------------------+ ");
1255 (*cells)[0]->setFocus(); 1261 (*cells)[0]->setFocus();
1256#endif 1262#endif
1257 1263
1258 //qDebug("update time %d ", ti.elapsed()); 1264 //qDebug("update time %d ", ti.elapsed());
1259} 1265}
1260 1266
1261void KOMonthView::resizeEvent(QResizeEvent * e) 1267void KOMonthView::resizeEvent(QResizeEvent * e)
1262{ 1268{
1263 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1269 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1264 if ( skipResize ) {
1265 skipResize = false;
1266 qDebug("skipResize ");
1267 return;
1268 }
1269 computeLayout(); 1270 computeLayout();
1270 clPending = true; 1271 clPending = true;
1271 if ( mShowWeekView ) 1272 if ( mShowWeekView )
1272 mCellsW[0]->setFocus(); 1273 mCellsW[0]->setFocus();
1273 else 1274 else
1274 mCells[0]->setFocus(); 1275 mCells[0]->setFocus();
1275} 1276}
1276void KOMonthView::computeLayoutWeek() 1277void KOMonthView::computeLayoutWeek()
1277{ 1278{
1278 static int lastWid = 0; 1279 static int lastWid = 0;
1279 static int lastHei = 0; 1280 static int lastHei = 0;
1280 int daysToShow; 1281 int daysToShow;
1281 bool combinedSatSun = false; 1282 bool combinedSatSun = false;
1282 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1283 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1283 daysToShow = 6; 1284 daysToShow = 6;
1284 combinedSatSun = true; 1285 combinedSatSun = true;
1285 } 1286 }
1286 int tWid = topLevelWidget()->size().width(); 1287 int tWid = topLevelWidget()->size().width();
1287 int tHei = topLevelWidget()->size().height(); 1288 int tHei = topLevelWidget()->size().height();
1288 1289
1289 int wid = size().width();//e 1290 int wid = width();//e
1290 int hei = size().height()-1; 1291 int hei = height()-1-mNavigatorBar->height();
1291 1292
1292 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1293 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1293 return; 1294 return;
1294 1295
1295 1296 if ( lastWid == width() && lastHei == height() )
1296 if ( lastWid == width() && lastHei ==height() )
1297 return; 1297 return;
1298 lastWid =width(); 1298 lastWid = width();
1299 lastHei = height(); 1299 lastHei = height();
1300 1300
1301 1301
1302 if ( wid < hei ) 1302 if ( wid < hei )
1303 daysToShow = 2; 1303 daysToShow = 2;
1304 else 1304 else
1305 daysToShow = 3; 1305 daysToShow = 3;
1306 mShowSatSunComp = true; 1306 mShowSatSunComp = true;
1307 combinedSatSun = true; 1307 combinedSatSun = true;
1308 1308
1309 qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1309 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1310 QFontMetrics fm ( mWeekLabels[0]->font() ); 1310 QFontMetrics fm ( mWeekLabels[0]->font() );
1311 int weeklabelwid = fm.width( "888" ); 1311 int weeklabelwid = fm.width( "888" );
1312 wid -= weeklabelwid; 1312 wid -= weeklabelwid;
1313 1313
1314 int colWid = wid / daysToShow; 1314 int colWid = wid / daysToShow;
1315 int lastCol = wid - ( colWid*6 ); 1315 int lastCol = wid - ( colWid*6 );
1316 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1316 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1317 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1317 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1318 int colModulo = wid % daysToShow; 1318 int colModulo = wid % daysToShow;
1319 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1319 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1320 //qDebug("rowmod %d ", rowModulo); 1320 //qDebug("rowmod %d ", rowModulo);
1321 int i; 1321 int i;
1322 int x,y,w,h; 1322 int x,y,w,h;
1323 x= 0; 1323 x= 0;
1324 y= 0; 1324 y= 0;
1325 w = colWid; 1325 w = colWid;
1326 h = dayLabelHei ; 1326 h = dayLabelHei ;
1327 for ( i = 0; i < 7; i++) { 1327 for ( i = 0; i < 7; i++) {
1328 if ( i && !( i % daysToShow) && i < 6) { 1328 if ( i && !( i % daysToShow) && i < 6) {
1329 y += hei/(5-daysToShow); 1329 y += hei/(5-daysToShow);
1330 x = 0; 1330 x = 0;
1331 w = colWid; 1331 w = colWid;
1332 } 1332 }
1333 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1333 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1334 ++w; 1334 ++w;
1335 } 1335 }
1336 if ( i >= 5 ) { 1336 if ( i >= 5 ) {
1337 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1337 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h);
1338 x -= (w/2 ); 1338 x -= (w/2 );
1339 } 1339 }
1340 else 1340 else
1341 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1341 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1342 x += w; 1342 x += w;
1343 } 1343 }
1344 x= 0; 1344 x= 0;
1345 y= dayLabelHei; 1345 y= dayLabelHei;
1346 w = colWid; 1346 w = colWid;
1347 h = cellHei; 1347 h = cellHei;
1348 for ( i = 0; i < mCellsW.count(); ++i) { 1348 for ( i = 0; i < mCellsW.count(); ++i) {
1349 if ( i > 6 ) { 1349 if ( i > 6 ) {
1350 mCellsW[i]->hide(); 1350 mCellsW[i]->hide();
1351 continue; 1351 continue;
1352 } 1352 }
1353 1353
1354 w = colWid; 1354 w = colWid;
1355 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1355 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1356 ++w; 1356 ++w;
1357 } 1357 }
1358 if ( i == (daysToShow-1-rowModulo)*7) 1358 if ( i == (daysToShow-1-rowModulo)*7)
1359 ++h; 1359 ++h;
1360 1360
1361 if ( i >= 5 ) { 1361 if ( i >= 5 ) {
1362 if ( i ==5 ) { 1362 if ( i ==5 ) {
1363 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1363 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1364 x -= w ;y += h/2; 1364 x -= w ;y += h/2;
1365 } else { 1365 } else {
1366 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1366 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1367 ++w; 1367 ++w;
1368 } 1368 }
1369 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1369 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1370 y -= h/2; 1370 y -= h/2;
1371 } 1371 }
1372 } else 1372 } else
1373 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1373 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1374 1374
1375 1375
1376 x += w; 1376 x += w;
1377 if ( x + w/2 > wid ) { 1377 if ( x + w/2 > wid ) {
1378 x = 0; 1378 x = 0;
1379 y += h+dayLabelHei ; 1379 y += h+dayLabelHei ;
1380 } 1380 }
1381 } 1381 }
1382 y= dayLabelHei; 1382 y= dayLabelHei;
1383 h = cellHei ; 1383 h = cellHei ;
1384 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1384 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1385 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1385 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1386 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1386 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1387 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1387 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1388 mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; 1388 mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ;
1389 updateDayLabels(); 1389 updateDayLabels();
1390 bool forceUpdate = !updatePossible; 1390 //bool forceUpdate = !updatePossible;
1391 updatePossible = true; 1391 updatePossible = true;
1392 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1392 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1393 if ( forceUpdate ) 1393 //if ( forceUpdate )
1394 updateView(); 1394 // updateView();
1395} 1395}
1396void KOMonthView::computeLayout() 1396void KOMonthView::computeLayout()
1397{ 1397{
1398 1398
1399 1399
1400 static int lastWid = 0; 1400 static int lastWid = 0;
1401 static int lastHei = 0; 1401 static int lastHei = 0;
1402 1402
1403 if ( mShowWeekView ){ 1403 if ( mShowWeekView ){
1404 computeLayoutWeek(); 1404 computeLayoutWeek();
1405 return; 1405 return;
1406 } 1406 }
1407 int daysToShow = 7; 1407 int daysToShow = 7;
1408 bool combinedSatSun = false; 1408 bool combinedSatSun = false;
1409 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1409 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1410 daysToShow = 6; 1410 daysToShow = 6;
1411 combinedSatSun = true; 1411 combinedSatSun = true;
1412 } 1412 }
1413 int tWid = topLevelWidget()->size().width(); 1413 int tWid = topLevelWidget()->size().width();
1414 int tHei = topLevelWidget()->size().height(); 1414 int tHei = topLevelWidget()->size().height();
1415 1415
1416 int wid = size().width();//e 1416 int wid = width();//e
1417 int hei = size().height()-1; 1417 int hei = height()-1-mNavigatorBar->height();
1418 1418
1419 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1419 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1420 return; 1420 return;
1421 if ( lastWid == width() && lastHei ==height() ) 1421 }
1422 if ( lastWid == width() && lastHei == height() ){
1422 return; 1423 return;
1423 lastWid =width(); 1424 }
1424 lastHei = height(); 1425
1425 qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); 1426 lastWid = width();
1427 lastHei = height();
1428 //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ ");
1426 QFontMetrics fm ( mWeekLabels[0]->font() ); 1429 QFontMetrics fm ( mWeekLabels[0]->font() );
1427 int weeklabelwid = fm.width( "888" ); 1430 int weeklabelwid = fm.width( "888" );
1428 wid -= weeklabelwid; 1431 wid -= weeklabelwid;
1429 1432
1430 int colWid = wid / daysToShow; 1433 int colWid = wid / daysToShow;
1431 int lastCol = wid - ( colWid*6 ); 1434 int lastCol = wid - ( colWid*6 );
1432 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1435 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1433 int cellHei = (hei - dayLabelHei) /6; 1436 int cellHei = (hei - dayLabelHei) /6;
1434 int colModulo = wid % daysToShow; 1437 int colModulo = wid % daysToShow;
1435 int rowModulo = (hei- dayLabelHei) % 6; 1438 int rowModulo = (hei- dayLabelHei) % 6;
1436 //qDebug("rowmod %d ", rowModulo); 1439 //qDebug("rowmod %d ", rowModulo);
1437 int i; 1440 int i;
1438 int x,y,w,h; 1441 int x,y,w,h;
1439 x= 0; 1442 x= 0;
1440 y= 0; 1443 y= 0;
1441 w = colWid; 1444 w = colWid;
1442 h = dayLabelHei ; 1445 h = dayLabelHei ;
1443 for ( i = 0; i < 7; i++) { 1446 for ( i = 0; i < 7; i++) {
1444 if ( i == daysToShow-colModulo ) 1447 if ( i == daysToShow-colModulo )
1445 ++w; 1448 ++w;
1446 if ( combinedSatSun ) { 1449 if ( combinedSatSun ) {
1447 if ( i >= daysToShow-1 ) { 1450 if ( i >= daysToShow-1 ) {
1448 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1451 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1449 x -= w/2 ; 1452 x -= w/2 ;
1450 } 1453 }
1451 else 1454 else
1452 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1455 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1453 } else 1456 } else
1454 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1457 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1455 x += w; 1458 x += w;
1456 } 1459 }
1457 x= 0; 1460 x= 0;
1458 y= dayLabelHei; 1461 y= dayLabelHei;
1459 w = colWid; 1462 w = colWid;
1460 h = cellHei ; 1463 h = cellHei ;
1461 for ( i = 0; i < mCells.count(); ++i) { 1464 for ( i = 0; i < mCells.count(); ++i) {
1462 //qDebug("iii %d ", i); 1465 //qDebug("iii %d ", i);
1463 w = colWid; 1466 w = colWid;
1464 if ( ((i) % 7) >= 7-colModulo ) { 1467 if ( ((i) % 7) >= 7-colModulo ) {
1465 ++w; 1468 ++w;
1466 } 1469 }
1467 if ( i == (6-rowModulo)*7) 1470 if ( i == (6-rowModulo)*7)
1468 ++h; 1471 ++h;
1469 if ( combinedSatSun ) { 1472 if ( combinedSatSun ) {
1470 if ( (i)%7 >= daysToShow-1 ) { 1473 if ( (i)%7 >= daysToShow-1 ) {
1471 if ( (i)%7 == daysToShow-1 ) { 1474 if ( (i)%7 == daysToShow-1 ) {
1472 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1475 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1473 x -= w ;y += h/2; 1476 x -= w ;y += h/2;
1474 } else { 1477 } else {
1475 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1478 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1476 y -= h/2; 1479 y -= h/2;
1477 } 1480 }
1478 } else 1481 } else
1479 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1482 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1480 1483
1481 } 1484 }
1482 else 1485 else
1483 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1486 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1484 x += w; 1487 x += w;
1485 if ( x + w/2 > wid ) { 1488 if ( x + w/2 > wid ) {
1486 x = 0; 1489 x = 0;
1487 y += h; 1490 y += h;
1488 } 1491 }
1489 } 1492 }
1490 y= dayLabelHei; 1493 y= dayLabelHei;
1491 h = cellHei ; 1494 h = cellHei ;
1492 for ( i = 0; i < 6; i++) { 1495 for ( i = 0; i < 6; i++) {
1493 if ( i == (6-rowModulo)) 1496 if ( i == (6-rowModulo))
1494 ++h; 1497 ++h;
1495 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1498 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1496 y += h; 1499 y += h;
1497 } 1500 }
1498 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1501 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1499 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1502 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1500 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1503 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1501 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; 1504 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ;
1502 updateDayLabels(); 1505 updateDayLabels();
1503 bool forceUpdate = !updatePossible; 1506 //bool forceUpdate = !updatePossible;
1504 updatePossible = true; 1507 updatePossible = true;
1505 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1508 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1506 if ( forceUpdate )
1507 updateView();
1508} 1509}
1509 1510
1510void KOMonthView::showContextMenu( Incidence *incidence ) 1511void KOMonthView::showContextMenu( Incidence *incidence )
1511{ 1512{
1512 mContextMenu->showIncidencePopup(incidence); 1513 mContextMenu->showIncidencePopup(incidence);
1513 /* 1514 /*
1514 if( incidence && incidence->type() == "Event" ) { 1515 if( incidence && incidence->type() == "Event" ) {
1515 Event *event = static_cast<Event *>(incidence); 1516 Event *event = static_cast<Event *>(incidence);
1516 mContextMenu->showEventPopup(event); 1517 mContextMenu->showEventPopup(event);
1517 } else { 1518 } else {
1518 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1519 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1519 } 1520 }
1520 */ 1521 */
1521} 1522}
1522MonthViewCell * KOMonthView::selectedCell( ) 1523MonthViewCell * KOMonthView::selectedCell( )
1523{ 1524{
1524 return mSelectedCell; 1525 return mSelectedCell;
1525} 1526}
1526void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1527void KOMonthView::setSelectedCell( MonthViewCell *cell )
1527{ 1528{
1528 // qDebug("KOMonthView::setSelectedCell "); 1529 // qDebug("KOMonthView::setSelectedCell ");
1529 if ( mSelectedCell && mSelectedCell != cell ) { 1530 if ( mSelectedCell && mSelectedCell != cell ) {
1530 MonthViewCell * mvc = mSelectedCell; 1531 MonthViewCell * mvc = mSelectedCell;
1531 mSelectedCell = cell; 1532 mSelectedCell = cell;
1532 mvc->deselect(); 1533 mvc->deselect();
1533 } else 1534 } else
1534 mSelectedCell = cell; 1535 mSelectedCell = cell;
1535 // if ( mSelectedCell ) 1536 // if ( mSelectedCell )
1536 // mSelectedCell->select(); 1537 // mSelectedCell->select();
1537 if ( !mSelectedCell ) 1538 if ( !mSelectedCell )
1538 emit incidenceSelected( 0 ); 1539 emit incidenceSelected( 0 );
1539 else 1540 else
1540 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1541 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1541} 1542}
1542 1543
1543void KOMonthView::processSelectionChange() 1544void KOMonthView::processSelectionChange()
1544{ 1545{
1545 QPtrList<Incidence> incidences = selectedIncidences(); 1546 QPtrList<Incidence> incidences = selectedIncidences();
1546 if (incidences.count() > 0) { 1547 if (incidences.count() > 0) {
1547 emit incidenceSelected( incidences.first() ); 1548 emit incidenceSelected( incidences.first() );
1548 } else { 1549 } else {
1549 emit incidenceSelected( 0 ); 1550 emit incidenceSelected( 0 );
1550 } 1551 }
1551} 1552}
1552 1553
1553void KOMonthView::clearSelection() 1554void KOMonthView::clearSelection()
1554{ 1555{
1555 if ( mSelectedCell ) { 1556 if ( mSelectedCell ) {
1556 mSelectedCell->deselect(); 1557 mSelectedCell->deselect();
1557 mSelectedCell = 0; 1558 mSelectedCell = 0;
1558 } 1559 }
1559} 1560}
1560void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1561void KOMonthView::keyPressEvent ( QKeyEvent * e )
1561{ 1562{
1562 //qDebug("KOMonthView::keyPressEvent "); 1563 //qDebug("KOMonthView::keyPressEvent ");
1563 switch(e->key()) { 1564 switch(e->key()) {
1564 case Key_Up: 1565 case Key_Up:
1565 { 1566 {
1566 emit prevMonth(); 1567 emit prevMonth();
1567 if ( mShowWeekView ) 1568 if ( mShowWeekView )
1568 mCellsW[0]->setFocus(); 1569 mCellsW[0]->setFocus();
1569 else 1570 else
1570 mCells[0]->setFocus(); 1571 mCells[0]->setFocus();
1571 } 1572 }
1572 e->accept(); 1573 e->accept();
1573 break; 1574 break;
1574 case Key_Down: 1575 case Key_Down:
1575 { 1576 {
1576 emit nextMonth(); 1577 emit nextMonth();
1577 if ( mShowWeekView ) 1578 if ( mShowWeekView )
1578 mCellsW[0]->setFocus(); 1579 mCellsW[0]->setFocus();
1579 else 1580 else
1580 mCells[0]->setFocus(); 1581 mCells[0]->setFocus();
1581 1582
1582 } 1583 }
1583 e->accept(); 1584 e->accept();
1584 break; 1585 break;
1585 case Key_Return: 1586 case Key_Return:
1586 case Key_Enter: 1587 case Key_Enter:
1587 { 1588 {
1588 selectInternalWeekNum ( currentWeek() ); 1589 selectInternalWeekNum ( currentWeek() );
1589 } 1590 }
1590 e->accept(); 1591 e->accept();
1591 break; 1592 break;
1592 default: 1593 default:
1593 e->ignore(); 1594 e->ignore();
1594 break; 1595 break;
1595 } 1596 }
1596} 1597}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index a29a1a8..bf861ef 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,295 +1,297 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qintdict.h> 30#include <qintdict.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qvaluelist.h> 32#include <qvaluelist.h>
33#include <qptrvector.h> 33#include <qptrvector.h>
34 34
35#include <libkcal/calendar.h> 35#include <libkcal/calendar.h>
36#include <libkcal/event.h> 36#include <libkcal/event.h>
37 37
38#include "koeventview.h" 38#include "koeventview.h"
39#include "navigatorbar.h"
39 40
40#ifdef DESKTOP_VERSION 41#ifdef DESKTOP_VERSION
41class QToolTipGroup; 42class QToolTipGroup;
42#endif 43#endif
43 44
44class KNOWhatsThis; 45class KNOWhatsThis;
45class KOWeekButton : public QPushButton 46class KOWeekButton : public QPushButton
46{ 47{
47 Q_OBJECT 48 Q_OBJECT
48 public: 49 public:
49 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 50 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
50 QPushButton( parent, name) 51 QPushButton( parent, name)
51 { 52 {
52 connect( this, SIGNAL( clicked() ), 53 connect( this, SIGNAL( clicked() ),
53 SLOT( bottonClicked() )); 54 SLOT( bottonClicked() ));
54 mNumber = -1; 55 mNumber = -1;
55 } 56 }
56 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 57 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
57 int getWeekNum() { return mNumber;} 58 int getWeekNum() { return mNumber;}
58 signals: 59 signals:
59 void selectWeekNum ( int ); 60 void selectWeekNum ( int );
60private: 61private:
61 int mNumber; 62 int mNumber;
62private slots : 63private slots :
63 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 64 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
64}; 65};
65 66
66class KNoScrollListBox: public QListBox 67class KNoScrollListBox: public QListBox
67{ 68{
68 Q_OBJECT 69 Q_OBJECT
69 public: 70 public:
70 KNoScrollListBox(QWidget *parent=0, const char *name=0); 71 KNoScrollListBox(QWidget *parent=0, const char *name=0);
71 ~KNoScrollListBox(); 72 ~KNoScrollListBox();
72 QString getWhatsThisText(QPoint p) ; 73 QString getWhatsThisText(QPoint p) ;
73 74
74 signals: 75 signals:
75 void shiftDown(); 76 void shiftDown();
76 void shiftUp(); 77 void shiftUp();
77 void rightClick(); 78 void rightClick();
78 79
79 protected slots: 80 protected slots:
80 void oneDown(); 81 void oneDown();
81 void keyPressEvent(QKeyEvent *); 82 void keyPressEvent(QKeyEvent *);
82 void keyReleaseEvent(QKeyEvent *); 83 void keyReleaseEvent(QKeyEvent *);
83 void mousePressEvent(QMouseEvent *); 84 void mousePressEvent(QMouseEvent *);
84 85
85 private: 86 private:
86 KNOWhatsThis * mWT; 87 KNOWhatsThis * mWT;
87}; 88};
88 89
89 90
90class MonthViewItem: public QListBoxItem 91class MonthViewItem: public QListBoxItem
91{ 92{
92 public: 93 public:
93 MonthViewItem( Incidence *, QDate qd, const QString & title ); 94 MonthViewItem( Incidence *, QDate qd, const QString & title );
94 95
95 void setRecur(bool on) { mRecur = on; } 96 void setRecur(bool on) { mRecur = on; }
96 void setAlarm(bool on) { mAlarm = on; } 97 void setAlarm(bool on) { mAlarm = on; }
97 void setReply(bool on) { mReply = on; } 98 void setReply(bool on) { mReply = on; }
98 void setMoreInfo(bool on) { mInfo = on; } 99 void setMoreInfo(bool on) { mInfo = on; }
99 100
100 101
101 void setPalette(const QPalette &p) { mPalette = p; } 102 void setPalette(const QPalette &p) { mPalette = p; }
102 QPalette palette() const { return mPalette; } 103 QPalette palette() const { return mPalette; }
103 104
104 Incidence *incidence() const { return mIncidence; } 105 Incidence *incidence() const { return mIncidence; }
105 QDate incidenceDate() { return mDate; } 106 QDate incidenceDate() { return mDate; }
106 107
107 protected: 108 protected:
108 virtual void paint(QPainter *); 109 virtual void paint(QPainter *);
109 virtual int height(const QListBox *) const; 110 virtual int height(const QListBox *) const;
110 virtual int width(const QListBox *) const; 111 virtual int width(const QListBox *) const;
111 112
112 private: 113 private:
113 bool mRecur; 114 bool mRecur;
114 bool mAlarm; 115 bool mAlarm;
115 bool mReply; 116 bool mReply;
116 bool mInfo; 117 bool mInfo;
117 118
118 QPalette mPalette; 119 QPalette mPalette;
119 QDate mDate; 120 QDate mDate;
120 121
121 Incidence *mIncidence; 122 Incidence *mIncidence;
122}; 123};
123 124
124 125
125class KOMonthView; 126class KOMonthView;
126 127
127class MonthViewCell : public QWidget 128class MonthViewCell : public QWidget
128{ 129{
129 Q_OBJECT 130 Q_OBJECT
130 public: 131 public:
131 MonthViewCell(KOMonthView *,QWidget* ); 132 MonthViewCell(KOMonthView *,QWidget* );
132 133
133 void setDate( const QDate & ); 134 void setDate( const QDate & );
134 QDate date() const; 135 QDate date() const;
135 136
136 void setPrimary( bool ); 137 void setPrimary( bool );
137 bool isPrimary() const; 138 bool isPrimary() const;
138 139
139 void setHoliday( bool ); 140 void setHoliday( bool );
140 void setHoliday( const QString & ); 141 void setHoliday( const QString & );
141 142
142 void updateCell(); 143 void updateCell();
143 void startUpdateCell(); 144 void startUpdateCell();
144 void finishUpdateCell(); 145 void finishUpdateCell();
145 void insertEvent(Event *); 146 void insertEvent(Event *);
146 void insertTodo(Todo *); 147 void insertTodo(Todo *);
147 148
148 void updateConfig( bool bigFont = false ); 149 void updateConfig( bool bigFont = false );
149 150
150 void enableScrollBars( bool ); 151 void enableScrollBars( bool );
151 152
152 Incidence *selectedIncidence(); 153 Incidence *selectedIncidence();
153 QDate selectedIncidenceDate(); 154 QDate selectedIncidenceDate();
154 155
155 void deselect(); 156 void deselect();
156 void select(); 157 void select();
157 158
158#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
159 static QToolTipGroup *toolTipGroup(); 160 static QToolTipGroup *toolTipGroup();
160#endif 161#endif
161 signals: 162 signals:
162 void defaultAction( Incidence * ); 163 void defaultAction( Incidence * );
163 void newEventSignal( QDateTime ); 164 void newEventSignal( QDateTime );
164 void showDaySignal( QDate ); 165 void showDaySignal( QDate );
165 166
166 protected: 167 protected:
167 QString mToolTip; 168 QString mToolTip;
168 void resizeEvent( QResizeEvent * ); 169 void resizeEvent( QResizeEvent * );
169 170
170 protected slots: 171 protected slots:
171 void defaultAction( QListBoxItem * ); 172 void defaultAction( QListBoxItem * );
172 void contextMenu( QListBoxItem * ); 173 void contextMenu( QListBoxItem * );
173 void selection( QListBoxItem * ); 174 void selection( QListBoxItem * );
174 void cellClicked( QListBoxItem * ); 175 void cellClicked( QListBoxItem * );
175 void newEvent(); 176 void newEvent();
176 void showDay(); 177 void showDay();
177 178
178 private: 179 private:
179 KOMonthView *mMonthView; 180 KOMonthView *mMonthView;
180 181
181 QDate mDate; 182 QDate mDate;
182 bool mPrimary; 183 bool mPrimary;
183 bool mHoliday; 184 bool mHoliday;
184 QString mHolidayString; 185 QString mHolidayString;
185 186
186 //QLabel *mLabel; 187 //QLabel *mLabel;
187 QPushButton *mLabel; 188 QPushButton *mLabel;
188 QListBox *mItemList; 189 QListBox *mItemList;
189#ifdef DESKTOP_VERSION 190#ifdef DESKTOP_VERSION
190 static QToolTipGroup *mToolTipGroup; 191 static QToolTipGroup *mToolTipGroup;
191#endif 192#endif
192 QSize mLabelSize; 193 QSize mLabelSize;
193 QSize mLabelBigSize; 194 QSize mLabelBigSize;
194 QPalette mHolidayPalette; 195 QPalette mHolidayPalette;
195 QPalette mStandardPalette; 196 QPalette mStandardPalette;
196 QPalette mPrimaryPalette; 197 QPalette mPrimaryPalette;
197 QPalette mNonPrimaryPalette; 198 QPalette mNonPrimaryPalette;
198 void setMyPalette(); 199 void setMyPalette();
199 QPalette getPalette (); 200 QPalette getPalette ();
200 void keyPressEvent ( QKeyEvent * ) ; 201 void keyPressEvent ( QKeyEvent * ) ;
201 202
202}; 203};
203 204
204 205
205class KOMonthView: public KOEventView 206class KOMonthView: public KOEventView
206{ 207{
207 Q_OBJECT 208 Q_OBJECT
208 public: 209 public:
209 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 210 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
210 ~KOMonthView(); 211 ~KOMonthView();
211 212
212 /** Returns maximum number of days supported by the komonthview */ 213 /** Returns maximum number of days supported by the komonthview */
213 virtual int maxDatesHint(); 214 virtual int maxDatesHint();
214 215
215 /** Returns number of currently shown dates. */ 216 /** Returns number of currently shown dates. */
216 virtual int currentDateCount(); 217 virtual int currentDateCount();
217 218
218 /** returns the currently selected events */ 219 /** returns the currently selected events */
219 virtual QPtrList<Incidence> selectedIncidences(); 220 virtual QPtrList<Incidence> selectedIncidences();
220 221
221 /** returns dates of the currently selected events */ 222 /** returns dates of the currently selected events */
222 virtual DateList selectedDates(); 223 virtual DateList selectedDates();
223 224
224 virtual void printPreview(CalPrinter *calPrinter, 225 virtual void printPreview(CalPrinter *calPrinter,
225 const QDate &, const QDate &); 226 const QDate &, const QDate &);
226 bool isMonthView() { return true; } 227 bool isMonthView() { return true; }
227 bool isUpdatePossible() { return updatePossible; } 228 bool isUpdatePossible() { return updatePossible; }
228 229
229 MonthViewCell * selectedCell(); 230 MonthViewCell * selectedCell();
230 bool skipResize; 231 bool skipResize;
232 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
231 public slots: 233 public slots:
232 virtual void updateView(); 234 virtual void updateView();
233 virtual void updateConfig(); 235 virtual void updateConfig();
234 virtual void showDates(const QDate &start, const QDate &end); 236 virtual void showDates(const QDate &start, const QDate &end);
235 virtual void showEvents(QPtrList<Event> eventList); 237 virtual void showEvents(QPtrList<Event> eventList);
236 238
237 void changeEventDisplay(Event *, int); 239 void changeEventDisplay(Event *, int);
238 240
239 void clearSelection(); 241 void clearSelection();
240 242
241 void showContextMenu( Incidence * ); 243 void showContextMenu( Incidence * );
242 244
243 void setSelectedCell( MonthViewCell * ); 245 void setSelectedCell( MonthViewCell * );
244 246
245 protected slots: 247 protected slots:
246 void selectInternalWeekNum ( int ); 248 void selectInternalWeekNum ( int );
247 void switchView(); 249 void switchView();
248 void processSelectionChange(); 250 void processSelectionChange();
249 signals: 251 signals:
250 void nextMonth(); 252 void nextMonth();
251 void prevMonth(); 253 void prevMonth();
252 void showNavigator( bool );
253 void selectWeekNum ( int ); 254 void selectWeekNum ( int );
254 void showDaySignal( QDate ); 255 void showDaySignal( QDate );
255 protected: 256 protected:
256 void resizeEvent(QResizeEvent *); 257 void resizeEvent(QResizeEvent *);
257 void viewChanged(); 258 void viewChanged();
258 void updateDayLabels(); 259 void updateDayLabels();
259 260
260 private: 261 private:
262 NavigatorBar* mNavigatorBar;
261 int currentWeek(); 263 int currentWeek();
262 bool clPending; 264 bool clPending;
263 QWidgetStack * mWidStack; 265 QWidgetStack * mWidStack;
264 QWidget* mMonthView; 266 QWidget* mMonthView;
265 QWidget* mWeekView; 267 QWidget* mWeekView;
266 bool mShowWeekView; 268 bool mShowWeekView;
267 bool updatePossible; 269 bool updatePossible;
268 int mDaysPerWeek; 270 int mDaysPerWeek;
269 int mNumWeeks; 271 int mNumWeeks;
270 int mNumCells; 272 int mNumCells;
271 bool mWeekStartsMonday; 273 bool mWeekStartsMonday;
272 bool mShowSatSunComp; 274 bool mShowSatSunComp;
273 void computeLayout(); 275 void computeLayout();
274 void computeLayoutWeek(); 276 void computeLayoutWeek();
275 277
276 QPtrVector<MonthViewCell> mCells; 278 QPtrVector<MonthViewCell> mCells;
277 QPtrVector<QLabel> mDayLabels; 279 QPtrVector<QLabel> mDayLabels;
278 QPtrVector<KOWeekButton> mWeekLabels; 280 QPtrVector<KOWeekButton> mWeekLabels;
279 QPtrVector<MonthViewCell> mCellsW; 281 QPtrVector<MonthViewCell> mCellsW;
280 QPtrVector<QLabel> mDayLabelsW; 282 QPtrVector<QLabel> mDayLabelsW;
281 QPtrVector<KOWeekButton> mWeekLabelsW; 283 QPtrVector<KOWeekButton> mWeekLabelsW;
282 284
283 bool mShortDayLabels; 285 bool mShortDayLabels;
284 int mWidthLongDayLabel; 286 int mWidthLongDayLabel;
285 287
286 QDate mStartDate; 288 QDate mStartDate;
287 289
288 MonthViewCell *mSelectedCell; 290 MonthViewCell *mSelectedCell;
289 291
290 KOEventPopupMenu *mContextMenu; 292 KOEventPopupMenu *mContextMenu;
291 void keyPressEvent ( QKeyEvent * ) ; 293 void keyPressEvent ( QKeyEvent * ) ;
292 294
293}; 295};
294 296
295#endif 297#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ba15f7f..b551e2a 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -108,231 +108,216 @@ void KOViewManager::showDateView( int view, QDate date)
108 108
109 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 109 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
110 bool savemFlagShowNextxDays = mFlagShowNextxDays; 110 bool savemFlagShowNextxDays = mFlagShowNextxDays;
111 mFlagShowNextxDays = false; 111 mFlagShowNextxDays = false;
112 if ( view == 3 ) { 112 if ( view == 3 ) {
113 //mCurrentAgendaView = 1 ; 113 //mCurrentAgendaView = 1 ;
114 lastDate = mMainView->dateNavigator()->selectedDates().first(); 114 lastDate = mMainView->dateNavigator()->selectedDates().first();
115 lastCount = mMainView->dateNavigator()->selectedDates().count(); 115 lastCount = mMainView->dateNavigator()->selectedDates().count();
116 lastNDMode = savemFlagShowNextxDays; 116 lastNDMode = savemFlagShowNextxDays;
117 mMainView->showDay( date ); 117 mMainView->showDay( date );
118 } else if (view == 4 ) { 118 } else if (view == 4 ) {
119 mCurrentAgendaView = 7 ; 119 mCurrentAgendaView = 7 ;
120 mMainView->dateNavigator()->selectDates( date, 7 ); 120 mMainView->dateNavigator()->selectDates( date, 7 );
121 } else if (view == 5 ) { 121 } else if (view == 5 ) {
122 mCurrentAgendaView = 14 ; 122 mCurrentAgendaView = 14 ;
123 mMainView->dateNavigator()->selectDates( date, 14); 123 mMainView->dateNavigator()->selectDates( date, 14);
124 } else if (view == 6 ) { 124 } else if (view == 6 ) {
125 //mMainView->dateNavigator()->selectDates( date, 7 ); 125 //mMainView->dateNavigator()->selectDates( date, 7 );
126 showMonthView(); 126 showMonthView();
127 } else if (view == 7 ) { 127 } else if (view == 7 ) {
128 mMainView->dateNavigator()->selectDate( date ); 128 mMainView->dateNavigator()->selectDate( date );
129 showJournalView(); 129 showJournalView();
130 } else if (view == 8 ) { 130 } else if (view == 8 ) {
131 globalFlagBlockAgenda = 1; 131 globalFlagBlockAgenda = 1;
132 if ( mCurrentAgendaView != 3 ) 132 if ( mCurrentAgendaView != 3 )
133 mCurrentAgendaView = -1; 133 mCurrentAgendaView = -1;
134 showAgendaView(KOPrefs::instance()->mFullViewMonth); 134 showAgendaView(KOPrefs::instance()->mFullViewMonth);
135 globalFlagBlockAgenda = 2; 135 globalFlagBlockAgenda = 2;
136 mMainView->dateNavigator()->selectDates( date , 136 mMainView->dateNavigator()->selectDates( date ,
137 KOPrefs::instance()->mNextXDays ); 137 KOPrefs::instance()->mNextXDays );
138 mFlagShowNextxDays = true; 138 mFlagShowNextxDays = true;
139 mCurrentAgendaView = 3 ; 139 mCurrentAgendaView = 3 ;
140 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 140 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
141 if ( lastMode ) { 141 if ( lastMode ) {
142 mCurrentAgendaView = lastCount ; 142 mCurrentAgendaView = lastCount ;
143 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 143 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
144 mFlagShowNextxDays = lastNDMode; 144 mFlagShowNextxDays = lastNDMode;
145 if ( mFlagShowNextxDays ) { 145 if ( mFlagShowNextxDays ) {
146 mCurrentAgendaView = 3 ; 146 mCurrentAgendaView = 3 ;
147 } 147 }
148 } else 148 } else
149 showWeekView(); 149 showWeekView();
150 } else if (view == 10) { 150 } else if (view == 10) {
151 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 151 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
152 } 152 }
153 lastMode = view; 153 lastMode = view;
154} 154}
155 155
156 156
157 157
158void KOViewManager::writeSettings(KConfig *config) 158void KOViewManager::writeSettings(KConfig *config)
159{ 159{
160 config->setGroup("General"); 160 config->setGroup("General");
161 161
162 QString view; 162 QString view;
163 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 163 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
164 else if (mCurrentView == mMonthView) view = "Month"; 164 else if (mCurrentView == mMonthView) view = "Month";
165 else if (mCurrentView == mListView) view = "List"; 165 else if (mCurrentView == mListView) view = "List";
166 else if (mCurrentView == mJournalView) view = "Journal"; 166 else if (mCurrentView == mJournalView) view = "Journal";
167 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 167 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
168 else if (mCurrentView == mTodoView) view = "Todo"; 168 else if (mCurrentView == mTodoView) view = "Todo";
169 else view = "Agenda"; 169 else view = "Agenda";
170 170
171 config->writeEntry("Current View",view); 171 config->writeEntry("Current View",view);
172 172
173 if (mAgendaView) { 173 if (mAgendaView) {
174 mAgendaView->writeSettings(config); 174 mAgendaView->writeSettings(config);
175 } 175 }
176 if (mTimeSpanView) { 176 if (mTimeSpanView) {
177 mTimeSpanView->writeSettings(config); 177 mTimeSpanView->writeSettings(config);
178 } 178 }
179 if (mListView) { 179 if (mListView) {
180 mListView->writeSettings(config); 180 mListView->writeSettings(config);
181 } 181 }
182 if (mTodoView) { 182 if (mTodoView) {
183 mTodoView->saveLayout(config,"Todo View"); 183 mTodoView->saveLayout(config,"Todo View");
184 } 184 }
185} 185}
186 186
187void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 187void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
188{ 188{
189 189
190 //mFlagShowNextxDays = false; 190 //mFlagShowNextxDays = false;
191 //if(view == mCurrentView) return; 191 //if(view == mCurrentView) return;
192 if ( view == 0 ) { 192 if ( view == 0 ) {
193 view = mCurrentView; 193 view = mCurrentView;
194 if ( view == 0 ) 194 if ( view == 0 )
195 return; 195 return;
196 } 196 }
197 bool full = fullScreen; 197 bool full = fullScreen;
198 if(view == mCurrentView && view != mWhatsNextView ) { 198 if(view == mCurrentView && view != mWhatsNextView ) {
199 if ( mCurrentAgendaView < 0 ) 199 if ( mCurrentAgendaView < 0 )
200 return; 200 return;
201 full = mMainView->leftFrame()->isVisible(); 201 full = mMainView->leftFrame()->isVisible();
202 } else { 202 } else {
203 if ( view == mMonthView && mMonthView) 203 if ( view == mMonthView && mMonthView)
204 mMonthView->skipResize = true ; 204 ;//mMonthView->skipResize = true ;
205 mCurrentView = view; 205 mCurrentView = view;
206 // bool full = fullScreen; 206 // bool full = fullScreen;
207 bool isFull = !mMainView->leftFrame()->isVisible(); 207 bool isFull = !mMainView->leftFrame()->isVisible();
208 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 208 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
209 full = true; 209 full = true;
210 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 210 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
211 full = false; 211 full = false;
212 } 212 }
213 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 213 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
214 //raiseCurrentView( full ); 214 //raiseCurrentView( full );
215 mMainView->processIncidenceSelection( 0 ); 215 mMainView->processIncidenceSelection( 0 );
216 //mMainView->updateView(); 216 //mMainView->updateView();
217 raiseCurrentView( full, true ); 217 raiseCurrentView( full, true );
218 mMainView->adaptNavigationUnits(); 218 mMainView->adaptNavigationUnits();
219} 219}
220 220
221void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 221void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
222{ 222{
223 mCurrentAgendaView = 0; 223 mCurrentAgendaView = 0;
224 int wid = mMainView->width() ;
225 int hei = mMainView->height();
226 if ( mCurrentView == mMonthView ) {
227 if ( true /* !KOPrefs::instance()->mMonthViewWeek*/ ) {
228 mMainView->navigatorBar()->show();
229 hei -= mMainView->navigatorBar()->sizeHint().height();
230 }
231 //mMainView->navigatorBar()->hide();
232 } else {
233 mMainView->navigatorBar()->hide();
234 }
235 if ( fullScreen ) { 224 if ( fullScreen ) {
236 mMainView->leftFrame()->hide(); 225 mMainView->leftFrame()->hide();
237 } else { 226 } else {
238 mMainView->leftFrame()->show(); 227 mMainView->leftFrame()->show();
239 if ( KOPrefs::instance()->mVerticalScreen )
240 hei -= mMainView->leftFrame()->height();
241 else
242 wid -= mMainView->leftFrame()->width();
243 } 228 }
244 emit signalFullScreen( !fullScreen ); 229 emit signalFullScreen( !fullScreen );
245 if ( callUpdateView ) 230 if ( callUpdateView )
246 mMainView->updateView(); 231 mMainView->updateView();
247 232
248 if ( globalFlagBlockAgenda == 5 ) { 233 if ( globalFlagBlockAgenda == 5 ) {
249 globalFlagBlockAgenda = 4; 234 globalFlagBlockAgenda = 4;
250 globalFlagBlockAgendaItemPaint = 1; 235 globalFlagBlockAgendaItemPaint = 1;
251 } 236 }
252 mMainView->viewStack()->raiseWidget(mCurrentView); 237 mMainView->viewStack()->raiseWidget(mCurrentView);
253 if ( globalFlagBlockAgenda == 4 ) { 238 if ( globalFlagBlockAgenda == 4 ) {
254 if ( mCurrentView == mAgendaView ) { 239 if ( mCurrentView == mAgendaView ) {
255 //globalFlagBlockAgenda =1 ; 240 //globalFlagBlockAgenda =1 ;
256 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 241 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
257 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 242 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
258 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 243 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
259 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 244 mAgendaView->setStartHour( QTime::currentTime ().hour() );
260 qApp->processEvents(); 245 qApp->processEvents();
261 //qDebug("qApp->processEvents() "); 246 //qDebug("qApp->processEvents() ");
262 globalFlagBlockAgenda = 0; 247 globalFlagBlockAgenda = 0;
263 mAgendaView->repaintAgenda(); 248 mAgendaView->repaintAgenda();
264 249
265 } 250 }
266 globalFlagBlockAgenda = 0; 251 globalFlagBlockAgenda = 0;
267 } 252 }
268 emit signalAgendaView( mCurrentView == mAgendaView ); 253 emit signalAgendaView( mCurrentView == mAgendaView );
269 //qDebug("raiseCurrentView ende "); 254 //qDebug("raiseCurrentView ende ");
270 255
271} 256}
272 257
273void KOViewManager::updateView() 258void KOViewManager::updateView()
274{ 259{
275 // qDebug("KOViewManager::updateView() "); 260 // qDebug("KOViewManager::updateView() ");
276 // if we are updating mTodoView, we get endless recursion 261 // if we are updating mTodoView, we get endless recursion
277 if ( mTodoView == mCurrentView ) 262 if ( mTodoView == mCurrentView )
278 return; 263 return;
279 if ( mCurrentView ) mCurrentView->updateView(); 264 if ( mCurrentView ) mCurrentView->updateView();
280 265
281} 266}
282 267
283void KOViewManager::updateView(const QDate &start, const QDate &end) 268void KOViewManager::updateView(const QDate &start, const QDate &end)
284{ 269{
285 // kdDebug() << "KOViewManager::updateView()" << endl; 270 // kdDebug() << "KOViewManager::updateView()" << endl;
286 271
287 if (mCurrentView) mCurrentView->showDates(start, end); 272 if (mCurrentView) mCurrentView->showDates(start, end);
288 273
289 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 274 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
290} 275}
291 276
292 277
293void KOViewManager::updateWNview() 278void KOViewManager::updateWNview()
294{ 279{
295 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 280 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
296 mWhatsNextView->updateView(); 281 mWhatsNextView->updateView();
297 282
298} 283}
299void KOViewManager::showWhatsNextView() 284void KOViewManager::showWhatsNextView()
300{ 285{
301 if (!mWhatsNextView) { 286 if (!mWhatsNextView) {
302 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 287 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
303 "KOViewManager::WhatsNextView"); 288 "KOViewManager::WhatsNextView");
304 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 289 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
305 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 290 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
306 addView(mWhatsNextView); 291 addView(mWhatsNextView);
307 connect(this, SIGNAL( printWNV() ), 292 connect(this, SIGNAL( printWNV() ),
308 mWhatsNextView, SLOT( printMe() ) ); 293 mWhatsNextView, SLOT( printMe() ) );
309 } 294 }
310 globalFlagBlockAgenda = 1; 295 globalFlagBlockAgenda = 1;
311 showView(mWhatsNextView, true ); 296 showView(mWhatsNextView, true );
312 //mWhatsNextView->updateView(); 297 //mWhatsNextView->updateView();
313 298
314} 299}
315 300
316void KOViewManager::showListView() 301void KOViewManager::showListView()
317{ 302{
318 if (!mListView) { 303 if (!mListView) {
319 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 304 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
320 addView(mListView); 305 addView(mListView);
321 306
322 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 307 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
323 mMainView, SLOT(showIncidence(Incidence *))); 308 mMainView, SLOT(showIncidence(Incidence *)));
324 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 309 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
325 mMainView, SLOT(editIncidence(Incidence *))); 310 mMainView, SLOT(editIncidence(Incidence *)));
326 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 311 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
327 mMainView, SLOT(deleteIncidence(Incidence *))); 312 mMainView, SLOT(deleteIncidence(Incidence *)));
328 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 313 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
329 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 314 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
330 connect( mListView, SIGNAL( signalNewEvent() ), 315 connect( mListView, SIGNAL( signalNewEvent() ),
331 mMainView, SLOT( newEvent() ) ); 316 mMainView, SLOT( newEvent() ) );
332 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 317 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
333 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 318 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
334 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 319 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
335 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 320 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
336 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 321 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
337 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 322 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
338 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 323 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
@@ -434,197 +419,213 @@ void KOViewManager::showDayView()
434 mCurrentAgendaView = 1 ; 419 mCurrentAgendaView = 1 ;
435 420
436} 421}
437 422
438void KOViewManager::showWorkWeekView() 423void KOViewManager::showWorkWeekView()
439{ 424{
440 mFlagShowNextxDays = false; 425 mFlagShowNextxDays = false;
441 globalFlagBlockAgenda = 1; 426 globalFlagBlockAgenda = 1;
442 globalFlagBlockLabel = 1; 427 globalFlagBlockLabel = 1;
443 if ( mCurrentAgendaView != 5 ) 428 if ( mCurrentAgendaView != 5 )
444 mCurrentAgendaView = -1; 429 mCurrentAgendaView = -1;
445 showAgendaView(); 430 showAgendaView();
446 qApp->processEvents(); 431 qApp->processEvents();
447 globalFlagBlockAgenda = 2; 432 globalFlagBlockAgenda = 2;
448 globalFlagBlockLabel = 0; 433 globalFlagBlockLabel = 0;
449 mMainView->dateNavigator()->selectWorkWeek(); 434 mMainView->dateNavigator()->selectWorkWeek();
450 mCurrentAgendaView = 5 ; 435 mCurrentAgendaView = 5 ;
451 436
452} 437}
453 438
454void KOViewManager::showWeekView() 439void KOViewManager::showWeekView()
455{ 440{
456 /* 441 /*
457 globalFlagBlockAgenda = 2; 442 globalFlagBlockAgenda = 2;
458 qDebug("4globalFlagBlockAgenda = 2; "); 443 qDebug("4globalFlagBlockAgenda = 2; ");
459 //globalFlagBlockPainting = true; 444 //globalFlagBlockPainting = true;
460 mMainView->dateNavigator()->selectWeek(); 445 mMainView->dateNavigator()->selectWeek();
461 showAgendaView(); 446 showAgendaView();
462 */ 447 */
463 448
464 449
465 mFlagShowNextxDays = false; 450 mFlagShowNextxDays = false;
466 globalFlagBlockAgenda = 1; 451 globalFlagBlockAgenda = 1;
467 globalFlagBlockLabel = 1; 452 globalFlagBlockLabel = 1;
468 if ( mCurrentAgendaView != 7 ) 453 if ( mCurrentAgendaView != 7 )
469 mCurrentAgendaView = -1; 454 mCurrentAgendaView = -1;
470 showAgendaView(); 455 showAgendaView();
471 qApp->processEvents(); 456 qApp->processEvents();
472 globalFlagBlockAgenda = 2; 457 globalFlagBlockAgenda = 2;
473 globalFlagBlockLabel = 0; 458 globalFlagBlockLabel = 0;
474 mMainView->dateNavigator()->selectWeek(); 459 mMainView->dateNavigator()->selectWeek();
475 mCurrentAgendaView = 7 ; 460 mCurrentAgendaView = 7 ;
476} 461}
477 462
478void KOViewManager::showNextXView() 463void KOViewManager::showNextXView()
479{ 464{
480 465
481 globalFlagBlockAgenda = 1; 466 globalFlagBlockAgenda = 1;
482 if ( mCurrentAgendaView != 3 ) 467 if ( mCurrentAgendaView != 3 )
483 mCurrentAgendaView = -1; 468 mCurrentAgendaView = -1;
484 showAgendaView(KOPrefs::instance()->mFullViewMonth); 469 showAgendaView(KOPrefs::instance()->mFullViewMonth);
485 globalFlagBlockAgenda = 2; 470 globalFlagBlockAgenda = 2;
486 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 471 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
487 KOPrefs::instance()->mNextXDays ); 472 KOPrefs::instance()->mNextXDays );
488 mFlagShowNextxDays = true; 473 mFlagShowNextxDays = true;
489 mCurrentAgendaView = 3 ; 474 mCurrentAgendaView = 3 ;
490} 475}
491bool KOViewManager::showsNextDays() 476bool KOViewManager::showsNextDays()
492{ 477{
493 return mFlagShowNextxDays; 478 return mFlagShowNextxDays;
494} 479}
495void KOViewManager::showMonthView() 480void KOViewManager::showMonthView()
496 { 481 {
497 if (!mMonthView) { 482 if (!mMonthView) {
498 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 483 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
499 484
500 addView(mMonthView); 485 addView(mMonthView);
501 // mMonthView->show(); 486 // mMonthView->show();
502 // SIGNALS/SLOTS FOR MONTH VIEW 487 // SIGNALS/SLOTS FOR MONTH VIEW
503 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 488 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
504 mMainView, SLOT(newEvent(QDateTime))); 489 mMainView, SLOT(newEvent(QDateTime)));
505 490
506 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 491 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
507 mMainView, SLOT(showIncidence(Incidence *))); 492 mMainView, SLOT(showIncidence(Incidence *)));
508 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 493 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
509 mMainView, SLOT(editIncidence(Incidence *))); 494 mMainView, SLOT(editIncidence(Incidence *)));
510 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 495 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
511 mMainView, SLOT(deleteIncidence(Incidence *))); 496 mMainView, SLOT(deleteIncidence(Incidence *)));
512 497
513 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 498 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
514 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 499 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
515 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 500 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
516 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 501 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
517 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 502 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
518 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 503 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
519 504
520 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 505 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
521 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
522 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 507 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
523 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 508 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
524 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 509 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
525 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 510 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
526 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 511 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
527 mMainView, SLOT ( showDay( QDate ) ) ); 512 mMainView, SLOT ( showDay( QDate ) ) );
528 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 513 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
529 connect( mMonthView, SIGNAL(nextMonth() ), 514 connect( mMonthView, SIGNAL(nextMonth() ),
530 mMainView->navigatorBar(), SIGNAL(goNextMonth() ) ); 515 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
531 connect( mMonthView, SIGNAL(prevMonth() ), 516 connect( mMonthView, SIGNAL(prevMonth() ),
532 mMainView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 517 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
533 connect( mMonthView, SIGNAL( showNavigator(bool) ), 518 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
534 mMainView, SLOT ( showNavigatorBar(bool) ) ); 519 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
520 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
521 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
522 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
523 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
524 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
525 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
526 connect( mMonthView->navigatorBar(), SIGNAL( selectWeek( int ) ),
527 mMainView->dateNavigator(), SLOT( selectWeek( int ) ) );
528
529 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
530 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
531
532
533 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
534 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
535
535 } 536 }
536 537
537 globalFlagBlockAgenda = 1; 538 globalFlagBlockAgenda = 1;
538 //mFlagShowNextxDays = false; 539 //mFlagShowNextxDays = false;
539 // if(mMonthView == mCurrentView) return; 540 // if(mMonthView == mCurrentView) return;
540 if ( KOPrefs::instance()->mMonthViewWeek ) 541 if ( KOPrefs::instance()->mMonthViewWeek )
541 mMainView->dateNavigator()->selectWeek(); 542 mMainView->dateNavigator()->selectWeek();
542 else 543 else
543 mMainView->dateNavigator()->selectMonth(); 544 mMainView->dateNavigator()->selectMonth();
544 545
545 showView(mMonthView, true ); 546 showView(mMonthView, true );
546 547
547} 548}
548 549
549void KOViewManager::showTodoView() 550void KOViewManager::showTodoView()
550{ 551{
551 //mFlagShowNextxDays = false; 552 //mFlagShowNextxDays = false;
552 if ( !mTodoView ) { 553 if ( !mTodoView ) {
553 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 554 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
554 "KOViewManager::TodoView" ); 555 "KOViewManager::TodoView" );
555 556
556 addView( mTodoView ); 557 addView( mTodoView );
557 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 558 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
558 559
559 // SIGNALS/SLOTS FOR TODO VIEW 560 // SIGNALS/SLOTS FOR TODO VIEW
560 connect( mTodoView, SIGNAL( newTodoSignal() ), 561 connect( mTodoView, SIGNAL( newTodoSignal() ),
561 mMainView, SLOT( newTodo() ) ); 562 mMainView, SLOT( newTodo() ) );
562 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 563 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
563 mMainView, SLOT( newSubTodo( Todo *) ) ); 564 mMainView, SLOT( newSubTodo( Todo *) ) );
564 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 565 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
565 mMainView, SLOT( showTodo( Todo * ) ) ); 566 mMainView, SLOT( showTodo( Todo * ) ) );
566 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 567 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
567 mMainView, SLOT( editTodo( Todo * ) ) ); 568 mMainView, SLOT( editTodo( Todo * ) ) );
568 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 569 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
569 mMainView, SLOT( deleteTodo( Todo * ) ) ); 570 mMainView, SLOT( deleteTodo( Todo * ) ) );
570 connect( mTodoView, SIGNAL( purgeCompletedSignal() ), 571 connect( mTodoView, SIGNAL( purgeCompletedSignal() ),
571 mMainView, SLOT( purgeCompleted() ) ); 572 mMainView, SLOT( purgeCompleted() ) );
572 573
573 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ), 574 connect( mTodoView, SIGNAL( incidenceSelected( Incidence * ) ),
574 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 575 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
575 576
576 connect( mMainView, SIGNAL( configChanged() ), mTodoView, 577 connect( mMainView, SIGNAL( configChanged() ), mTodoView,
577 SLOT( updateConfig() ) ); 578 SLOT( updateConfig() ) );
578 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 579 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
579 SLOT( updateTodo( Todo *, int ) ) ); 580 SLOT( updateTodo( Todo *, int ) ) );
580 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 581 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
581 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 582 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
582 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 583 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
583 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 584 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
584 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 585 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
585 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 586 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
586 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 587 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
587 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 588 mMainView, SLOT ( todo_unsub( Todo * ) ) );
588 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 589 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
589 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 590 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
590 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 591 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
591 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 592 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
592 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 593 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
593 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 594 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
594 KConfig *config = KOGlobals::config(); 595 KConfig *config = KOGlobals::config();
595 mTodoView->restoreLayout(config,"Todo View"); 596 mTodoView->restoreLayout(config,"Todo View");
596 mTodoView->setNavigator( mMainView->dateNavigator() ); 597 mTodoView->setNavigator( mMainView->dateNavigator() );
597 } 598 }
598 599
599 globalFlagBlockAgenda = 1; 600 globalFlagBlockAgenda = 1;
600 showView( mTodoView, true ); 601 showView( mTodoView, true );
601 602
602} 603}
603 604
604void KOViewManager::showJournalView() 605void KOViewManager::showJournalView()
605{ 606{
606 //mFlagShowNextxDays = false; 607 //mFlagShowNextxDays = false;
607 if (!mJournalView) { 608 if (!mJournalView) {
608 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 609 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
609 "KOViewManager::JournalView"); 610 "KOViewManager::JournalView");
610 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 611 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
611 SLOT( updateConfig() ) ); 612 SLOT( updateConfig() ) );
612 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 613 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
613 addView(mJournalView); 614 addView(mJournalView);
614 } 615 }
615 616
616 showView(mJournalView); 617 showView(mJournalView);
617 mMainView->dateNavigator()->selectDates( 1 ); 618 mMainView->dateNavigator()->selectDates( 1 );
618} 619}
619 620
620void KOViewManager::showTimeSpanView() 621void KOViewManager::showTimeSpanView()
621{ 622{
622 //mFlagShowNextxDays = false; 623 //mFlagShowNextxDays = false;
623 if (!mTimeSpanView) { 624 if (!mTimeSpanView) {
624 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 625 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
625 "KOViewManager::TimeSpanView"); 626 "KOViewManager::TimeSpanView");
626 addView(mTimeSpanView); 627 addView(mTimeSpanView);
627 628
628 mTimeSpanView->readSettings(); 629 mTimeSpanView->readSettings();
629 } 630 }
630 631
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 657f98d..f05e6f6 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -61,141 +61,142 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
61 61
62 topLayout->addWidget( mCtrlFrame ); 62 topLayout->addWidget( mCtrlFrame );
63 63
64 QFont tfont = font(); 64 QFont tfont = font();
65 if ( QApplication::desktop()->width() >= 480 ) 65 if ( QApplication::desktop()->width() >= 480 )
66 tfont.setPointSize(tfont.pointSize()+2); 66 tfont.setPointSize(tfont.pointSize()+2);
67 tfont.setBold(true); 67 tfont.setBold(true);
68 68
69 bool isRTL = KOGlobals::self()->reverseLayout(); 69 bool isRTL = KOGlobals::self()->reverseLayout();
70#ifndef DESKTOP_VERSION 70#ifndef DESKTOP_VERSION
71 bool isDesktop = false; 71 bool isDesktop = false;
72#else 72#else
73 bool isDesktop = true; 73 bool isDesktop = true;
74#endif 74#endif
75 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) 75 if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 )
76 isDesktop = true; 76 isDesktop = true;
77 // Create backward navigation buttons 77 // Create backward navigation buttons
78 mPrevYear = new QPushButton( mCtrlFrame ); 78 mPrevYear = new QPushButton( mCtrlFrame );
79 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); 79 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
80 QToolTip::add( mPrevYear, i18n("Previous Year") ); 80 QToolTip::add( mPrevYear, i18n("Previous Year") );
81 81
82 mPrevMonth = new QPushButton( mCtrlFrame ); 82 mPrevMonth = new QPushButton( mCtrlFrame );
83 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 83 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
84 QToolTip::add( mPrevMonth, i18n("Previous Month") ); 84 QToolTip::add( mPrevMonth, i18n("Previous Month") );
85 85
86 // Create forward navigation buttons 86 // Create forward navigation buttons
87 mNextMonth = new QPushButton( mCtrlFrame ); 87 mNextMonth = new QPushButton( mCtrlFrame );
88 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 88 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
89 QToolTip::add( mNextMonth, i18n("Next Month") ); 89 QToolTip::add( mNextMonth, i18n("Next Month") );
90 90
91 mNextYear = new QPushButton( mCtrlFrame ); 91 mNextYear = new QPushButton( mCtrlFrame );
92 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); 92 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") );
93 QToolTip::add( mNextYear, i18n("Next Year") ); 93 QToolTip::add( mNextYear, i18n("Next Year") );
94 mSelectMonth = new QPushButton( mCtrlFrame ); 94 mSelectMonth = new QPushButton( mCtrlFrame );
95 // Create month name label 95 // Create month name label
96 //selectMonth->setFont( tfont ); 96 //selectMonth->setFont( tfont );
97 // selectMonth->setAlignment( AlignCenter ); 97 // selectMonth->setAlignment( AlignCenter );
98 //mDateLabel = new QLabel( selectMonth ); 98 //mDateLabel = new QLabel( selectMonth );
99 //mDateLabel->setFont( tfont ); 99 //mDateLabel->setFont( tfont );
100 //mDateLabel->setAlignment( AlignCenter ); 100 //mDateLabel->setAlignment( AlignCenter );
101 if ( QString ( name ) == QString("useBigPixmaps") ) { 101 if ( QString ( name ) == QString("useBigPixmaps") ) {
102 mNextMonth->setFlat( true); 102 mNextMonth->setFlat( true);
103 mNextYear->setFlat( true); 103 mNextYear->setFlat( true);
104 mSelectMonth->setFlat( true); 104 mSelectMonth->setFlat( true);
105 mPrevYear->setFlat( true); 105 mPrevYear->setFlat( true);
106 mPrevMonth->setFlat( true); 106 mPrevMonth->setFlat( true);
107 } 107 }
108 mSelectMonth->setFont( tfont ); 108 mSelectMonth->setFont( tfont );
109 // Set minimum width to width of widest month name label 109 // Set minimum width to width of widest month name label
110 int i; 110 int i;
111 int maxwidth = 0; 111 int maxwidth = 0;
112 QFontMetrics fm ( mSelectMonth->font() ); 112 QFontMetrics fm ( mSelectMonth->font() );
113 int width = fm.width("September '00" ); 113 int width = fm.width("September '00" );
114// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); 114// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
115// ++i ) { 115// ++i ) {
116// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, 116// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
117// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); 117// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
118// int width = fm.width("September 2000" ); 118// int width = fm.width("September 2000" );
119// if ( width > maxwidth ) maxwidth = width; 119// if ( width > maxwidth ) maxwidth = width;
120// } 120// }
121 maxwidth = width+2; 121 maxwidth = width+2;
122 int size = fm.height()+2; 122 int size = fm.height()+2;
123 if ( QApplication::desktop()->width() >= 480 ) { 123 if ( QApplication::desktop()->width() >= 480 ) {
124 size += 6; 124 size += 6;
125 maxwidth+= 6; 125 maxwidth+= 6;
126 } 126 }
127 127
128 mSelectMonth->setFixedWidth( maxwidth ); 128 mSelectMonth->setFixedWidth( maxwidth );
129 mSelectMonth->setFixedHeight( size ); 129 mSelectMonth->setFixedHeight( size );
130 mPrevYear->setFixedHeight( size ); 130 mPrevYear->setFixedHeight( size );
131 mPrevMonth->setFixedHeight( size ); 131 mPrevMonth->setFixedHeight( size );
132 mNextMonth->setFixedHeight( size ); 132 mNextMonth->setFixedHeight( size );
133 mNextYear->setFixedHeight ( size ); 133 mNextYear->setFixedHeight ( size );
134 // set up control frame layout 134 // set up control frame layout
135 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 135 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
136 ctrlLayout->addWidget( mPrevYear, 3 ); 136 ctrlLayout->addWidget( mPrevYear, 3 );
137 ctrlLayout->addWidget( mPrevMonth, 3 ); 137 ctrlLayout->addWidget( mPrevMonth, 3 );
138 //ctrlLayout->addStretch( 1 ); 138 //ctrlLayout->addStretch( 1 );
139 // ctrlLayout->addSpacing( 1 ); 139 // ctrlLayout->addSpacing( 1 );
140 // ctrlLayout->addWidget( mDateLabel ); 140 // ctrlLayout->addWidget( mDateLabel );
141 ctrlLayout->addWidget( mSelectMonth ); 141 ctrlLayout->addWidget( mSelectMonth );
142 // ctrlLayout->addSpacing( 1 ); 142 // ctrlLayout->addSpacing( 1 );
143 // ctrlLayout->addStretch( 1 ); 143 // ctrlLayout->addStretch( 1 );
144 ctrlLayout->addWidget( mNextMonth, 3 ); 144 ctrlLayout->addWidget( mNextMonth, 3 );
145 ctrlLayout->addWidget( mNextYear, 3 ); 145 ctrlLayout->addWidget( mNextYear, 3 );
146 146
147 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 147 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
148 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 148 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
149 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 149 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
150 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 150 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
151 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 151 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
152 mPrevYear->setFocusPolicy(NoFocus); 152 mPrevYear->setFocusPolicy(NoFocus);
153 mPrevMonth->setFocusPolicy(NoFocus); 153 mPrevMonth->setFocusPolicy(NoFocus);
154 mNextMonth->setFocusPolicy(NoFocus); 154 mNextMonth->setFocusPolicy(NoFocus);
155 mNextYear->setFocusPolicy(NoFocus); 155 mNextYear->setFocusPolicy(NoFocus);
156 mSelectMonth->setFocusPolicy(NoFocus); 156 mSelectMonth->setFocusPolicy(NoFocus);
157 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
157 158
158} 159}
159 160
160NavigatorBar::~NavigatorBar() 161NavigatorBar::~NavigatorBar()
161{ 162{
162} 163}
163 164
164void NavigatorBar::selectMonth() 165void NavigatorBar::selectMonth()
165{ 166{
166 167
167 int month; 168 int month;
168 KPopupFrame* popup = new KPopupFrame(this); 169 KPopupFrame* popup = new KPopupFrame(this);
169 int size = 12; 170 int size = 12;
170 if ( QApplication::desktop()->width() >= 480 ) 171 if ( QApplication::desktop()->width() >= 480 )
171 size = 18; 172 size = 18;
172 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); 173 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup);
173 // ----- 174 // -----
174 picker->resize(picker->sizeHint()); 175 picker->resize(picker->sizeHint());
175 popup->setMainWidget(picker); 176 popup->setMainWidget(picker);
176 picker->setFocus(); 177 picker->setFocus();
177 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 178 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
178 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 179 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
179 { 180 {
180 month = picker->getResult(); 181 month = picker->getResult();
181 emit monthSelected ( month ); 182 emit monthSelected ( month );
182 } else { 183 } else {
183 KNotifyClient::beep(); 184 KNotifyClient::beep();
184 } 185 }
185 delete popup; 186 delete popup;
186} 187}
187void NavigatorBar::selectDates( const KCal::DateList &dateList ) 188void NavigatorBar::selectDates( const KCal::DateList &dateList )
188{ 189{
189 if (dateList.count() > 0) { 190 if (dateList.count() > 0) {
190 QDate date = dateList.first(); 191 QDate date = dateList.first();
191 192
192 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); 193 const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem();
193 194
194 // compute the label at the top of the navigator 195 // compute the label at the top of the navigator
195 QString dtstr = i18n(calSys->monthName( date )) + " '" + 196 QString dtstr = i18n(calSys->monthName( date )) + " '" +
196 QString::number( calSys->year( date ) ).right(2); 197 QString::number( calSys->year( date ) ).right(2);
197 198
198 mSelectMonth->setText( dtstr ); 199 mSelectMonth->setText( dtstr );
199 } 200 }
200} 201}
201 202