-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 65 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.h | 4 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 3 |
5 files changed, 67 insertions, 8 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 71d7208..27d37c4 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -4,4 +4,6 @@ Info about the changes in new versions of KDE-Pim/Pi Fixed a problem in KA/Pi search. +Fixed some minor problems in KO/Pi. +Added calendar selection possibility to the todo view popup and to the event/todo editor. diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 29e68b3..753630b 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -82,5 +82,5 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); - headerLayout->addWidget(summaryLabel,1,0); + headerLayout->addWidget(summaryLabel,0,0); mSummaryEdit = new KOLocationBox(TRUE,parent, 10); @@ -94,12 +94,15 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } // mSummaryEdit = new QLineEdit(parent); - headerLayout->addWidget(mSummaryEdit,1,1); + if ( QApplication::desktop()->height() < 320 ) + headerLayout->addWidget(mSummaryEdit,0,1); + else + headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); QLabel *locationLabel = new QLabel(i18n("Location:"),parent); if ( QApplication::desktop()->height() < 320 ) - headerLayout->addWidget(locationLabel,1,2); + headerLayout->addWidget(locationLabel,0,2); else - headerLayout->addWidget(locationLabel,2,0); + headerLayout->addWidget(locationLabel,1,0); mLocationEdit = new KOLocationBox(TRUE,parent,10); @@ -110,13 +113,20 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) // mLocationEdit = new QLineEdit(parent); connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); + + mCalendarBox = new QComboBox ( parent ); + mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); if ( QApplication::desktop()->height() < 320 ) { - headerLayout->addWidget(mLocationEdit,1,3); + headerLayout->addWidget(mLocationEdit,0,3); + headerLayout->addWidget(mCalendarBox,0,4); headerLayout->setColStretch( 1, 10); headerLayout->setColStretch( 3, 10); + mCalendarBox->setMaximumWidth( 64 ); } else { - headerLayout->addWidget(mLocationEdit,2,1); + headerLayout->addWidget(mLocationEdit,1,1); + headerLayout->addWidget(mCalendarBox,1,2); headerLayout->setColStretch( 1, 10); } + } void KOEditorGeneral::setFocusOn( int i ) @@ -437,4 +447,5 @@ void KOEditorGeneral::setDefaults(bool allDay) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; setCategories(""); + fillCalCombo(); } void KOEditorGeneral::setSecrecy( int num ) @@ -442,7 +453,46 @@ void KOEditorGeneral::setSecrecy( int num ) mSecrecyCombo->setCurrentItem(num); } -void KOEditorGeneral::readIncidence(Incidence *event) +void KOEditorGeneral::fillCalCombo( int setToID ) +{ + mCalendarBox->clear(); + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + int std = 0; + int count = 0; + while ( kkf ) { + if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) { + if ( setToID ) { + if ( kkf->mCalNumber == setToID ) + std = count; + } else { + if ( kkf->isStandard ) { + std = count; + } + } + ++count; + mCalendarBox->insertItem( kkf->mName ); + } + kkf = KOPrefs::instance()->mCalendars.next(); + } + mCalendarBox->setCurrentItem( std ); + if ( KOPrefs::instance()->mCalendars.count() == 1 ) + mCalendarBox->hide(); + else + mCalendarBox->show(); + +} +int KOEditorGeneral::getCalendarID() { + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + while ( kkf ) { + if ( mCalendarBox->currentText() == kkf->mName) + return kkf->mCalNumber; + kkf = KOPrefs::instance()->mCalendars.next(); + } + return 1; +} +void KOEditorGeneral::readIncidence(Incidence *event) +{ + fillCalCombo( event->calID() ); mAlarmMessage = event->summary(); if ( ! event->location().isEmpty() ) @@ -570,3 +620,4 @@ void KOEditorGeneral::writeIncidence(Incidence *event) } } + event->setCalID( getCalendarID() ); } diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index c463403..d8b15af 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h @@ -36,4 +36,5 @@ #include <qlayout.h> #include <qspinbox.h> +#include <qcombobox.h> #include <ktextedit.h> @@ -73,4 +74,5 @@ class KOEditorGeneral : public QObject void enableAlarm( bool enable ); void setSecrecy( int num ); + int getCalendarID(); public slots: void setCategories(const QString &); @@ -93,4 +95,5 @@ class KOEditorGeneral : public QObject protected: + void fillCalCombo( int setToID = 0 ); int mNextFocus; //QLineEdit *mSummaryEdit; @@ -98,4 +101,5 @@ class KOEditorGeneral : public QObject KOLocationBox *mSummaryEdit; KOLocationBox *mLocationEdit; + QComboBox *mCalendarBox; QLabel *mAlarmBell; QCheckBox *mAlarmButton; diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 77322e7..fc4d9a4 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp @@ -79,5 +79,4 @@ void KOEventPopupMenu::enableDefault( bool enable ) setItemEnabled(*it,enable); } - } diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index ca64e66..cce798f 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -224,4 +224,5 @@ bool CalendarLocal::addEvent( Event *event ) setModified( true ); + if ( event->calID() == 0 ) event->setCalID( mDefaultCalendar ); event->setCalEnabled( true ); @@ -278,4 +279,5 @@ bool CalendarLocal::addTodo( Todo *todo ) setModified( true ); + if ( todo->calID() == 0 ) todo->setCalID( mDefaultCalendar ); todo->setCalEnabled( true ); @@ -782,4 +784,5 @@ bool CalendarLocal::addJournal(Journal *journal) setModified( true ); + if ( journal->calID() == 0 ) journal->setCalID( mDefaultCalendar ); journal->setCalEnabled( true ); |