summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-17 10:42:07 (UTC)
committer zautrix <zautrix>2005-04-17 10:42:07 (UTC)
commitff7743ec82aa6d70325e613d0a1054c7de83a76c (patch) (unidiff)
treee6d4c46a26e120817acd5ab7e47ef41b1428700b /korganizer
parentfd67a473a94c5a3d63a89c52fb8f612cb19b5363 (diff)
downloadkdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.zip
kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.gz
kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp95
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp4
-rw-r--r--korganizer/koviewmanager.cpp7
6 files changed, 105 insertions, 11 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b175f9a..2b7e41f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -313,198 +313,208 @@ void MonthViewItem::paint(QPainter *p)
313#if QT_VERSION >= 0x030000 313#if QT_VERSION >= 0x030000
314 bool sel = isSelected(); 314 bool sel = isSelected();
315#else 315#else
316 bool sel = selected(); 316 bool sel = selected();
317#endif 317#endif
318 318
319 319
320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 320 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
321 { 321 {
322 p->setBackgroundColor( palette().color( QPalette::Normal, \ 322 p->setBackgroundColor( palette().color( QPalette::Normal, \
323 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 323 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 324 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
325 } 325 }
326 int x = 1; 326 int x = 1;
327 //int y = 3;//(height() - mRecurPixmap.height()) /2; 327 //int y = 3;//(height() - mRecurPixmap.height()) /2;
328 int size = PIXMAP_SIZE; 328 int size = PIXMAP_SIZE;
329 if ( QApplication::desktop()->width() < 300 ) 329 if ( QApplication::desktop()->width() < 300 )
330 size = 3; 330 size = 3;
331 int heihei = height( listBox () ); 331 int heihei = height( listBox () );
332 int y = (heihei - size -1 ) /2; 332 int y = (heihei - size -1 ) /2;
333 333
334 if ( KOPrefs::instance()->mMonthShowIcons ) { 334 if ( KOPrefs::instance()->mMonthShowIcons ) {
335 if ( mInfo ) { 335 if ( mInfo ) {
336 p->fillRect ( x, y,size,size, Qt::darkGreen ); 336 p->fillRect ( x, y,size,size, Qt::darkGreen );
337 x += size + 1; 337 x += size + 1;
338 } 338 }
339 if ( mRecur ) { 339 if ( mRecur ) {
340 p->fillRect ( x, y,size,size, Qt::blue ); 340 p->fillRect ( x, y,size,size, Qt::blue );
341 x += size + 1; 341 x += size + 1;
342 } 342 }
343 if ( mAlarm ) { 343 if ( mAlarm ) {
344 p->fillRect ( x, y,size,size, Qt::red ); 344 p->fillRect ( x, y,size,size, Qt::red );
345 x += size + 1; 345 x += size + 1;
346 } 346 }
347 if ( mReply ) { 347 if ( mReply ) {
348 p->fillRect ( x, y,size,size, Qt::yellow ); 348 p->fillRect ( x, y,size,size, Qt::yellow );
349 x += size + 1; 349 x += size + 1;
350 } 350 }
351 } 351 }
352 if ( mMultiday ) { 352 if ( mMultiday ) {
353 int yyy = y+(size/2); 353 int yyy = y+(size/2);
354 int sizeM = size+2; 354 int sizeM = size+2;
355 p->setBrush( QBrush::SolidPattern ); 355 p->setBrush( QBrush::SolidPattern );
356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
357 if ( mMultiday == 2 || mMultiday == 3 ) { 357 if ( mMultiday == 2 || mMultiday == 3 ) {
358 QPointArray pa ( 3 ); 358 QPointArray pa ( 3 );
359 pa.setPoint (0, x, yyy ); 359 pa.setPoint (0, x, yyy );
360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
362 p->drawPolygon( pa ); 362 p->drawPolygon( pa );
363 } 363 }
364 if ( mMultiday == 2 || mMultiday == 1 ) { 364 if ( mMultiday == 2 || mMultiday == 1 ) {
365 QPointArray pa ( 3 ); 365 QPointArray pa ( 3 );
366 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 366 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 369 p->drawPolygon( pa );
370 } 370 }
371 if ( mMultiday == 1 ) { 371 if ( mMultiday == 1 ) {
372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
373 373
374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
375 } 375 }
376 if ( mMultiday == 3 ) { 376 if ( mMultiday == 3 ) {
377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
379 379
380 } 380 }
381 x += sizeM/2 + 1; 381 x += sizeM/2 + 1;
382 x += sizeM + 1; 382 x += sizeM + 1;
383 } 383 }
384 384
385 if ( mIncidence->type() == "Todo" ){ 385 if ( mIncidence->type() == "Todo" ){
386 Todo* td = ( Todo* ) mIncidence; 386 Todo* td = ( Todo* ) mIncidence;
387 if ( td->isCompleted() ) { 387 if ( td->isCompleted() ) {
388 int half = size/2; 388 int half = size/2;
389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
391 x += half+half + 4; 391 x += half+half + 4;
392 392
393 } else { 393 } else {
394 int val = td->percentComplete()/20; 394 int val = td->percentComplete()/20;
395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
396 p->drawRect ( x, y-2,7,size+4); 396 p->drawRect ( x, y-2,7,size+4);
397 x += size + 3; 397 x += size + 3;
398 } 398 }
399 } 399 }
400 QFontMetrics fm = p->fontMetrics(); 400 QFontMetrics fm = p->fontMetrics();
401 int yPos; 401 int yPos;
402 int pmheight = size; 402 int pmheight = size;
403 if( pmheight < fm.height() ) 403 if( pmheight < fm.height() )
404 yPos = fm.ascent() + fm.leading()/2; 404 yPos = fm.ascent() + fm.leading()/2;
405 else 405 else
406 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 406 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 407 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 408 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 p->drawText( x, yPos, text() ); 409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
410 if ( mIncidence->cancelled() ) { 410 p->drawText( x, yPos, text() );
411 int wid = fm.width( text() ); 411 if ( mIncidence->cancelled() ) {
412 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 412 int wid = fm.width( text() );
413 } 413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
414 414 }
415 } else {
416 QString pText = text();
417 if( pText.mid(2,1) == ":" )
418 pText = pText.mid( 6 );
419 p->drawText( x, yPos, pText );
420 if ( mIncidence->cancelled() ) {
421 int wid = fm.width( pText );
422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
423 }
424 }
415} 425}
416 426
417int MonthViewItem::height(const QListBox *lb) const 427int MonthViewItem::height(const QListBox *lb) const
418{ 428{
419 int ret = 10; 429 int ret = 10;
420 if ( lb ) 430 if ( lb )
421 ret = lb->fontMetrics().lineSpacing()+1; 431 ret = lb->fontMetrics().lineSpacing()+1;
422 return ret; 432 return ret;
423} 433}
424 434
425int MonthViewItem::width(const QListBox *lb) const 435int MonthViewItem::width(const QListBox *lb) const
426{ 436{
427 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 437 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
428 int size = PIXMAP_SIZE; 438 int size = PIXMAP_SIZE;
429 if ( QApplication::desktop()->width() < 300 ) 439 if ( QApplication::desktop()->width() < 300 )
430 size = 3; 440 size = 3;
431 int x = 1; 441 int x = 1;
432 if ( KOPrefs::instance()->mMonthShowIcons ) { 442 if ( KOPrefs::instance()->mMonthShowIcons ) {
433 if ( mInfo ) { 443 if ( mInfo ) {
434 x += size + 1; 444 x += size + 1;
435 } 445 }
436 if( mRecur ) { 446 if( mRecur ) {
437 x += size+1; 447 x += size+1;
438 } 448 }
439 if( mAlarm ) { 449 if( mAlarm ) {
440 x += size+1; 450 x += size+1;
441 } 451 }
442 if( mReply ) { 452 if( mReply ) {
443 x += size+1; 453 x += size+1;
444 } 454 }
445 } 455 }
446 if( mMultiday ) { 456 if( mMultiday ) {
447 x += size+1+2+size/2; 457 x += size+1+2+size/2;
448 } 458 }
449 return( x + lb->fontMetrics().width( text() ) + 1 ); 459 return( x + lb->fontMetrics().width( text() ) + 1 );
450 } 460 }
451 if ( ! lb ) 461 if ( ! lb )
452 return 10; 462 return 10;
453 //qDebug("ret wid %d ", lb->width()); 463 //qDebug("ret wid %d ", lb->width());
454 return lb->width(); 464 return lb->width();
455} 465}
456 466
457 467
458MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 468MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
459 : KNoScrollListBox( par ), 469 : KNoScrollListBox( par ),
460 mMonthView( parent ) 470 mMonthView( parent )
461{ 471{
462 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 472 //QVBoxLayout *topLayout = new QVBoxLayout( this );
463 currentPalette = 0; 473 currentPalette = 0;
464 // mLabel = new QLabel( this );QPushButton 474 // mLabel = new QLabel( this );QPushButton
465 mLabel = new QPushButton( this ); 475 mLabel = new QPushButton( this );
466 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 476 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
467 //mLabel->setLineWidth( 1 ); 477 //mLabel->setLineWidth( 1 );
468 //mLabel->setAlignment( AlignCenter ); 478 //mLabel->setAlignment( AlignCenter );
469 mLabel->setFlat( true ); 479 mLabel->setFlat( true );
470 mLabel->setFocusPolicy(NoFocus); 480 mLabel->setFocusPolicy(NoFocus);
471 //mItemList = new KNoScrollListBox( this ); 481 //mItemList = new KNoScrollListBox( this );
472 setMinimumSize( 10, 10 ); 482 setMinimumSize( 10, 10 );
473 setFrameStyle( QFrame::Panel | QFrame::Plain ); 483 setFrameStyle( QFrame::Panel | QFrame::Plain );
474 setLineWidth( 1 ); 484 setLineWidth( 1 );
475 //topLayout->addWidget( mItemList ); 485 //topLayout->addWidget( mItemList );
476 mLabel->raise(); 486 mLabel->raise();
477 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 487 // QColor( 0,0,255 ) QColor( 160,1600,255 )
478 mStandardPalette = palette(); 488 mStandardPalette = palette();
479 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 489 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
480 490
481 enableScrollBars( false ); 491 enableScrollBars( false );
482 updateConfig(); 492 updateConfig();
483 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 493 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
484 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 494 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
485 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 495 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
486 SLOT( defaultAction( QListBoxItem * ) ) ); 496 SLOT( defaultAction( QListBoxItem * ) ) );
487 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 497 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
488 const QPoint &) ), 498 const QPoint &) ),
489 SLOT( contextMenu( QListBoxItem * ) ) ); 499 SLOT( contextMenu( QListBoxItem * ) ) );
490 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 500 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
491 SLOT( selection( QListBoxItem * ) ) ); 501 SLOT( selection( QListBoxItem * ) ) );
492 502
493 /* 503 /*
494 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 504 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
495 SLOT( selection( QListBoxItem * ) ) ); 505 SLOT( selection( QListBoxItem * ) ) );
496 */ 506 */
497} 507}
498#ifdef DESKTOP_VERSION 508#ifdef DESKTOP_VERSION
499QToolTipGroup *MonthViewCell::toolTipGroup() 509QToolTipGroup *MonthViewCell::toolTipGroup()
500{ 510{
501 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 511 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
502 return mToolTipGroup; 512 return mToolTipGroup;
503} 513}
504#endif 514#endif
505 515
506void MonthViewCell::setDate( const QDate &date ) 516void MonthViewCell::setDate( const QDate &date )
507{ 517{
508 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 518 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
509 mDate = date; 519 mDate = date;
510 520
@@ -949,350 +959,378 @@ Incidence *MonthViewCell::selectedIncidence()
949{ 959{
950 int index = currentItem(); 960 int index = currentItem();
951 if ( index < 0 ) return 0; 961 if ( index < 0 ) return 0;
952 962
953 MonthViewItem *mitem = 963 MonthViewItem *mitem =
954 static_cast<MonthViewItem *>( item( index ) ); 964 static_cast<MonthViewItem *>( item( index ) );
955 965
956 if ( !mitem ) return 0; 966 if ( !mitem ) return 0;
957 967
958 return mitem->incidence(); 968 return mitem->incidence();
959} 969}
960 970
961QDate MonthViewCell::selectedIncidenceDate() 971QDate MonthViewCell::selectedIncidenceDate()
962{ 972{
963 QDate qd; 973 QDate qd;
964 int index = currentItem(); 974 int index = currentItem();
965 if ( index < 0 ) return qd; 975 if ( index < 0 ) return qd;
966 976
967 MonthViewItem *mitem = 977 MonthViewItem *mitem =
968 static_cast<MonthViewItem *>( item( index ) ); 978 static_cast<MonthViewItem *>( item( index ) );
969 979
970 if ( !mitem ) return qd; 980 if ( !mitem ) return qd;
971 981
972 return mitem->incidenceDate(); 982 return mitem->incidenceDate();
973} 983}
974 984
975void MonthViewCell::deselect() 985void MonthViewCell::deselect()
976{ 986{
977 clearSelection(); 987 clearSelection();
978 enableScrollBars( false ); 988 enableScrollBars( false );
979 // updateCell(); 989 // updateCell();
980} 990}
981void MonthViewCell::select() 991void MonthViewCell::select()
982{ 992{
983 ;// updateCell(); 993 ;// updateCell();
984} 994}
985 995
986void MonthViewCell::resizeEvent ( QResizeEvent * e ) 996void MonthViewCell::resizeEvent ( QResizeEvent * e )
987{ 997{
988 if ( !mMonthView->isUpdatePossible() ) 998 if ( !mMonthView->isUpdatePossible() )
989 return; 999 return;
990 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 1000 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
991 deselect(); 1001 deselect();
992 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 1002 mLabel->setMaximumHeight( height() - lineWidth()*2 );
993 1003
994 QString text; 1004 QString text;
995 mLabel->setText( text ); 1005 mLabel->setText( text );
996 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 1006 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
997 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 1007 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
998 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 1008 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
999 mLabel->resize( mLabelBigSize ); 1009 mLabel->resize( mLabelBigSize );
1000 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1010 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1001 } else { 1011 } else {
1002 mLabel->resize( mLabelSize ); 1012 mLabel->resize( mLabelSize );
1003 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1013 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1004 } 1014 }
1005 mLabel->setText( text ); 1015 mLabel->setText( text );
1006 1016
1007 int size = height() - mLabel->height() - lineWidth()-1; 1017 int size = height() - mLabel->height() - lineWidth()-1;
1008 //qDebug("LW %d ", lineWidth()); 1018 //qDebug("LW %d ", lineWidth());
1009 if ( size > 0 ) 1019 if ( size > 0 )
1010 verticalScrollBar()->setMaximumHeight( size ); 1020 verticalScrollBar()->setMaximumHeight( size );
1011 size = width() - mLabel->width() -lineWidth()-1; 1021 size = width() - mLabel->width() -lineWidth()-1;
1012 if ( size > 0 ) 1022 if ( size > 0 )
1013 horizontalScrollBar()->setMaximumWidth( size ); 1023 horizontalScrollBar()->setMaximumWidth( size );
1014 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1024 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1015 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1025 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1016 // mItemList->resize ( width(), height () ); 1026 // mItemList->resize ( width(), height () );
1017 if ( e ) 1027 if ( e )
1018 KNoScrollListBox::resizeEvent ( e ); 1028 KNoScrollListBox::resizeEvent ( e );
1019} 1029}
1020 1030
1021void MonthViewCell::defaultAction( QListBoxItem *item ) 1031void MonthViewCell::defaultAction( QListBoxItem *item )
1022{ 1032{
1023 1033
1024 if ( !item ) { 1034 if ( !item ) {
1025 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1035 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1026 emit newEventSignal( dt ); 1036 emit newEventSignal( dt );
1027 return; 1037 return;
1028 } 1038 }
1029 1039
1030 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1040 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1031 Incidence *incidence = eventItem->incidence(); 1041 Incidence *incidence = eventItem->incidence();
1032 if ( incidence ) mMonthView->defaultAction( incidence ); 1042 if ( incidence ) mMonthView->defaultAction( incidence );
1033} 1043}
1034void MonthViewCell::showDay() 1044void MonthViewCell::showDay()
1035{ 1045{
1036 emit showDaySignal( date() ); 1046 emit showDaySignal( date() );
1037} 1047}
1038void MonthViewCell::newEvent() 1048void MonthViewCell::newEvent()
1039{ 1049{
1040 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1050 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1041 emit newEventSignal( dt ); 1051 emit newEventSignal( dt );
1042} 1052}
1043void MonthViewCell::cellClicked( QListBoxItem *item ) 1053void MonthViewCell::cellClicked( QListBoxItem *item )
1044{ 1054{
1055 mMonthView->setSelectedCell( this );
1045 qDebug("CELL "); 1056 qDebug("CELL ");
1046 if ( item == 0 ) { 1057 if ( item == 0 ) {
1047 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1058 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1048 emit newEventSignal( dt ); 1059 emit newEventSignal( dt );
1049 return; 1060 return;
1050 } 1061 }
1051 1062
1052} 1063}
1053 1064
1054void MonthViewCell::contextMenu( QListBoxItem *item ) 1065void MonthViewCell::contextMenu( QListBoxItem *item )
1055{ 1066{
1056 if ( !item ) return; 1067 mMonthView->setPopupCell( this );
1057 1068 if ( !item ) {
1069 mMonthView->showContextMenu( 0 );
1070 return;
1071 }
1058 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1072 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1059 Incidence *incidence = eventItem->incidence(); 1073 Incidence *incidence = eventItem->incidence();
1060 if ( incidence ) mMonthView->showContextMenu( incidence ); 1074 if ( incidence ) mMonthView->showContextMenu( incidence );
1061} 1075}
1062 1076
1063void MonthViewCell::selection( QListBoxItem *item ) 1077void MonthViewCell::selection( QListBoxItem *item )
1064{ 1078{
1065 if ( !item ) return; 1079 if ( !item ) return;
1066 1080
1067 mMonthView->setSelectedCell( this ); 1081 mMonthView->setSelectedCell( this );
1068} 1082}
1069 1083
1070 1084
1071// ******************************************************************************* 1085// *******************************************************************************
1072// ******************************************************************************* 1086// *******************************************************************************
1073// ******************************************************************************* 1087// *******************************************************************************
1074 1088
1075 1089
1076KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1090KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1077 : KOEventView( calendar, parent, name ), 1091 : KOEventView( calendar, parent, name ),
1078 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1092 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1079 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1093 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1080{ 1094{
1081 mFlagKeyPressed = false; 1095 mFlagKeyPressed = false;
1082 mShortDayLabelsM = false; 1096 mShortDayLabelsM = false;
1083 mShortDayLabelsW = false; 1097 mShortDayLabelsW = false;
1084 skipResize = false; 1098 skipResize = false;
1085 clPending = true; 1099 clPending = true;
1100 mPopupCell = 0;
1086 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1101 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1087 mWidStack = new QWidgetStack( this ); 1102 mWidStack = new QWidgetStack( this );
1088 QVBoxLayout* hb = new QVBoxLayout( this ); 1103 QVBoxLayout* hb = new QVBoxLayout( this );
1089 mMonthView = new QWidget( mWidStack ); 1104 mMonthView = new QWidget( mWidStack );
1090 mWeekView = new QWidget( mWidStack ); 1105 mWeekView = new QWidget( mWidStack );
1091#if QT_VERSION >= 0x030000 1106#if QT_VERSION >= 0x030000
1092 mWidStack->addWidget(mMonthView ); 1107 mWidStack->addWidget(mMonthView );
1093 mWidStack->addWidget(mWeekView ); 1108 mWidStack->addWidget(mWeekView );
1094#else 1109#else
1095 mWidStack->addWidget( mMonthView, 1 ); 1110 mWidStack->addWidget( mMonthView, 1 );
1096 mWidStack->addWidget( mWeekView , 1 ); 1111 mWidStack->addWidget( mWeekView , 1 );
1097#endif 1112#endif
1098 hb->addWidget( mNavigatorBar ); 1113 hb->addWidget( mNavigatorBar );
1099 hb->addWidget( mWidStack ); 1114 hb->addWidget( mWidStack );
1100 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1115 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1101 updatePossible = false; 1116 updatePossible = false;
1102 //updatePossible = true; 1117 //updatePossible = true;
1103 mCells.setAutoDelete( true ); 1118 mCells.setAutoDelete( true );
1104 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1119 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1105 mDayLabels.resize( mDaysPerWeek ); 1120 mDayLabels.resize( mDaysPerWeek );
1106 mDayLabelsW.resize( mDaysPerWeek ); 1121 mDayLabelsW.resize( mDaysPerWeek );
1107 QFont bfont = font(); 1122 QFont bfont = font();
1108 if ( QApplication::desktop()->width() < 650 ) { 1123 if ( QApplication::desktop()->width() < 650 ) {
1109 bfont.setPointSize( bfont.pointSize() - 2 ); 1124 bfont.setPointSize( bfont.pointSize() - 2 );
1110 } 1125 }
1111 bfont.setBold( true ); 1126 bfont.setBold( true );
1112 int i; 1127 int i;
1113 1128
1114 for( i = 0; i < mDaysPerWeek; i++ ) { 1129 for( i = 0; i < mDaysPerWeek; i++ ) {
1115 QLabel *label = new QLabel( mMonthView ); 1130 QLabel *label = new QLabel( mMonthView );
1116 label->setFont(bfont); 1131 label->setFont(bfont);
1117 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1132 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1118 label->setLineWidth(1); 1133 label->setLineWidth(1);
1119 label->setAlignment(AlignCenter); 1134 label->setAlignment(AlignCenter);
1120 mDayLabels.insert( i, label ); 1135 mDayLabels.insert( i, label );
1121 label = new QLabel( mWeekView ); 1136 label = new QLabel( mWeekView );
1122 label->setFont(bfont); 1137 label->setFont(bfont);
1123 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1138 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1124 label->setLineWidth(1); 1139 label->setLineWidth(1);
1125 label->setAlignment(AlignCenter); 1140 label->setAlignment(AlignCenter);
1126 mDayLabelsW.insert( i, label ); 1141 mDayLabelsW.insert( i, label );
1127 } 1142 }
1128 1143
1129 bfont.setBold( false ); 1144 bfont.setBold( false );
1130 mWeekLabels.resize( mNumWeeks+1 ); 1145 mWeekLabels.resize( mNumWeeks+1 );
1131 mWeekLabelsW.resize( 2 ); 1146 mWeekLabelsW.resize( 2 );
1132 for( i = 0; i < mNumWeeks+1; i++ ) { 1147 for( i = 0; i < mNumWeeks+1; i++ ) {
1133 KOWeekButton *label = new KOWeekButton( mMonthView ); 1148 KOWeekButton *label = new KOWeekButton( mMonthView );
1134 label->setFocusPolicy(NoFocus); 1149 label->setFocusPolicy(NoFocus);
1135 label->setFont(bfont); 1150 label->setFont(bfont);
1136 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1151 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1137 label->setFlat(true); 1152 label->setFlat(true);
1138 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1153 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1139 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1154 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1140 //label->setLineWidth(1); 1155 //label->setLineWidth(1);
1141 //label->setAlignment(AlignCenter); 1156 //label->setAlignment(AlignCenter);
1142 mWeekLabels.insert( i, label ); 1157 mWeekLabels.insert( i, label );
1143 } 1158 }
1144 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1159 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1145 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1160 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1146 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1161 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1147 1162
1148 for( i = 0; i < 1+1; i++ ) { 1163 for( i = 0; i < 1+1; i++ ) {
1149 KOWeekButton *label = new KOWeekButton( mWeekView ); 1164 KOWeekButton *label = new KOWeekButton( mWeekView );
1150 label->setFocusPolicy(NoFocus); 1165 label->setFocusPolicy(NoFocus);
1151 label->setFont(bfont); 1166 label->setFont(bfont);
1152 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1167 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1153 label->setFlat(true); 1168 label->setFlat(true);
1154 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1169 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1155 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1170 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1156 //label->setLineWidth(1); 1171 //label->setLineWidth(1);
1157 //label->setAlignment(AlignCenter); 1172 //label->setAlignment(AlignCenter);
1158 mWeekLabelsW.insert( i, label ); 1173 mWeekLabelsW.insert( i, label );
1159 } 1174 }
1160 mWeekLabelsW[1]->setText( i18n("W")); 1175 mWeekLabelsW[1]->setText( i18n("W"));
1161 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1176 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1162 1177
1163 1178
1164 int row, col; 1179 int row, col;
1165 mCells.resize( mNumCells ); 1180 mCells.resize( mNumCells );
1166 for( row = 0; row < mNumWeeks; ++row ) { 1181 for( row = 0; row < mNumWeeks; ++row ) {
1167 for( col = 0; col < mDaysPerWeek; ++col ) { 1182 for( col = 0; col < mDaysPerWeek; ++col ) {
1168 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1183 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1169 mCells.insert( row * mDaysPerWeek + col, cell ); 1184 mCells.insert( row * mDaysPerWeek + col, cell );
1170 1185
1171 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1186 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1172 SLOT( defaultAction( Incidence * ) ) ); 1187 SLOT( defaultAction( Incidence * ) ) );
1173 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1188 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1174 SIGNAL( newEventSignal( QDateTime ) ) ); 1189 SIGNAL( newEventSignal( QDateTime ) ) );
1175 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1190 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1176 SIGNAL( showDaySignal( QDate ) ) ); 1191 SIGNAL( showDaySignal( QDate ) ) );
1177 connect( cell, SIGNAL( nextCell() ), 1192 connect( cell, SIGNAL( nextCell() ),
1178 SLOT( nextCell() ) ); 1193 SLOT( nextCell() ) );
1179 connect( cell, SIGNAL( prevCell() ), 1194 connect( cell, SIGNAL( prevCell() ),
1180 SLOT( prevCell() ) ); 1195 SLOT( prevCell() ) );
1181 } 1196 }
1182 } 1197 }
1183 mCellsW.resize( mDaysPerWeek ); 1198 mCellsW.resize( mDaysPerWeek );
1184 for( col = 0; col < mDaysPerWeek; ++col ) { 1199 for( col = 0; col < mDaysPerWeek; ++col ) {
1185 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1200 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1186 mCellsW.insert( col, cell ); 1201 mCellsW.insert( col, cell );
1187 1202
1188 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1203 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1189 SLOT( defaultAction( Incidence * ) ) ); 1204 SLOT( defaultAction( Incidence * ) ) );
1190 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1205 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1191 SIGNAL( newEventSignal( QDateTime ) ) ); 1206 SIGNAL( newEventSignal( QDateTime ) ) );
1192 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1207 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1193 SIGNAL( showDaySignal( QDate ) ) ); 1208 SIGNAL( showDaySignal( QDate ) ) );
1194 connect( cell, SIGNAL( nextCell() ), 1209 connect( cell, SIGNAL( nextCell() ),
1195 SLOT( nextCell() ) ); 1210 SLOT( nextCell() ) );
1196 connect( cell, SIGNAL( prevCell() ), 1211 connect( cell, SIGNAL( prevCell() ),
1197 SLOT( prevCell() ) ); 1212 SLOT( prevCell() ) );
1198 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1213 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1199 } 1214 }
1200 1215
1201 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1216 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1202 mContextMenu = eventPopup(); 1217 mContextMenu = eventPopup();
1218 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1219 i18n("New Event..."),this,
1220 SLOT(slotNewEvent()),false);
1221 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1222 i18n("New Todo..."),this,
1223 SLOT(slotNewTodo()),false);
1224 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1225 i18n("Journal"),this,
1226 SLOT(slotEditJournal()),false);
1227
1228
1229
1230 QString pathString = "";
1231 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1232 if ( QApplication::desktop()->width() < 480 )
1233 pathString += "icons16/";
1234 } else
1235 pathString += "iconsmini/";
1236 mNewItemMenu = new QPopupMenu( this );
1237 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1238 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1239 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1240
1203 // updateConfig(); //useless here... 1241 // updateConfig(); //useless here...
1204 // ... but we need mWidthLongDayLabel computed 1242 // ... but we need mWidthLongDayLabel computed
1205 QFontMetrics fontmetric(mDayLabels[0]->font()); 1243 QFontMetrics fontmetric(mDayLabels[0]->font());
1206 mWidthLongDayLabel = 0; 1244 mWidthLongDayLabel = 0;
1207 for (int i = 0; i < 7; i++) { 1245 for (int i = 0; i < 7; i++) {
1208 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1246 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1209 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1247 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1210 } 1248 }
1211 1249
1212 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1250 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1213 1251
1214#if 0 1252#if 0
1215 if ( mShowWeekView ) 1253 if ( mShowWeekView )
1216 mWidStack->raiseWidget( mWeekView ); 1254 mWidStack->raiseWidget( mWeekView );
1217 else 1255 else
1218 mWidStack->raiseWidget( mMonthView ); 1256 mWidStack->raiseWidget( mMonthView );
1219#endif 1257#endif
1220 1258
1221 emit incidenceSelected( 0 ); 1259 emit incidenceSelected( 0 );
1222 1260
1223 mComputeLayoutTimer = new QTimer( this ); 1261 mComputeLayoutTimer = new QTimer( this );
1224 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1262 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1225 1263
1226 1264
1227#ifndef DESKTOP_VERSION 1265#ifndef DESKTOP_VERSION
1228 resize( QApplication::desktop()->size() ); 1266 resize( QApplication::desktop()->size() );
1229#else 1267#else
1230 resize(640, 480 ); 1268 resize(640, 480 );
1231 updatePossible = true; 1269 updatePossible = true;
1232#endif 1270#endif
1233 computeLayout(); 1271 computeLayout();
1234 1272
1235 if ( mShowWeekView ) 1273 if ( mShowWeekView )
1236 mWidStack->raiseWidget( mWeekView ); 1274 mWidStack->raiseWidget( mWeekView );
1237 else 1275 else
1238 mWidStack->raiseWidget( mMonthView ); 1276 mWidStack->raiseWidget( mMonthView );
1239} 1277}
1240 1278
1241KOMonthView::~KOMonthView() 1279KOMonthView::~KOMonthView()
1242{ 1280{
1243 delete mContextMenu; 1281 delete mContextMenu;
1244} 1282}
1245 1283
1246void KOMonthView::selectInternalWeekNum ( int n ) 1284void KOMonthView::selectInternalWeekNum ( int n )
1247{ 1285{
1248 switchView(); 1286 switchView();
1249 if ( !KOPrefs::instance()->mMonthViewWeek ) 1287 if ( !KOPrefs::instance()->mMonthViewWeek )
1250 emit selectMonth (); 1288 emit selectMonth ();
1251 else 1289 else
1252 emit selectWeekNum ( n ); 1290 emit selectWeekNum ( n );
1253} 1291}
1254 1292
1255int KOMonthView::currentWeek() 1293int KOMonthView::currentWeek()
1256{ 1294{
1257 if ( mShowWeekView ) 1295 if ( mShowWeekView )
1258 return mWeekLabelsW[0]->getWeekNum(); 1296 return mWeekLabelsW[0]->getWeekNum();
1259 return mWeekLabels[0]->getWeekNum(); 1297 return mWeekLabels[0]->getWeekNum();
1260} 1298}
1261void KOMonthView::switchView() 1299void KOMonthView::switchView()
1262{ 1300{
1263 if ( selectedCell( ) ) 1301 if ( selectedCell( ) )
1264 selectedCell()->deselect(); 1302 selectedCell()->deselect();
1265 mShowWeekView = !mShowWeekView; 1303 mShowWeekView = !mShowWeekView;
1266 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1304 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1267 if ( clPending ) { 1305 if ( clPending ) {
1268 computeLayout(); 1306 computeLayout();
1269 updateConfig(); 1307 updateConfig();
1270 } 1308 }
1271 if ( mShowWeekView ) 1309 if ( mShowWeekView )
1272 mWidStack->raiseWidget( mWeekView ); 1310 mWidStack->raiseWidget( mWeekView );
1273 else 1311 else
1274 mWidStack->raiseWidget( mMonthView ); 1312 mWidStack->raiseWidget( mMonthView );
1275 clPending = false; 1313 clPending = false;
1276} 1314}
1277 1315
1278int KOMonthView::maxDatesHint() 1316int KOMonthView::maxDatesHint()
1279{ 1317{
1280 return mNumCells; 1318 return mNumCells;
1281} 1319}
1282 1320
1283int KOMonthView::currentDateCount() 1321int KOMonthView::currentDateCount()
1284{ 1322{
1285 return mNumCells; 1323 return mNumCells;
1286} 1324}
1287 1325
1288QPtrList<Incidence> KOMonthView::selectedIncidences() 1326QPtrList<Incidence> KOMonthView::selectedIncidences()
1289{ 1327{
1290 QPtrList<Incidence> selected; 1328 QPtrList<Incidence> selected;
1291 1329
1292 if ( mSelectedCell ) { 1330 if ( mSelectedCell ) {
1293 Incidence *incidence = mSelectedCell->selectedIncidence(); 1331 Incidence *incidence = mSelectedCell->selectedIncidence();
1294 if ( incidence ) selected.append( incidence ); 1332 if ( incidence ) selected.append( incidence );
1295 } 1333 }
1296 1334
1297 return selected; 1335 return selected;
1298} 1336}
@@ -1800,217 +1838,254 @@ void KOMonthView::computeLayout()
1800 wid -= weeklabelwid; 1838 wid -= weeklabelwid;
1801 1839
1802 int colWid = wid / daysToShow; 1840 int colWid = wid / daysToShow;
1803 int lastCol = wid - ( colWid*6 ); 1841 int lastCol = wid - ( colWid*6 );
1804 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1842 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1805 int cellHei = (hei - dayLabelHei) /6; 1843 int cellHei = (hei - dayLabelHei) /6;
1806 int colModulo = wid % daysToShow; 1844 int colModulo = wid % daysToShow;
1807 int rowModulo = (hei- dayLabelHei) % 6; 1845 int rowModulo = (hei- dayLabelHei) % 6;
1808 //qDebug("rowmod %d ", rowModulo); 1846 //qDebug("rowmod %d ", rowModulo);
1809 int i; 1847 int i;
1810 int x,y,w,h; 1848 int x,y,w,h;
1811 x= 0; 1849 x= 0;
1812 y= 0; 1850 y= 0;
1813 w = colWid; 1851 w = colWid;
1814 h = dayLabelHei ; 1852 h = dayLabelHei ;
1815 for ( i = 0; i < 7; i++) { 1853 for ( i = 0; i < 7; i++) {
1816 if ( i == daysToShow-colModulo ) 1854 if ( i == daysToShow-colModulo )
1817 ++w; 1855 ++w;
1818 if ( combinedSatSun ) { 1856 if ( combinedSatSun ) {
1819 if ( i >= daysToShow-1 ) { 1857 if ( i >= daysToShow-1 ) {
1820 1858
1821 if ( i == 6 ) 1859 if ( i == 6 )
1822 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); 1860 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h);
1823 else 1861 else
1824 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1862 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1825 x -= w/2 ; 1863 x -= w/2 ;
1826 } 1864 }
1827 else 1865 else
1828 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1866 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1829 } else 1867 } else
1830 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1868 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1831 x += w; 1869 x += w;
1832 } 1870 }
1833 x= 0; 1871 x= 0;
1834 y= dayLabelHei; 1872 y= dayLabelHei;
1835 w = colWid; 1873 w = colWid;
1836 h = cellHei ; 1874 h = cellHei ;
1837 int max = 0; 1875 int max = 0;
1838 for ( i = 0; i < mCells.count(); ++i) { 1876 for ( i = 0; i < mCells.count(); ++i) {
1839 //qDebug("iii %d ", i); 1877 //qDebug("iii %d ", i);
1840 w = colWid; 1878 w = colWid;
1841 if ( ((i) % 7) >= 7-colModulo ) { 1879 if ( ((i) % 7) >= 7-colModulo ) {
1842 ++w; 1880 ++w;
1843 } 1881 }
1844 if ( i == (6-rowModulo)*7) 1882 if ( i == (6-rowModulo)*7)
1845 ++h; 1883 ++h;
1846 if ( combinedSatSun ) { 1884 if ( combinedSatSun ) {
1847 if ( (i)%7 >= daysToShow-1 ) { 1885 if ( (i)%7 >= daysToShow-1 ) {
1848 if ( (i)%7 == daysToShow-1 ) { 1886 if ( (i)%7 == daysToShow-1 ) {
1849 w = width()-x-weeklabelwid; 1887 w = width()-x-weeklabelwid;
1850 max = h/2; 1888 max = h/2;
1851 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1889 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1852 x -= w ;y += h/2; 1890 x -= w ;y += h/2;
1853 } else { 1891 } else {
1854 w = width()-x-weeklabelwid; 1892 w = width()-x-weeklabelwid;
1855 max = h-h/2; 1893 max = h-h/2;
1856 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1894 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1857 y -= h/2; 1895 y -= h/2;
1858 } 1896 }
1859 } else { 1897 } else {
1860 max = h; 1898 max = h;
1861 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1899 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1862 } 1900 }
1863 1901
1864 } 1902 }
1865 else { 1903 else {
1866 max = h; 1904 max = h;
1867 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1905 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1868 } 1906 }
1869 x += w; 1907 x += w;
1870 if ( x + w/2 > wid ) { 1908 if ( x + w/2 > wid ) {
1871 x = 0; 1909 x = 0;
1872 y += h; 1910 y += h;
1873 } 1911 }
1874 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); 1912 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
1875 } 1913 }
1876 y= dayLabelHei; 1914 y= dayLabelHei;
1877 h = cellHei ; 1915 h = cellHei ;
1878 for ( i = 0; i < 6; i++) { 1916 for ( i = 0; i < 6; i++) {
1879 if ( i == (6-rowModulo)) 1917 if ( i == (6-rowModulo))
1880 ++h; 1918 ++h;
1881 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1919 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1882 y += h; 1920 y += h;
1883 } 1921 }
1884 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1922 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1885 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1923 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1886 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1924 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1887 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; 1925 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ;
1888 updateDayLabels(); 1926 updateDayLabels();
1889 //bool forceUpdate = !updatePossible; 1927 //bool forceUpdate = !updatePossible;
1890 updatePossible = true; 1928 updatePossible = true;
1891 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1929 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1892} 1930}
1893 1931
1894void KOMonthView::showContextMenu( Incidence *incidence ) 1932void KOMonthView::showContextMenu( Incidence *incidence )
1895{ 1933{
1896 mContextMenu->showIncidencePopup(incidence); 1934 if( incidence )
1935 mContextMenu->showIncidencePopup(incidence);
1936 else {
1937 //qDebug("KOMonthView::showContextMenu ");
1938 mNewItemMenu->popup(QCursor::pos());
1939 }
1897 /* 1940 /*
1898 if( incidence && incidence->type() == "Event" ) { 1941 if( incidence && incidence->type() == "Event" ) {
1899 Event *event = static_cast<Event *>(incidence); 1942 Event *event = static_cast<Event *>(incidence);
1900 mContextMenu->showEventPopup(event); 1943 mContextMenu->showEventPopup(event);
1901 } else { 1944 } else {
1902 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1945 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1903 } 1946 }
1904 */ 1947 */
1905} 1948}
1906MonthViewCell * KOMonthView::selectedCell( ) 1949MonthViewCell * KOMonthView::selectedCell( )
1907{ 1950{
1908 return mSelectedCell; 1951 return mSelectedCell;
1909} 1952}
1910void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1953void KOMonthView::setSelectedCell( MonthViewCell *cell )
1911{ 1954{
1912 //qDebug("KOMonthView::setSelectedCell "); 1955 //qDebug("KOMonthView::setSelectedCell %d", cell);
1913 if ( mSelectedCell && mSelectedCell != cell ) { 1956 if ( mSelectedCell && mSelectedCell != cell ) {
1914 MonthViewCell * mvc = mSelectedCell; 1957 MonthViewCell * mvc = mSelectedCell;
1915 mSelectedCell = cell; 1958 mSelectedCell = cell;
1916 mvc->deselect(); 1959 mvc->deselect();
1917 } else 1960 } else
1918 mSelectedCell = cell; 1961 mSelectedCell = cell;
1919 // if ( mSelectedCell ) 1962 // if ( mSelectedCell )
1920 // mSelectedCell->select(); 1963 // mSelectedCell->select();
1921 if ( !mSelectedCell ) 1964 if ( !mSelectedCell )
1922 emit incidenceSelected( 0 ); 1965 emit incidenceSelected( 0 );
1923 else 1966 else
1924 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1967 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1925} 1968}
1926 1969
1927void KOMonthView::processSelectionChange() 1970void KOMonthView::processSelectionChange()
1928{ 1971{
1929 QPtrList<Incidence> incidences = selectedIncidences(); 1972 QPtrList<Incidence> incidences = selectedIncidences();
1930 if (incidences.count() > 0) { 1973 if (incidences.count() > 0) {
1931 emit incidenceSelected( incidences.first() ); 1974 emit incidenceSelected( incidences.first() );
1932 } else { 1975 } else {
1933 emit incidenceSelected( 0 ); 1976 emit incidenceSelected( 0 );
1934 clearSelection(); 1977 clearSelection();
1935 } 1978 }
1936} 1979}
1937 1980
1938void KOMonthView::clearSelection() 1981void KOMonthView::clearSelection()
1939{ 1982{
1940 if ( mSelectedCell ) { 1983 if ( mSelectedCell ) {
1941 mSelectedCell->deselect(); 1984 mSelectedCell->deselect();
1942 mSelectedCell = 0; 1985 mSelectedCell = 0;
1943 } 1986 }
1944} 1987}
1945 1988
1946void KOMonthView::keyReleaseEvent ( QKeyEvent * e) 1989void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
1947{ 1990{
1948 if ( !e->isAutoRepeat() ) { 1991 if ( !e->isAutoRepeat() ) {
1949 mFlagKeyPressed = false; 1992 mFlagKeyPressed = false;
1950 } 1993 }
1951} 1994}
1952 1995
1953void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1996void KOMonthView::keyPressEvent ( QKeyEvent * e )
1954{ 1997{
1955 1998
1956 qApp->processEvents(); 1999 qApp->processEvents();
1957 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 2000 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1958 //e->ignore(); 2001 //e->ignore();
1959 e->accept(); 2002 e->accept();
1960 return; 2003 return;
1961 } 2004 }
1962 if (! e->isAutoRepeat() ) 2005 if (! e->isAutoRepeat() )
1963 mFlagKeyPressed = true; 2006 mFlagKeyPressed = true;
1964 switch(e->key()) { 2007 switch(e->key()) {
1965 case Key_Up: 2008 case Key_Up:
1966 { 2009 {
1967 if ( mShowWeekView ) { 2010 if ( mShowWeekView ) {
1968 emit selectWeekNum ( currentWeek() - 1 ); 2011 emit selectWeekNum ( currentWeek() - 1 );
1969 } 2012 }
1970 else { 2013 else {
1971 emit prevMonth(); 2014 emit prevMonth();
1972 } 2015 }
1973 } 2016 }
1974 e->accept(); 2017 e->accept();
1975 break; 2018 break;
1976 case Key_Down: 2019 case Key_Down:
1977 { 2020 {
1978 if ( mShowWeekView ) { 2021 if ( mShowWeekView ) {
1979 emit selectWeekNum ( currentWeek() +1); 2022 emit selectWeekNum ( currentWeek() +1);
1980 } 2023 }
1981 else { 2024 else {
1982 emit nextMonth(); 2025 emit nextMonth();
1983 } 2026 }
1984 2027
1985 } 2028 }
1986 e->accept(); 2029 e->accept();
1987 break; 2030 break;
1988 case Key_Return: 2031 case Key_Return:
1989 case Key_Enter: 2032 case Key_Enter:
1990 { 2033 {
1991 selectInternalWeekNum ( currentWeek() ); 2034 selectInternalWeekNum ( currentWeek() );
1992 } 2035 }
1993 e->accept(); 2036 e->accept();
1994 break; 2037 break;
1995 case Key_D: 2038 case Key_D:
1996 if ( mSelectedCell ) { 2039 if ( mSelectedCell ) {
1997 mSelectedCell->showDay(); 2040 mSelectedCell->showDay();
1998 e->accept(); 2041 e->accept();
1999 } else { 2042 } else {
2000 e->ignore(); 2043 e->ignore();
2001 } 2044 }
2002 break; 2045 break;
2003 default: 2046 default:
2004 e->ignore(); 2047 e->ignore();
2005 break; 2048 break;
2006 } 2049 }
2007} 2050}
2008 2051
2009void KOMonthView::nextCell() 2052void KOMonthView::nextCell()
2010{ 2053{
2011 bool res = focusNextPrevChild ( true ); 2054 bool res = focusNextPrevChild ( true );
2012} 2055}
2013void KOMonthView::prevCell() 2056void KOMonthView::prevCell()
2014{ 2057{
2015 focusNextPrevChild ( false ); 2058 focusNextPrevChild ( false );
2016} 2059}
2060
2061void KOMonthView::slotNewTodo()
2062{
2063 //qDebug("KOMonthView::slotNewTodo() ");
2064 if ( mPopupCell ){
2065 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2066 emit newTodoSignal(dt,true);
2067 }
2068 mPopupCell = 0;
2069}
2070void KOMonthView::slotNewEvent()
2071{
2072 if ( mPopupCell ) {
2073 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2074 emit newEventSignal( dt );
2075 }
2076 //qDebug("KOMonthView::slotNewEvent() ");
2077 mPopupCell = 0;
2078}
2079
2080void KOMonthView::slotEditJournal()
2081{
2082 if ( mPopupCell )
2083 emit showJournalSignal( 7, mPopupCell->date() );
2084 //qDebug("KOMonthView::slotEditJournal() ");
2085 mPopupCell = 0;
2086}
2087
2088void KOMonthView::setPopupCell( MonthViewCell * c)
2089{
2090 mPopupCell = c;
2091}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index c6b6b5e..de5c014 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -178,155 +178,163 @@ class MonthViewCell : public KNoScrollListBox
178 178
179 void deselect(); 179 void deselect();
180 void select(); 180 void select();
181#ifdef DESKTOP_VERSION 181#ifdef DESKTOP_VERSION
182 static QToolTipGroup *toolTipGroup(); 182 static QToolTipGroup *toolTipGroup();
183#endif 183#endif
184 signals: 184 signals:
185 void defaultAction( Incidence * ); 185 void defaultAction( Incidence * );
186 void newEventSignal( QDateTime ); 186 void newEventSignal( QDateTime );
187 void showDaySignal( QDate ); 187 void showDaySignal( QDate );
188 188
189 protected: 189 protected:
190 QStringList mToolTip; 190 QStringList mToolTip;
191 void resizeEvent( QResizeEvent * ); 191 void resizeEvent( QResizeEvent * );
192 192
193public slots: 193public slots:
194 void showDay(); 194 void showDay();
195 195
196 protected slots: 196 protected slots:
197 void defaultAction( QListBoxItem * ); 197 void defaultAction( QListBoxItem * );
198 void contextMenu( QListBoxItem * ); 198 void contextMenu( QListBoxItem * );
199 void selection( QListBoxItem * ); 199 void selection( QListBoxItem * );
200 void cellClicked( QListBoxItem * ); 200 void cellClicked( QListBoxItem * );
201 void newEvent(); 201 void newEvent();
202 202
203 private: 203 private:
204 int mdayCount; 204 int mdayCount;
205 QPtrList <MonthViewItem> mAvailItemList; 205 QPtrList <MonthViewItem> mAvailItemList;
206 KOMonthView *mMonthView; 206 KOMonthView *mMonthView;
207 int currentPalette; 207 int currentPalette;
208 208
209 QDate mDate; 209 QDate mDate;
210 bool mPrimary; 210 bool mPrimary;
211 bool mHoliday; 211 bool mHoliday;
212 QString mHolidayString; 212 QString mHolidayString;
213 213
214 //QLabel *mLabel; 214 //QLabel *mLabel;
215 QPushButton *mLabel; 215 QPushButton *mLabel;
216 //QListBox *mItemList; 216 //QListBox *mItemList;
217#ifdef DESKTOP_VERSION 217#ifdef DESKTOP_VERSION
218 static QToolTipGroup *mToolTipGroup; 218 static QToolTipGroup *mToolTipGroup;
219#endif 219#endif
220 QSize mLabelSize; 220 QSize mLabelSize;
221 QSize mLabelBigSize; 221 QSize mLabelBigSize;
222 QPalette mHolidayPalette; 222 QPalette mHolidayPalette;
223 QPalette mStandardPalette; 223 QPalette mStandardPalette;
224 QPalette mPrimaryPalette; 224 QPalette mPrimaryPalette;
225 QPalette mNonPrimaryPalette; 225 QPalette mNonPrimaryPalette;
226 void setMyPalette(); 226 void setMyPalette();
227 QPalette getPalette (); 227 QPalette getPalette ();
228 228
229}; 229};
230 230
231 231
232class KOMonthView: public KOEventView 232class KOMonthView: public KOEventView
233{ 233{
234 Q_OBJECT 234 Q_OBJECT
235 public: 235 public:
236 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 236 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
237 ~KOMonthView(); 237 ~KOMonthView();
238 238
239 /** Returns maximum number of days supported by the komonthview */ 239 /** Returns maximum number of days supported by the komonthview */
240 virtual int maxDatesHint(); 240 virtual int maxDatesHint();
241 241
242 /** Returns number of currently shown dates. */ 242 /** Returns number of currently shown dates. */
243 virtual int currentDateCount(); 243 virtual int currentDateCount();
244 244
245 /** returns the currently selected events */ 245 /** returns the currently selected events */
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 247
248 /** returns dates of the currently selected events */ 248 /** returns dates of the currently selected events */
249 virtual DateList selectedDates(); 249 virtual DateList selectedDates();
250 250
251 virtual void printPreview(CalPrinter *calPrinter, 251 virtual void printPreview(CalPrinter *calPrinter,
252 const QDate &, const QDate &); 252 const QDate &, const QDate &);
253 bool isMonthView() { return !mShowWeekView; } 253 bool isMonthView() { return !mShowWeekView; }
254 bool isUpdatePossible() { return updatePossible; } 254 bool isUpdatePossible() { return updatePossible; }
255 255
256 MonthViewCell * selectedCell(); 256 MonthViewCell * selectedCell();
257 bool skipResize; 257 bool skipResize;
258 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 258 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
259 public slots: 259 public slots:
260 void nextCell(); 260 void nextCell();
261 void prevCell(); 261 void prevCell();
262 virtual void updateView(); 262 virtual void updateView();
263 virtual void updateConfig(); 263 virtual void updateConfig();
264 virtual void showDates(const QDate &start, const QDate &end); 264 virtual void showDates(const QDate &start, const QDate &end);
265 virtual void showEvents(QPtrList<Event> eventList); 265 virtual void showEvents(QPtrList<Event> eventList);
266 266
267 void changeEventDisplay(Event *, int); 267 void changeEventDisplay(Event *, int);
268 268
269 void clearSelection(); 269 void clearSelection();
270 270
271 void showContextMenu( Incidence * ); 271 void showContextMenu( Incidence * );
272 272
273 void setSelectedCell( MonthViewCell * ); 273 void setSelectedCell( MonthViewCell * );
274 void setPopupCell( MonthViewCell * );
274 void switchView(); 275 void switchView();
275 void setKeyBoardFocus(); 276 void setKeyBoardFocus();
276 void setKeyBFocus(); 277 void setKeyBFocus();
277 278
278 protected slots: 279 protected slots:
280 void slotNewTodo();
281 void slotNewEvent();
282 void slotEditJournal();
279 void slotComputeLayout(); 283 void slotComputeLayout();
280 void selectInternalWeekNum ( int ); 284 void selectInternalWeekNum ( int );
281 void processSelectionChange(); 285 void processSelectionChange();
282 signals: 286 signals:
283 void nextMonth(); 287 void nextMonth();
284 void prevMonth(); 288 void prevMonth();
285 void selectWeekNum ( int ); 289 void selectWeekNum ( int );
286 void selectMonth (); 290 void selectMonth ();
287 void showDaySignal( QDate ); 291 void showDaySignal( QDate );
292 void newTodoSignal( QDateTime, bool );
293 void showJournalSignal( int,QDate );
288 protected: 294 protected:
289 void resizeEvent(QResizeEvent *); 295 void resizeEvent(QResizeEvent *);
290 void viewChanged(); 296 void viewChanged();
291 void updateDayLabels(); 297 void updateDayLabels();
292 298
293 private: 299 private:
294 QTimer* mComputeLayoutTimer; 300 QTimer* mComputeLayoutTimer;
295 NavigatorBar* mNavigatorBar; 301 NavigatorBar* mNavigatorBar;
296 int currentWeek(); 302 int currentWeek();
297 bool clPending; 303 bool clPending;
298 QWidgetStack * mWidStack; 304 QWidgetStack * mWidStack;
299 QWidget* mMonthView; 305 QWidget* mMonthView;
300 QWidget* mWeekView; 306 QWidget* mWeekView;
301 bool mShowWeekView; 307 bool mShowWeekView;
302 bool updatePossible; 308 bool updatePossible;
303 int mDaysPerWeek; 309 int mDaysPerWeek;
304 int mNumWeeks; 310 int mNumWeeks;
305 int mNumCells; 311 int mNumCells;
306 //bool mWeekStartsMonday; 312 //bool mWeekStartsMonday;
307 bool mShowSatSunComp; 313 bool mShowSatSunComp;
308 void computeLayout(); 314 void computeLayout();
309 void computeLayoutWeek(); 315 void computeLayoutWeek();
310 316
311 QPtrVector<MonthViewCell> mCells; 317 QPtrVector<MonthViewCell> mCells;
312 QPtrVector<QLabel> mDayLabels; 318 QPtrVector<QLabel> mDayLabels;
313 QPtrVector<KOWeekButton> mWeekLabels; 319 QPtrVector<KOWeekButton> mWeekLabels;
314 QPtrVector<MonthViewCell> mCellsW; 320 QPtrVector<MonthViewCell> mCellsW;
315 QPtrVector<QLabel> mDayLabelsW; 321 QPtrVector<QLabel> mDayLabelsW;
316 QPtrVector<KOWeekButton> mWeekLabelsW; 322 QPtrVector<KOWeekButton> mWeekLabelsW;
317 323
318 bool mShortDayLabelsM; 324 bool mShortDayLabelsM;
319 bool mShortDayLabelsW; 325 bool mShortDayLabelsW;
320 int mWidthLongDayLabel; 326 int mWidthLongDayLabel;
321 327
322 QDate mStartDate; 328 QDate mStartDate;
323 329
324 MonthViewCell *mSelectedCell; 330 MonthViewCell *mSelectedCell;
331 MonthViewCell *mPopupCell;
325 bool mFlagKeyPressed; 332 bool mFlagKeyPressed;
326 KOEventPopupMenu *mContextMenu; 333 KOEventPopupMenu *mContextMenu;
334 QPopupMenu *mNewItemMenu;
327 void keyPressEvent ( QKeyEvent * ) ; 335 void keyPressEvent ( QKeyEvent * ) ;
328 void keyReleaseEvent ( QKeyEvent * ) ; 336 void keyReleaseEvent ( QKeyEvent * ) ;
329 337
330}; 338};
331 339
332#endif 340#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a571ed4..34044ab 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -144,192 +144,193 @@ KOPrefs::KOPrefs() :
144 KPrefs::setCurrentGroup("Personal Settings"); 144 KPrefs::setCurrentGroup("Personal Settings");
145 145
146 addItemInt("Mail Client",&mMailClient,MailClientKMail); 146 addItemInt("Mail Client",&mMailClient,MailClientKMail);
147 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 147 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
148 addItemBool("Bcc",&mBcc,false); 148 addItemBool("Bcc",&mBcc,false);
149 149
150 KPrefs::setCurrentGroup("Time & Date"); 150 KPrefs::setCurrentGroup("Time & Date");
151 151
152 152
153 addItemInt("Default Start Time",&mStartTime,10); 153 addItemInt("Default Start Time",&mStartTime,10);
154 addItemInt("Default Duration",&mDefaultDuration,2); 154 addItemInt("Default Duration",&mDefaultDuration,2);
155 addItemInt("Default Alarm Time",&mAlarmTime,3); 155 addItemInt("Default Alarm Time",&mAlarmTime,3);
156 KPrefs::setCurrentGroup("AlarmSettings"); 156 KPrefs::setCurrentGroup("AlarmSettings");
157 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 157 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
158 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 158 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
159 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 159 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
160 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 160 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
161 161
162 162
163 KPrefs::setCurrentGroup("Calendar"); 163 KPrefs::setCurrentGroup("Calendar");
164 164
165 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 165 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
166 166
167 KPrefs::setCurrentGroup("Fonts"); 167 KPrefs::setCurrentGroup("Fonts");
168 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 168 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
169 QFont fon = KGlobalSettings::generalFont(); 169 QFont fon = KGlobalSettings::generalFont();
170 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 170 addItemFont("TimeBar Font",&mTimeBarFont,fon );
171 addItemFont("MonthView Font",&mMonthViewFont,fon); 171 addItemFont("MonthView Font",&mMonthViewFont,fon);
172 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 172 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
173 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 173 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
174 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 174 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
175 addItemFont("TodoView Font",&mTodoViewFont,fon); 175 addItemFont("TodoView Font",&mTodoViewFont,fon);
176 addItemFont("ListView Font",&mListViewFont,fon); 176 addItemFont("ListView Font",&mListViewFont,fon);
177 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 177 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
178 addItemFont("EditBox Font",&mEditBoxFont,fon); 178 addItemFont("EditBox Font",&mEditBoxFont,fon);
179 addItemFont("JournalView Font",&mJornalViewFont,fon); 179 addItemFont("JournalView Font",&mJornalViewFont,fon);
180 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 180 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
181 addItemFont("EventView Font",&mEventViewFont,fon); 181 addItemFont("EventView Font",&mEventViewFont,fon);
182 182
183 KPrefs::setCurrentGroup("RemoteSyncing"); 183 KPrefs::setCurrentGroup("RemoteSyncing");
184 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 184 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
185 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 185 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
186 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 186 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
187 addItemInt("LastSyncTime",&mLastSyncTime,0); 187 addItemInt("LastSyncTime",&mLastSyncTime,0);
188 188
189#ifdef _WIN32_ 189#ifdef _WIN32_
190 QString hdp= locateLocal("data","korganizer")+"\\\\"; 190 QString hdp= locateLocal("data","korganizer")+"\\\\";
191#else 191#else
192 QString hdp= locateLocal("data","korganizer")+"/"; 192 QString hdp= locateLocal("data","korganizer")+"/";
193#endif 193#endif
194 194
195 KPrefs::setCurrentGroup("LoadSaveFileNames"); 195 KPrefs::setCurrentGroup("LoadSaveFileNames");
196 196
197 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 197 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
198 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 198 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
199 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 199 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
200 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 200 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
201 201
202 202
203 KPrefs::setCurrentGroup("Locale"); 203 KPrefs::setCurrentGroup("Locale");
204 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 204 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
205 205
206 206
207 KPrefs::setCurrentGroup("Colors"); 207 KPrefs::setCurrentGroup("Colors");
208 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 208 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
209 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 209 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
210 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 210 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
211 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 211 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
212 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 212 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
220 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 220 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
221 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 221 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
222 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 222 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
223 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 223 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
224 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 224 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
225 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 225 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
226 addItemBool("UseAppColors",&mUseAppColors,false); 226 addItemBool("UseAppColors",&mUseAppColors,false);
227 227
228 228
229 229
230 KPrefs::setCurrentGroup("Views"); 230 KPrefs::setCurrentGroup("Views");
231 addItemBool("Block Popup Menu",&mBlockPopupMenu,true); 231 addItemBool("Block Popup Menu",&mBlockPopupMenu,true);
232 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 232 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
233 addItemInt("Hour Size",&mHourSize,8); 233 addItemInt("Hour Size",&mHourSize,8);
234 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 234 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
238 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 238 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
240 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
240#ifdef DESKTOP_VERION 241#ifdef DESKTOP_VERION
241 addItemBool("Enable ToolTips",&mEnableToolTips,true); 242 addItemBool("Enable ToolTips",&mEnableToolTips,true);
242#else 243#else
243 addItemBool("Enable ToolTips",&mEnableToolTips,false); 244 addItemBool("Enable ToolTips",&mEnableToolTips,false);
244#endif 245#endif
245 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 246 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
246 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 247 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
247 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 248 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
248 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 249 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
249 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 250 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
250 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 251 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
251 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 252 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
252 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 253 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
253 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 254 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
254 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 255 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
255 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 256 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
256 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 257 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
257 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 258 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
258 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 259 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
259 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 260 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
260 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 261 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
261 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 262 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
262 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 263 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
263 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 264 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
264 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 265 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
265#ifdef DESKTOP_VERSION 266#ifdef DESKTOP_VERSION
266 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 267 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
267#else 268#else
268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 269 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
269#endif 270#endif
270 addItemInt("Day Begins",&mDayBegins,7); 271 addItemInt("Day Begins",&mDayBegins,7);
271 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 272 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
272 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 273 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
273 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 274 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
274 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 275 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
275 276
276 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 277 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
277 addItemBool("Full View Month",&mFullViewMonth,true); 278 addItemBool("Full View Month",&mFullViewMonth,true);
278 addItemBool("Full View Todo",&mFullViewTodo,true); 279 addItemBool("Full View Todo",&mFullViewTodo,true);
279 addItemBool("Quick Todo",&mEnableQuickTodo,false); 280 addItemBool("Quick Todo",&mEnableQuickTodo,false);
280 281
281 addItemInt("Next X Days",&mNextXDays,3); 282 addItemInt("Next X Days",&mNextXDays,3);
282 283
283 KPrefs::setCurrentGroup("Printer"); 284 KPrefs::setCurrentGroup("Printer");
284 285
285 KPrefs::setCurrentGroup("Layout"); 286 KPrefs::setCurrentGroup("Layout");
286 287
287 addItemBool("CompactDialogs",&mCompactDialogs,false); 288 addItemBool("CompactDialogs",&mCompactDialogs,false);
288 addItemBool("VerticalScreen",&mVerticalScreen,true); 289 addItemBool("VerticalScreen",&mVerticalScreen,true);
289 290
290 KPrefs::setCurrentGroup("KOrganizer Plugins"); 291 KPrefs::setCurrentGroup("KOrganizer Plugins");
291 292
292 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 293 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
293 294
294 KPrefs::setCurrentGroup("Group Scheduling"); 295 KPrefs::setCurrentGroup("Group Scheduling");
295 296
296 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 297 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
297 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 298 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
298 addItemStringList("AdditionalMails",&mAdditionalMails,""); 299 addItemStringList("AdditionalMails",&mAdditionalMails,"");
299 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 300 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
300 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 301 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
301 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 302 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
302 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 303 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
303 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 304 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
304 305
305 KPrefs::setCurrentGroup( "Editors" ); 306 KPrefs::setCurrentGroup( "Editors" );
306 307
307 addItemStringList( "EventTemplates", &mEventTemplates ); 308 addItemStringList( "EventTemplates", &mEventTemplates );
308 addItemStringList( "TodoTemplates", &mTodoTemplates ); 309 addItemStringList( "TodoTemplates", &mTodoTemplates );
309 310
310 addItemInt("DestinationPolicy",&mDestination,standardDestination); 311 addItemInt("DestinationPolicy",&mDestination,standardDestination);
311 312
312 KPrefs::setCurrentGroup( "ViewOptions" ); 313 KPrefs::setCurrentGroup( "ViewOptions" );
313 addItemBool("EVshowDetails",&mEVshowDetails,true); 314 addItemBool("EVshowDetails",&mEVshowDetails,true);
314 addItemBool("EVshowCreated",&mEVshowCreated,true); 315 addItemBool("EVshowCreated",&mEVshowCreated,true);
315 addItemBool("EVshowChanged",&mEVshowChanged,true); 316 addItemBool("EVshowChanged",&mEVshowChanged,true);
316 addItemBool("WTshowDetails",&mWTshowDetails,false); 317 addItemBool("WTshowDetails",&mWTshowDetails,false);
317 addItemBool("WTshowCreated",&mWTshowCreated,false); 318 addItemBool("WTshowCreated",&mWTshowCreated,false);
318 addItemBool("WTshowChanged",&mWTshowChanged,false); 319 addItemBool("WTshowChanged",&mWTshowChanged,false);
319 320
320} 321}
321 322
322 323
323KOPrefs::~KOPrefs() 324KOPrefs::~KOPrefs()
324{ 325{
325 if (mInstance == this) 326 if (mInstance == this)
326 mInstance = insd.setObject(0); 327 mInstance = insd.setObject(0);
327 328
328 //qDebug("KOPrefs::~KOPrefs() "); 329 //qDebug("KOPrefs::~KOPrefs() ");
329} 330}
330 331
331 332
332KOPrefs *KOPrefs::instance() 333KOPrefs *KOPrefs::instance()
333{ 334{
334 if (!mInstance) { 335 if (!mInstance) {
335 mInstance = insd.setObject(new KOPrefs()); 336 mInstance = insd.setObject(new KOPrefs());
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 2a0ee64..e06df1c 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -66,192 +66,193 @@ class KOPrefs : public KPimPrefs
66 /** Write preferences to config file */ 66 /** Write preferences to config file */
67 void usrWriteConfig(); 67 void usrWriteConfig();
68 void setCategoryDefaults(); 68 void setCategoryDefaults();
69 void setAllDefaults(); 69 void setAllDefaults();
70 70
71 protected: 71 protected:
72 void setTimeZoneIdDefault(); 72 void setTimeZoneIdDefault();
73 73
74 /** Fill empty mail fields with default values. */ 74 /** Fill empty mail fields with default values. */
75 void fillMailDefaults(); 75 void fillMailDefaults();
76 76
77 private: 77 private:
78 /** Constructor disabled for public. Use instance() to create a KOPrefs 78 /** Constructor disabled for public. Use instance() to create a KOPrefs
79 object. */ 79 object. */
80 KOPrefs(); 80 KOPrefs();
81 81
82 static KOPrefs *mInstance; 82 static KOPrefs *mInstance;
83 QStringList getDefaultList(); 83 QStringList getDefaultList();
84 QStringList getLocationDefaultList(); 84 QStringList getLocationDefaultList();
85 public: 85 public:
86 // preferences data 86 // preferences data
87 KConfig* getConfig(); 87 KConfig* getConfig();
88 void setFullName(const QString &); 88 void setFullName(const QString &);
89 QString fullName(); 89 QString fullName();
90 void setEmail(const QString &); 90 void setEmail(const QString &);
91 QString email(); 91 QString email();
92 92
93 QString mAdditional; 93 QString mAdditional;
94 94
95 bool mEmailControlCenter; 95 bool mEmailControlCenter;
96 96
97 bool mBcc; 97 bool mBcc;
98 bool mAutoSave; 98 bool mAutoSave;
99 int mAutoSaveInterval; 99 int mAutoSaveInterval;
100 bool mConfirm; 100 bool mConfirm;
101 101
102 bool mEnableGroupScheduling; 102 bool mEnableGroupScheduling;
103 bool mEnableProjectView; 103 bool mEnableProjectView;
104 104
105 int mDefaultFormat; 105 int mDefaultFormat;
106 int mMailClient; 106 int mMailClient;
107 107
108 int mStartTime; 108 int mStartTime;
109 int mDefaultDuration; 109 int mDefaultDuration;
110 int mAlarmTime; 110 int mAlarmTime;
111 111
112 int mWorkingHoursStart; 112 int mWorkingHoursStart;
113 int mWorkingHoursEnd; 113 int mWorkingHoursEnd;
114 bool mExcludeHolidays; 114 bool mExcludeHolidays;
115 bool mExcludeSaturdays; 115 bool mExcludeSaturdays;
116 bool mMarcusBainsShowSeconds; 116 bool mMarcusBainsShowSeconds;
117 117
118 QFont mTimeBarFont; 118 QFont mTimeBarFont;
119 QFont mMonthViewFont; 119 QFont mMonthViewFont;
120 QFont mAgendaViewFont; 120 QFont mAgendaViewFont;
121 QFont mMarcusBainsFont; 121 QFont mMarcusBainsFont;
122 QFont mTimeLabelsFont; 122 QFont mTimeLabelsFont;
123 QFont mTodoViewFont; 123 QFont mTodoViewFont;
124 QFont mListViewFont; 124 QFont mListViewFont;
125 QFont mDateNavigatorFont; 125 QFont mDateNavigatorFont;
126 QFont mEditBoxFont; 126 QFont mEditBoxFont;
127 QFont mJornalViewFont; 127 QFont mJornalViewFont;
128 QFont mWhatsNextFont; 128 QFont mWhatsNextFont;
129 QFont mEventViewFont; 129 QFont mEventViewFont;
130 130
131 131
132 132
133 133
134 QColor mHolidayColor; 134 QColor mHolidayColor;
135 QColor mHighlightColor; 135 QColor mHighlightColor;
136 QColor mEventColor; 136 QColor mEventColor;
137 QColor mTodoDoneColor; 137 QColor mTodoDoneColor;
138 QColor mAgendaBgColor; 138 QColor mAgendaBgColor;
139 QColor mWorkingHoursColor; 139 QColor mWorkingHoursColor;
140 QColor mTodoDueTodayColor; 140 QColor mTodoDueTodayColor;
141 QColor mTodoOverdueColor; 141 QColor mTodoOverdueColor;
142 QColor mTodoRunColor; 142 QColor mTodoRunColor;
143 QColor mMonthViewEvenColor; 143 QColor mMonthViewEvenColor;
144 QColor mMonthViewOddColor; 144 QColor mMonthViewOddColor;
145 QColor mMonthViewHolidayColor; 145 QColor mMonthViewHolidayColor;
146 bool mMonthViewUsesDayColors; 146 bool mMonthViewUsesDayColors;
147 bool mMonthViewSatSunTog; 147 bool mMonthViewSatSunTog;
148 bool mMonthViewWeek; 148 bool mMonthViewWeek;
149 QColor mAppColor1; 149 QColor mAppColor1;
150 QColor mAppColor2; 150 QColor mAppColor2;
151 bool mUseAppColors; 151 bool mUseAppColors;
152 152
153 int mDayBegins; 153 int mDayBegins;
154 int mHourSize; 154 int mHourSize;
155 int mAllDaySize; 155 int mAllDaySize;
156 bool mShowFullMenu; 156 bool mShowFullMenu;
157 bool mDailyRecur; 157 bool mDailyRecur;
158 bool mWeeklyRecur; 158 bool mWeeklyRecur;
159 bool mMonthDailyRecur; 159 bool mMonthDailyRecur;
160 bool mMonthWeeklyRecur; 160 bool mMonthWeeklyRecur;
161 bool mMonthShowIcons; 161 bool mMonthShowIcons;
162 bool mMonthShowTimes;
162 bool mMonthShowShort; 163 bool mMonthShowShort;
163 bool mEnableToolTips; 164 bool mEnableToolTips;
164 bool mEnableMonthScroll; 165 bool mEnableMonthScroll;
165 bool mFullViewMonth; 166 bool mFullViewMonth;
166 bool mMonthViewUsesCategoryColor; 167 bool mMonthViewUsesCategoryColor;
167 bool mFullViewTodo; 168 bool mFullViewTodo;
168 bool mShowCompletedTodo; 169 bool mShowCompletedTodo;
169 bool mMarcusBainsEnabled; 170 bool mMarcusBainsEnabled;
170 int mNextXDays; 171 int mNextXDays;
171 int mWhatsNextDays; 172 int mWhatsNextDays;
172 int mWhatsNextPrios; 173 int mWhatsNextPrios;
173 bool mEnableQuickTodo; 174 bool mEnableQuickTodo;
174 175
175 bool mCompactDialogs; 176 bool mCompactDialogs;
176 bool mVerticalScreen; 177 bool mVerticalScreen;
177 178
178 bool mShowIconNewTodo; 179 bool mShowIconNewTodo;
179 bool mShowIconNewEvent; 180 bool mShowIconNewEvent;
180 bool mShowIconSearch; 181 bool mShowIconSearch;
181 bool mShowIconList; 182 bool mShowIconList;
182 bool mShowIconDay1; 183 bool mShowIconDay1;
183 bool mShowIconDay5; 184 bool mShowIconDay5;
184 bool mShowIconDay6; 185 bool mShowIconDay6;
185 bool mShowIconDay7; 186 bool mShowIconDay7;
186 bool mShowIconMonth; 187 bool mShowIconMonth;
187 bool mShowIconTodoview; 188 bool mShowIconTodoview;
188 bool mShowIconBackFast; 189 bool mShowIconBackFast;
189 bool mShowIconBack; 190 bool mShowIconBack;
190 bool mShowIconToday; 191 bool mShowIconToday;
191 bool mShowIconForward; 192 bool mShowIconForward;
192 bool mShowIconForwardFast; 193 bool mShowIconForwardFast;
193 bool mShowIconWhatsThis; 194 bool mShowIconWhatsThis;
194 bool mShowIconWeekNum; 195 bool mShowIconWeekNum;
195 bool mShowIconNextDays; 196 bool mShowIconNextDays;
196 bool mShowIconNext; 197 bool mShowIconNext;
197 bool mShowIconJournal; 198 bool mShowIconJournal;
198 bool mShowIconFilter; 199 bool mShowIconFilter;
199 bool mShowIconOnetoolbar; 200 bool mShowIconOnetoolbar;
200 bool mShowIconNavigator; 201 bool mShowIconNavigator;
201 bool mShowIconAllday; 202 bool mShowIconAllday;
202 bool mShowIconFilterview; 203 bool mShowIconFilterview;
203 bool mShowIconToggleFull; 204 bool mShowIconToggleFull;
204 205
205 bool mShowIconStretch; 206 bool mShowIconStretch;
206 207
207 bool mToolBarHor; 208 bool mToolBarHor;
208 bool mToolBarUp; 209 bool mToolBarUp;
209 bool mToolBarHorV; 210 bool mToolBarHorV;
210 bool mToolBarUpV; 211 bool mToolBarUpV;
211 bool mToolBarHorN; 212 bool mToolBarHorN;
212 bool mToolBarUpN; 213 bool mToolBarUpN;
213 bool mToolBarHorF; 214 bool mToolBarHorF;
214 bool mToolBarUpF; 215 bool mToolBarUpF;
215 bool mToolBarMiniIcons; 216 bool mToolBarMiniIcons;
216 217
217 bool mAskForQuit; 218 bool mAskForQuit;
218 bool mUsePassWd; 219 bool mUsePassWd;
219 bool mShowSyncEvents; 220 bool mShowSyncEvents;
220 bool mShowTodoInAgenda; 221 bool mShowTodoInAgenda;
221 bool mShowTimeInAgenda; 222 bool mShowTimeInAgenda;
222 bool mHideNonStartedTodos; 223 bool mHideNonStartedTodos;
223 224
224 bool mBlockPopupMenu; 225 bool mBlockPopupMenu;
225 226
226 int mLastSyncTime; 227 int mLastSyncTime;
227 void setCategoryColor(QString cat,const QColor & color); 228 void setCategoryColor(QString cat,const QColor & color);
228 QColor *categoryColor(QString cat); 229 QColor *categoryColor(QString cat);
229 230
230 QString mArchiveFile; 231 QString mArchiveFile;
231 QString mHtmlExportFile; 232 QString mHtmlExportFile;
232 bool mHtmlWithSave; 233 bool mHtmlWithSave;
233 234
234 QStringList mSelectedPlugins; 235 QStringList mSelectedPlugins;
235 236
236 QString mLastImportFile; 237 QString mLastImportFile;
237 QString mLastVcalFile; 238 QString mLastVcalFile;
238 QString mLastSaveFile; 239 QString mLastSaveFile;
239 QString mLastLoadFile; 240 QString mLastLoadFile;
240 241
241 242
242 QString mDefaultAlarmFile; 243 QString mDefaultAlarmFile;
243 int mIMIPScheduler; 244 int mIMIPScheduler;
244 int mIMIPSend; 245 int mIMIPSend;
245 QStringList mAdditionalMails; 246 QStringList mAdditionalMails;
246 int mIMIPAutoRefresh; 247 int mIMIPAutoRefresh;
247 int mIMIPAutoInsertReply; 248 int mIMIPAutoInsertReply;
248 int mIMIPAutoInsertRequest; 249 int mIMIPAutoInsertRequest;
249 int mIMIPAutoFreeBusy; 250 int mIMIPAutoFreeBusy;
250 int mIMIPAutoFreeBusyReply; 251 int mIMIPAutoFreeBusyReply;
251 252
252 QStringList mTodoTemplates; 253 QStringList mTodoTemplates;
253 QStringList mEventTemplates; 254 QStringList mEventTemplates;
254 255
255 int mDestination; 256 int mDestination;
256 257
257 258
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index ad3c61c..cb9c272 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -671,193 +671,195 @@ void KOPrefsDialog::setupViewsTab()
671 addWidBool(i18n("Enable tooltips displaying summary of ev."), 671 addWidBool(i18n("Enable tooltips displaying summary of ev."),
672 &(KOPrefs::instance()->mEnableToolTips),topFrame); 672 &(KOPrefs::instance()->mEnableToolTips),topFrame);
673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
674#endif 674#endif
675 // ********************************************************* 675 // *********************************************************
676 676
677 topFrame = addPage(i18n("Agenda View"),0,0); 677 topFrame = addPage(i18n("Agenda View"),0,0);
678 // DesktopIcon("viewmag",KIcon::SizeMedium)); 678 // DesktopIcon("viewmag",KIcon::SizeMedium));
679 679
680 topLayout = new QGridLayout(topFrame,5,1); 680 topLayout = new QGridLayout(topFrame,5,1);
681 topLayout->setSpacing(mSpacingHint); 681 topLayout->setSpacing(mSpacingHint);
682 topLayout->setMargin(mMarginHint); 682 topLayout->setMargin(mMarginHint);
683 ii = 0; 683 ii = 0;
684 684
685 685
686 dummy = 686 dummy =
687 addWidBool(i18n("Show time in agenda items"), 687 addWidBool(i18n("Show time in agenda items"),
688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
689 topLayout->addWidget(dummy->checkBox(),ii++,0); 689 topLayout->addWidget(dummy->checkBox(),ii++,0);
690 690
691 dummy = 691 dummy =
692 addWidBool(i18n("Highlight current day in agenda"), 692 addWidBool(i18n("Highlight current day in agenda"),
693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
694 topLayout->addWidget(dummy->checkBox(),ii++,0); 694 topLayout->addWidget(dummy->checkBox(),ii++,0);
695 695
696 dummy = 696 dummy =
697 addWidBool(i18n("Use light color for highlight current day"), 697 addWidBool(i18n("Use light color for highlight current day"),
698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
699 topLayout->addWidget(dummy->checkBox(),ii++,0); 699 topLayout->addWidget(dummy->checkBox(),ii++,0);
700 700
701 701
702 KPrefsDialogWidBool *marcusBainsEnabled = 702 KPrefsDialogWidBool *marcusBainsEnabled =
703 addWidBool(i18n("Show current time"), 703 addWidBool(i18n("Show current time"),
704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
706 706
707 707
708 dummy = 708 dummy =
709 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 709 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
711 topLayout->addWidget(dummy->checkBox(),ii++,0); 711 topLayout->addWidget(dummy->checkBox(),ii++,0);
712 712
713 dummy = 713 dummy =
714 addWidBool(i18n("Set agenda to current time on change"), 714 addWidBool(i18n("Set agenda to current time on change"),
715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
716 topLayout->addWidget(dummy->checkBox(),ii++,0); 716 topLayout->addWidget(dummy->checkBox(),ii++,0);
717 717
718 718
719 719
720 720
721 721
722 722
723 723
724 topFrame = addPage(i18n("Month View"),0,0); 724 topFrame = addPage(i18n("Month View"),0,0);
725 // DesktopIcon("viewmag",KIcon::SizeMedium)); 725 // DesktopIcon("viewmag",KIcon::SizeMedium));
726 726
727 topLayout = new QGridLayout(topFrame,5,1); 727 topLayout = new QGridLayout(topFrame,5,1);
728 topLayout->setSpacing(mSpacingHint); 728 topLayout->setSpacing(mSpacingHint);
729 topLayout->setMargin(mMarginHint); 729 topLayout->setMargin(mMarginHint);
730 ii = 0; 730 ii = 0;
731 QLabel *lab; 731 QLabel *lab;
732 QHBox *habo = new QHBox( topFrame ); 732 QHBox *habo = new QHBox( topFrame );
733 if ( QApplication::desktop()->width() <= 480 ) { 733 if ( QApplication::desktop()->width() <= 480 ) {
734 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 734 lab = new QLabel ( i18n("Show events that recur "), topFrame );
735 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 735 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
736 ii++; 736 ii++;
737 } else { 737 } else {
738 new QLabel ( i18n("Show events that recur "), habo ); 738 new QLabel ( i18n("Show events that recur "), habo );
739 } 739 }
740 dailyRecur = 740 dailyRecur =
741 addWidBool(i18n("daily"), 741 addWidBool(i18n("daily"),
742 &(KOPrefs::instance()->mMonthDailyRecur),habo); 742 &(KOPrefs::instance()->mMonthDailyRecur),habo);
743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
744 744
745 weeklyRecur = 745 weeklyRecur =
746 addWidBool(i18n("weekly"), 746 addWidBool(i18n("weekly"),
747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
748 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 748 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
749 ii++; 749 ii++;
750 750
751 751
752 habo = new QHBox( topFrame ); 752 habo = new QHBox( topFrame );
753 if ( QApplication::desktop()->width() <= 480 ) { 753 if ( QApplication::desktop()->width() <= 480 ) {
754 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 754 lab = new QLabel (i18n("Show in every cell ") , topFrame );
755 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 755 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
756 ii++; 756 ii++;
757 757
758 } else { 758 } else {
759 new QLabel ( i18n("Show in every cell "), habo ); 759 new QLabel ( i18n("Show in every cell "), habo );
760 } 760 }
761 weeklyRecur = 761 weeklyRecur =
762 addWidBool(i18n("short month"), 762 addWidBool(i18n("short month"),
763 &(KOPrefs::instance()->mMonthShowShort),habo); 763 &(KOPrefs::instance()->mMonthShowShort),habo);
764 weeklyRecur = 764 weeklyRecur =
765 addWidBool(i18n("icons"), 765 addWidBool(i18n("icons"),
766 &(KOPrefs::instance()->mMonthShowIcons),habo); 766 &(KOPrefs::instance()->mMonthShowIcons),habo);
767 767 weeklyRecur =
768 addWidBool(i18n("times"),
769 &(KOPrefs::instance()->mMonthShowTimes),habo);
768 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 770 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
769 ii++; 771 ii++;
770#ifdef DESKTOP_VERSION 772#ifdef DESKTOP_VERSION
771 KPrefsDialogWidBool *enableMonthScroll = 773 KPrefsDialogWidBool *enableMonthScroll =
772 addWidBool(i18n("Enable scrollbars in month view cells"), 774 addWidBool(i18n("Enable scrollbars in month view cells"),
773 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
774 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
775#endif 777#endif
776 dummy = 778 dummy =
777 addWidBool(i18n("Week view mode uses bigger font"), 779 addWidBool(i18n("Week view mode uses bigger font"),
778 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
779 topLayout->addWidget(dummy->checkBox(),ii++,0); 781 topLayout->addWidget(dummy->checkBox(),ii++,0);
780 dummy = 782 dummy =
781 addWidBool(i18n("Show Sat/Sun together"), 783 addWidBool(i18n("Show Sat/Sun together"),
782 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
783 topLayout->addWidget(dummy->checkBox(),ii++,0); 785 topLayout->addWidget(dummy->checkBox(),ii++,0);
784 786
785 KPrefsDialogWidBool *coloredCategoriesInMonthView = 787 KPrefsDialogWidBool *coloredCategoriesInMonthView =
786 addWidBool(i18n("Month view uses category colors"), 788 addWidBool(i18n("Month view uses category colors"),
787 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
788 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
789 791
790 dummy = 792 dummy =
791 addWidBool(i18n("Categorie colors are applied to text"), 793 addWidBool(i18n("Categorie colors are applied to text"),
792 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
793 topLayout->addWidget(dummy->checkBox(),ii++,0); 795 topLayout->addWidget(dummy->checkBox(),ii++,0);
794 coloredCategoriesInMonthView = 796 coloredCategoriesInMonthView =
795 addWidBool(i18n("Month view uses day colors"), 797 addWidBool(i18n("Month view uses day colors"),
796 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
797 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
798 800
799 KPrefsDialogWidColor *holidayColor = 801 KPrefsDialogWidColor *holidayColor =
800 addWidColor(i18n("Day color odd months"), 802 addWidColor(i18n("Day color odd months"),
801 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
802 topLayout->addWidget(holidayColor->label(),ii,0); 804 topLayout->addWidget(holidayColor->label(),ii,0);
803 topLayout->addWidget(holidayColor->button(),ii++,1); 805 topLayout->addWidget(holidayColor->button(),ii++,1);
804 806
805 holidayColor = 807 holidayColor =
806 addWidColor(i18n("Day color even months"), 808 addWidColor(i18n("Day color even months"),
807 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
808 topLayout->addWidget(holidayColor->label(),ii,0); 810 topLayout->addWidget(holidayColor->label(),ii,0);
809 topLayout->addWidget(holidayColor->button(),ii++,1); 811 topLayout->addWidget(holidayColor->button(),ii++,1);
810 812
811 813
812 holidayColor = 814 holidayColor =
813 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 815 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
814 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
815 topLayout->addWidget(holidayColor->label(),ii,0); 817 topLayout->addWidget(holidayColor->label(),ii,0);
816 topLayout->addWidget(holidayColor->button(),ii++,1); 818 topLayout->addWidget(holidayColor->button(),ii++,1);
817 // *********************** What'sNext View 819 // *********************** What'sNext View
818 topFrame = addPage(i18n("What's Next View"),0,0); 820 topFrame = addPage(i18n("What's Next View"),0,0);
819 // DesktopIcon("viewmag",KIcon::SizeMedium)); 821 // DesktopIcon("viewmag",KIcon::SizeMedium));
820 822
821 topLayout = new QGridLayout(topFrame,4,1); 823 topLayout = new QGridLayout(topFrame,4,1);
822 topLayout->setSpacing(mSpacingHint); 824 topLayout->setSpacing(mSpacingHint);
823 topLayout->setMargin(mMarginHint); 825 topLayout->setMargin(mMarginHint);
824 ii = 0; 826 ii = 0;
825 827
826 828
827 QHBox* hdummy = new QHBox(topFrame); 829 QHBox* hdummy = new QHBox(topFrame);
828 new QLabel(i18n("Days in What's Next:"),hdummy); 830 new QLabel(i18n("Days in What's Next:"),hdummy);
829 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
830 832
831 topLayout->addWidget(hdummy,ii++,0); 833 topLayout->addWidget(hdummy,ii++,0);
832 834
833 QHBox *prioBox = new QHBox(topFrame); 835 QHBox *prioBox = new QHBox(topFrame);
834 // intervalBox->setSpacing(mSpacingHint); 836 // intervalBox->setSpacing(mSpacingHint);
835 topLayout->addWidget(prioBox,ii++,0); 837 topLayout->addWidget(prioBox,ii++,0);
836 838
837 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); 839 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
838 mPrioSpin = new QSpinBox(0,5,1,prioBox); 840 mPrioSpin = new QSpinBox(0,5,1,prioBox);
839 if ( QApplication::desktop()->width() < 300 ) 841 if ( QApplication::desktop()->width() < 300 )
840 mPrioSpin->setFixedWidth( 40 ); 842 mPrioSpin->setFixedWidth( 40 );
841 843
842 KPrefsDialogWidBool *passwdk = 844 KPrefsDialogWidBool *passwdk =
843 845
844 addWidBool(i18n("Show events, that are done"), 846 addWidBool(i18n("Show events, that are done"),
845 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
846 topLayout->addWidget(passwdk->checkBox(), ii++,0); 848 topLayout->addWidget(passwdk->checkBox(), ii++,0);
847 passwdk = 849 passwdk =
848 addWidBool(i18n("Show parent To-Do's"), 850 addWidBool(i18n("Show parent To-Do's"),
849 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
850 topLayout->addWidget(passwdk->checkBox(), ii++,0); 852 topLayout->addWidget(passwdk->checkBox(), ii++,0);
851 853
852 passwdk = 854 passwdk =
853 addWidBool(i18n("Show location"), 855 addWidBool(i18n("Show location"),
854 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
855 topLayout->addWidget(passwdk->checkBox(), ii++,0); 857 topLayout->addWidget(passwdk->checkBox(), ii++,0);
856 858
857 passwdk = 859 passwdk =
858 addWidBool(i18n("Show Sync Events in WN+Agenda"), 860 addWidBool(i18n("Show Sync Events in WN+Agenda"),
859 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 861 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
860 topLayout->addWidget(passwdk->checkBox(), ii++,0); 862 topLayout->addWidget(passwdk->checkBox(), ii++,0);
861 passwdk = 863 passwdk =
862 addWidBool(i18n("Use short date in WN+Event view"), 864 addWidBool(i18n("Use short date in WN+Event view"),
863 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 865 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 406e741..f1f2dd2 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -506,192 +506,199 @@ void KOViewManager::showAgendaView( bool fullScreen )
506 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
509 mAgendaView->readSettings(); 509 mAgendaView->readSettings();
510 mAgendaView->updateConfig(); 510 mAgendaView->updateConfig();
511 } 511 }
512 512
513 showView( mAgendaView, full); 513 showView( mAgendaView, full);
514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
515} 515}
516 516
517void KOViewManager::showDayView() 517void KOViewManager::showDayView()
518{ 518{
519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
520 mFlagShowNextxDays = false; 520 mFlagShowNextxDays = false;
521 globalFlagBlockLabel = 1; 521 globalFlagBlockLabel = 1;
522 globalFlagBlockAgenda = 1; 522 globalFlagBlockAgenda = 1;
523 if ( mCurrentAgendaView != 1 ) 523 if ( mCurrentAgendaView != 1 )
524 mCurrentAgendaView = -1; 524 mCurrentAgendaView = -1;
525 showAgendaView(); 525 showAgendaView();
526 qApp->processEvents(); 526 qApp->processEvents();
527 globalFlagBlockAgenda = 2; 527 globalFlagBlockAgenda = 2;
528 globalFlagBlockLabel = 0; 528 globalFlagBlockLabel = 0;
529 mMainView->dateNavigator()->selectDates( 1 ); 529 mMainView->dateNavigator()->selectDates( 1 );
530 mCurrentAgendaView = 1 ; 530 mCurrentAgendaView = 1 ;
531 531
532} 532}
533 533
534void KOViewManager::showWorkWeekView() 534void KOViewManager::showWorkWeekView()
535{ 535{
536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
537 mFlagShowNextxDays = false; 537 mFlagShowNextxDays = false;
538 globalFlagBlockAgenda = 1; 538 globalFlagBlockAgenda = 1;
539 globalFlagBlockLabel = 1; 539 globalFlagBlockLabel = 1;
540 if ( mCurrentAgendaView != 5 ) 540 if ( mCurrentAgendaView != 5 )
541 mCurrentAgendaView = -1; 541 mCurrentAgendaView = -1;
542 showAgendaView(); 542 showAgendaView();
543 qApp->processEvents(); 543 qApp->processEvents();
544 globalFlagBlockAgenda = 2; 544 globalFlagBlockAgenda = 2;
545 globalFlagBlockLabel = 0; 545 globalFlagBlockLabel = 0;
546 mMainView->dateNavigator()->selectWorkWeek(); 546 mMainView->dateNavigator()->selectWorkWeek();
547 mCurrentAgendaView = 5 ; 547 mCurrentAgendaView = 5 ;
548 548
549} 549}
550 550
551void KOViewManager::showWeekView() 551void KOViewManager::showWeekView()
552{ 552{
553 /* 553 /*
554 globalFlagBlockAgenda = 2; 554 globalFlagBlockAgenda = 2;
555 qDebug("4globalFlagBlockAgenda = 2; "); 555 qDebug("4globalFlagBlockAgenda = 2; ");
556 //globalFlagBlockPainting = true; 556 //globalFlagBlockPainting = true;
557 mMainView->dateNavigator()->selectWeek(); 557 mMainView->dateNavigator()->selectWeek();
558 showAgendaView(); 558 showAgendaView();
559 */ 559 */
560 560
561 561
562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
563 mFlagShowNextxDays = false; 563 mFlagShowNextxDays = false;
564 globalFlagBlockAgenda = 1; 564 globalFlagBlockAgenda = 1;
565 globalFlagBlockLabel = 1; 565 globalFlagBlockLabel = 1;
566 if ( mCurrentAgendaView != 7 ) 566 if ( mCurrentAgendaView != 7 )
567 mCurrentAgendaView = -1; 567 mCurrentAgendaView = -1;
568 showAgendaView(); 568 showAgendaView();
569 qApp->processEvents(); 569 qApp->processEvents();
570 globalFlagBlockAgenda = 2; 570 globalFlagBlockAgenda = 2;
571 globalFlagBlockLabel = 0; 571 globalFlagBlockLabel = 0;
572 mMainView->dateNavigator()->selectWeek(); 572 mMainView->dateNavigator()->selectWeek();
573 mCurrentAgendaView = 7 ; 573 mCurrentAgendaView = 7 ;
574} 574}
575 575
576void KOViewManager::showNextXView() 576void KOViewManager::showNextXView()
577{ 577{
578 578
579 globalFlagBlockAgenda = 1; 579 globalFlagBlockAgenda = 1;
580 if ( mCurrentAgendaView != 3 ) 580 if ( mCurrentAgendaView != 3 )
581 mCurrentAgendaView = -1; 581 mCurrentAgendaView = -1;
582 showAgendaView(KOPrefs::instance()->mFullViewMonth); 582 showAgendaView(KOPrefs::instance()->mFullViewMonth);
583 globalFlagBlockAgenda = 2; 583 globalFlagBlockAgenda = 2;
584 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 584 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
585 KOPrefs::instance()->mNextXDays ); 585 KOPrefs::instance()->mNextXDays );
586 mFlagShowNextxDays = true; 586 mFlagShowNextxDays = true;
587 mCurrentAgendaView = 3 ; 587 mCurrentAgendaView = 3 ;
588 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 588 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
589} 589}
590bool KOViewManager::showsNextDays() 590bool KOViewManager::showsNextDays()
591{ 591{
592 return mFlagShowNextxDays; 592 return mFlagShowNextxDays;
593} 593}
594void KOViewManager::createMonthView() 594void KOViewManager::createMonthView()
595{ 595{
596if (!mMonthView) { 596if (!mMonthView) {
597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
598 598
599 addView(mMonthView); 599 addView(mMonthView);
600 // mMonthView->show(); 600 // mMonthView->show();
601 // SIGNALS/SLOTS FOR MONTH VIEW 601 // SIGNALS/SLOTS FOR MONTH VIEW
602
603 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
604
605 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
606 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
607
608
602 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 609 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
603 mMainView, SLOT(newEvent(QDateTime))); 610 mMainView, SLOT(newEvent(QDateTime)));
604 611
605 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 612 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
606 mMainView, SLOT(showIncidence(Incidence *))); 613 mMainView, SLOT(showIncidence(Incidence *)));
607 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 614 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
608 mMainView, SLOT(editIncidence(Incidence *))); 615 mMainView, SLOT(editIncidence(Incidence *)));
609 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 616 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
610 mMainView, SLOT(deleteIncidence(Incidence *))); 617 mMainView, SLOT(deleteIncidence(Incidence *)));
611 618
612 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 619 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
613 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 620 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
614 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 621 connect( mMonthView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
615 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 622 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
616 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 623 connect( mMonthView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
617 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 624 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
618 625
619 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 626 connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
620 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 627 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
621 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 628 connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
622 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 629 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
623 connect( mMonthView, SIGNAL( selectWeekNum( int ) ), 630 connect( mMonthView, SIGNAL( selectWeekNum( int ) ),
624 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); 631 mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) );
625 connect( mMonthView, SIGNAL( selectMonth() ), 632 connect( mMonthView, SIGNAL( selectMonth() ),
626 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); 633 mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) );
627 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), 634 connect( mMonthView, SIGNAL( showDaySignal( QDate ) ),
628 mMainView, SLOT ( showDay( QDate ) ) ); 635 mMainView, SLOT ( showDay( QDate ) ) );
629 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); 636 connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig()));
630 connect( mMonthView, SIGNAL(nextMonth() ), 637 connect( mMonthView, SIGNAL(nextMonth() ),
631 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); 638 mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) );
632 connect( mMonthView, SIGNAL(prevMonth() ), 639 connect( mMonthView, SIGNAL(prevMonth() ),
633 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) ); 640 mMonthView->navigatorBar(), SIGNAL(goPrevMonth() ) );
634 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ), 641 connect( mMonthView->navigatorBar(), SIGNAL( goPrevYear() ),
635 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) ); 642 mMainView->dateNavigator(), SLOT( selectPreviousYear() ) );
636 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), 643 connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ),
637 mMainView->dateNavigator(), SLOT( selectNextYear() ) ); 644 mMainView->dateNavigator(), SLOT( selectNextYear() ) );
638 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), 645 connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ),
639 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); 646 mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) );
640 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), 647 connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ),
641 mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); 648 mMainView->dateNavigator(), SLOT( selectNextMonth() ) );
642 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), 649 connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ),
643 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); 650 mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) );
644 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), 651 connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ),
645 mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); 652 mMainView->dateNavigator(), SLOT( selectNextWeek() ) );
646 653
647 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 654 connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
648 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 655 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
649 656
650 657
651 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 658 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
652 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 659 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
653 660
654 } 661 }
655} 662}
656void KOViewManager::showMonthViewWeek() 663void KOViewManager::showMonthViewWeek()
657{ 664{
658 createMonthView(); 665 createMonthView();
659 globalFlagBlockAgenda = 1; 666 globalFlagBlockAgenda = 1;
660 bool full = true; 667 bool full = true;
661 if ( mCurrentView == mMonthView) 668 if ( mCurrentView == mMonthView)
662 full = mMainView->leftFrame()->isVisible(); 669 full = mMainView->leftFrame()->isVisible();
663 if ( !KOPrefs::instance()->mMonthViewWeek ) { 670 if ( !KOPrefs::instance()->mMonthViewWeek ) {
664 mMonthView->switchView(); 671 mMonthView->switchView();
665 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 672 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
666 full = false; 673 full = false;
667 else 674 else
668 full = true; 675 full = true;
669 } 676 }
670 mMainView->dateNavigator()->selectWeek(); 677 mMainView->dateNavigator()->selectWeek();
671 showView(mMonthView, full ); 678 showView(mMonthView, full );
672 mMonthView->setKeyBFocus(); 679 mMonthView->setKeyBFocus();
673 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 680 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
674} 681}
675 682
676void KOViewManager::showMonth( const QDate & date ) 683void KOViewManager::showMonth( const QDate & date )
677{ 684{
678 mMainView->dateNavigator()->blockSignals( true ); 685 mMainView->dateNavigator()->blockSignals( true );
679 mMainView->dateNavigator()->selectDate( date ); 686 mMainView->dateNavigator()->selectDate( date );
680 mMainView->dateNavigator()->blockSignals( false ); 687 mMainView->dateNavigator()->blockSignals( false );
681 showMonthView(); 688 showMonthView();
682} 689}
683void KOViewManager::showMonthView() 690void KOViewManager::showMonthView()
684 { 691 {
685 692
686 createMonthView(); 693 createMonthView();
687 globalFlagBlockAgenda = 1; 694 globalFlagBlockAgenda = 1;
688 //mFlagShowNextxDays = false; 695 //mFlagShowNextxDays = false;
689 bool full = true; 696 bool full = true;
690 if ( mCurrentView == mMonthView) 697 if ( mCurrentView == mMonthView)
691 full = mMainView->leftFrame()->isVisible(); 698 full = mMainView->leftFrame()->isVisible();
692 // if(mMonthView == mCurrentView) return; 699 // if(mMonthView == mCurrentView) return;
693 if ( KOPrefs::instance()->mMonthViewWeek ) { 700 if ( KOPrefs::instance()->mMonthViewWeek ) {
694 mMonthView->switchView(); 701 mMonthView->switchView();
695 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 702 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
696 full = false; 703 full = false;
697 else 704 else