-rw-r--r-- | korganizer/koeditorgeneral.cpp | 65 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.h | 4 | ||||
-rw-r--r-- | korganizer/koeventpopupmenu.cpp | 1 |
3 files changed, 62 insertions, 8 deletions
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) | |||
82 | headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); | 82 | headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); |
83 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); | 83 | QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); |
84 | headerLayout->addWidget(summaryLabel,1,0); | 84 | headerLayout->addWidget(summaryLabel,0,0); |
85 | 85 | ||
86 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); | 86 | mSummaryEdit = new KOLocationBox(TRUE,parent, 10); |
@@ -94,12 +94,15 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | |||
94 | // 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 } |
95 | // mSummaryEdit = new QLineEdit(parent); | 95 | // mSummaryEdit = new QLineEdit(parent); |
96 | headerLayout->addWidget(mSummaryEdit,1,1); | 96 | if ( QApplication::desktop()->height() < 320 ) |
97 | headerLayout->addWidget(mSummaryEdit,0,1); | ||
98 | else | ||
99 | headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); | ||
97 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 100 | connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
98 | 101 | ||
99 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); | 102 | QLabel *locationLabel = new QLabel(i18n("Location:"),parent); |
100 | if ( QApplication::desktop()->height() < 320 ) | 103 | if ( QApplication::desktop()->height() < 320 ) |
101 | headerLayout->addWidget(locationLabel,1,2); | 104 | headerLayout->addWidget(locationLabel,0,2); |
102 | else | 105 | else |
103 | headerLayout->addWidget(locationLabel,2,0); | 106 | headerLayout->addWidget(locationLabel,1,0); |
104 | 107 | ||
105 | mLocationEdit = new KOLocationBox(TRUE,parent,10); | 108 | mLocationEdit = new KOLocationBox(TRUE,parent,10); |
@@ -110,13 +113,20 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | |||
110 | // mLocationEdit = new QLineEdit(parent); | 113 | // mLocationEdit = new QLineEdit(parent); |
111 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); | 114 | connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); |
115 | |||
116 | mCalendarBox = new QComboBox ( parent ); | ||
117 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | ||
112 | if ( QApplication::desktop()->height() < 320 ) { | 118 | if ( QApplication::desktop()->height() < 320 ) { |
113 | headerLayout->addWidget(mLocationEdit,1,3); | 119 | headerLayout->addWidget(mLocationEdit,0,3); |
120 | headerLayout->addWidget(mCalendarBox,0,4); | ||
114 | headerLayout->setColStretch( 1, 10); | 121 | headerLayout->setColStretch( 1, 10); |
115 | headerLayout->setColStretch( 3, 10); | 122 | headerLayout->setColStretch( 3, 10); |
123 | mCalendarBox->setMaximumWidth( 64 ); | ||
116 | } | 124 | } |
117 | else { | 125 | else { |
118 | headerLayout->addWidget(mLocationEdit,2,1); | 126 | headerLayout->addWidget(mLocationEdit,1,1); |
127 | headerLayout->addWidget(mCalendarBox,1,2); | ||
119 | headerLayout->setColStretch( 1, 10); | 128 | headerLayout->setColStretch( 1, 10); |
120 | } | 129 | } |
130 | |||
121 | } | 131 | } |
122 | void KOEditorGeneral::setFocusOn( int i ) | 132 | void KOEditorGeneral::setFocusOn( int i ) |
@@ -437,4 +447,5 @@ void KOEditorGeneral::setDefaults(bool allDay) | |||
437 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 447 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
438 | setCategories(""); | 448 | setCategories(""); |
449 | fillCalCombo(); | ||
439 | } | 450 | } |
440 | void KOEditorGeneral::setSecrecy( int num ) | 451 | void KOEditorGeneral::setSecrecy( int num ) |
@@ -442,7 +453,46 @@ void KOEditorGeneral::setSecrecy( int num ) | |||
442 | mSecrecyCombo->setCurrentItem(num); | 453 | mSecrecyCombo->setCurrentItem(num); |
443 | } | 454 | } |
444 | void KOEditorGeneral::readIncidence(Incidence *event) | 455 | void KOEditorGeneral::fillCalCombo( int setToID ) |
445 | { | 456 | { |
457 | mCalendarBox->clear(); | ||
458 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
459 | int std = 0; | ||
460 | int count = 0; | ||
461 | while ( kkf ) { | ||
462 | if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) { | ||
463 | if ( setToID ) { | ||
464 | if ( kkf->mCalNumber == setToID ) | ||
465 | std = count; | ||
466 | } else { | ||
467 | if ( kkf->isStandard ) { | ||
468 | std = count; | ||
469 | } | ||
470 | } | ||
471 | ++count; | ||
472 | mCalendarBox->insertItem( kkf->mName ); | ||
473 | } | ||
474 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
475 | } | ||
476 | mCalendarBox->setCurrentItem( std ); | ||
477 | if ( KOPrefs::instance()->mCalendars.count() == 1 ) | ||
478 | mCalendarBox->hide(); | ||
479 | else | ||
480 | mCalendarBox->show(); | ||
481 | |||
482 | } | ||
483 | int KOEditorGeneral::getCalendarID() | ||
484 | { | ||
485 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
486 | while ( kkf ) { | ||
487 | if ( mCalendarBox->currentText() == kkf->mName) | ||
488 | return kkf->mCalNumber; | ||
489 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
490 | } | ||
491 | return 1; | ||
492 | } | ||
446 | 493 | ||
494 | void KOEditorGeneral::readIncidence(Incidence *event) | ||
495 | { | ||
496 | fillCalCombo( event->calID() ); | ||
447 | mAlarmMessage = event->summary(); | 497 | mAlarmMessage = event->summary(); |
448 | if ( ! event->location().isEmpty() ) | 498 | if ( ! event->location().isEmpty() ) |
@@ -570,3 +620,4 @@ void KOEditorGeneral::writeIncidence(Incidence *event) | |||
570 | } | 620 | } |
571 | } | 621 | } |
622 | event->setCalID( getCalendarID() ); | ||
572 | } | 623 | } |
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 @@ | |||
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qcombobox.h> | ||
38 | 39 | ||
39 | #include <ktextedit.h> | 40 | #include <ktextedit.h> |
@@ -73,4 +74,5 @@ class KOEditorGeneral : public QObject | |||
73 | void enableAlarm( bool enable ); | 74 | void enableAlarm( bool enable ); |
74 | void setSecrecy( int num ); | 75 | void setSecrecy( int num ); |
76 | int getCalendarID(); | ||
75 | public slots: | 77 | public slots: |
76 | void setCategories(const QString &); | 78 | void setCategories(const QString &); |
@@ -93,4 +95,5 @@ class KOEditorGeneral : public QObject | |||
93 | 95 | ||
94 | protected: | 96 | protected: |
97 | void fillCalCombo( int setToID = 0 ); | ||
95 | int mNextFocus; | 98 | int mNextFocus; |
96 | //QLineEdit *mSummaryEdit; | 99 | //QLineEdit *mSummaryEdit; |
@@ -98,4 +101,5 @@ class KOEditorGeneral : public QObject | |||
98 | KOLocationBox *mSummaryEdit; | 101 | KOLocationBox *mSummaryEdit; |
99 | KOLocationBox *mLocationEdit; | 102 | KOLocationBox *mLocationEdit; |
103 | QComboBox *mCalendarBox; | ||
100 | QLabel *mAlarmBell; | 104 | QLabel *mAlarmBell; |
101 | QCheckBox *mAlarmButton; | 105 | 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 ) | |||
79 | setItemEnabled(*it,enable); | 79 | setItemEnabled(*it,enable); |
80 | } | 80 | } |
81 | |||
82 | } | 81 | } |
83 | 82 | ||