summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-01 14:47:16 (UTC)
committer zautrix <zautrix>2005-07-01 14:47:16 (UTC)
commitf330b9d0a7f755660ddd59739e3ab9b98d60bc18 (patch) (unidiff)
treec29630a799dc39906e57ba1d23cba6861f1cc0bb /korganizer
parenteee2e65aebe1c93a0c391a927b86ce87a278a4df (diff)
downloadkdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.zip
kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.tar.gz
kdepimpi-f330b9d0a7f755660ddd59739e3ab9b98d60bc18.tar.bz2
fixii
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp20
-rw-r--r--korganizer/koeditordetails.cpp2
-rw-r--r--korganizer/koeditorgeneral.cpp9
-rw-r--r--korganizer/koeditorgeneralevent.cpp5
-rw-r--r--korganizer/koeditorgeneraltodo.cpp2
-rw-r--r--korganizer/koeventeditor.cpp6
-rw-r--r--korganizer/koincidenceeditor.cpp2
-rw-r--r--korganizer/kotodoeditor.cpp4
8 files changed, 40 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index c0f3be7..fd026fa 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -591,192 +591,206 @@ void CalendarView::init()
591 591
592 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 592 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
593 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 593 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
594 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 594 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
595 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 595 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
596 596
597 597
598 598
599 599
600 600
601 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 601 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
602 SLOT(checkClipboard())); 602 SLOT(checkClipboard()));
603 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 603 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
604 SLOT( processTodoListSelection( Incidence * ) ) ); 604 SLOT( processTodoListSelection( Incidence * ) ) );
605 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 605 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
606 606
607 // kdDebug() << "CalendarView::CalendarView() done" << endl; 607 // kdDebug() << "CalendarView::CalendarView() done" << endl;
608 608
609 mDateFrame = new QVBox(0,0,WType_Popup); 609 mDateFrame = new QVBox(0,0,WType_Popup);
610 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 610 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
611 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 611 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
612 mDateFrame->setLineWidth(3); 612 mDateFrame->setLineWidth(3);
613 mDateFrame->hide(); 613 mDateFrame->hide();
614 mDateFrame->setCaption( i18n( "Pick a date to display")); 614 mDateFrame->setCaption( i18n( "Pick a date to display"));
615 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 615 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
616 616
617 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 617 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
618 618
619 mEventEditor = mDialogManager->getEventEditor(); 619 mEventEditor = mDialogManager->getEventEditor();
620 mTodoEditor = mDialogManager->getTodoEditor(); 620 mTodoEditor = mDialogManager->getTodoEditor();
621 621
622 mFlagEditDescription = false; 622 mFlagEditDescription = false;
623 623
624 mSuspendTimer = new QTimer( this ); 624 mSuspendTimer = new QTimer( this );
625 mAlarmTimer = new QTimer( this ); 625 mAlarmTimer = new QTimer( this );
626 mRecheckAlarmTimer = new QTimer( this ); 626 mRecheckAlarmTimer = new QTimer( this );
627 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 627 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
628 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 628 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
629 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 629 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
630 mAlarmDialog = new AlarmDialog( this ); 630 mAlarmDialog = new AlarmDialog( this );
631 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 631 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
632 mAlarmDialog->setServerNotification( false ); 632 mAlarmDialog->setServerNotification( false );
633 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 633 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
634 634
635 635
636#ifndef DESKTOP_VERSION 636#ifndef DESKTOP_VERSION
637//US listen for arriving address resultsets 637//US listen for arriving address resultsets
638 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 638 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
639 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 639 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
640#endif 640#endif
641 mDateNavigator->setCalendar( mCalendar ); 641 mDateNavigator->setCalendar( mCalendar );
642} 642}
643 643
644 644
645CalendarView::~CalendarView() 645CalendarView::~CalendarView()
646{ 646{
647 // kdDebug() << "~CalendarView()" << endl; 647 // kdDebug() << "~CalendarView()" << endl;
648 //qDebug("CalendarView::~CalendarView() "); 648 //qDebug("CalendarView::~CalendarView() ");
649 delete mDialogManager; 649 delete mDialogManager;
650 delete mViewManager; 650 delete mViewManager;
651 delete mStorage; 651 delete mStorage;
652 delete mDateFrame ; 652 delete mDateFrame ;
653 delete mEventViewerDialog; 653 delete mEventViewerDialog;
654 //kdDebug() << "~CalendarView() done" << endl; 654 //kdDebug() << "~CalendarView() done" << endl;
655} 655}
656void CalendarView::setScrollBarStep(int val ) 656void CalendarView::setScrollBarStep(int val )
657{ 657{
658#ifdef DESKTOP_VERSION 658#ifdef DESKTOP_VERSION
659 mDateScrollBar->setLineStep ( val ); 659 mDateScrollBar->setLineStep ( val );
660#endif 660#endif
661} 661}
662void CalendarView::scrollBarValue(int val ) 662void CalendarView::scrollBarValue(int val )
663{ 663{
664#ifdef DESKTOP_VERSION 664#ifdef DESKTOP_VERSION
665 if ( QApplication::desktop()->width() < 800 ) return; 665 if ( QApplication::desktop()->width() < 800 ) return;
666 static bool block = false; 666 static bool block = false;
667 if ( block ) return; 667 if ( block ) return;
668 block = true; 668 block = true;
669 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 669 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
670 //qDebug("VAL %d ",val ); 670 //qDebug("VAL %d ",val );
671 int count = mNavigator->selectedDates().count(); 671 int count = mNavigator->selectedDates().count();
672 int year = mNavigator->selectedDates().first().year(); 672 int year = mNavigator->selectedDates().first().year();
673 int day = mNavigator->selectedDates().first().dayOfYear(); 673 int day = mNavigator->selectedDates().first().dayOfYear();
674 if ( val == day -1 ) { 674 if ( val == day -1 ) {
675 block = false; 675 block = false;
676 return; 676 return;
677 } 677 }
678 QDate d ( year,1,1 ); 678 QDate d ( year,1,1 );
679 mNavigator->selectDates( d.addDays( val ), count ); 679 mNavigator->selectDates( d.addDays( val ), count );
680 block = false; 680 block = false;
681#endif 681#endif
682 682
683} 683}
684 684
685void CalendarView::checkAlarms() 685void CalendarView::checkAlarms()
686{ 686{
687
688 QString message;
689 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
690 KopiCalendarFile * cal = calendars.first();
691 while ( cal ) {
692 if ( cal->mErrorOnLoad ) {
693 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
694 }
695 cal = calendars.next();
696 }
697 if ( !message.isEmpty() ) {
698 message = KGlobal::formatMessage( i18n("The loading of one or more calendar failed:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0);
699 KMessageBox::error(this,message);
700 }
687 KConfig *config = KOGlobals::config(); 701 KConfig *config = KOGlobals::config();
688 config->setGroup( "AppRun" ); 702 config->setGroup( "AppRun" );
689 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 703 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
690 int daysto = dt.daysTo( QDate::currentDate() ); 704 int daysto = dt.daysTo( QDate::currentDate() );
691 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 705 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
692 dt = dt.addDays( days ); 706 dt = dt.addDays( days );
693 int secto = dt.secsTo( QDateTime::currentDateTime() ); 707 int secto = dt.secsTo( QDateTime::currentDateTime() );
694 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 708 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
695 //qDebug("KO: Reading program stop %d ", secs); 709 //qDebug("KO: Reading program stop %d ", secs);
696 //secs -= ( 3600 * 24*3 ); // debug only 710 //secs -= ( 3600 * 24*3 ); // debug only
697 QDateTime latest = dt.addSecs ( secs ); 711 QDateTime latest = dt.addSecs ( secs );
698 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 712 qDebug("KO: Last termination on %s ", latest.toString().latin1());
699 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 713 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
700 QPtrList<Incidence> el = mCalendar->rawIncidences(); 714 QPtrList<Incidence> el = mCalendar->rawIncidences();
701 QPtrList<Incidence> al; 715 QPtrList<Incidence> al;
702 Incidence* inL = el.first(); 716 Incidence* inL = el.first();
703 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 717 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
704 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 718 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
705 while ( inL ) { 719 while ( inL ) {
706 bool ok = false; 720 bool ok = false;
707 int offset = 0; 721 int offset = 0;
708 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 722 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
709 if ( ok ) { 723 if ( ok ) {
710 //qDebug("OK %s",next.toString().latin1()); 724 //qDebug("OK %s",next.toString().latin1());
711 if ( next < cur ) { 725 if ( next < cur ) {
712 al.append( inL ); 726 al.append( inL );
713 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 727 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
714 } 728 }
715 } 729 }
716 inL = el.next(); 730 inL = el.next();
717 } 731 }
718 if ( al.count() ) { 732 if ( al.count() ) {
719 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 733 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
720 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 734 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
721 QVBoxLayout* lay = new QVBoxLayout( dia ); 735 QVBoxLayout* lay = new QVBoxLayout( dia );
722 lay->setSpacing( 0 ); 736 lay->setSpacing( 0 );
723 lay->setMargin( 0 ); 737 lay->setMargin( 0 );
724 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 738 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
725 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 739 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
726 lay->addWidget( matb ); 740 lay->addWidget( matb );
727 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 741 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
728 int wid = 210; 742 int wid = 210;
729 int x = QApplication::desktop()->width() - wid - 7; 743 int x = QApplication::desktop()->width() - wid - 7;
730 int y = QApplication::desktop()->height() - wid - 70; 744 int y = QApplication::desktop()->height() - wid - 70;
731 dia->setGeometry ( x,y,wid,wid); 745 dia->setGeometry ( x,y,wid,wid);
732 } else { 746 } else {
733 int si = 220; 747 int si = 220;
734 if ( QApplication::desktop()->width() > 470 ) 748 if ( QApplication::desktop()->width() > 470 )
735 si = 400; 749 si = 400;
736 dia->resize(si,si/2); 750 dia->resize(si,si/2);
737 } 751 }
738 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 752 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
739 dia->show(); 753 dia->show();
740 754
741 } 755 }
742} 756}
743void CalendarView::showDay( QDate d ) 757void CalendarView::showDay( QDate d )
744{ 758{
745 dateNavigator()->blockSignals( true ); 759 dateNavigator()->blockSignals( true );
746 dateNavigator()->selectDate( d ); 760 dateNavigator()->selectDate( d );
747 dateNavigator()->blockSignals( false ); 761 dateNavigator()->blockSignals( false );
748 mViewManager->showDayView(); 762 mViewManager->showDayView();
749 //dateNavigator()->selectDate( d ); 763 //dateNavigator()->selectDate( d );
750} 764}
751void CalendarView::timerAlarm() 765void CalendarView::timerAlarm()
752{ 766{
753 //qDebug("CalendarView::timerAlarm() "); 767 //qDebug("CalendarView::timerAlarm() ");
754 computeAlarm(mAlarmNotification ); 768 computeAlarm(mAlarmNotification );
755} 769}
756 770
757void CalendarView::suspendAlarm() 771void CalendarView::suspendAlarm()
758{ 772{
759 //qDebug(" CalendarView::suspendAlarm() "); 773 //qDebug(" CalendarView::suspendAlarm() ");
760 computeAlarm(mSuspendAlarmNotification ); 774 computeAlarm(mSuspendAlarmNotification );
761 775
762} 776}
763 777
764void CalendarView::startAlarm( QString mess , QString filename) 778void CalendarView::startAlarm( QString mess , QString filename)
765{ 779{
766 780
767 topLevelWidget()->showNormal(); 781 topLevelWidget()->showNormal();
768 topLevelWidget()->setActiveWindow(); 782 topLevelWidget()->setActiveWindow();
769 topLevelWidget()->raise(); 783 topLevelWidget()->raise();
770 784
771 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 785 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
772 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 786 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
773 787
774} 788}
775 789
776void CalendarView::checkNextTimerAlarm() 790void CalendarView::checkNextTimerAlarm()
777{ 791{
778 mCalendar->checkAlarmForIncidence( 0, true ); 792 mCalendar->checkAlarmForIncidence( 0, true );
779} 793}
780 794
781void CalendarView::computeAlarm( QString msg ) 795void CalendarView::computeAlarm( QString msg )
782{ 796{
@@ -1830,203 +1844,203 @@ bool CalendarView::importQtopia( const QString &categories,
1830 1844
1831 QtopiaFormat qtopiaFormat; 1845 QtopiaFormat qtopiaFormat;
1832 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1846 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1833 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1847 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1834 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1848 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1835 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1849 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1836 1850
1837 updateView(); 1851 updateView();
1838 return true; 1852 return true;
1839 1853
1840#if 0 1854#if 0
1841 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1855 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1842 mCurrentSyncDevice = "qtopia-XML"; 1856 mCurrentSyncDevice = "qtopia-XML";
1843 if ( mSyncManager->mAskForPreferences ) 1857 if ( mSyncManager->mAskForPreferences )
1844 edit_sync_options(); 1858 edit_sync_options();
1845 qApp->processEvents(); 1859 qApp->processEvents();
1846 CalendarLocal* calendar = new CalendarLocal(); 1860 CalendarLocal* calendar = new CalendarLocal();
1847 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1861 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1848 bool syncOK = false; 1862 bool syncOK = false;
1849 QtopiaFormat qtopiaFormat; 1863 QtopiaFormat qtopiaFormat;
1850 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1864 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1851 bool loadOk = true; 1865 bool loadOk = true;
1852 if ( !categories.isEmpty() ) 1866 if ( !categories.isEmpty() )
1853 loadOk = qtopiaFormat.load( calendar, categories ); 1867 loadOk = qtopiaFormat.load( calendar, categories );
1854 if ( loadOk && !datebook.isEmpty() ) 1868 if ( loadOk && !datebook.isEmpty() )
1855 loadOk = qtopiaFormat.load( calendar, datebook ); 1869 loadOk = qtopiaFormat.load( calendar, datebook );
1856 if ( loadOk && !todolist.isEmpty() ) 1870 if ( loadOk && !todolist.isEmpty() )
1857 loadOk = qtopiaFormat.load( calendar, todolist ); 1871 loadOk = qtopiaFormat.load( calendar, todolist );
1858 1872
1859 if ( loadOk ) { 1873 if ( loadOk ) {
1860 getEventViewerDialog()->setSyncMode( true ); 1874 getEventViewerDialog()->setSyncMode( true );
1861 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1875 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1862 getEventViewerDialog()->setSyncMode( false ); 1876 getEventViewerDialog()->setSyncMode( false );
1863 qApp->processEvents(); 1877 qApp->processEvents();
1864 if ( syncOK ) { 1878 if ( syncOK ) {
1865 if ( mSyncManager->mWriteBackFile ) 1879 if ( mSyncManager->mWriteBackFile )
1866 { 1880 {
1867 // write back XML file 1881 // write back XML file
1868 1882
1869 } 1883 }
1870 setModified( true ); 1884 setModified( true );
1871 } 1885 }
1872 } else { 1886 } else {
1873 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1887 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1874 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1888 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1875 question, i18n("Ok")) ; 1889 question, i18n("Ok")) ;
1876 } 1890 }
1877 delete calendar; 1891 delete calendar;
1878 updateView(); 1892 updateView();
1879 return syncOK; 1893 return syncOK;
1880 1894
1881 1895
1882#endif 1896#endif
1883 1897
1884} 1898}
1885 1899
1886void CalendarView::setSyncEventsReadOnly() 1900void CalendarView::setSyncEventsReadOnly()
1887{ 1901{
1888 mCalendar->setSyncEventsReadOnly(); 1902 mCalendar->setSyncEventsReadOnly();
1889} 1903}
1890 1904
1891bool CalendarView::loadCalendars() 1905bool CalendarView::loadCalendars()
1892{ 1906{
1893 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1907 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1894 KopiCalendarFile * cal = calendars.first(); 1908 KopiCalendarFile * cal = calendars.first();
1895 mCalendar->setDefaultCalendar( 1 ); 1909 mCalendar->setDefaultCalendar( 1 );
1896 openCalendar( MainWindow::defaultFileName(), false ); 1910 openCalendar( MainWindow::defaultFileName(), false );
1897 cal = calendars.next(); 1911 cal = calendars.next();
1898 while ( cal ) { 1912 while ( cal ) {
1899 addCalendar( cal ); 1913 addCalendar( cal );
1900 cal = calendars.next(); 1914 cal = calendars.next();
1901 } 1915 }
1902 restoreCalendarSettings(); 1916 restoreCalendarSettings();
1903 return true; 1917 return true;
1904} 1918}
1905bool CalendarView::restoreCalendarSettings() 1919bool CalendarView::restoreCalendarSettings()
1906{ 1920{
1907 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1921 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1908 KopiCalendarFile * cal = calendars.first(); 1922 KopiCalendarFile * cal = calendars.first();
1909 while ( cal ) { 1923 while ( cal ) {
1910 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 1924 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
1911 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 1925 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
1912 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 1926 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
1913 if ( cal->isStandard ) 1927 if ( cal->isStandard )
1914 mCalendar->setDefaultCalendar( cal->mCalNumber ); 1928 mCalendar->setDefaultCalendar( cal->mCalNumber );
1915 cal = calendars.next(); 1929 cal = calendars.next();
1916 } 1930 }
1917 setSyncEventsReadOnly(); 1931 setSyncEventsReadOnly();
1918 mCalendar->reInitAlarmSettings(); 1932 mCalendar->reInitAlarmSettings();
1919 updateUnmanagedViews(); 1933 updateUnmanagedViews();
1920 updateView(); 1934 updateView();
1921 return true; 1935 return true;
1922} 1936}
1923void CalendarView::addCalendarId( int id ) 1937void CalendarView::addCalendarId( int id )
1924{ 1938{
1925 KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id ); 1939 KopiCalendarFile * cal = KOPrefs::instance()->getCalendar( id );
1926 addCalendar( cal ); 1940 if ( cal )
1941 addCalendar( cal );
1927} 1942}
1928bool CalendarView::addCalendar( KopiCalendarFile * cal ) 1943bool CalendarView::addCalendar( KopiCalendarFile * cal )
1929{ 1944{
1930 cal->mErrorOnLoad = false; 1945 cal->mErrorOnLoad = false;
1931 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) { 1946 if ( mCalendar->addCalendarFile( cal->mFileName, cal->mCalNumber )) {
1932 cal->mLoadDt = QDateTime::currentDateTime(); 1947 cal->mLoadDt = QDateTime::currentDateTime();
1933 return true; 1948 return true;
1934 } 1949 }
1935 qDebug("KO: Error adding calendar file %1 ",cal->mFileName.latin1() ); 1950 qDebug("KO: Error adding calendar file %s ",cal->mFileName.latin1() );
1936 KMessageBox::error(this,i18n("Error loading calendar file\n%1.").arg(cal->mFileName));
1937 cal->mErrorOnLoad = true; 1951 cal->mErrorOnLoad = true;
1938 return false; 1952 return false;
1939} 1953}
1940bool CalendarView::openCalendar(QString filename, bool merge) 1954bool CalendarView::openCalendar(QString filename, bool merge)
1941{ 1955{
1942 1956
1943 if (filename.isEmpty()) { 1957 if (filename.isEmpty()) {
1944 return false; 1958 return false;
1945 } 1959 }
1946 1960
1947 if (!QFile::exists(filename)) { 1961 if (!QFile::exists(filename)) {
1948 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1962 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1949 return false; 1963 return false;
1950 } 1964 }
1951 1965
1952 globalFlagBlockAgenda = 1; 1966 globalFlagBlockAgenda = 1;
1953 clearAllViews(); 1967 clearAllViews();
1954 if (!merge) { 1968 if (!merge) {
1955 mViewManager->setDocumentId( filename ); 1969 mViewManager->setDocumentId( filename );
1956 mCalendar->close(); 1970 mCalendar->close();
1957 } 1971 }
1958 mStorage->setFileName( filename ); 1972 mStorage->setFileName( filename );
1959 1973
1960 if ( mStorage->load() ) { 1974 if ( mStorage->load() ) {
1961 if ( merge ) ;//setModified( true ); 1975 if ( merge ) ;//setModified( true );
1962 else { 1976 else {
1963 //setModified( true ); 1977 //setModified( true );
1964 mViewManager->setDocumentId( filename ); 1978 mViewManager->setDocumentId( filename );
1965 mDialogManager->setDocumentId( filename ); 1979 mDialogManager->setDocumentId( filename );
1966 mTodoList->setDocumentId( filename ); 1980 mTodoList->setDocumentId( filename );
1967 } 1981 }
1968 globalFlagBlockAgenda = 2; 1982 globalFlagBlockAgenda = 2;
1969 // if ( getLastSyncEvent() ) 1983 // if ( getLastSyncEvent() )
1970 // getLastSyncEvent()->setReadOnly( true ); 1984 // getLastSyncEvent()->setReadOnly( true );
1971 mCalendar->reInitAlarmSettings(); 1985 mCalendar->reInitAlarmSettings();
1972 setSyncEventsReadOnly(); 1986 setSyncEventsReadOnly();
1973 updateUnmanagedViews(); 1987 updateUnmanagedViews();
1974 updateView(); 1988 updateView();
1975 if ( filename != MainWindow::defaultFileName() ) { 1989 if ( filename != MainWindow::defaultFileName() ) {
1976 saveCalendar( MainWindow::defaultFileName() ); 1990 saveCalendar( MainWindow::defaultFileName() );
1977 } else { 1991 } else {
1978 QFileInfo finf ( MainWindow::defaultFileName()); 1992 QFileInfo finf ( MainWindow::defaultFileName());
1979 if ( finf.exists() ) { 1993 if ( finf.exists() ) {
1980 setLoadedFileVersion( finf.lastModified () ); 1994 setLoadedFileVersion( finf.lastModified () );
1981 } 1995 }
1982 } 1996 }
1983 return true; 1997 return true;
1984 } else { 1998 } else {
1985 // while failing to load, the calendar object could 1999 // while failing to load, the calendar object could
1986 // have become partially populated. Clear it out. 2000 // have become partially populated. Clear it out.
1987 if ( !merge ) { 2001 if ( !merge ) {
1988 mCalendar->close(); 2002 mCalendar->close();
1989 mViewManager->setDocumentId( filename ); 2003 mViewManager->setDocumentId( filename );
1990 mDialogManager->setDocumentId( filename ); 2004 mDialogManager->setDocumentId( filename );
1991 mTodoList->setDocumentId( filename ); 2005 mTodoList->setDocumentId( filename );
1992 } 2006 }
1993 2007
1994 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 2008 //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1995 2009
1996 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); 2010 QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) );
1997 globalFlagBlockAgenda = 2; 2011 globalFlagBlockAgenda = 2;
1998 mCalendar->reInitAlarmSettings(); 2012 mCalendar->reInitAlarmSettings();
1999 setSyncEventsReadOnly(); 2013 setSyncEventsReadOnly();
2000 updateUnmanagedViews(); 2014 updateUnmanagedViews();
2001 updateView(); 2015 updateView();
2002 } 2016 }
2003 return false; 2017 return false;
2004} 2018}
2005void CalendarView::showOpenError() 2019void CalendarView::showOpenError()
2006{ 2020{
2007 KMessageBox::error(this,i18n("Couldn't load calendar\n.")); 2021 KMessageBox::error(this,i18n("Couldn't load calendar\n."));
2008} 2022}
2009void CalendarView::setLoadedFileVersion(QDateTime dt) 2023void CalendarView::setLoadedFileVersion(QDateTime dt)
2010{ 2024{
2011 loadedFileVersion = dt; 2025 loadedFileVersion = dt;
2012} 2026}
2013bool CalendarView::checkFileChanged(QString fn) 2027bool CalendarView::checkFileChanged(QString fn)
2014{ 2028{
2015 QFileInfo finf ( fn ); 2029 QFileInfo finf ( fn );
2016 if ( !finf.exists() ) 2030 if ( !finf.exists() )
2017 return true; 2031 return true;
2018 QDateTime dt = finf.lastModified (); 2032 QDateTime dt = finf.lastModified ();
2019 if ( dt <= loadedFileVersion ) 2033 if ( dt <= loadedFileVersion )
2020 return false; 2034 return false;
2021 return true; 2035 return true;
2022 2036
2023} 2037}
2024void CalendarView::watchSavedFile() 2038void CalendarView::watchSavedFile()
2025{ 2039{
2026 QFileInfo finf ( MainWindow::defaultFileName()); 2040 QFileInfo finf ( MainWindow::defaultFileName());
2027 if ( !finf.exists() ) 2041 if ( !finf.exists() )
2028 return; 2042 return;
2029 QDateTime dt = finf.lastModified (); 2043 QDateTime dt = finf.lastModified ();
2030 if ( dt < loadedFileVersion ) { 2044 if ( dt < loadedFileVersion ) {
2031 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); 2045 //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1());
2032 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); 2046 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 7354940..479bd8b 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -1,179 +1,181 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in thse hope that it will be useful, 10 This program is distributed in thse hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapp.h> 32#include <qapp.h>
33 33
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobal.h> 35#include <kglobal.h>
36#include <kdialog.h>
36#include <kiconloader.h> 37#include <kiconloader.h>
37#include <kstandarddirs.h> 38#include <kstandarddirs.h>
38#include <kmessagebox.h> 39#include <kmessagebox.h>
39#ifndef KORG_NOKABC 40#ifndef KORG_NOKABC
40 41
41#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
42#include <kabc/addresseedialog.h> 43#include <kabc/addresseedialog.h>
43#else //DESKTOP_VERSION 44#else //DESKTOP_VERSION
44#include <externalapphandler.h> 45#include <externalapphandler.h>
45#endif //DESKTOP_VERSION 46#endif //DESKTOP_VERSION
46 47
47#endif 48#endif
48 49
49#include <libkcal/incidence.h> 50#include <libkcal/incidence.h>
50 51
51#include "koprefs.h" 52#include "koprefs.h"
52 53
53#include "koeditordetails.h" 54#include "koeditordetails.h"
54 55
55template <> 56template <>
56CustomListViewItem<class Attendee *>::~CustomListViewItem() 57CustomListViewItem<class Attendee *>::~CustomListViewItem()
57{ 58{
58 delete mData; 59 delete mData;
59} 60}
60 61
61template <> 62template <>
62void CustomListViewItem<class Attendee *>::updateItem() 63void CustomListViewItem<class Attendee *>::updateItem()
63{ 64{
64 setText(0,mData->name()); 65 setText(0,mData->name());
65 setText(1,mData->email()); 66 setText(1,mData->email());
66 setText(2,mData->roleStr()); 67 setText(2,mData->roleStr());
67 setText(3,mData->statusStr()); 68 setText(3,mData->statusStr());
68 if (mData->RSVP() && !mData->email().isEmpty()) { 69 if (mData->RSVP() && !mData->email().isEmpty()) {
69 setPixmap(4,SmallIcon("mailappt")); 70 setPixmap(4,SmallIcon("mailappt"));
70 setSortKey(4,"j"); 71 setSortKey(4,"j");
71 } 72 }
72 else { 73 else {
73 setPixmap(4,SmallIcon("nomailappt")); 74 setPixmap(4,SmallIcon("nomailappt"));
74 setSortKey(4,"n"); 75 setSortKey(4,"n");
75 } 76 }
76} 77}
77 78
78 79
79KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name) 80KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
80 : QWidget( parent, name), mDisableItemUpdate( false ) 81 : QWidget( parent, name), mDisableItemUpdate( false )
81{ 82{
82 QGridLayout *topLayout = new QGridLayout(this); 83 QGridLayout *topLayout = new QGridLayout(this);
83 topLayout->setSpacing(spacing); 84 topLayout->setSpacing(spacing);
85 topLayout->setMargin(KDialog::marginHint()-2);
84 86
85 QString organizer = KOPrefs::instance()->email(); 87 QString organizer = KOPrefs::instance()->email();
86 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this); 88 mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
87 89
88 mListView = new KListView(this,"mListView"); 90 mListView = new KListView(this,"mListView");
89 mListView->addColumn(i18n("Name"),180); 91 mListView->addColumn(i18n("Name"),180);
90 mListView->addColumn(i18n("Email"),180); 92 mListView->addColumn(i18n("Email"),180);
91 mListView->addColumn(i18n("Role"),60); 93 mListView->addColumn(i18n("Role"),60);
92 mListView->addColumn(i18n("Status"),100); 94 mListView->addColumn(i18n("Status"),100);
93 mListView->addColumn(i18n("RSVP"),35); 95 mListView->addColumn(i18n("RSVP"),35);
94 if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) { 96 if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) {
95 int hei = 80; 97 int hei = 80;
96 if ( QApplication::desktop()->height() <= 240 ) 98 if ( QApplication::desktop()->height() <= 240 )
97 hei = 60; 99 hei = 60;
98 mListView->setFixedHeight(hei); 100 mListView->setFixedHeight(hei);
99 } 101 }
100 mListView->setAllColumnsShowFocus (true ); 102 mListView->setAllColumnsShowFocus (true );
101 //mListView->setSingleClick( true ); 103 //mListView->setSingleClick( true );
102 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)), 104 connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
103 SLOT(updateAttendeeInput())); 105 SLOT(updateAttendeeInput()));
104 106
105 connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )), 107 connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )),
106 SLOT(itemClicked(QListViewItem * ,const QPoint& , int ))); 108 SLOT(itemClicked(QListViewItem * ,const QPoint& , int )));
107 109
108 mRsvpButton = new QCheckBox(this); 110 mRsvpButton = new QCheckBox(this);
109 mRsvpButton->setText(i18n("Request response")); 111 mRsvpButton->setText(i18n("Request response"));
110 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this); 112 mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
111 QLabel *attendeeLabel = new QLabel(this); 113 QLabel *attendeeLabel = new QLabel(this);
112 attendeeLabel->setText(i18n("Name:")); 114 attendeeLabel->setText(i18n("Name:"));
113 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() ); 115 attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
114 mNameEdit = new QLineEdit(this); 116 mNameEdit = new QLineEdit(this);
115 connect(mNameEdit,SIGNAL(textChanged(const QString &)), 117 connect(mNameEdit,SIGNAL(textChanged(const QString &)),
116 SLOT(updateAttendeeItem())); 118 SLOT(updateAttendeeItem()));
117 119
118 mUidEdit = new QLineEdit(0); 120 mUidEdit = new QLineEdit(0);
119 mUidEdit->setText(""); 121 mUidEdit->setText("");
120 122
121 QLabel *emailLabel = new QLabel(this); 123 QLabel *emailLabel = new QLabel(this);
122 emailLabel->setText(i18n("Email:")); 124 emailLabel->setText(i18n("Email:"));
123 mEmailEdit = new QLineEdit(this); 125 mEmailEdit = new QLineEdit(this);
124 connect(mEmailEdit,SIGNAL(textChanged(const QString &)), 126 connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
125 SLOT(updateAttendeeItem())); 127 SLOT(updateAttendeeItem()));
126 128
127 QLabel *attendeeRoleLabel = new QLabel(this); 129 QLabel *attendeeRoleLabel = new QLabel(this);
128 attendeeRoleLabel->setText(i18n("Role:")); 130 attendeeRoleLabel->setText(i18n("Role:"));
129 mRoleCombo = new QComboBox(false,this); 131 mRoleCombo = new QComboBox(false,this);
130 mRoleCombo->insertStringList(Attendee::roleList()); 132 mRoleCombo->insertStringList(Attendee::roleList());
131 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 133 connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
132 134
133 QLabel *statusLabel = new QLabel(this); 135 QLabel *statusLabel = new QLabel(this);
134 statusLabel->setText( i18n("Status:") ); 136 statusLabel->setText( i18n("Status:") );
135 137
136 mStatusCombo = new QComboBox(false,this); 138 mStatusCombo = new QComboBox(false,this);
137 mStatusCombo->insertStringList(Attendee::statusList()); 139 mStatusCombo->insertStringList(Attendee::statusList());
138 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem())); 140 connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
139 141
140 142
141 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem())); 143 connect(mRsvpButton,SIGNAL(clicked()),SLOT(updateAttendeeItem()));
142 QWidget *buttonBox = new QWidget(this); 144 QWidget *buttonBox = new QWidget(this);
143 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox); 145 QVBoxLayout *buttonLayout = new QVBoxLayout(buttonBox);
144 146
145 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox); 147 QPushButton *newButton = new QPushButton(i18n("&New"),buttonBox);
146 buttonLayout->addWidget(newButton); 148 buttonLayout->addWidget(newButton);
147 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee())); 149 connect(newButton,SIGNAL(clicked()),SLOT(addNewAttendee()));
148 150
149 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox); 151 mRemoveButton = new QPushButton(i18n("&Remove"),buttonBox);
150 buttonLayout->addWidget(mRemoveButton); 152 buttonLayout->addWidget(mRemoveButton);
151 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee())); 153 connect(mRemoveButton, SIGNAL(clicked()),SLOT(removeAttendee()));
152 154
153 // buttonLayout->addWidget(mAddressBookButton); 155 // buttonLayout->addWidget(mAddressBookButton);
154 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook())); 156 connect(mAddressBookButton,SIGNAL(clicked()),SLOT(openAddressBook()));
155 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () ); 157 //mRoleCombo->setFixedSize( mRoleCombo->sizeHint () );
156 if ( QApplication::desktop()->height() <= 240 ) { 158 if ( QApplication::desktop()->height() <= 240 ) {
157 mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); 159 mRoleCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
158 mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) ); 160 mStatusCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Minimum ,FALSE) );
159 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5); 161 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,5);
160 topLayout->addMultiCellWidget(mListView,1,1,0,5); 162 topLayout->addMultiCellWidget(mListView,1,1,0,5);
161 topLayout->addWidget(attendeeLabel,3,0); 163 topLayout->addWidget(attendeeLabel,3,0);
162 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4); 164 topLayout->addMultiCellWidget(mNameEdit,3,3,1,4);
163 topLayout->addWidget(emailLabel,4,0); 165 topLayout->addWidget(emailLabel,4,0);
164 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4); 166 topLayout->addMultiCellWidget(mEmailEdit,4,4,1,4);
165 topLayout->addWidget(attendeeRoleLabel,5,0); 167 topLayout->addWidget(attendeeRoleLabel,5,0);
166 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2); 168 topLayout->addMultiCellWidget(mRoleCombo,5,5,1,2);
167 topLayout->addWidget(statusLabel,5,3); 169 topLayout->addWidget(statusLabel,5,3);
168 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5); 170 topLayout->addMultiCellWidget(mStatusCombo,5,5,4,5);
169 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5); 171 topLayout->addMultiCellWidget(mAddressBookButton,2,2,2,5);
170 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1); 172 topLayout->addMultiCellWidget(mRsvpButton,2,2,0,1);
171 topLayout->addMultiCellWidget(buttonBox,3,4,5,5); 173 topLayout->addMultiCellWidget(buttonBox,3,4,5,5);
172 topLayout->setRowStretch(1,5); 174 topLayout->setRowStretch(1,5);
173 topLayout->setColStretch(0,0); 175 topLayout->setColStretch(0,0);
174 } else { 176 } else {
175 if (qApp->desktop()->width() < 640 ) { 177 if (qApp->desktop()->width() < 640 ) {
176 if ( qApp->desktop()->width() < 300 ) 178 if ( qApp->desktop()->width() < 300 )
177 topLayout->setSpacing(1); 179 topLayout->setSpacing(1);
178 ;//mListView->setFixedHeight(80); 180 ;//mListView->setFixedHeight(80);
179 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3); 181 topLayout->addMultiCellWidget(mOrganizerLabel,0,0,0,3);
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index e07bc53..29e68b3 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -1,288 +1,291 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qregexp.h> 34#include <qregexp.h>
35 35
36 36
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kdialog.h>
38#include <kdebug.h> 39#include <kdebug.h>
39#include <klocale.h> 40#include <klocale.h>
40#include <kiconloader.h> 41#include <kiconloader.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
42#include <kfiledialog.h> 43#include <kfiledialog.h>
43#include <kstandarddirs.h> 44#include <kstandarddirs.h>
44 45
45#include <libkcal/todo.h> 46#include <libkcal/todo.h>
46#include <libkcal/event.h> 47#include <libkcal/event.h>
47#include <libkdepim/categoryselectdialog.h> 48#include <libkdepim/categoryselectdialog.h>
48#include <libkdepim/kdateedit.h> 49#include <libkdepim/kdateedit.h>
49 50
50#include "koprefs.h" 51#include "koprefs.h"
51#include "koglobals.h" 52#include "koglobals.h"
52 53
53#include "koeditorgeneral.h" 54#include "koeditorgeneral.h"
54#include "kolocationbox.h" 55#include "kolocationbox.h"
55#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
56#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
57#else 58#else
58#include <qapplication.h> 59#include <qapplication.h>
59#endif 60#endif
60 61
61KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
62 QObject( parent, name) 63 QObject( parent, name)
63{ 64{
64 mNextFocus = 0; 65 mNextFocus = 0;
65} 66}
66 67
67KOEditorGeneral::~KOEditorGeneral() 68KOEditorGeneral::~KOEditorGeneral()
68{ 69{
69} 70}
70 71
71void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
72{ 73{
73 QGridLayout *headerLayout = new QGridLayout(topLayout); 74 QGridLayout *headerLayout = new QGridLayout(topLayout);
74 75
75#if 0 76#if 0
76 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 77 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
77 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
78#endif 79#endif
79 80 // 1 on pda
81 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
80 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
81 headerLayout->addWidget(summaryLabel,1,0); 84 headerLayout->addWidget(summaryLabel,1,0);
82 85
83 mSummaryEdit = new KOLocationBox(TRUE,parent, 10); 86 mSummaryEdit = new KOLocationBox(TRUE,parent, 10);
84 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
85 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
86 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
87 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
88 if ( QApplication::desktop()->width() > 320 ) 91 if ( QApplication::desktop()->width() > 320 )
89 mSummaryEdit->setMaximumHeight( hei +6 ); 92 mSummaryEdit->setMaximumHeight( hei +6 );
90 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
91 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
92 // mSummaryEdit = new QLineEdit(parent); 95 // mSummaryEdit = new QLineEdit(parent);
93 headerLayout->addWidget(mSummaryEdit,1,1); 96 headerLayout->addWidget(mSummaryEdit,1,1);
94 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 97 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
95 98
96 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 99 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
97 if ( QApplication::desktop()->height() < 320 ) 100 if ( QApplication::desktop()->height() < 320 )
98 headerLayout->addWidget(locationLabel,1,2); 101 headerLayout->addWidget(locationLabel,1,2);
99 else 102 else
100 headerLayout->addWidget(locationLabel,2,0); 103 headerLayout->addWidget(locationLabel,2,0);
101 104
102 mLocationEdit = new KOLocationBox(TRUE,parent,10); 105 mLocationEdit = new KOLocationBox(TRUE,parent,10);
103 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 106 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
104 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 107 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
105 mLocationEdit->setMaximumHeight( hei + 6); 108 mLocationEdit->setMaximumHeight( hei + 6);
106 109
107 // mLocationEdit = new QLineEdit(parent); 110 // mLocationEdit = new QLineEdit(parent);
108 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 111 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
109 if ( QApplication::desktop()->height() < 320 ) { 112 if ( QApplication::desktop()->height() < 320 ) {
110 headerLayout->addWidget(mLocationEdit,1,3); 113 headerLayout->addWidget(mLocationEdit,1,3);
111 headerLayout->setColStretch( 1, 10); 114 headerLayout->setColStretch( 1, 10);
112 headerLayout->setColStretch( 3, 10); 115 headerLayout->setColStretch( 3, 10);
113 } 116 }
114 else { 117 else {
115 headerLayout->addWidget(mLocationEdit,2,1); 118 headerLayout->addWidget(mLocationEdit,2,1);
116 headerLayout->setColStretch( 1, 10); 119 headerLayout->setColStretch( 1, 10);
117 } 120 }
118} 121}
119void KOEditorGeneral::setFocusOn( int i ) 122void KOEditorGeneral::setFocusOn( int i )
120{ 123{
121 mNextFocus = i; 124 mNextFocus = i;
122 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 125 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
123} 126}
124void KOEditorGeneral::slotSetFocusOn() 127void KOEditorGeneral::slotSetFocusOn()
125{ 128{
126 mNextFocus; 129 mNextFocus;
127 if ( mNextFocus == 1 ) { 130 if ( mNextFocus == 1 ) {
128 mDescriptionEdit->setFocus(); 131 mDescriptionEdit->setFocus();
129 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 132 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
130 } 133 }
131 if ( mNextFocus == 2 ) { 134 if ( mNextFocus == 2 ) {
132 mSummaryEdit->setFocus(); 135 mSummaryEdit->setFocus();
133 } 136 }
134} 137}
135void KOEditorGeneral::editCategories() 138void KOEditorGeneral::editCategories()
136{ 139{
137 // qDebug("KOEditorGeneral::editCategories() "); 140 // qDebug("KOEditorGeneral::editCategories() ");
138 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 141 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
139 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 142 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
140 //KOGlobals::fitDialogToScreen( csd ); 143 //KOGlobals::fitDialogToScreen( csd );
141 csd->setColorEnabled(); 144 csd->setColorEnabled();
142 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 145 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
143 csd->exec(); 146 csd->exec();
144 delete csd; 147 delete csd;
145} 148}
146 149
147void KOEditorGeneral::showCatPopup() 150void KOEditorGeneral::showCatPopup()
148{ 151{
149 mCatPopup->clear(); 152 mCatPopup->clear();
150 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 153 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
151 int index = 0; 154 int index = 0;
152 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 155 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
153 it != KOPrefs::instance()->mCustomCategories.end (); 156 it != KOPrefs::instance()->mCustomCategories.end ();
154 ++it) { 157 ++it) {
155 mCatPopup->insertItem (*it, index ); 158 mCatPopup->insertItem (*it, index );
156 //mCategory[index] = *it; 159 //mCategory[index] = *it;
157 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 160 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
158 ++index; 161 ++index;
159 } 162 }
160} 163}
161void KOEditorGeneral::selectedCatPopup( int index ) 164void KOEditorGeneral::selectedCatPopup( int index )
162{ 165{
163 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 166 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
164 QString colcat = categories.first(); 167 QString colcat = categories.first();
165 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 168 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
166 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 169 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
167 else 170 else
168 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 171 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
169 categories.sort (); 172 categories.sort ();
170 if ( !colcat.isEmpty() ) { 173 if ( !colcat.isEmpty() ) {
171 if ( categories.find ( colcat ) != categories.end () ) { 174 if ( categories.find ( colcat ) != categories.end () ) {
172 categories.remove( colcat ); 175 categories.remove( colcat );
173 categories.prepend( colcat ); 176 categories.prepend( colcat );
174 } 177 }
175 } 178 }
176 setCategories( categories.join(",") ); 179 setCategories( categories.join(",") );
177} 180}
178 181
179void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 182void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
180{ 183{
181 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 184 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
182 mCatPopup = new QPopupMenu ( parent ); 185 mCatPopup = new QPopupMenu ( parent );
183 mCatPopup->setCheckable (true); 186 mCatPopup->setCheckable (true);
184 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 187 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
185 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 188 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
186 mCategoriesButton = new QPushButton(parent); 189 mCategoriesButton = new QPushButton(parent);
187 mCategoriesButton->setText(i18n("Categories...")); 190 mCategoriesButton->setText(i18n("Categories..."));
188 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 191 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
189 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 192 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
190 categoriesLayout->addWidget(mCategoriesButton); 193 categoriesLayout->addWidget(mCategoriesButton);
191 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 194 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
192 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 195 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
193 mCategoriesLabel->setPopup( mCatPopup ); 196 mCategoriesLabel->setPopup( mCatPopup );
194 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 197 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
195 categoriesLayout->addWidget(mCategoriesLabel,1); 198 categoriesLayout->addWidget(mCategoriesLabel,1);
196} 199}
197 200
198void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 201void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
199{ 202{
200 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 203 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
201 204
202 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 205 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
203 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 206 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
204 secrecyLayout->addWidget(mCancelBox); 207 secrecyLayout->addWidget(mCancelBox);
205 secrecyLayout->addWidget(secrecyLabel); 208 secrecyLayout->addWidget(secrecyLabel);
206 209
207 mSecrecyCombo = new QComboBox(parent); 210 mSecrecyCombo = new QComboBox(parent);
208 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 211 mSecrecyCombo->insertStringList(Incidence::secrecyList());
209 secrecyLayout->addWidget(mSecrecyCombo); 212 secrecyLayout->addWidget(mSecrecyCombo);
210} 213}
211 214
212void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout) 215void KOEditorGeneral::initDescription(QWidget *parent,QBoxLayout *topLayout)
213{ 216{
214 mDescriptionEdit = new KTextEdit(parent); 217 mDescriptionEdit = new KTextEdit(parent);
215 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont ); 218 mDescriptionEdit->setFont(KOPrefs::instance()->mEditBoxFont );
216 mDescriptionEdit->append(""); 219 mDescriptionEdit->append("");
217 mDescriptionEdit->setReadOnly(false); 220 mDescriptionEdit->setReadOnly(false);
218 mDescriptionEdit->setOverwriteMode(false); 221 mDescriptionEdit->setOverwriteMode(false);
219 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth ); 222 mDescriptionEdit->setWordWrap( KTextEdit::WidgetWidth );
220 topLayout->addWidget(mDescriptionEdit); 223 topLayout->addWidget(mDescriptionEdit);
221#ifndef DESKTOP_VERSION 224#ifndef DESKTOP_VERSION
222 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold ); 225 QPEApplication::setStylusOperation( mDescriptionEdit, QPEApplication::RightOnHold );
223#endif 226#endif
224 227
225} 228}
226 229
227void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) 230void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout)
228{ 231{
229 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout); 232 QBoxLayout *alarmLayout = new QHBoxLayout(topLayout);
230 233
231 //mAlarmBell = new QLabel(parent); 234 //mAlarmBell = new QLabel(parent);
232 //mAlarmBell->setPixmap(SmallIcon("bell")); 235 //mAlarmBell->setPixmap(SmallIcon("bell"));
233 //alarmLayout->addWidget(mAlarmBell); 236 //alarmLayout->addWidget(mAlarmBell);
234 if ( QApplication::desktop()->width() < 320 ) 237 if ( QApplication::desktop()->width() < 320 )
235 mAlarmButton = new QCheckBox(i18n("Rem."),parent); 238 mAlarmButton = new QCheckBox(i18n("Rem."),parent);
236 else 239 else
237 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent); 240 mAlarmButton = new QCheckBox(i18n("Reminder:"),parent);
238 241
239 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool))); 242 connect(mAlarmButton, SIGNAL(toggled(bool)), SLOT(enableAlarmEdit(bool)));
240 alarmLayout->addWidget(mAlarmButton); 243 alarmLayout->addWidget(mAlarmButton);
241 244
242 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 245 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
243 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus ); 246 mAlarmTimeEdit->setButtonSymbols( QSpinBox::PlusMinus );
244 alarmLayout->addWidget(mAlarmTimeEdit); 247 alarmLayout->addWidget(mAlarmTimeEdit);
245 mAlarmIncrCombo = new QComboBox(false, parent); 248 mAlarmIncrCombo = new QComboBox(false, parent);
246 if ( QApplication::desktop()->width() < 320 ) { 249 if ( QApplication::desktop()->width() < 320 ) {
247 mAlarmIncrCombo->insertItem(i18n("min")); 250 mAlarmIncrCombo->insertItem(i18n("min"));
248 mAlarmIncrCombo->insertItem(i18n("hou")); 251 mAlarmIncrCombo->insertItem(i18n("hou"));
249 mAlarmIncrCombo->insertItem(i18n("day")); 252 mAlarmIncrCombo->insertItem(i18n("day"));
250 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() ); 253 mAlarmTimeEdit->setMaximumWidth( mAlarmTimeEdit->sizeHint().width() );
251 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() ); 254 mAlarmIncrCombo->setMaximumWidth( mAlarmIncrCombo->sizeHint().width() );
252 } else { 255 } else {
253 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 256 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
254 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 257 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
255 mAlarmIncrCombo->insertItem(i18n("day(s)")); 258 mAlarmIncrCombo->insertItem(i18n("day(s)"));
256 } 259 }
257 260
258 // mAlarmIncrCombo->setMinimumHeight(20); 261 // mAlarmIncrCombo->setMinimumHeight(20);
259 alarmLayout->addWidget(mAlarmIncrCombo); 262 alarmLayout->addWidget(mAlarmIncrCombo);
260 mAlarmSoundButton = new QPushButton(parent); 263 mAlarmSoundButton = new QPushButton(parent);
261 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 264 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
262 mAlarmSoundButton->setToggleButton(true); 265 mAlarmSoundButton->setToggleButton(true);
263 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 266 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
264 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 267 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
265 alarmLayout->addWidget(mAlarmSoundButton); 268 alarmLayout->addWidget(mAlarmSoundButton);
266 269
267 mAlarmProgramButton = new QPushButton(parent); 270 mAlarmProgramButton = new QPushButton(parent);
268 mAlarmProgramButton->setPixmap(SmallIcon("run")); 271 mAlarmProgramButton->setPixmap(SmallIcon("run"));
269 mAlarmProgramButton->setToggleButton(true); 272 mAlarmProgramButton->setToggleButton(true);
270 QToolTip::add(mAlarmProgramButton, i18n("No program set")); 273 QToolTip::add(mAlarmProgramButton, i18n("No program set"));
271 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 274 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
272 alarmLayout->addWidget(mAlarmProgramButton); 275 alarmLayout->addWidget(mAlarmProgramButton);
273 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 276 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
274 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 277 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
275 // if ( KOPrefs::instance()->mCompactDialogs ) { 278 // if ( KOPrefs::instance()->mCompactDialogs ) {
276 // mAlarmSoundButton->hide(); 279 // mAlarmSoundButton->hide();
277 // mAlarmProgramButton->hide(); 280 // mAlarmProgramButton->hide();
278 // } 281 // }
279} 282}
280 283
281void KOEditorGeneral::pickAlarmSound() 284void KOEditorGeneral::pickAlarmSound()
282{ 285{
283 286
284 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); 287 //qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() );
285 288
286 bool oldState = mAlarmSoundButton->isOn(); 289 bool oldState = mAlarmSoundButton->isOn();
287 290
288 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 291 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp
index 3dd7f5c..2c6ed9f 100644
--- a/korganizer/koeditorgeneralevent.cpp
+++ b/korganizer/koeditorgeneralevent.cpp
@@ -1,191 +1,192 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qvgroupbox.h> 28#include <qvgroupbox.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <kglobal.h> 33#include <kglobal.h>
34#include <kdialog.h>
34#include <klocale.h> 35#include <klocale.h>
35#include <kiconloader.h> 36#include <kiconloader.h>
36#include <kmessagebox.h> 37#include <kmessagebox.h>
37#include <kfiledialog.h> 38#include <kfiledialog.h>
38#include <kstandarddirs.h> 39#include <kstandarddirs.h>
39 40
40#include <libkcal/event.h> 41#include <libkcal/event.h>
41 42
42#include <libkdepim/kdateedit.h> 43#include <libkdepim/kdateedit.h>
43 44
44#include "koprefs.h" 45#include "koprefs.h"
45 46
46#include "koeditorgeneralevent.h" 47#include "koeditorgeneralevent.h"
47#include "kolocationbox.h" 48#include "kolocationbox.h"
48 49
49KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent, 50KOEditorGeneralEvent::KOEditorGeneralEvent(QObject* parent,
50 const char* name) : 51 const char* name) :
51 KOEditorGeneral( parent, name) 52 KOEditorGeneral( parent, name)
52{ 53{
53 mTemplate = false; 54 mTemplate = false;
54 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 55 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
55 SLOT(setDuration())); 56 SLOT(setDuration()));
56 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 57 connect(this,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
57 SLOT(emitDateTimeStr())); 58 SLOT(emitDateTimeStr()));
58} 59}
59 60
60KOEditorGeneralEvent::~KOEditorGeneralEvent() 61KOEditorGeneralEvent::~KOEditorGeneralEvent()
61{ 62{
62} 63}
63 64
64void KOEditorGeneralEvent::finishSetup() 65void KOEditorGeneralEvent::finishSetup()
65{ 66{
66 67
67 //disabled 68 //disabled
68// QWidget::setTabOrder( mSummaryEdit, mLocationEdit ); 69// QWidget::setTabOrder( mSummaryEdit, mLocationEdit );
69// QWidget::setTabOrder( mLocationEdit, mStartDateEdit ); 70// QWidget::setTabOrder( mLocationEdit, mStartDateEdit );
70// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit ); 71// QWidget::setTabOrder( mStartDateEdit, mStartTimeEdit );
71// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit ); 72// QWidget::setTabOrder( mStartTimeEdit, mEndDateEdit );
72// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit ); 73// QWidget::setTabOrder( mEndDateEdit, mEndTimeEdit );
73// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton ); 74// QWidget::setTabOrder( mEndTimeEdit, mNoTimeButton );
74// QWidget::setTabOrder( mNoTimeButton, mAlarmButton ); 75// QWidget::setTabOrder( mNoTimeButton, mAlarmButton );
75// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit ); 76// QWidget::setTabOrder( mAlarmButton, mAlarmTimeEdit );
76// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton ); 77// QWidget::setTabOrder( mFreeTimeCombo, mCategoriesButton );
77// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo ); 78// QWidget::setTabOrder( mCategoriesButton, mSecrecyCombo );
78// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit ); 79// QWidget::setTabOrder( mSecrecyCombo, mDescriptionEdit );
79 80
80 81
81 82
82 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT); 83 mSummaryEdit->load(KOLocationBox::SUMMARYEVENT);
83 mSummaryEdit->setFocus(); 84 mSummaryEdit->setFocus();
84} 85}
85 86
86void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout) 87void KOEditorGeneralEvent::initTime(QWidget *parent,QBoxLayout *topLayout)
87{ 88{
88 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 89 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
89 90
90 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 91 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
91 i18n("Date && Time"),parent); 92 i18n("Date && Time"),parent);
92 timeLayout->addWidget(timeGroupBox); 93 timeLayout->addWidget(timeGroupBox);
93 94
94 timeGroupBox->layout()->setSpacing( 0 ); 95 timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() );
95 timeGroupBox->layout()->setMargin( 5 ); 96 timeGroupBox->layout()->setMargin( KDialog::marginHint() );
96 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 97 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
97 98
98 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3); 99 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,2,3);
99 layoutTimeBox->setSpacing(topLayout->spacing()); 100 layoutTimeBox->setSpacing(topLayout->spacing());
100 101
101 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame); 102 mStartDateLabel = new QLabel(i18n("Start:"),timeBoxFrame);
102 layoutTimeBox->addWidget(mStartDateLabel,0,0); 103 layoutTimeBox->addWidget(mStartDateLabel,0,0);
103 104
104 mStartDateEdit = new KDateEdit(timeBoxFrame); 105 mStartDateEdit = new KDateEdit(timeBoxFrame);
105 layoutTimeBox->addWidget(mStartDateEdit,0,1); 106 layoutTimeBox->addWidget(mStartDateEdit,0,1);
106 107
107 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 108 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
108 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 109 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
109 110
110 111
111 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame); 112 mEndDateLabel = new QLabel(i18n("End:"),timeBoxFrame);
112 layoutTimeBox->addWidget(mEndDateLabel,1,0); 113 layoutTimeBox->addWidget(mEndDateLabel,1,0);
113 114
114 mEndDateEdit = new KDateEdit(timeBoxFrame); 115 mEndDateEdit = new KDateEdit(timeBoxFrame);
115 layoutTimeBox->addWidget(mEndDateEdit,1,1); 116 layoutTimeBox->addWidget(mEndDateEdit,1,1);
116 117
117 mEndTimeEdit = new KOTimeEdit(timeBoxFrame); 118 mEndTimeEdit = new KOTimeEdit(timeBoxFrame);
118 layoutTimeBox->addWidget(mEndTimeEdit,1,2); 119 layoutTimeBox->addWidget(mEndTimeEdit,1,2);
119 QWidget* duration = new QWidget( timeBoxFrame ); 120 QWidget* duration = new QWidget( timeBoxFrame );
120 QHBoxLayout *flagsBox = new QHBoxLayout( duration ); 121 QHBoxLayout *flagsBox = new QHBoxLayout( duration );
121 mNoTimeButton = new QCheckBox(i18n("All day event"),duration); 122 mNoTimeButton = new QCheckBox(i18n("All day event"),duration);
122 flagsBox->addWidget(mNoTimeButton); 123 flagsBox->addWidget(mNoTimeButton);
123 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool))); 124 connect(mNoTimeButton, SIGNAL(toggled(bool)),SLOT(dontAssociateTime(bool)));
124 mDurationLabel = new QLabel( duration ); 125 mDurationLabel = new QLabel( duration );
125 // if ( KOPrefs::instance()->mCompactDialogs ) { 126 // if ( KOPrefs::instance()->mCompactDialogs ) {
126 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 ); 127 //layoutTimeBox->addMultiCellWidget( mDurationLabel, 3, 3, 0, 3 );
127 //} else { 128 //} else {
128 flagsBox->addWidget( mDurationLabel ); 129 flagsBox->addWidget( mDurationLabel );
129 //} 130 //}
130 flagsBox->setStretchFactor(mDurationLabel, 10 ); 131 flagsBox->setStretchFactor(mDurationLabel, 10 );
131 mDurationLabel->setAlignment( AlignRight | AlignVCenter); 132 mDurationLabel->setAlignment( AlignRight | AlignVCenter);
132 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 ); 133 layoutTimeBox->addMultiCellWidget( duration, 2, 2, 0, 3 );
133 134
134 // time widgets are checked if they contain a valid time 135 // time widgets are checked if they contain a valid time
135 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)), 136 connect(mStartTimeEdit, SIGNAL(timeChanged(QTime)),
136 this, SLOT(startTimeChanged(QTime))); 137 this, SLOT(startTimeChanged(QTime)));
137 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)), 138 connect(mEndTimeEdit, SIGNAL(timeChanged(QTime)),
138 this, SLOT(endTimeChanged(QTime))); 139 this, SLOT(endTimeChanged(QTime)));
139 140
140 // date widgets are checked if they contain a valid date 141 // date widgets are checked if they contain a valid date
141 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), 142 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
142 this, SLOT(startDateChanged(QDate))); 143 this, SLOT(startDateChanged(QDate)));
143 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)), 144 connect(mEndDateEdit, SIGNAL(dateChanged(QDate)),
144 this, SLOT(endDateChanged(QDate))); 145 this, SLOT(endDateChanged(QDate)));
145 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime))); 146 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(sTimeChanged(QTime)));
146 connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime))); 147 connect(mEndDateEdit,SIGNAL(setTimeTo(QTime)),this,SLOT(eTimeChanged(QTime)));
147} 148}
148 149
149void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout) 150void KOEditorGeneralEvent::initClass(QWidget *parent,QBoxLayout *topLayout)
150{ 151{
151 QBoxLayout *classLayout = new QHBoxLayout(topLayout); 152 QBoxLayout *classLayout = new QHBoxLayout(topLayout);
152 153
153 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent); 154 QLabel *freeTimeLabel = new QLabel(i18n("Show time as:"),parent);
154 classLayout->addWidget(freeTimeLabel); 155 classLayout->addWidget(freeTimeLabel);
155 156
156 mFreeTimeCombo = new QComboBox(false, parent); 157 mFreeTimeCombo = new QComboBox(false, parent);
157 mFreeTimeCombo->insertItem(i18n("Busy")); 158 mFreeTimeCombo->insertItem(i18n("Busy"));
158 mFreeTimeCombo->insertItem(i18n("Free")); 159 mFreeTimeCombo->insertItem(i18n("Free"));
159 classLayout->addWidget(mFreeTimeCombo); 160 classLayout->addWidget(mFreeTimeCombo);
160} 161}
161 162
162void KOEditorGeneralEvent::timeStuffDisable(bool disable) 163void KOEditorGeneralEvent::timeStuffDisable(bool disable)
163{ 164{
164 mStartTimeEdit->setEnabled( !disable ); 165 mStartTimeEdit->setEnabled( !disable );
165 mEndTimeEdit->setEnabled( !disable ); 166 mEndTimeEdit->setEnabled( !disable );
166 167
167 setDuration(); 168 setDuration();
168 emitDateTimeStr(); 169 emitDateTimeStr();
169} 170}
170 171
171void KOEditorGeneralEvent::dontAssociateTime(bool noTime) 172void KOEditorGeneralEvent::dontAssociateTime(bool noTime)
172{ 173{
173 timeStuffDisable(noTime); 174 timeStuffDisable(noTime);
174 //if(alarmButton->isChecked()) alarmStuffDisable(noTime); 175 //if(alarmButton->isChecked()) alarmStuffDisable(noTime);
175 allDayChanged(noTime); 176 allDayChanged(noTime);
176} 177}
177 178
178void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end) 179void KOEditorGeneralEvent::setDateTimes(QDateTime start, QDateTime end)
179{ 180{
180// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl; 181// kdDebug() << "KOEditorGeneralEvent::setDateTimes(): Start DateTime: " << start.toString() << endl;
181 if ( !mTemplate ) 182 if ( !mTemplate )
182 mStartDateEdit->setDate(start.date()); 183 mStartDateEdit->setDate(start.date());
183 // KTimeEdit seems to emit some signals when setTime() is called. 184 // KTimeEdit seems to emit some signals when setTime() is called.
184 mStartTimeEdit->blockSignals( true ); 185 mStartTimeEdit->blockSignals( true );
185 mStartTimeEdit->setTime(start.time()); 186 mStartTimeEdit->setTime(start.time());
186 mStartTimeEdit->blockSignals( false ); 187 mStartTimeEdit->blockSignals( false );
187 if ( !mTemplate ) 188 if ( !mTemplate )
188 mEndDateEdit->setDate(end.date()); 189 mEndDateEdit->setDate(end.date());
189 mEndTimeEdit->setTime(end.time()); 190 mEndTimeEdit->setTime(end.time());
190 191
191 mCurrStartDateTime = start; 192 mCurrStartDateTime = start;
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index 0a734ee..965cf47 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -1,188 +1,188 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qfiledialog.h> 25#include <qfiledialog.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qbuttongroup.h> 28#include <qbuttongroup.h>
29#include <qvgroupbox.h> 29#include <qvgroupbox.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <kglobal.h> 34#include <kglobal.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kmessagebox.h> 37#include <kmessagebox.h>
38#include <kdebug.h> 38#include <kdebug.h>
39#include <krestrictedline.h> 39#include <krestrictedline.h>
40#include <kstandarddirs.h> 40#include <kstandarddirs.h>
41#include <kfiledialog.h> 41#include <kfiledialog.h>
42#include <kdialog.h> 42#include <kdialog.h>
43 43
44#include <libkcal/todo.h> 44#include <libkcal/todo.h>
45 45
46#include <libkdepim/kdateedit.h> 46#include <libkdepim/kdateedit.h>
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49#include "ktimeedit.h" 49#include "ktimeedit.h"
50 50
51#include "koeditorgeneraltodo.h" 51#include "koeditorgeneraltodo.h"
52#include "kolocationbox.h" 52#include "kolocationbox.h"
53 53
54KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent, 54KOEditorGeneralTodo::KOEditorGeneralTodo(QObject* parent,
55 const char* name) 55 const char* name)
56 : KOEditorGeneral( parent, name) 56 : KOEditorGeneral( parent, name)
57{ 57{
58} 58}
59 59
60KOEditorGeneralTodo::~KOEditorGeneralTodo() 60KOEditorGeneralTodo::~KOEditorGeneralTodo()
61{ 61{
62} 62}
63 63
64void KOEditorGeneralTodo::finishSetup() 64void KOEditorGeneralTodo::finishSetup()
65{ 65{
66 66
67// QWidget::setTabOrder(mSummaryEdit, mLocationEdit); 67// QWidget::setTabOrder(mSummaryEdit, mLocationEdit);
68// QWidget::setTabOrder(mLocationEdit, mDueCheck); 68// QWidget::setTabOrder(mLocationEdit, mDueCheck);
69// QWidget::setTabOrder(mDueCheck, mDueDateEdit); 69// QWidget::setTabOrder(mDueCheck, mDueDateEdit);
70// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit); 70// QWidget::setTabOrder(mDueDateEdit, mDueTimeEdit);
71// QWidget::setTabOrder(mDueTimeEdit, mStartCheck); 71// QWidget::setTabOrder(mDueTimeEdit, mStartCheck);
72// QWidget::setTabOrder(mStartCheck, mStartDateEdit); 72// QWidget::setTabOrder(mStartCheck, mStartDateEdit);
73// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit); 73// QWidget::setTabOrder(mStartDateEdit, mStartTimeEdit);
74// QWidget::setTabOrder(mStartTimeEdit, mTimeButton); 74// QWidget::setTabOrder(mStartTimeEdit, mTimeButton);
75// QWidget::setTabOrder(mTimeButton, mCompletedCombo); 75// QWidget::setTabOrder(mTimeButton, mCompletedCombo);
76// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo); 76// QWidget::setTabOrder(mCompletedCombo, mPriorityCombo);
77// QWidget::setTabOrder(mPriorityCombo, mAlarmButton); 77// QWidget::setTabOrder(mPriorityCombo, mAlarmButton);
78// QWidget::setTabOrder(mAlarmButton, mCategoriesButton); 78// QWidget::setTabOrder(mAlarmButton, mCategoriesButton);
79// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo); 79// QWidget::setTabOrder(mCategoriesButton, mSecrecyCombo);
80// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit); 80// QWidget::setTabOrder(mSecrecyCombo, mDescriptionEdit);
81 mSummaryEdit->load(KOLocationBox::SUMMARYTODO); 81 mSummaryEdit->load(KOLocationBox::SUMMARYTODO);
82 mSummaryEdit->setFocus(); 82 mSummaryEdit->setFocus();
83} 83}
84 84
85void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout) 85void KOEditorGeneralTodo::initTime(QWidget *parent,QBoxLayout *topLayout)
86{ 86{
87 QBoxLayout *timeLayout = new QVBoxLayout(topLayout); 87 QBoxLayout *timeLayout = new QVBoxLayout(topLayout);
88 88
89 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal, 89 QGroupBox *timeGroupBox = new QGroupBox(1,QGroupBox::Horizontal,
90 i18n("Date && Time"),parent); 90 i18n("Date && Time"),parent);
91 timeLayout->addWidget(timeGroupBox); 91 timeLayout->addWidget(timeGroupBox);
92 timeGroupBox->layout()->setSpacing( KDialog::spacingHintSmall() ); 92 timeGroupBox->layout()->setSpacing( KDialog::spacingHint()-2 );
93 timeGroupBox->layout()->setMargin( KDialog::marginHint() ); 93 timeGroupBox->layout()->setMargin( KDialog::marginHint() );
94 QFrame *timeBoxFrame = new QFrame(timeGroupBox); 94 QFrame *timeBoxFrame = new QFrame(timeGroupBox);
95 95
96 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3); 96 QGridLayout *layoutTimeBox = new QGridLayout(timeBoxFrame,3,3);
97 layoutTimeBox->setSpacing(KDialog::spacingHintSmall()); 97 layoutTimeBox->setSpacing(KDialog::spacingHintSmall());
98 layoutTimeBox->setColStretch( 1, 1 ); 98 layoutTimeBox->setColStretch( 1, 1 );
99 99
100 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame); 100 mDueCheck = new QCheckBox(i18n("Due:"),timeBoxFrame);
101 layoutTimeBox->addWidget(mDueCheck,1,0); 101 layoutTimeBox->addWidget(mDueCheck,1,0);
102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool))); 102 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(enableDueEdit(bool)));
103 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm())); 103 connect(mDueCheck,SIGNAL(toggled(bool)),SLOT(showAlarm()));
104 104
105 105
106 mDueDateEdit = new KDateEdit(timeBoxFrame); 106 mDueDateEdit = new KDateEdit(timeBoxFrame);
107 layoutTimeBox->addWidget(mDueDateEdit,1,1); 107 layoutTimeBox->addWidget(mDueDateEdit,1,1);
108 108
109 mDueTimeEdit = new KOTimeEdit(timeBoxFrame); 109 mDueTimeEdit = new KOTimeEdit(timeBoxFrame);
110 layoutTimeBox->addWidget(mDueTimeEdit,1,2); 110 layoutTimeBox->addWidget(mDueTimeEdit,1,2);
111 111
112 112
113 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame); 113 mStartCheck = new QCheckBox(i18n("Start:"),timeBoxFrame);
114 layoutTimeBox->addWidget(mStartCheck,0,0); 114 layoutTimeBox->addWidget(mStartCheck,0,0);
115 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool))); 115 connect(mStartCheck,SIGNAL(toggled(bool)),SLOT(enableStartEdit(bool)));
116 116
117 mStartDateEdit = new KDateEdit(timeBoxFrame); 117 mStartDateEdit = new KDateEdit(timeBoxFrame);
118 layoutTimeBox->addWidget(mStartDateEdit,0,1); 118 layoutTimeBox->addWidget(mStartDateEdit,0,1);
119 119
120 mStartTimeEdit = new KOTimeEdit(timeBoxFrame); 120 mStartTimeEdit = new KOTimeEdit(timeBoxFrame);
121 layoutTimeBox->addWidget(mStartTimeEdit,0,2); 121 layoutTimeBox->addWidget(mStartTimeEdit,0,2);
122 122
123 123
124 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame); 124 mTimeButton = new QCheckBox(i18n("Time associated"),timeBoxFrame);
125 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1); 125 layoutTimeBox->addMultiCellWidget(mTimeButton,2,2,0,1);
126 126
127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool))); 127 connect(mTimeButton,SIGNAL(toggled(bool)),SLOT(enableTimeEdits(bool)));
128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime))); 128 connect(mDueDateEdit,SIGNAL(setTimeTo(QTime)),mDueTimeEdit,SLOT(setTime(QTime)));
129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime))); 129 connect(mStartDateEdit,SIGNAL(setTimeTo(QTime)),mStartTimeEdit,SLOT(setTime(QTime)));
130 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)), 130 connect(mStartDateEdit, SIGNAL(dateChanged(QDate)),
131 this, SLOT(startDateChanged(QDate))); 131 this, SLOT(startDateChanged(QDate)));
132 // some more layouting 132 // some more layouting
133 //layoutTimeBox->setColStretch(3,1); 133 //layoutTimeBox->setColStretch(3,1);
134} 134}
135 135
136 136
137void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) 137void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
138{ 138{
139 mCompletedCombo = new QComboBox(parent); 139 mCompletedCombo = new QComboBox(parent);
140 // xgettext:no-c-format 140 // xgettext:no-c-format
141 mCompletedCombo->insertItem(i18n(" 0 %")); 141 mCompletedCombo->insertItem(i18n(" 0 %"));
142 // xgettext:no-c-format 142 // xgettext:no-c-format
143 mCompletedCombo->insertItem(i18n(" 20 %")); 143 mCompletedCombo->insertItem(i18n(" 20 %"));
144 // xgettext:no-c-format 144 // xgettext:no-c-format
145 mCompletedCombo->insertItem(i18n(" 40 %")); 145 mCompletedCombo->insertItem(i18n(" 40 %"));
146 // xgettext:no-c-format 146 // xgettext:no-c-format
147 mCompletedCombo->insertItem(i18n(" 60 %")); 147 mCompletedCombo->insertItem(i18n(" 60 %"));
148 // xgettext:no-c-format 148 // xgettext:no-c-format
149 mCompletedCombo->insertItem(i18n(" 80 %")); 149 mCompletedCombo->insertItem(i18n(" 80 %"));
150 // xgettext:no-c-format 150 // xgettext:no-c-format
151 mCompletedCombo->insertItem(i18n("100 %")); 151 mCompletedCombo->insertItem(i18n("100 %"));
152 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); 152 connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int)));
153 topLayout->addWidget(mCompletedCombo); 153 topLayout->addWidget(mCompletedCombo);
154 154
155 mCompletedLabel = new QLabel(i18n("completed"),parent); 155 mCompletedLabel = new QLabel(i18n("completed"),parent);
156 topLayout->addWidget(mCompletedLabel); 156 topLayout->addWidget(mCompletedLabel);
157 157
158 mCompleteDateEdit = new KDateEdit(parent); 158 mCompleteDateEdit = new KDateEdit(parent);
159 topLayout->addWidget(mCompleteDateEdit ); 159 topLayout->addWidget(mCompleteDateEdit );
160 160
161 mCompleteTimeEdit = new KOTimeEdit(parent); 161 mCompleteTimeEdit = new KOTimeEdit(parent);
162 topLayout->addWidget( mCompleteTimeEdit); 162 topLayout->addWidget( mCompleteTimeEdit);
163 163
164 mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) ); 164 mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) );
165 mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) ); 165 mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) );
166 connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime))); 166 connect(mCompleteDateEdit,SIGNAL(setTimeTo(QTime)),mCompleteTimeEdit,SLOT(setTime(QTime)));
167 167
168 if ( QApplication::desktop()->width() <= 480 ) { 168 if ( QApplication::desktop()->width() <= 480 ) {
169 if ( QApplication::desktop()->width() < 320 ) 169 if ( QApplication::desktop()->width() < 320 )
170 mCompleteDateEdit->setMaximumWidth( 85 ); 170 mCompleteDateEdit->setMaximumWidth( 85 );
171 else 171 else
172 mCompleteDateEdit->setMaximumWidth( 140 ); 172 mCompleteDateEdit->setMaximumWidth( 140 );
173 topLayout->setSpacing( 0 ); 173 topLayout->setSpacing( 0 );
174 } 174 }
175} 175}
176 176
177void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) 177void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
178{ 178{
179 179
180 QHBox* h = new QHBox ( parent ); 180 QHBox* h = new QHBox ( parent );
181 topLayout->addWidget( h ); 181 topLayout->addWidget( h );
182 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); 182 QLabel *priorityLabel = new QLabel(i18n("Priority:"), h);
183 // topLayout->addWidget(priorityLabel); 183 // topLayout->addWidget(priorityLabel);
184 mPriorityCombo = new QComboBox( h ); 184 mPriorityCombo = new QComboBox( h );
185 mPriorityCombo->insertItem(i18n("1 (high)")); 185 mPriorityCombo->insertItem(i18n("1 (high)"));
186 mPriorityCombo->insertItem(i18n("2")); 186 mPriorityCombo->insertItem(i18n("2"));
187 mPriorityCombo->insertItem(i18n("3")); 187 mPriorityCombo->insertItem(i18n("3"));
188 mPriorityCombo->insertItem(i18n("4")); 188 mPriorityCombo->insertItem(i18n("4"));
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 75dae34..9ede543 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -15,228 +15,234 @@
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qhbox.h> 27#include <qhbox.h>
28#include <qdir.h> 28#include <qdir.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qwidgetstack.h> 30#include <qwidgetstack.h>
31#include <qapplication.h> 31#include <qapplication.h>
32 32
33#include <kiconloader.h> 33#include <kiconloader.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kmessagebox.h> 38#include <kmessagebox.h>
39#include <libkcal/calendarresources.h> 39#include <libkcal/calendarresources.h>
40#include <libkcal/resourcecalendar.h> 40#include <libkcal/resourcecalendar.h>
41#include <kresources/resourceselectdialog.h> 41#include <kresources/resourceselectdialog.h>
42 42
43#include <libkdepim/categoryselectdialog.h> 43#include <libkdepim/categoryselectdialog.h>
44#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46 46
47#include "koprefs.h" 47#include "koprefs.h"
48 48
49#include "koeventeditor.h" 49#include "koeventeditor.h"
50extern int globalFlagBlockAgenda; 50extern int globalFlagBlockAgenda;
51 51
52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) : 52KOEventEditor::KOEventEditor( Calendar *calendar, QWidget *parent ) :
53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent ) 53 KOIncidenceEditor( i18n("Edit Event"), calendar, parent )
54{ 54{
55 mEvent = 0; 55 mEvent = 0;
56 init(); 56 init();
57 if ( QApplication::desktop()->height() <= 240 ) 57 if ( QApplication::desktop()->height() <= 240 )
58 hideButtons(); 58 hideButtons();
59} 59}
60 60
61KOEventEditor::~KOEventEditor() 61KOEventEditor::~KOEventEditor()
62{ 62{
63 //emit dialogClose( mEvent ); 63 //emit dialogClose( mEvent );
64} 64}
65 65
66void KOEventEditor::init() 66void KOEventEditor::init()
67{ 67{
68 68
69 setupGeneral(); 69 setupGeneral();
70 setupAttendeesTab(); 70 setupAttendeesTab();
71 setupRecurrence(); 71 setupRecurrence();
72 72
73 // Propagate date time settings to recurrence tab 73 // Propagate date time settings to recurrence tab
74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 74 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
75 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); 75 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)), 76 connect(mGeneral,SIGNAL(dateTimeStrChanged(const QString &)),
77 mRecurrence,SLOT(setDateTimeStr(const QString &))); 77 mRecurrence,SLOT(setDateTimeStr(const QString &)));
78 78
79 // Category dialog 79 // Category dialog
80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 80 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)), 81 //connect(mCategoryDialog,SIGNAL(categoriesSelected(const QString &)),
82 // mGeneral,SLOT(setCategories(const QString &))); 82 // mGeneral,SLOT(setCategories(const QString &)));
83 83
84 84
85} 85}
86 86
87void KOEventEditor::reload() 87void KOEventEditor::reload()
88{ 88{
89 if ( mEvent ) readEvent( mEvent ); 89 if ( mEvent ) readEvent( mEvent );
90} 90}
91 91
92void KOEventEditor::setSecrecy( int sec ) 92void KOEventEditor::setSecrecy( int sec )
93{ 93{
94 mGeneral->setSecrecy( sec ); 94 mGeneral->setSecrecy( sec );
95} 95}
96void KOEventEditor::setCategories( QString s ) 96void KOEventEditor::setCategories( QString s )
97{ 97{
98 mGeneral->setCategories(s); 98 mGeneral->setCategories(s);
99 99
100} 100}
101void KOEventEditor::setupGeneral() 101void KOEventEditor::setupGeneral()
102{ 102{
103 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" ); 103 mGeneral = new KOEditorGeneralEvent( this, "KOEditorGeneralEvent" );
104 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 104 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
105 105
106 if( KOPrefs::instance()->mCompactDialogs ) { 106 if( KOPrefs::instance()->mCompactDialogs ) {
107 QFrame *topFrame = addPage(i18n("General")); 107 QFrame *topFrame = addPage(i18n("General"));
108 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 108 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
109 topLayout->setSpacing(spacingHint()-1); 109 topLayout->setSpacing(spacingHint()-1);
110 topLayout->setMargin(marginHint()-1); 110 topLayout->setMargin(marginHint()-1);
111 topLayout->addStretch ( 1 );
111 mGeneral->initHeader(topFrame,topLayout); 112 mGeneral->initHeader(topFrame,topLayout);
113 topLayout->addStretch ( 1 );
112 mGeneral->initTime(topFrame,topLayout); 114 mGeneral->initTime(topFrame,topLayout);
115 topLayout->addStretch ( 1 );
113// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 116// QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
114 mGeneral->initAlarm(topFrame,topLayout); 117 mGeneral->initAlarm(topFrame,topLayout);
118 topLayout->addStretch ( 1 );
115 mGeneral->enableAlarm( false ); 119 mGeneral->enableAlarm( false );
116 120
117 QBoxLayout *buttonLayout; 121 QBoxLayout *buttonLayout;
118 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 ) 122 if ( QApplication::desktop()->width() < 500 && QApplication::desktop()->height() > 240 )
119 buttonLayout = new QVBoxLayout( topLayout ); 123 buttonLayout = new QVBoxLayout( topLayout );
120 else 124 else
121 buttonLayout = new QHBoxLayout( topLayout ); 125 buttonLayout = new QHBoxLayout( topLayout );
122 QHBox* buttonWidget = new QHBox (topFrame); 126 QHBox* buttonWidget = new QHBox (topFrame);
123 QIconSet icon; 127 QIconSet icon;
124 if ( QApplication::desktop()->width() < 321 ) 128 if ( QApplication::desktop()->width() < 321 )
125 icon = SmallIcon("fileexport16"); 129 icon = SmallIcon("fileexport16");
126 else 130 else
127 icon = SmallIcon("fileexport"); 131 icon = SmallIcon("fileexport");
128 QPushButton * loadTemplate = new QPushButton( buttonWidget); 132 QPushButton * loadTemplate = new QPushButton( buttonWidget);
129 QPushButton * saveTemplate = new QPushButton( buttonWidget); 133 QPushButton * saveTemplate = new QPushButton( buttonWidget);
130 saveTemplate->setIconSet (icon ) ; 134 saveTemplate->setIconSet (icon ) ;
131 int size = saveTemplate->sizeHint().height(); 135 int size = saveTemplate->sizeHint().height();
132 saveTemplate->setFixedSize( size, size ); 136 saveTemplate->setFixedSize( size, size );
133 if ( QApplication::desktop()->width() < 321 ) 137 if ( QApplication::desktop()->width() < 321 )
134 icon = SmallIcon("fileimport16"); 138 icon = SmallIcon("fileimport16");
135 else 139 else
136 icon = SmallIcon("fileimport"); 140 icon = SmallIcon("fileimport");
137 loadTemplate->setIconSet (icon ) ; 141 loadTemplate->setIconSet (icon ) ;
138 loadTemplate->setFixedSize( size, size ); 142 loadTemplate->setFixedSize( size, size );
139 buttonLayout->addWidget( buttonWidget ); 143 buttonLayout->addWidget( buttonWidget );
140 mGeneral->initCategories( topFrame, buttonLayout ); 144 mGeneral->initCategories( topFrame, buttonLayout );
141 145
142 topLayout->addStretch( 1 ); 146 topLayout->addStretch( 1 );
143 147
144 QFrame *topFrame2 = addPage(i18n("Details")); 148 QFrame *topFrame2 = addPage(i18n("Details"));
145 149
146 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 150 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
151 topLayout2->setSpacing(spacingHint()-1);
152 topLayout2->setMargin(marginHint()-1);
147 topLayout2->setSpacing(spacingHint()); 153 topLayout2->setSpacing(spacingHint());
148 154
149 mGeneral->initClass(topFrame2,topLayout2); 155 mGeneral->initClass(topFrame2,topLayout2);
150 mGeneral->initSecrecy( topFrame2, topLayout2 ); 156 mGeneral->initSecrecy( topFrame2, topLayout2 );
151 mGeneral->initDescription(topFrame2,topLayout2); 157 mGeneral->initDescription(topFrame2,topLayout2);
152 158
153 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 159 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
154 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 160 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
155 } else { 161 } else {
156 QFrame *topFrame = addPage(i18n("General")); 162 QFrame *topFrame = addPage(i18n("General"));
157 163
158 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 164 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
159 topLayout->setSpacing(spacingHint()); 165 topLayout->setSpacing(spacingHint());
160 166
161 mGeneral->initHeader(topFrame,topLayout); 167 mGeneral->initHeader(topFrame,topLayout);
162 mGeneral->initTime(topFrame,topLayout); 168 mGeneral->initTime(topFrame,topLayout);
163 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 169 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
164 mGeneral->initAlarm(topFrame,alarmLineLayout); 170 mGeneral->initAlarm(topFrame,alarmLineLayout);
165 mGeneral->initClass(topFrame,alarmLineLayout); 171 mGeneral->initClass(topFrame,alarmLineLayout);
166 mGeneral->initDescription(topFrame,topLayout); 172 mGeneral->initDescription(topFrame,topLayout);
167 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 173 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
168 mGeneral->initCategories( topFrame, detailsLayout ); 174 mGeneral->initCategories( topFrame, detailsLayout );
169 mGeneral->initSecrecy( topFrame, detailsLayout ); 175 mGeneral->initSecrecy( topFrame, detailsLayout );
170 } 176 }
171 177
172 mGeneral->finishSetup(); 178 mGeneral->finishSetup();
173 179
174} 180}
175 181
176void KOEventEditor::setupRecurrence() 182void KOEventEditor::setupRecurrence()
177{ 183{
178 QFrame *topFrame = addPage( i18n("Recurrence") ); 184 QFrame *topFrame = addPage( i18n("Recurrence") );
179 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 185 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
180 186
181 mRecurrence = new KOEditorRecurrence( topFrame ); 187 mRecurrence = new KOEditorRecurrence( topFrame );
182 topLayout->addWidget( mRecurrence ); 188 topLayout->addWidget( mRecurrence );
183} 189}
184 190
185void KOEventEditor::editEvent(Event *event, bool showDescription) 191void KOEventEditor::editEvent(Event *event, bool showDescription)
186{ 192{
187 // init(); 193 // init();
188 194
189 mEvent = event; 195 mEvent = event;
190 readEvent(mEvent); 196 readEvent(mEvent);
191 if ( showDescription ) { 197 if ( showDescription ) {
192 showPage( 1 ); 198 showPage( 1 );
193 mGeneral->setFocusOn( 1 ); 199 mGeneral->setFocusOn( 1 );
194 } else { 200 } else {
195 showPage( 0 ); 201 showPage( 0 );
196 mGeneral->setFocusOn( 2 ); 202 mGeneral->setFocusOn( 2 );
197 } 203 }
198} 204}
199 205
200void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay ) 206void KOEventEditor::newEvent( QDateTime from, QDateTime to, bool allDay )
201{ 207{
202 // init(); 208 // init();
203 209
204 mEvent = 0; 210 mEvent = 0;
205 setDefaults(from,to,allDay); 211 setDefaults(from,to,allDay);
206} 212}
207 213
208void KOEventEditor::loadDefaults() 214void KOEventEditor::loadDefaults()
209{ 215{
210 int fmt = KOPrefs::instance()->mStartTime; 216 int fmt = KOPrefs::instance()->mStartTime;
211 217
212 QDateTime from(QDate::currentDate(), QTime(fmt,0,0)); 218 QDateTime from(QDate::currentDate(), QTime(fmt,0,0));
213 QDateTime to(QDate::currentDate(), 219 QDateTime to(QDate::currentDate(),
214 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0)); 220 QTime(fmt+KOPrefs::instance()->mDefaultDuration,0,0));
215 221
216 setDefaults(from,to,false); 222 setDefaults(from,to,false);
217} 223}
218 224
219bool KOEventEditor::processInput( bool emitTime ) 225bool KOEventEditor::processInput( bool emitTime )
220{ 226{
221 if (!validateInput()) return false; 227 if (!validateInput()) return false;
222 228
223 Event *event = 0; 229 Event *event = 0;
224 230
225 if (mEvent) event = mEvent; 231 if (mEvent) event = mEvent;
226 else { 232 else {
227 event = new Event; 233 event = new Event;
228 event->setOrganizer(KOPrefs::instance()->email()); 234 event->setOrganizer(KOPrefs::instance()->email());
229 } 235 }
230 236
231 writeEvent(event); 237 writeEvent(event);
232 if ( emitTime ) { 238 if ( emitTime ) {
233 globalFlagBlockAgenda = 1; 239 globalFlagBlockAgenda = 1;
234 emit showAgendaView( false ); 240 emit showAgendaView( false );
235 emit jumpToTime( event->dtStart().date() ); 241 emit jumpToTime( event->dtStart().date() );
236 globalFlagBlockAgenda = 2; 242 globalFlagBlockAgenda = 2;
237 243
238 } 244 }
239 if (mEvent) { 245 if (mEvent) {
240 event->setRevision(event->revision()+1); 246 event->setRevision(event->revision()+1);
241 emit eventChanged(event); 247 emit eventChanged(event);
242 } else { 248 } else {
diff --git a/korganizer/koincidenceeditor.cpp b/korganizer/koincidenceeditor.cpp
index 9813a80..9bc0302 100644
--- a/korganizer/koincidenceeditor.cpp
+++ b/korganizer/koincidenceeditor.cpp
@@ -1,185 +1,185 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qdatetime.h> 29#include <qdatetime.h>
30#include <qdir.h> 30#include <qdir.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36#include <kfiledialog.h> 36#include <kfiledialog.h>
37 37
38#include <libkdepim/categoryselectdialog.h> 38#include <libkdepim/categoryselectdialog.h>
39#include <libkdepim/kinputdialog.h> 39#include <libkdepim/kinputdialog.h>
40 40
41#include <libkcal/calendarlocal.h> 41#include <libkcal/calendarlocal.h>
42#include <libkcal/icalformat.h> 42#include <libkcal/icalformat.h>
43 43
44#include "koprefs.h" 44#include "koprefs.h"
45 45
46#include "koincidenceeditor.h" 46#include "koincidenceeditor.h"
47 47
48KOIncidenceEditor::KOIncidenceEditor( const QString &caption, 48KOIncidenceEditor::KOIncidenceEditor( const QString &caption,
49 Calendar *calendar, QWidget *parent ) : 49 Calendar *calendar, QWidget *parent ) :
50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok, 50 KDialogBase( Tabbed, caption, Ok | Apply | Cancel |/* Default | */User1, Ok,
51 parent, caption, true, false ), 51 parent, caption, true, false ),
52 mSaveTemplateDialog( 0 ) 52 mSaveTemplateDialog( 0 )
53{ 53{
54 mCalendar = calendar; 54 mCalendar = calendar;
55 55
56 setButtonText( Default, i18n("Template...") ); 56 setButtonText( Default, i18n("Template...") );
57 57
58 QString saveTemplateText; 58 QString saveTemplateText;
59 // if ( KOPrefs::instance()->mCompactDialogs ) { 59 // if ( KOPrefs::instance()->mCompactDialogs ) {
60// showButton( User1, false ); 60// showButton( User1, false );
61// showButton( Apply, false ); 61// showButton( Apply, false );
62// } else { 62// } else {
63 showButton( Apply, false ); 63 showButton( Apply, false );
64 saveTemplateText = i18n("Ok+Agenda"); 64 saveTemplateText = i18n("Ok+Agenda");
65 // } 65 // }
66 setButtonText( User1, saveTemplateText ); 66 setButtonText( User1, saveTemplateText );
67 67
68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this ); 68 //mCategoryDialog = new KPIM::CategorySelectDialog( KOPrefs::instance(), this );
69 // KOGlobals::fitDialogToScreen( mCategoryDialog ); 69 // KOGlobals::fitDialogToScreen( mCategoryDialog );
70 70
71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories())); 71 //connect(mCategoryDialog,SIGNAL(editCategories()),SIGNAL(editCategories()));
72 72
73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) ); 73 //connect( this, SIGNAL( defaultClicked() ), SLOT( slotLoadTemplate() ) );
74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) ); 74 // connect( this, SIGNAL( user1Clicked() ), SLOT( slotSaveTemplate() ) );
75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) ); 75 connect( this, SIGNAL( user1Clicked() ), SLOT( slotShowIncidence() ) );
76} 76}
77 77
78KOIncidenceEditor::~KOIncidenceEditor() 78KOIncidenceEditor::~KOIncidenceEditor()
79{ 79{
80 //delete mCategoryDialog; 80 //delete mCategoryDialog;
81} 81}
82 82
83void KOIncidenceEditor::setupAttendeesTab() 83void KOIncidenceEditor::setupAttendeesTab()
84{ 84{
85 QFrame *topFrame = addPage(i18n("Attendees")); 85 QFrame *topFrame = addPage(i18n("Attendees"));
86 86
87 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 87 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
88 88
89 mDetails = new KOEditorDetails(spacingHint(),topFrame); 89 mDetails = new KOEditorDetails(spacingHint()-2,topFrame);
90 topLayout->addWidget(mDetails); 90 topLayout->addWidget(mDetails);
91} 91}
92 92
93 93
94void KOIncidenceEditor::slotApply() 94void KOIncidenceEditor::slotApply()
95{ 95{
96 processInput( false ); 96 processInput( false );
97} 97}
98void KOIncidenceEditor::accept() 98void KOIncidenceEditor::accept()
99{ 99{
100 slotOk(); 100 slotOk();
101} 101}
102void KOIncidenceEditor::slotOk() 102void KOIncidenceEditor::slotOk()
103{ 103{
104 if ( processInput( false ) ) QDialog::accept(); 104 if ( processInput( false ) ) QDialog::accept();
105} 105}
106 106
107void KOIncidenceEditor::updateCategoryConfig() 107void KOIncidenceEditor::updateCategoryConfig()
108{ 108{
109 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! "); 109 qDebug("KOIncidenceEditor::updateCategoryConfig() is dead! ");
110 //mCategoryDialog->updateCategoryConfig(); 110 //mCategoryDialog->updateCategoryConfig();
111} 111}
112 112
113void KOIncidenceEditor::slotCancel() 113void KOIncidenceEditor::slotCancel()
114{ 114{
115 reject(); 115 reject();
116} 116}
117 117
118void KOIncidenceEditor::slotLoadTemplate() 118void KOIncidenceEditor::slotLoadTemplate()
119{ 119{
120 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl; 120 kdDebug() << "KOIncidenceEditor::loadTemplate()" << endl;
121} 121}
122void KOIncidenceEditor::slotShowIncidence() 122void KOIncidenceEditor::slotShowIncidence()
123{ 123{
124 124
125 if ( processInput(true ) ) { 125 if ( processInput(true ) ) {
126 accept(); 126 accept();
127 } 127 }
128} 128}
129 129
130void KOIncidenceEditor::slotSaveTemplate() 130void KOIncidenceEditor::slotSaveTemplate()
131{ 131{
132 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl; 132 kdDebug() << "KOIncidenceEditor::saveTemplate()" << endl;
133} 133}
134 134
135void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type ) 135void KOIncidenceEditor::createSaveTemplateDialog( SaveTemplateDialog::IncidenceType type )
136{ 136{
137 if ( !mSaveTemplateDialog ) { 137 if ( !mSaveTemplateDialog ) {
138 mSaveTemplateDialog = new SaveTemplateDialog( type, this ); 138 mSaveTemplateDialog = new SaveTemplateDialog( type, this );
139 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ), 139 connect( mSaveTemplateDialog, SIGNAL( templateSelected( const QString & ) ),
140 SLOT( saveTemplate( const QString & ) ) ); 140 SLOT( saveTemplate( const QString & ) ) );
141 } 141 }
142 mSaveTemplateDialog->show(); 142 mSaveTemplateDialog->show();
143 mSaveTemplateDialog->raise(); 143 mSaveTemplateDialog->raise();
144} 144}
145 145
146void KOIncidenceEditor::saveAsTemplate( Incidence *incidence, 146void KOIncidenceEditor::saveAsTemplate( Incidence *incidence,
147 const QString &templateName ) 147 const QString &templateName )
148{ 148{
149 CalendarLocal cal; 149 CalendarLocal cal;
150 cal.addIncidence( incidence ); 150 cal.addIncidence( incidence );
151 ICalFormat format; 151 ICalFormat format;
152 format.save( &cal, templateName ); 152 format.save( &cal, templateName );
153} 153}
154 154
155QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type, 155QString KOIncidenceEditor::loadTemplate( Calendar *cal, const QString &type,
156 const QStringList &templates ) 156 const QStringList &templates )
157{ 157{
158 // bool ok = false; 158 // bool ok = false;
159// QString templateName = KInputDialog::getItem( i18n("Load Template"), 159// QString templateName = KInputDialog::getItem( i18n("Load Template"),
160// i18n("Select a template to load:"), templates, 0, &ok ); 160// i18n("Select a template to load:"), templates, 0, &ok );
161// if ( !ok || templateName.isEmpty() ) return QString::null; 161// if ( !ok || templateName.isEmpty() ) return QString::null;
162 162
163// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" + 163// QString fileName = locateLocal( "data", "korganizer/templates/" + type + "/" +
164// templateName ); 164// templateName );
165// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this ); 165// fn =KFileDialog:: getOpenFileName( fn, "Import filename(*.ics/*.vcs)", this );
166 166
167 // QString fileName;// =locateLocal( "templates", incidence->type() ); 167 // QString fileName;// =locateLocal( "templates", incidence->type() );
168// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this ); 168// fileName=KFileDialog:: getOpenFileName( fileName, "Load "+incidence()->type(), this );
169// if ( fileNamelength() == 0) 169// if ( fileNamelength() == 0)
170// return QString::null; 170// return QString::null;
171// if ( fileName.isEmpty() ) { 171// if ( fileName.isEmpty() ) {
172// KMessageBox::error( this, i18n("Unable to find template '%1'.") 172// KMessageBox::error( this, i18n("Unable to find template '%1'.")
173// .arg( fileName ) ); 173// .arg( fileName ) );
174// return QString::null; 174// return QString::null;
175// } else { 175// } else {
176// ICalFormat format; 176// ICalFormat format;
177// if ( !format.load( cal, fileName ) ) { 177// if ( !format.load( cal, fileName ) ) {
178// KMessageBox::error( this, i18n("Error loading template file '%1'.") 178// KMessageBox::error( this, i18n("Error loading template file '%1'.")
179// .arg( fileName ) ); 179// .arg( fileName ) );
180// return QString::null; 180// return QString::null;
181// } 181// }
182// } 182// }
183 183
184 return ""; 184 return "";
185} 185}
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 8b90ae5..555c1b1 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -27,195 +27,199 @@
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34 34
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40 40
41#include <libkdepim/categoryselectdialog.h> 41#include <libkdepim/categoryselectdialog.h>
42#include <libkcal/calendarlocal.h> 42#include <libkcal/calendarlocal.h>
43#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
44#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46#include <kresources/resourceselectdialog.h> 46#include <kresources/resourceselectdialog.h>
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50#include "kolocationbox.h" 50#include "kolocationbox.h"
51 51
52#include "kotodoeditor.h" 52#include "kotodoeditor.h"
53extern int globalFlagBlockAgenda; 53extern int globalFlagBlockAgenda;
54 54
55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
57{ 57{
58 mTodo = 0; 58 mTodo = 0;
59 mRelatedTodo = 0; 59 mRelatedTodo = 0;
60 findButton(User1)->hide(); 60 findButton(User1)->hide();
61 init(); 61 init();
62 if ( QApplication::desktop()->height() <= 240 ) 62 if ( QApplication::desktop()->height() <= 240 )
63 hideButtons(); 63 hideButtons();
64} 64}
65 65
66KOTodoEditor::~KOTodoEditor() 66KOTodoEditor::~KOTodoEditor()
67{ 67{
68 emit dialogClose( mTodo ); 68 emit dialogClose( mTodo );
69} 69}
70 70
71void KOTodoEditor::init() 71void KOTodoEditor::init()
72{ 72{
73 setupGeneral(); 73 setupGeneral();
74 setupAttendeesTab(); 74 setupAttendeesTab();
75 setupRecurrence(); 75 setupRecurrence();
76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
78 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)), 78 connect(mGeneral,SIGNAL(dateTimesChanged(QDateTime,QDateTime)),
79 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime))); 79 mRecurrence,SLOT(setDefaultsDates(QDateTime,QDateTime)));
80} 80}
81void KOTodoEditor::setupRecurrence() 81void KOTodoEditor::setupRecurrence()
82{ 82{
83 QFrame *topFrame = addPage( i18n("Recurrence") ); 83 QFrame *topFrame = addPage( i18n("Recurrence") );
84 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 84 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
85 85
86 mRecurrence = new KOEditorRecurrence( topFrame ); 86 mRecurrence = new KOEditorRecurrence( topFrame );
87 topLayout->addWidget( mRecurrence ); 87 topLayout->addWidget( mRecurrence );
88} 88}
89 89
90void KOTodoEditor::setCategories( QString s ) 90void KOTodoEditor::setCategories( QString s )
91{ 91{
92 mGeneral->setCategories(s); 92 mGeneral->setCategories(s);
93} 93}
94void KOTodoEditor::setSecrecy( int sec ) 94void KOTodoEditor::setSecrecy( int sec )
95{ 95{
96 mGeneral->setSecrecy( sec ); 96 mGeneral->setSecrecy( sec );
97} 97}
98void KOTodoEditor::reload() 98void KOTodoEditor::reload()
99{ 99{
100 if ( mTodo ) readTodo( mTodo ); 100 if ( mTodo ) readTodo( mTodo );
101} 101}
102 102
103void KOTodoEditor::setupGeneral() 103void KOTodoEditor::setupGeneral()
104{ 104{
105 mGeneral = new KOEditorGeneralTodo(this); 105 mGeneral = new KOEditorGeneralTodo(this);
106 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 106 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
107 107
108 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 108 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
109 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 109 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
110 // mGeneral,SLOT(setCategories(const QString &))); 110 // mGeneral,SLOT(setCategories(const QString &)));
111 111
112 if (KOPrefs::instance()->mCompactDialogs) { 112 if (KOPrefs::instance()->mCompactDialogs) {
113 QFrame *topFrame = addPage(i18n("General")); 113 QFrame *topFrame = addPage(i18n("General"));
114 114
115 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 115 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
116 if ( QApplication::desktop()->width() < 480 ) { 116 if ( QApplication::desktop()->width() < 480 ) {
117 topLayout->setMargin(marginHintSmall()); 117 topLayout->setMargin(marginHintSmall());
118 topLayout->setSpacing(spacingHintSmall()); 118 topLayout->setSpacing(spacingHintSmall());
119 } else { 119 } else {
120 topLayout->setMargin(marginHint()); 120 topLayout->setMargin(marginHint());
121 topLayout->setSpacing(spacingHint()); 121 topLayout->setSpacing(spacingHint());
122 } 122 }
123 topLayout->addStretch( 1 );
123 mGeneral->initHeader(topFrame,topLayout); 124 mGeneral->initHeader(topFrame,topLayout);
125 topLayout->addStretch( 1 );
124 mGeneral->initTime(topFrame,topLayout); 126 mGeneral->initTime(topFrame,topLayout);
127 topLayout->addStretch( 1 );
125 mGeneral->initAlarm(topFrame,topLayout); 128 mGeneral->initAlarm(topFrame,topLayout);
129 topLayout->addStretch( 1 );
126 mGeneral->enableAlarm( false ); 130 mGeneral->enableAlarm( false );
127 131
128 132
129 QBoxLayout *priorityLayout; 133 QBoxLayout *priorityLayout;
130 if ( QApplication::desktop()->width() < 500 ) 134 if ( QApplication::desktop()->width() < 500 )
131 priorityLayout = new QVBoxLayout( topLayout ); 135 priorityLayout = new QVBoxLayout( topLayout );
132 else 136 else
133 priorityLayout = new QHBoxLayout( topLayout ); 137 priorityLayout = new QHBoxLayout( topLayout );
134 QWidget* prioWidget = new QWidget (topFrame); 138 QWidget* prioWidget = new QWidget (topFrame);
135 priorityLayout->addWidget( prioWidget ); 139 priorityLayout->addWidget( prioWidget );
136 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); 140 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget);
137 141
138 142
139 QIconSet icon; 143 QIconSet icon;
140 if ( QApplication::desktop()->width() < 321 ) 144 if ( QApplication::desktop()->width() < 321 )
141 icon = SmallIcon("fileimport16"); 145 icon = SmallIcon("fileimport16");
142 else 146 else
143 icon = SmallIcon("fileimport"); 147 icon = SmallIcon("fileimport");
144 QPushButton * loadTemplate = new QPushButton( prioWidget); 148 QPushButton * loadTemplate = new QPushButton( prioWidget);
145 loadTemplate->setIconSet (icon ) ; 149 loadTemplate->setIconSet (icon ) ;
146 int size = loadTemplate->sizeHint().height(); 150 int size = loadTemplate->sizeHint().height();
147 loadTemplate->setFixedSize( size, size ); 151 loadTemplate->setFixedSize( size, size );
148 if ( QApplication::desktop()->width() < 321 ) 152 if ( QApplication::desktop()->width() < 321 )
149 icon = SmallIcon("fileexport16"); 153 icon = SmallIcon("fileexport16");
150 else 154 else
151 icon = SmallIcon("fileexport"); 155 icon = SmallIcon("fileexport");
152 QPushButton * saveTemplate = new QPushButton( prioWidget); 156 QPushButton * saveTemplate = new QPushButton( prioWidget);
153 saveTemplate->setIconSet (icon ) ; 157 saveTemplate->setIconSet (icon ) ;
154 saveTemplate->setFixedSize( size, size ); 158 saveTemplate->setFixedSize( size, size );
155 159
156 priorityLayout2->addWidget(loadTemplate); 160 priorityLayout2->addWidget(loadTemplate);
157 priorityLayout2->addWidget(saveTemplate); 161 priorityLayout2->addWidget(saveTemplate);
158 mGeneral->initPriority(prioWidget,priorityLayout2); 162 mGeneral->initPriority(prioWidget,priorityLayout2);
159 mGeneral->initCategories( topFrame, priorityLayout ); 163 mGeneral->initCategories( topFrame, priorityLayout );
160 topLayout->addStretch(1); 164 topLayout->addStretch(1);
161 165
162 QFrame *topFrame2 = addPage(i18n("Details")); 166 QFrame *topFrame2 = addPage(i18n("Details"));
163 167
164 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2); 168 QBoxLayout *topLayout2 = new QVBoxLayout(topFrame2);
165 topLayout2->setMargin(marginHint()); 169 topLayout2->setMargin(marginHint());
166 topLayout2->setSpacing(spacingHint()); 170 topLayout2->setSpacing(spacingHint());
167 171
168 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 ); 172 QHBoxLayout *completionLayout = new QHBoxLayout( topLayout2 );
169 mGeneral->initCompletion(topFrame2,completionLayout); 173 mGeneral->initCompletion(topFrame2,completionLayout);
170 174
171 175
172 mGeneral->initSecrecy( topFrame2, topLayout2 ); 176 mGeneral->initSecrecy( topFrame2, topLayout2 );
173 mGeneral->initDescription(topFrame2,topLayout2); 177 mGeneral->initDescription(topFrame2,topLayout2);
174 178
175 // QHBox * hb = new QHBox ( topFrame2 ); 179 // QHBox * hb = new QHBox ( topFrame2 );
176 // topLayout2->addWidget(hb); 180 // topLayout2->addWidget(hb);
177 // hb->setSpacing( 3 ); 181 // hb->setSpacing( 3 );
178 182
179 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 183 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
180 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 184 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
181 185
182 } else { 186 } else {
183 QFrame *topFrame = addPage(i18n("General")); 187 QFrame *topFrame = addPage(i18n("General"));
184 188
185 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 189 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
186 topLayout->setSpacing(spacingHint()); 190 topLayout->setSpacing(spacingHint());
187 191
188 mGeneral->initHeader(topFrame,topLayout); 192 mGeneral->initHeader(topFrame,topLayout);
189 mGeneral->initTime(topFrame,topLayout); 193 mGeneral->initTime(topFrame,topLayout);
190 mGeneral->initStatus(topFrame,topLayout); 194 mGeneral->initStatus(topFrame,topLayout);
191 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout); 195 QBoxLayout *alarmLineLayout = new QHBoxLayout(topLayout);
192 mGeneral->initAlarm(topFrame,alarmLineLayout); 196 mGeneral->initAlarm(topFrame,alarmLineLayout);
193 mGeneral->initDescription(topFrame,topLayout); 197 mGeneral->initDescription(topFrame,topLayout);
194 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout); 198 QBoxLayout *detailsLayout = new QHBoxLayout(topLayout);
195 mGeneral->initCategories( topFrame, detailsLayout ); 199 mGeneral->initCategories( topFrame, detailsLayout );
196 mGeneral->initSecrecy( topFrame, detailsLayout ); 200 mGeneral->initSecrecy( topFrame, detailsLayout );
197 } 201 }
198 mGeneral->finishSetup(); 202 mGeneral->finishSetup();
199 203
200} 204}
201 205
202void KOTodoEditor::editTodo(Todo *todo, bool editDescription) 206void KOTodoEditor::editTodo(Todo *todo, bool editDescription)
203{ 207{
204 //init(); 208 //init();
205 209
206 mTodo = todo; 210 mTodo = todo;
207 readTodo(mTodo); 211 readTodo(mTodo);
208 if ( editDescription ) { 212 if ( editDescription ) {
209 showPage( 1 ); 213 showPage( 1 );
210 mGeneral->setFocusOn( 1 ); 214 mGeneral->setFocusOn( 1 );
211 } else { 215 } else {
212 showPage( 0 ); 216 showPage( 0 );
213 mGeneral->setFocusOn( 2 ); 217 mGeneral->setFocusOn( 2 );
214 } 218 }
215 checkRecurrence(); 219 checkRecurrence();
216} 220}
217 221
218void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay) 222void KOTodoEditor::newTodo(QDateTime due,Todo *relatedTodo,bool allDay)
219{ 223{
220 //init(); 224 //init();
221 225