summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-22 17:32:45 (UTC)
committer zautrix <zautrix>2005-04-22 17:32:45 (UTC)
commite6feb1ca0c45397ba7b922198c87fe9b95b7d872 (patch) (unidiff)
tree61b56d5a17f3eba87fef958d264e2da679496bda
parent81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261 (diff)
downloadkdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.zip
kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.tar.gz
kdepimpi-e6feb1ca0c45397ba7b922198c87fe9b95b7d872.tar.bz2
fixxxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp38
-rw-r--r--korganizer/kodaymatrix.cpp2
-rw-r--r--korganizer/mainwindow.cpp8
3 files changed, 42 insertions, 6 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9c40142..a4f3579 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -456,212 +456,246 @@ void KABCore::toggleBeamReceive( )
456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
458#endif 458#endif
459} 459}
460 460
461 461
462void KABCore::disableBR(bool b) 462void KABCore::disableBR(bool b)
463{ 463{
464#ifndef DESKTOP_VERSION 464#ifndef DESKTOP_VERSION
465 if ( b ) { 465 if ( b ) {
466 if ( infrared ) { 466 if ( infrared ) {
467 toggleBeamReceive( ); 467 toggleBeamReceive( );
468 } 468 }
469 mBRdisabled = true; 469 mBRdisabled = true;
470 } else { 470 } else {
471 if ( mBRdisabled ) { 471 if ( mBRdisabled ) {
472 mBRdisabled = false; 472 mBRdisabled = false;
473 //toggleBeamReceive( ); 473 //toggleBeamReceive( );
474 } 474 }
475 } 475 }
476#endif 476#endif
477 477
478} 478}
479void KABCore::recieve( QString fn ) 479void KABCore::recieve( QString fn )
480{ 480{
481 //qDebug("KABCore::recieve "); 481 //qDebug("KABCore::recieve ");
482 int count = mAddressBook->importFromFile( fn, true ); 482 int count = mAddressBook->importFromFile( fn, true );
483 if ( count ) 483 if ( count )
484 setModified( true ); 484 setModified( true );
485 mViewManager->refreshView(); 485 mViewManager->refreshView();
486 message(i18n("%1 contact(s) received!").arg( count )); 486 message(i18n("%1 contact(s) received!").arg( count ));
487 topLevelWidget()->showMaximized(); 487 topLevelWidget()->showMaximized();
488 topLevelWidget()->raise(); 488 topLevelWidget()->raise();
489} 489}
490void KABCore::restoreSettings() 490void KABCore::restoreSettings()
491{ 491{
492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 492 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
493 493
494 bool state; 494 bool state;
495 495
496 if (mMultipleViewsAtOnce) 496 if (mMultipleViewsAtOnce)
497 state = KABPrefs::instance()->mDetailsPageVisible; 497 state = KABPrefs::instance()->mDetailsPageVisible;
498 else 498 else
499 state = false; 499 state = false;
500 500
501 mActionDetails->setChecked( state ); 501 mActionDetails->setChecked( state );
502 setDetailsVisible( state ); 502 setDetailsVisible( state );
503 503
504 state = KABPrefs::instance()->mJumpButtonBarVisible; 504 state = KABPrefs::instance()->mJumpButtonBarVisible;
505 505
506 mActionJumpBar->setChecked( state ); 506 mActionJumpBar->setChecked( state );
507 setJumpButtonBarVisible( state ); 507 setJumpButtonBarVisible( state );
508/*US 508/*US
509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 509 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
510 if ( splitterSize.count() == 0 ) { 510 if ( splitterSize.count() == 0 ) {
511 splitterSize.append( width() / 2 ); 511 splitterSize.append( width() / 2 );
512 splitterSize.append( width() / 2 ); 512 splitterSize.append( width() / 2 );
513 } 513 }
514 mMiniSplitter->setSizes( splitterSize ); 514 mMiniSplitter->setSizes( splitterSize );
515 if ( mExtensionBarSplitter ) { 515 if ( mExtensionBarSplitter ) {
516 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 516 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
517 if ( splitterSize.count() == 0 ) { 517 if ( splitterSize.count() == 0 ) {
518 splitterSize.append( width() / 2 ); 518 splitterSize.append( width() / 2 );
519 splitterSize.append( width() / 2 ); 519 splitterSize.append( width() / 2 );
520 } 520 }
521 mExtensionBarSplitter->setSizes( splitterSize ); 521 mExtensionBarSplitter->setSizes( splitterSize );
522 522
523 } 523 }
524*/ 524*/
525 mViewManager->restoreSettings(); 525 mViewManager->restoreSettings();
526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 526 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
527 mExtensionManager->restoreSettings(); 527 mExtensionManager->restoreSettings();
528#ifdef DESKTOP_VERSION 528#ifdef DESKTOP_VERSION
529 int wid = width(); 529 int wid = width();
530 if ( wid < 10 ) 530 if ( wid < 10 )
531 wid = 400; 531 wid = 400;
532#else 532#else
533 int wid = QApplication::desktop()->width(); 533 int wid = QApplication::desktop()->width();
534 if ( wid < 640 ) 534 if ( wid < 640 )
535 wid = QApplication::desktop()->height(); 535 wid = QApplication::desktop()->height();
536#endif 536#endif
537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 537 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
538 if ( true /*splitterSize.count() == 0*/ ) { 538 if ( true /*splitterSize.count() == 0*/ ) {
539 splitterSize.append( wid / 2 ); 539 splitterSize.append( wid / 2 );
540 splitterSize.append( wid / 2 ); 540 splitterSize.append( wid / 2 );
541 } 541 }
542 mMiniSplitter->setSizes( splitterSize ); 542 mMiniSplitter->setSizes( splitterSize );
543 if ( mExtensionBarSplitter ) { 543 if ( mExtensionBarSplitter ) {
544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 544 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
545 if ( true /*splitterSize.count() == 0*/ ) { 545 if ( true /*splitterSize.count() == 0*/ ) {
546 splitterSize.append( wid / 2 ); 546 splitterSize.append( wid / 2 );
547 splitterSize.append( wid / 2 ); 547 splitterSize.append( wid / 2 );
548 } 548 }
549 mExtensionBarSplitter->setSizes( splitterSize ); 549 mExtensionBarSplitter->setSizes( splitterSize );
550 550
551 } 551 }
552 552#ifdef DESKTOP_VERSION
553 553 KConfig *config = KABPrefs::instance()->getConfig();
554 config->setGroup("WidgetLayout");
555 QStringList list;
556 list = config->readListEntry("MainLayout");
557 int x,y,w,h;
558 if ( ! list.isEmpty() ) {
559 x = list[0].toInt();
560 y = list[1].toInt();
561 w = list[2].toInt();
562 h = list[3].toInt();
563 KApplication::testCoords( &x,&y,&w,&h );
564 topLevelWidget()->setGeometry(x,y,w,h);
565
566 } else {
567 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
568 }
569#endif
554} 570}
555 571
556void KABCore::saveSettings() 572void KABCore::saveSettings()
557{ 573{
558 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 574 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
559 if ( mExtensionBarSplitter ) 575 if ( mExtensionBarSplitter )
560 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 576 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
561 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 577 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
562 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 578 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
563#ifndef KAB_EMBEDDED 579#ifndef KAB_EMBEDDED
564 580
565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 581 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 582 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
567#endif //KAB_EMBEDDED 583#endif //KAB_EMBEDDED
568 mExtensionManager->saveSettings(); 584 mExtensionManager->saveSettings();
569 mViewManager->saveSettings(); 585 mViewManager->saveSettings();
570 586
571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 587 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
588#ifdef DESKTOP_VERSION
589 KConfig *config = KABPrefs::instance()->getConfig();
590 config->setGroup("WidgetLayout");
591 QStringList list ;//= config->readListEntry("MainLayout");
592 int x,y,w,h;
593 QWidget* wid;
594 wid = topLevelWidget();
595 x = wid->geometry().x();
596 y = wid->geometry().y();
597 w = wid->width();
598 h = wid->height();
599 list.clear();
600 list << QString::number( x );
601 list << QString::number( y );
602 list << QString::number( w );
603 list << QString::number( h );
604 config->writeEntry("MainLayout",list );
605#endif
572 KABPrefs::instance()->writeConfig(); 606 KABPrefs::instance()->writeConfig();
573 qDebug("KA: KABCore::saveSettings() "); 607 qDebug("KA: KABCore::saveSettings() ");
574} 608}
575 609
576KABC::AddressBook *KABCore::addressBook() const 610KABC::AddressBook *KABCore::addressBook() const
577{ 611{
578 return mAddressBook; 612 return mAddressBook;
579} 613}
580 614
581KConfig *KABCore::config() 615KConfig *KABCore::config()
582{ 616{
583#ifndef KAB_EMBEDDED 617#ifndef KAB_EMBEDDED
584 return KABPrefs::instance()->config(); 618 return KABPrefs::instance()->config();
585#else //KAB_EMBEDDED 619#else //KAB_EMBEDDED
586 return KABPrefs::instance()->getConfig(); 620 return KABPrefs::instance()->getConfig();
587#endif //KAB_EMBEDDED 621#endif //KAB_EMBEDDED
588} 622}
589 623
590KActionCollection *KABCore::actionCollection() const 624KActionCollection *KABCore::actionCollection() const
591{ 625{
592 return mGUIClient->actionCollection(); 626 return mGUIClient->actionCollection();
593} 627}
594 628
595KABC::Field *KABCore::currentSearchField() const 629KABC::Field *KABCore::currentSearchField() const
596{ 630{
597 if (mIncSearchWidget) 631 if (mIncSearchWidget)
598 return mIncSearchWidget->currentField(); 632 return mIncSearchWidget->currentField();
599 else 633 else
600 return 0; 634 return 0;
601} 635}
602 636
603QStringList KABCore::selectedUIDs() const 637QStringList KABCore::selectedUIDs() const
604{ 638{
605 return mViewManager->selectedUids(); 639 return mViewManager->selectedUids();
606} 640}
607 641
608KABC::Resource *KABCore::requestResource( QWidget *parent ) 642KABC::Resource *KABCore::requestResource( QWidget *parent )
609{ 643{
610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 644 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
611 645
612 QPtrList<KRES::Resource> kresResources; 646 QPtrList<KRES::Resource> kresResources;
613 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 647 QPtrListIterator<KABC::Resource> resIt( kabcResources );
614 KABC::Resource *resource; 648 KABC::Resource *resource;
615 while ( ( resource = resIt.current() ) != 0 ) { 649 while ( ( resource = resIt.current() ) != 0 ) {
616 ++resIt; 650 ++resIt;
617 if ( !resource->readOnly() ) { 651 if ( !resource->readOnly() ) {
618 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 652 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
619 if ( res ) 653 if ( res )
620 kresResources.append( res ); 654 kresResources.append( res );
621 } 655 }
622 } 656 }
623 657
624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 658 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
625 return static_cast<KABC::Resource*>( res ); 659 return static_cast<KABC::Resource*>( res );
626} 660}
627 661
628#ifndef KAB_EMBEDDED 662#ifndef KAB_EMBEDDED
629KAboutData *KABCore::createAboutData() 663KAboutData *KABCore::createAboutData()
630#else //KAB_EMBEDDED 664#else //KAB_EMBEDDED
631void KABCore::createAboutData() 665void KABCore::createAboutData()
632#endif //KAB_EMBEDDED 666#endif //KAB_EMBEDDED
633{ 667{
634 668
635 669
636 QString version; 670 QString version;
637#include <../version> 671#include <../version>
638 QMessageBox::about( this, "About KAddressbook/Pi", 672 QMessageBox::about( this, "About KAddressbook/Pi",
639 "KAddressbook/Platform-independent\n" 673 "KAddressbook/Platform-independent\n"
640 "(KA/Pi) " +version + " - " + 674 "(KA/Pi) " +version + " - " +
641#ifdef DESKTOP_VERSION 675#ifdef DESKTOP_VERSION
642 "Desktop Edition\n" 676 "Desktop Edition\n"
643#else 677#else
644 "PDA-Edition\n" 678 "PDA-Edition\n"
645 "for: Zaurus 5500 / 7x0 / 8x0\n" 679 "for: Zaurus 5500 / 7x0 / 8x0\n"
646#endif 680#endif
647 681
648 "(c) 2004 Ulf Schenk\n" 682 "(c) 2004 Ulf Schenk\n"
649 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" 683 "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n"
650 "(c) 1997-2003, The KDE PIM Team\n" 684 "(c) 1997-2003, The KDE PIM Team\n"
651 "Tobias Koenig Maintainer\n" 685 "Tobias Koenig Maintainer\n"
652 "Don Sanders Original author\n" 686 "Don Sanders Original author\n"
653 "Cornelius Schumacher Co-maintainer\n" 687 "Cornelius Schumacher Co-maintainer\n"
654 "Mike Pilone GUI and framework redesign\n" 688 "Mike Pilone GUI and framework redesign\n"
655 "Greg Stern DCOP interface\n" 689 "Greg Stern DCOP interface\n"
656 "Mark Westcot Contact pinning\n" 690 "Mark Westcot Contact pinning\n"
657 "Michel Boyer de la Giroday LDAP Lookup\n" 691 "Michel Boyer de la Giroday LDAP Lookup\n"
658 "Steffen Hansen LDAP Lookup" 692 "Steffen Hansen LDAP Lookup"
659#ifdef _WIN32_ 693#ifdef _WIN32_
660 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 694 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
661#endif 695#endif
662 ); 696 );
663} 697}
664 698
665void KABCore::setContactSelected( const QString &uid ) 699void KABCore::setContactSelected( const QString &uid )
666{ 700{
667 KABC::Addressee addr = mAddressBook->findByUid( uid ); 701 KABC::Addressee addr = mAddressBook->findByUid( uid );
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 4366265..30efbf6 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -110,208 +110,208 @@ KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
110 mLastView = -1; 110 mLastView = -1;
111 oldW = 0; 111 oldW = 0;
112 oldH = 0; 112 oldH = 0;
113 myPix.resize( 150, 120 ); 113 myPix.resize( 150, 120 );
114 mRedrawNeeded = true; 114 mRedrawNeeded = true;
115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
116 mPendingUpdateBeforeRepaint = false; 116 mPendingUpdateBeforeRepaint = false;
117 mouseDown = false; 117 mouseDown = false;
118 // initialize dynamic arrays 118 // initialize dynamic arrays
119 bDays.resize ( NUMDAYS ); 119 bDays.resize ( NUMDAYS );
120 pDays.resize ( NUMDAYS ); 120 pDays.resize ( NUMDAYS );
121 hDays.resize ( NUMDAYS ); 121 hDays.resize ( NUMDAYS );
122 eDays.resize ( NUMDAYS ); 122 eDays.resize ( NUMDAYS );
123 days = new QDate[NUMDAYS]; 123 days = new QDate[NUMDAYS];
124 daylbls = new QString[NUMDAYS]; 124 daylbls = new QString[NUMDAYS];
125 //events = new int[NUMDAYS]; 125 //events = new int[NUMDAYS];
126 mToolTip = new DynamicTip(this); 126 mToolTip = new DynamicTip(this);
127 127
128 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
129 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
130 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
133 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
134 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
135 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
136 136
137 setAcceptDrops(true); 137 setAcceptDrops(true);
138 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
139 139
140 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
142 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
144 mDayChanged = false; 144 mDayChanged = false;
145 updateView(); 145 updateView();
146} 146}
147QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
148{ 148{
149 149
150 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
152 return QString(); 152 return QString();
153 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
154 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
155 Event *event; 155 Event *event;
156 QStringList mToolTip; 156 QStringList mToolTip;
157 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
158 QString mToolTipText; 158 QString mToolTipText;
159 QString text; 159 QString text;
160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
161 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
162 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
163 QString time; 163 QString time;
164 if ( event->doesRecur() ) { 164 if ( event->doesRecur() ) {
165 if ( event->recursOn( mDate) ) { 165 if ( event->recursOn( mDate) ) {
166 prefix ="->" ;multiday = 1; 166 prefix ="->" ;multiday = 1;
167 } 167 }
168 else { 168 else {
169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
170 if ( event->recursOn( mDate.addDays( -days)) ) { 170 if ( event->recursOn( mDate.addDays( -days)) ) {
171 prefix ="<-" ;multiday = 3; 171 prefix ="<-" ;multiday = 3;
172 } 172 }
173 } 173 }
174 } else { 174 } else {
175 if (mDate == event->dtStart().date()) { 175 if (mDate == event->dtStart().date()) {
176 prefix ="->" ;multiday = 1; 176 prefix ="->" ;multiday = 1;
177 } else if (mDate == event->dtEnd().date()) { 177 } else if (mDate == event->dtEnd().date()) {
178 prefix ="<-" ;multiday = 3; 178 prefix ="<-" ;multiday = 3;
179 } 179 }
180 } 180 }
181 if ( !event->doesFloat() ) { 181 if ( !event->doesFloat() ) {
182 if ( mDate == event->dtStart().date () ) 182 if ( mDate == event->dtStart().date () )
183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
184 else if ( mDate == event->dtEnd().date () ) 184 else if ( mDate == event->dtEnd().date () )
185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
186 186
187 } 187 }
188 text = time + event->summary(); 188 text = time + event->summary();
189 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
190 } else { 190 } else {
191 if (event->doesFloat()) { 191 if (event->doesFloat()) {
192 text = event->summary(); 192 text = event->summary();
193 mToolTipText += text; 193 mToolTipText += text;
194 } 194 }
195 else { 195 else {
196 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
197 text += " " + event->summary(); 197 text += " " + event->summary();
198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
199 } 199 }
200 } 200 }
201 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
202 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
203 //qDebug("TTT: %s ", mToolTipText.latin1()); 203 //qDebug("TTT: %s ", mToolTipText.latin1());
204 mToolTip.append( deTag( mToolTipText ) ); 204 mToolTip.append( deTag( mToolTipText ) );
205 } 205 }
206 mToolTip.sort();
206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 207 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
207 QPtrList<Todo> todolist = mCalendar->todos(mDate); 208 QPtrList<Todo> todolist = mCalendar->todos(mDate);
208 Todo *todo; 209 Todo *todo;
209 for(todo=todolist.first();todo != 0;todo=todolist.next()) { 210 for(todo=todolist.first();todo != 0;todo=todolist.next()) {
210 QString mToolTipText; 211 QString mToolTipText;
211 if ( !todo->doesFloat() ) 212 if ( !todo->doesFloat() )
212 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" "; 213 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
213 mToolTipText += todo->summary(); 214 mToolTipText += todo->summary();
214 if ( !todo->location().isEmpty() ) 215 if ( !todo->location().isEmpty() )
215 mToolTipText += " (" + todo->location() + ")"; 216 mToolTipText += " (" + todo->location() + ")";
216 mToolTipText = deTag( mToolTipText); 217 mToolTipText = deTag( mToolTipText);
217 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; 218 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
218 mToolTip.append( mToolTipText ); 219 mToolTip.append( mToolTipText );
219 } 220 }
220 } 221 }
221 mToolTip.sort();
222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
223 Journal *j = mCalendar->journal( mDate ); 223 Journal *j = mCalendar->journal( mDate );
224 if ( j ) { 224 if ( j ) {
225 QString mToolTipText = j->description().left(100); 225 QString mToolTipText = j->description().left(100);
226 if ( j->description().length() > 100 ) 226 if ( j->description().length() > 100 )
227 mToolTipText += " ..."; 227 mToolTipText += " ...";
228 mToolTipText = deTag( mToolTipText); 228 mToolTipText = deTag( mToolTipText);
229 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; 229 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
230 mToolTip.append( mToolTipText ); 230 mToolTip.append( mToolTipText );
231 } 231 }
232 } 232 }
233 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 233 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
234} 234}
235 235
236 236
237QString KODayMatrix::deTag( QString mToolTipText ) 237QString KODayMatrix::deTag( QString mToolTipText )
238{ 238{
239 239
240#if QT_VERSION >= 0x030000 240#if QT_VERSION >= 0x030000
241 mToolTipText.replace( '<' , "&lt;" ); 241 mToolTipText.replace( '<' , "&lt;" );
242 mToolTipText.replace( '>' , "&gt;" ); 242 mToolTipText.replace( '>' , "&gt;" );
243#else 243#else
244 if ( mToolTipText.find ('<') >= 0 ) { 244 if ( mToolTipText.find ('<') >= 0 ) {
245 mToolTipText.replace( QRegExp("<") , "&lt;" ); 245 mToolTipText.replace( QRegExp("<") , "&lt;" );
246 } 246 }
247 if ( mToolTipText.find ('>') >= 0 ) { 247 if ( mToolTipText.find ('>') >= 0 ) {
248 mToolTipText.replace( QRegExp(">") , "&gt;" ); 248 mToolTipText.replace( QRegExp(">") , "&gt;" );
249 } 249 }
250#endif 250#endif
251 return mToolTipText; 251 return mToolTipText;
252} 252}
253void KODayMatrix::setCalendar( Calendar *cal ) 253void KODayMatrix::setCalendar( Calendar *cal )
254{ 254{
255 mCalendar = cal; 255 mCalendar = cal;
256 256
257 setAcceptDrops( mCalendar ); 257 setAcceptDrops( mCalendar );
258 258
259 updateEvents(); 259 updateEvents();
260} 260}
261 261
262QColor KODayMatrix::getShadedColor(QColor color) 262QColor KODayMatrix::getShadedColor(QColor color)
263{ 263{
264 QColor shaded; 264 QColor shaded;
265 int h=0; 265 int h=0;
266 int s=0; 266 int s=0;
267 int v=0; 267 int v=0;
268 color.hsv(&h,&s,&v); 268 color.hsv(&h,&s,&v);
269 s = s/4; 269 s = s/4;
270 v = 192+v/4; 270 v = 192+v/4;
271 shaded.setHsv(h,s,v); 271 shaded.setHsv(h,s,v);
272 272
273 return shaded; 273 return shaded;
274} 274}
275 275
276KODayMatrix::~KODayMatrix() 276KODayMatrix::~KODayMatrix()
277{ 277{
278#if QT_VERSION >= 0x030000 278#if QT_VERSION >= 0x030000
279 279
280#else 280#else
281 delete mKODaymatrixWhatsThis; 281 delete mKODaymatrixWhatsThis;
282#endif 282#endif
283 283
284 // delete mKODaymatrixWhatsThis; 284 // delete mKODaymatrixWhatsThis;
285 delete [] days; 285 delete [] days;
286 delete [] daylbls; 286 delete [] daylbls;
287 //delete [] events; 287 //delete [] events;
288 delete mToolTip; 288 delete mToolTip;
289} 289}
290 290
291/* 291/*
292void KODayMatrix::setStartDate(QDate start) 292void KODayMatrix::setStartDate(QDate start)
293{ 293{
294 updateView(start); 294 updateView(start);
295} 295}
296*/ 296*/
297 297
298void KODayMatrix::addSelectedDaysTo(DateList& selDays) 298void KODayMatrix::addSelectedDaysTo(DateList& selDays)
299{ 299{
300 300
301 if (mSelStart == NOSELECTION) { 301 if (mSelStart == NOSELECTION) {
302 return; 302 return;
303 } 303 }
304 304
305 //cope with selection being out of matrix limits at top (< 0) 305 //cope with selection being out of matrix limits at top (< 0)
306 int i0 = mSelStart; 306 int i0 = mSelStart;
307 if (i0 < 0) { 307 if (i0 < 0) {
308 for (int i = i0; i < 0; i++) { 308 for (int i = i0; i < 0; i++) {
309 selDays.append(days[0].addDays(i)); 309 selDays.append(days[0].addDays(i));
310 } 310 }
311 i0 = 0; 311 i0 = 0;
312 } 312 }
313 313
314 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 314 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
315 if (mSelEnd > NUMDAYS-1) { 315 if (mSelEnd > NUMDAYS-1) {
316 for (int i = i0; i <= NUMDAYS-1; i++) { 316 for (int i = i0; i <= NUMDAYS-1; i++) {
317 selDays.append(days[i]); 317 selDays.append(days[i]);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index eed023c..3c0259f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -94,193 +94,193 @@ class KOex2phonePrefs : public QDialog
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132int globalFlagBlockStartup; 132int globalFlagBlockStartup;
133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
134 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
135{ 135{
136 136
137 mClosed = false; 137 mClosed = false;
138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
139 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
140 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
141 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
142 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
143 mBlockAtStartup = true; 143 mBlockAtStartup = true;
144 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 p->mCurrentDisplayedView = 0; 148 p->mCurrentDisplayedView = 0;
149 if ( p->mHourSize > 22 ) 149 if ( p->mHourSize > 22 )
150 p->mHourSize = 22; 150 p->mHourSize = 22;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 169
170#ifdef DESKTOP_VERSION 170#ifdef DESKTOP_VERSION
171 if ( KOPrefs::instance()->mShowIconFilter ) 171 if ( KOPrefs::instance()->mShowIconFilter )
172#else 172#else
173 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 173 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
174#endif 174#endif
175 175
176{ 176{
177 if ( p->mToolBarHorF ) { 177 if ( p->mToolBarHorF ) {
178 if ( p->mToolBarUpF ) 178 if ( p->mToolBarUpF )
179 tbd = Bottom; 179 tbd = Bottom;
180 else 180 else
181 tbd = Top; 181 tbd = Top;
182 } 182 }
183 else { 183 else {
184 if ( p->mToolBarUpF ) 184 if ( p->mToolBarUpF )
185 tbd = Right; 185 tbd = Right;
186 else 186 else
187 tbd = Left; 187 tbd = Left;
188 } 188 }
189 filterToolBar = new QPEToolBar ( this ); 189 filterToolBar = new QPEToolBar ( this );
190 filterMenubar = new QMenuBar( filterToolBar ); 190 filterMenubar = new QMenuBar( 0 );
191 QFontMetrics fm ( filterMenubar->font() ); 191 QFontMetrics fm ( filterMenubar->font() );
192 192
193 filterPopupMenu = new QPopupMenu( this ); 193 filterPopupMenu = new QPopupMenu( this );
194 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 194 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
195 QString addTest = "A"; 195 QString addTest = "A";
196 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 196 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
197#ifdef DESKTOP_VERSION 197#ifdef DESKTOP_VERSION
198 addTest = "AAABBBCCCx"; 198 addTest = "AAABBBCCCx";
199#else 199#else
200 addTest = "AAx"; 200 addTest = "AAx";
201#endif 201#endif
202 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 202 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
203 addToolBar (filterToolBar , tbd ); 203 addToolBar (filterToolBar , tbd );
204 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 204 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
205 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 205 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
206 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 206 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
207 filterToolBar->hide(); 207 filterToolBar->hide();
208 } else { 208 } else {
209 filterToolBar = 0; 209 filterToolBar = 0;
210 filterMenubar = 0; 210 filterMenubar = 0;
211 filterPopupMenu = 0; 211 filterPopupMenu = 0;
212 } 212 }
213 if ( p->mShowIconOnetoolbar ) { 213 if ( p->mShowIconOnetoolbar ) {
214 viewToolBar = iconToolBar ; 214 viewToolBar = iconToolBar ;
215 navigatorToolBar = iconToolBar ; 215 navigatorToolBar = iconToolBar ;
216 } else { 216 } else {
217#ifndef DESKTOP_VERSION 217#ifndef DESKTOP_VERSION
218 setToolBarsMovable( false ); 218 setToolBarsMovable( false );
219#endif 219#endif
220 if ( p->mToolBarHorV ) { 220 if ( p->mToolBarHorV ) {
221 if ( p->mToolBarUpV ) 221 if ( p->mToolBarUpV )
222 tbd = Bottom; 222 tbd = Bottom;
223 else 223 else
224 tbd = Top; 224 tbd = Top;
225 } 225 }
226 else { 226 else {
227 if ( p->mToolBarUpV ) 227 if ( p->mToolBarUpV )
228 tbd = Right; 228 tbd = Right;
229 else 229 else
230 tbd = Left; 230 tbd = Left;
231 } 231 }
232 viewToolBar = new QPEToolBar( this ); 232 viewToolBar = new QPEToolBar( this );
233 addToolBar (viewToolBar , tbd ); 233 addToolBar (viewToolBar , tbd );
234 if ( p->mToolBarHorN ) { 234 if ( p->mToolBarHorN ) {
235 if ( p->mToolBarUpN ) 235 if ( p->mToolBarUpN )
236 tbd = Bottom; 236 tbd = Bottom;
237 else 237 else
238 tbd = Top; 238 tbd = Top;
239 } 239 }
240 else { 240 else {
241 if ( p->mToolBarUpN ) 241 if ( p->mToolBarUpN )
242 tbd = Right; 242 tbd = Right;
243 else 243 else
244 tbd = Left; 244 tbd = Left;
245 } 245 }
246 navigatorToolBar = new QPEToolBar( this ); 246 navigatorToolBar = new QPEToolBar( this );
247 addToolBar (navigatorToolBar , tbd ); 247 addToolBar (navigatorToolBar , tbd );
248 } 248 }
249 249
250 250
251 251
252 mCalendarModifiedFlag = false; 252 mCalendarModifiedFlag = false;
253 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 253 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
254 splash->setAlignment ( AlignCenter ); 254 splash->setAlignment ( AlignCenter );
255 setCentralWidget( splash ); 255 setCentralWidget( splash );
256#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
257 showMaximized(); 257 showMaximized();
258#endif 258#endif
259 259
260 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 260 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
261 setDefaultPreferences(); 261 setDefaultPreferences();
262 mCalendar = new CalendarLocal(); 262 mCalendar = new CalendarLocal();
263 mView = new CalendarView( mCalendar, this,"mCalendar " ); 263 mView = new CalendarView( mCalendar, this,"mCalendar " );
264 mView->hide(); 264 mView->hide();
265 //mView->resize(splash->size() ); 265 //mView->resize(splash->size() );
266 initActions(); 266 initActions();
267 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 267 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
268 mSyncManager->setBlockSave(false); 268 mSyncManager->setBlockSave(false);
269 mView->setSyncManager(mSyncManager); 269 mView->setSyncManager(mSyncManager);
270#ifndef DESKTOP_VERSION 270#ifndef DESKTOP_VERSION
271 iconToolBar->show(); 271 iconToolBar->show();
272 qApp->processEvents(); 272 qApp->processEvents();
273#endif 273#endif
274 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 274 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
275 int vh = height() ; 275 int vh = height() ;
276 int vw = width(); 276 int vw = width();
277 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 277 //qDebug("Toolbar hei %d ",iconToolBar->height() );
278 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 278 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
279 vh -= iconToolBar->height(); 279 vh -= iconToolBar->height();
280 } else { 280 } else {
281 vw -= iconToolBar->height(); 281 vw -= iconToolBar->height();
282 } 282 }
283 //mView->setMaximumSize( splash->size() ); 283 //mView->setMaximumSize( splash->size() );
284 //mView->resize( splash->size() ); 284 //mView->resize( splash->size() );
285 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 285 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
286 mView->readSettings(); 286 mView->readSettings();
@@ -1187,194 +1187,196 @@ void MainWindow::initActions()
1187 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1187 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1188 connect( action, SIGNAL( activated() ), 1188 connect( action, SIGNAL( activated() ),
1189 mView, SLOT( goPrevious() ) ); 1189 mView, SLOT( goPrevious() ) );
1190 action->addTo( navigatorToolBar ); 1190 action->addTo( navigatorToolBar );
1191 } 1191 }
1192 icon = loadPixmap( pathString + "today" ); 1192 icon = loadPixmap( pathString + "today" );
1193 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1193 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1194 if (p-> mShowIconToday) 1194 if (p-> mShowIconToday)
1195 today_action->addTo( navigatorToolBar ); 1195 today_action->addTo( navigatorToolBar );
1196 icon = loadPixmap( pathString + "1rightarrowB" ); 1196 icon = loadPixmap( pathString + "1rightarrowB" );
1197 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1197 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1198 if (p-> mShowIconForward) { 1198 if (p-> mShowIconForward) {
1199 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1199 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1200 connect( action, SIGNAL( activated() ), 1200 connect( action, SIGNAL( activated() ),
1201 mView, SLOT( goNext() ) ); 1201 mView, SLOT( goNext() ) );
1202 action->addTo( navigatorToolBar ); 1202 action->addTo( navigatorToolBar );
1203 } 1203 }
1204 icon = loadPixmap( pathString + "2rightarrowB" ); 1204 icon = loadPixmap( pathString + "2rightarrowB" );
1205 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1205 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1206 if (p-> mShowIconForwardFast) { 1206 if (p-> mShowIconForwardFast) {
1207 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1207 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1208 connect( action, SIGNAL( activated() ), 1208 connect( action, SIGNAL( activated() ),
1209 mView, SLOT( goNextMonth() ) ); 1209 mView, SLOT( goNextMonth() ) );
1210 action->addTo( navigatorToolBar ); 1210 action->addTo( navigatorToolBar );
1211 } 1211 }
1212 1212
1213 1213
1214 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1214 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1215 1215
1216 1216
1217 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1217 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1218 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1218 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1219 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1219 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1220 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1220 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1221 1221
1222 if (p-> mShowIconNewEvent) 1222 if (p-> mShowIconNewEvent)
1223 configureToolBarMenu->setItemChecked( 10, true ); 1223 configureToolBarMenu->setItemChecked( 10, true );
1224 if (p->mShowIconNewTodo ) 1224 if (p->mShowIconNewTodo )
1225 configureToolBarMenu->setItemChecked( 20, true ); 1225 configureToolBarMenu->setItemChecked( 20, true );
1226 if (p-> mShowIconSearch) 1226 if (p-> mShowIconSearch)
1227 configureToolBarMenu->setItemChecked( 120, true ); 1227 configureToolBarMenu->setItemChecked( 120, true );
1228 if (p-> mShowIconList) 1228 if (p-> mShowIconList)
1229 configureToolBarMenu->setItemChecked( 30, true ); 1229 configureToolBarMenu->setItemChecked( 30, true );
1230 if (p-> mShowIconDay1) 1230 if (p-> mShowIconDay1)
1231 configureToolBarMenu->setItemChecked( 40, true ); 1231 configureToolBarMenu->setItemChecked( 40, true );
1232 if (p-> mShowIconDay5) 1232 if (p-> mShowIconDay5)
1233 configureToolBarMenu->setItemChecked( 50, true ); 1233 configureToolBarMenu->setItemChecked( 50, true );
1234 if (p-> mShowIconDay6) 1234 if (p-> mShowIconDay6)
1235 configureToolBarMenu->setItemChecked( 75, true ); 1235 configureToolBarMenu->setItemChecked( 75, true );
1236 if (p-> mShowIconDay7) 1236 if (p-> mShowIconDay7)
1237 configureToolBarMenu->setItemChecked( 60, true ); 1237 configureToolBarMenu->setItemChecked( 60, true );
1238 if (p-> mShowIconMonth) 1238 if (p-> mShowIconMonth)
1239 configureToolBarMenu->setItemChecked( 70, true ); 1239 configureToolBarMenu->setItemChecked( 70, true );
1240 if (p-> mShowIconTodoview) 1240 if (p-> mShowIconTodoview)
1241 configureToolBarMenu->setItemChecked( 80, true ); 1241 configureToolBarMenu->setItemChecked( 80, true );
1242 if (p-> mShowIconBackFast) 1242 if (p-> mShowIconBackFast)
1243 configureToolBarMenu->setItemChecked( 200, true ); 1243 configureToolBarMenu->setItemChecked( 200, true );
1244 if (p-> mShowIconBack) 1244 if (p-> mShowIconBack)
1245 configureToolBarMenu->setItemChecked( 210, true ); 1245 configureToolBarMenu->setItemChecked( 210, true );
1246 if (p-> mShowIconToday) 1246 if (p-> mShowIconToday)
1247 configureToolBarMenu->setItemChecked( 130, true ); 1247 configureToolBarMenu->setItemChecked( 130, true );
1248 if (p-> mShowIconForward) 1248 if (p-> mShowIconForward)
1249 configureToolBarMenu->setItemChecked( 220, true ); 1249 configureToolBarMenu->setItemChecked( 220, true );
1250 if (p-> mShowIconForwardFast) 1250 if (p-> mShowIconForwardFast)
1251 configureToolBarMenu->setItemChecked( 230, true ); 1251 configureToolBarMenu->setItemChecked( 230, true );
1252 if (p-> mShowIconNextDays) 1252 if (p-> mShowIconNextDays)
1253 configureToolBarMenu->setItemChecked( 100, true ); 1253 configureToolBarMenu->setItemChecked( 100, true );
1254 if (p-> mShowIconNext) 1254 if (p-> mShowIconNext)
1255 configureToolBarMenu->setItemChecked( 110, true ); 1255 configureToolBarMenu->setItemChecked( 110, true );
1256 if (p-> mShowIconJournal) 1256 if (p-> mShowIconJournal)
1257 configureToolBarMenu->setItemChecked( 90, true ); 1257 configureToolBarMenu->setItemChecked( 90, true );
1258 if (p-> mShowIconWhatsThis) 1258 if (p-> mShowIconWhatsThis)
1259 configureToolBarMenu->setItemChecked( 300, true ); 1259 configureToolBarMenu->setItemChecked( 300, true );
1260 if (p-> mShowIconWeekNum) 1260 if (p-> mShowIconWeekNum)
1261 configureToolBarMenu->setItemChecked( 400, true ); 1261 configureToolBarMenu->setItemChecked( 400, true );
1262 if (!p-> mShowIconStretch) { 1262 if (!p-> mShowIconStretch) {
1263 QLabel* dummy = new QLabel( iconToolBar ); 1263 QLabel* dummy = new QLabel( iconToolBar );
1264 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1264 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1265 dummy->setMinimumWidth( 0 ); 1265 dummy->setMinimumWidth( 0 );
1266 iconToolBar->setStretchableWidget ( dummy ) ; 1266 iconToolBar->setStretchableWidget ( dummy ) ;
1267 } 1267 }
1268 else { 1268 else {
1269 iconToolBar->setHorizontalStretchable (true ); 1269 iconToolBar->setHorizontalStretchable (true );
1270 viewToolBar->setHorizontalStretchable (true ); 1270 viewToolBar->setHorizontalStretchable (true );
1271 navigatorToolBar->setHorizontalStretchable (true ); 1271 navigatorToolBar->setHorizontalStretchable (true );
1272 iconToolBar->setVerticalStretchable (true ); 1272 iconToolBar->setVerticalStretchable (true );
1273 viewToolBar->setVerticalStretchable (true ); 1273 viewToolBar->setVerticalStretchable (true );
1274 navigatorToolBar->setVerticalStretchable (true ); 1274 navigatorToolBar->setVerticalStretchable (true );
1275 configureToolBarMenu->setItemChecked( 5, true ); 1275 configureToolBarMenu->setItemChecked( 5, true );
1276 } 1276 }
1277 if (p-> mShowIconFilter) 1277 if (p-> mShowIconFilter)
1278 configureToolBarMenu->setItemChecked( 7, true ); 1278 configureToolBarMenu->setItemChecked( 7, true );
1279 if (p-> mShowIconOnetoolbar) 1279 if (p-> mShowIconOnetoolbar)
1280 configureToolBarMenu->setItemChecked( 6, true ); 1280 configureToolBarMenu->setItemChecked( 6, true );
1281 1281
1282 1282
1283 if ( filterMenubar ) 1283 if ( filterMenubar ) {
1284 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1284 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1285 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1286 }
1285 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1287 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1286 configureAgenda( p->mHourSize ); 1288 configureAgenda( p->mHourSize );
1287 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1289 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1288} 1290}
1289 1291
1290void MainWindow::exportToPhone( int mode ) 1292void MainWindow::exportToPhone( int mode )
1291{ 1293{
1292 1294
1293 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1295 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1294 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1296 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1295 KOex2phonePrefs ex2phone; 1297 KOex2phonePrefs ex2phone;
1296 1298
1297 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1299 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1298 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1300 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1299 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1301 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1300 if ( mode == 1 ) 1302 if ( mode == 1 )
1301 ex2phone.setCaption(i18n("Export complete calendar")); 1303 ex2phone.setCaption(i18n("Export complete calendar"));
1302 if ( mode == 2 ) 1304 if ( mode == 2 )
1303 ex2phone.setCaption(i18n("Export filtered calendar")); 1305 ex2phone.setCaption(i18n("Export filtered calendar"));
1304 1306
1305 if ( !ex2phone.exec() ) { 1307 if ( !ex2phone.exec() ) {
1306 return; 1308 return;
1307 } 1309 }
1308 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1310 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1309 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1311 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1310 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1312 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1311 1313
1312 int inFuture = 0; 1314 int inFuture = 0;
1313 if ( ex2phone.mWriteBackFuture->isChecked() ) 1315 if ( ex2phone.mWriteBackFuture->isChecked() )
1314 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1316 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1315 QPtrList<Incidence> delSel; 1317 QPtrList<Incidence> delSel;
1316 if ( mode == 1 ) 1318 if ( mode == 1 )
1317 delSel = mCalendar->rawIncidences(); 1319 delSel = mCalendar->rawIncidences();
1318 if ( mode == 2 ) 1320 if ( mode == 2 )
1319 delSel = mCalendar->incidences(); 1321 delSel = mCalendar->incidences();
1320 CalendarLocal* cal = new CalendarLocal(); 1322 CalendarLocal* cal = new CalendarLocal();
1321 cal->setLocalTime(); 1323 cal->setLocalTime();
1322 Incidence *incidence = delSel.first(); 1324 Incidence *incidence = delSel.first();
1323 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1325 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1324 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1326 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1325 while ( incidence ) { 1327 while ( incidence ) {
1326 if ( incidence->type() != "Journal" ) { 1328 if ( incidence->type() != "Journal" ) {
1327 bool add = true; 1329 bool add = true;
1328 if ( inFuture ) { 1330 if ( inFuture ) {
1329 QDateTime dt; 1331 QDateTime dt;
1330 if ( incidence->type() == "Todo" ) { 1332 if ( incidence->type() == "Todo" ) {
1331 Todo * t = (Todo*)incidence; 1333 Todo * t = (Todo*)incidence;
1332 if ( t->hasDueDate() ) 1334 if ( t->hasDueDate() )
1333 dt = t->dtDue(); 1335 dt = t->dtDue();
1334 else 1336 else
1335 dt = cur.addSecs( 62 ); 1337 dt = cur.addSecs( 62 );
1336 } 1338 }
1337 else { 1339 else {
1338 bool ok; 1340 bool ok;
1339 dt = incidence->getNextOccurence( cur, &ok ); 1341 dt = incidence->getNextOccurence( cur, &ok );
1340 if ( !ok ) 1342 if ( !ok )
1341 dt = cur.addSecs( -62 ); 1343 dt = cur.addSecs( -62 );
1342 } 1344 }
1343 if ( dt < cur || dt > end ) { 1345 if ( dt < cur || dt > end ) {
1344 add = false; 1346 add = false;
1345 } 1347 }
1346 } 1348 }
1347 if ( add ) { 1349 if ( add ) {
1348 Incidence *in = incidence->clone(); 1350 Incidence *in = incidence->clone();
1349 cal->addIncidence( in ); 1351 cal->addIncidence( in );
1350 } 1352 }
1351 } 1353 }
1352 incidence = delSel.next(); 1354 incidence = delSel.next();
1353 } 1355 }
1354 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1356 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1355 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1357 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1356 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1358 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1357 1359
1358 setCaption( i18n("Writing to phone...")); 1360 setCaption( i18n("Writing to phone..."));
1359 if ( PhoneFormat::writeToPhone( cal ) ) 1361 if ( PhoneFormat::writeToPhone( cal ) )
1360 setCaption( i18n("Export to phone successful!")); 1362 setCaption( i18n("Export to phone successful!"));
1361 else 1363 else
1362 setCaption( i18n("Error exporting to phone!")); 1364 setCaption( i18n("Error exporting to phone!"));
1363 delete cal; 1365 delete cal;
1364} 1366}
1365 1367
1366 1368
1367void MainWindow::setDefaultPreferences() 1369void MainWindow::setDefaultPreferences()
1368{ 1370{
1369 KOPrefs *p = KOPrefs::instance(); 1371 KOPrefs *p = KOPrefs::instance();
1370 1372
1371 p->mCompactDialogs = true; 1373 p->mCompactDialogs = true;
1372 p->mConfirm = true; 1374 p->mConfirm = true;
1373 // p->mEnableQuickTodo = false; 1375 // p->mEnableQuickTodo = false;
1374 1376
1375} 1377}
1376 1378
1377QString MainWindow::resourcePath() 1379QString MainWindow::resourcePath()
1378{ 1380{
1379 return KGlobal::iconLoader()->iconPath(); 1381 return KGlobal::iconLoader()->iconPath();
1380} 1382}