-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 | 7 |
5 files changed, 69 insertions, 10 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 | |||
@@ -1,53 +1,55 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.1.13 ************ | 3 | ********** VERSION 2.1.13 ************ |
4 | 4 | ||
5 | Fixed a problem in KA/Pi search. | 5 | Fixed a problem in KA/Pi search. |
6 | Fixed some minor problems in KO/Pi. | ||
7 | Added calendar selection possibility to the todo view popup and to the event/todo editor. | ||
6 | 8 | ||
7 | 9 | ||
8 | ********** VERSION 2.1.12 ************ | 10 | ********** VERSION 2.1.12 ************ |
9 | 11 | ||
10 | KO/Pi: | 12 | KO/Pi: |
11 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. | 13 | Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. |
12 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. | 14 | Fixed a problem with the month view when file was saved but KO/Pi was not the active window. |
13 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). | 15 | Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). |
14 | Fixed some other small problems. | 16 | Fixed some other small problems. |
15 | 17 | ||
16 | ********** VERSION 2.1.11 ************ | 18 | ********** VERSION 2.1.11 ************ |
17 | 19 | ||
18 | KO/Pi: | 20 | KO/Pi: |
19 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. | 21 | Because we can have many calendars now in KO/Pi we can have more than one journal entry per day. |
20 | Added features to handle (and add ) more than one journal entry per day. | 22 | Added features to handle (and add ) more than one journal entry per day. |
21 | Added option for a journal title. | 23 | Added option for a journal title. |
22 | 24 | ||
23 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. | 25 | Added info about the calendar, the item belongs to, to the event/todo/journal viewer. |
24 | Fixed a problem of the alarm of completed recurring todos. | 26 | Fixed a problem of the alarm of completed recurring todos. |
25 | Added to the event/todo editor to set quickly the category of an item. | 27 | Added to the event/todo editor to set quickly the category of an item. |
26 | 28 | ||
27 | 29 | ||
28 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. | 30 | Fixed some problems when calling KO/Pi or KA/Pi from the alarm applet. |
29 | 31 | ||
30 | Added KA/Pi multi sync to the multi sync called from the alarm applet. | 32 | Added KA/Pi multi sync to the multi sync called from the alarm applet. |
31 | 33 | ||
32 | ********** VERSION 2.1.10 ************ | 34 | ********** VERSION 2.1.10 ************ |
33 | 35 | ||
34 | KO/Pi: | 36 | KO/Pi: |
35 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. | 37 | Importing Birthdays will now create another file resource "Birthdays" and import the birthday data from KA/Pi into that file. |
36 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. | 38 | When a multidayevent is selected in monthview all occurences of this event in the monthview are now hightlighted. |
37 | Fixed a bug in searching for a small timerange, i.e. one day. | 39 | Fixed a bug in searching for a small timerange, i.e. one day. |
38 | 40 | ||
39 | KA/Pi: | 41 | KA/Pi: |
40 | Fixed two problems in csv export. | 42 | Fixed two problems in csv export. |
41 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. | 43 | Fixed problems when calling the contact selection dialog from KO/Pi or OM/Pi. |
42 | 44 | ||
43 | ********** VERSION 2.1.9 ************ | 45 | ********** VERSION 2.1.9 ************ |
44 | 46 | ||
45 | KO/Pi: | 47 | KO/Pi: |
46 | Fixed some problems of the new search options in the search dialog. | 48 | Fixed some problems of the new search options in the search dialog. |
47 | Fixed some problems in the new resource config options. | 49 | Fixed some problems in the new resource config options. |
48 | Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. | 50 | Changed the recurrence edit of events and todos such that the recurrence edit page now is notified about a change of the start date on the first page. |
49 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: | 51 | Fixed a problem creating new events in the agenda view if at the day/time is already an agenda item shown: |
50 | Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. | 52 | Now you can click on the bottom/top of an allday agenda item or on the left/right side of an agenda item to get the "new todo/new event" popup. |
51 | 53 | ||
52 | Fixed a problem in recurrence range in syncing with DTM. | 54 | Fixed a problem in recurrence range in syncing with DTM. |
53 | 55 | ||
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 29e68b3..753630b 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -36,133 +36,143 @@ | |||
36 | 36 | ||
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kdialog.h> | 38 | #include <kdialog.h> |
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | #include <kfiledialog.h> | 43 | #include <kfiledialog.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | 45 | ||
46 | #include <libkcal/todo.h> | 46 | #include <libkcal/todo.h> |
47 | #include <libkcal/event.h> | 47 | #include <libkcal/event.h> |
48 | #include <libkdepim/categoryselectdialog.h> | 48 | #include <libkdepim/categoryselectdialog.h> |
49 | #include <libkdepim/kdateedit.h> | 49 | #include <libkdepim/kdateedit.h> |
50 | 50 | ||
51 | #include "koprefs.h" | 51 | #include "koprefs.h" |
52 | #include "koglobals.h" | 52 | #include "koglobals.h" |
53 | 53 | ||
54 | #include "koeditorgeneral.h" | 54 | #include "koeditorgeneral.h" |
55 | #include "kolocationbox.h" | 55 | #include "kolocationbox.h" |
56 | #ifndef DESKTOP_VERSION | 56 | #ifndef DESKTOP_VERSION |
57 | #include <qpe/qpeapplication.h> | 57 | #include <qpe/qpeapplication.h> |
58 | #else | 58 | #else |
59 | #include <qapplication.h> | 59 | #include <qapplication.h> |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : | 62 | KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : |
63 | QObject( parent, name) | 63 | QObject( parent, name) |
64 | { | 64 | { |
65 | mNextFocus = 0; | 65 | mNextFocus = 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | KOEditorGeneral::~KOEditorGeneral() | 68 | KOEditorGeneral::~KOEditorGeneral() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) | 72 | void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) |
73 | { | 73 | { |
74 | QGridLayout *headerLayout = new QGridLayout(topLayout); | 74 | QGridLayout *headerLayout = new QGridLayout(topLayout); |
75 | 75 | ||
76 | #if 0 | 76 | #if 0 |
77 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); | 77 | mOwnerLabel = new QLabel(i18n("Owner:"),parent); |
78 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); | 78 | headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); |
79 | #endif | 79 | #endif |
80 | // 1 on pda | 80 | // 1 on pda |
81 | // 11 on desktop | 81 | // 11 on desktop |
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); |
87 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 87 | mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
88 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); | 88 | //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); |
89 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); | 89 | //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); |
90 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; | 90 | int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; |
91 | if ( QApplication::desktop()->width() > 320 ) | 91 | if ( QApplication::desktop()->width() > 320 ) |
92 | mSummaryEdit->setMaximumHeight( hei +6 ); | 92 | mSummaryEdit->setMaximumHeight( hei +6 ); |
93 | //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 ); |
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); |
106 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); | 109 | mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); |
107 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) | 110 | if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) |
108 | mLocationEdit->setMaximumHeight( hei + 6); | 111 | mLocationEdit->setMaximumHeight( hei + 6); |
109 | 112 | ||
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 ) |
123 | { | 133 | { |
124 | mNextFocus = i; | 134 | mNextFocus = i; |
125 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); | 135 | QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); |
126 | } | 136 | } |
127 | void KOEditorGeneral::slotSetFocusOn() | 137 | void KOEditorGeneral::slotSetFocusOn() |
128 | { | 138 | { |
129 | mNextFocus; | 139 | mNextFocus; |
130 | if ( mNextFocus == 1 ) { | 140 | if ( mNextFocus == 1 ) { |
131 | mDescriptionEdit->setFocus(); | 141 | mDescriptionEdit->setFocus(); |
132 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); | 142 | mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); |
133 | } | 143 | } |
134 | if ( mNextFocus == 2 ) { | 144 | if ( mNextFocus == 2 ) { |
135 | mSummaryEdit->setFocus(); | 145 | mSummaryEdit->setFocus(); |
136 | } | 146 | } |
137 | } | 147 | } |
138 | void KOEditorGeneral::editCategories() | 148 | void KOEditorGeneral::editCategories() |
139 | { | 149 | { |
140 | // qDebug("KOEditorGeneral::editCategories() "); | 150 | // qDebug("KOEditorGeneral::editCategories() "); |
141 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 151 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
142 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); | 152 | connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); |
143 | //KOGlobals::fitDialogToScreen( csd ); | 153 | //KOGlobals::fitDialogToScreen( csd ); |
144 | csd->setColorEnabled(); | 154 | csd->setColorEnabled(); |
145 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); | 155 | csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); |
146 | csd->exec(); | 156 | csd->exec(); |
147 | delete csd; | 157 | delete csd; |
148 | } | 158 | } |
149 | 159 | ||
150 | void KOEditorGeneral::showCatPopup() | 160 | void KOEditorGeneral::showCatPopup() |
151 | { | 161 | { |
152 | mCatPopup->clear(); | 162 | mCatPopup->clear(); |
153 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); | 163 | QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); |
154 | int index = 0; | 164 | int index = 0; |
155 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 165 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
156 | it != KOPrefs::instance()->mCustomCategories.end (); | 166 | it != KOPrefs::instance()->mCustomCategories.end (); |
157 | ++it) { | 167 | ++it) { |
158 | mCatPopup->insertItem (*it, index ); | 168 | mCatPopup->insertItem (*it, index ); |
159 | //mCategory[index] = *it; | 169 | //mCategory[index] = *it; |
160 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); | 170 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); |
161 | ++index; | 171 | ++index; |
162 | } | 172 | } |
163 | } | 173 | } |
164 | void KOEditorGeneral::selectedCatPopup( int index ) | 174 | void KOEditorGeneral::selectedCatPopup( int index ) |
165 | { | 175 | { |
166 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); | 176 | QStringList categories = QStringList::split (",", mCategoriesLabel->text()); |
167 | QString colcat = categories.first(); | 177 | QString colcat = categories.first(); |
168 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 178 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
@@ -391,104 +401,144 @@ void KOEditorGeneral::alarmDisable(bool disable) | |||
391 | } else { | 401 | } else { |
392 | //mAlarmBell->setEnabled(false); | 402 | //mAlarmBell->setEnabled(false); |
393 | mAlarmButton->setEnabled(false); | 403 | mAlarmButton->setEnabled(false); |
394 | mAlarmButton->setChecked(false); | 404 | mAlarmButton->setChecked(false); |
395 | mAlarmTimeEdit->setEnabled(false); | 405 | mAlarmTimeEdit->setEnabled(false); |
396 | mAlarmSoundButton->setEnabled(false); | 406 | mAlarmSoundButton->setEnabled(false); |
397 | mAlarmProgramButton->setEnabled(false); | 407 | mAlarmProgramButton->setEnabled(false); |
398 | mAlarmIncrCombo->setEnabled(false); | 408 | mAlarmIncrCombo->setEnabled(false); |
399 | } | 409 | } |
400 | } | 410 | } |
401 | 411 | ||
402 | void KOEditorGeneral::setCategories(const QString &str) | 412 | void KOEditorGeneral::setCategories(const QString &str) |
403 | { | 413 | { |
404 | QString tt = str; | 414 | QString tt = str; |
405 | QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); | 415 | QToolTip::add( mCategoriesLabel, i18n("<b>Click here to edit categories: </b>") +"<em>"+tt.replace( QRegExp(","),", ")+"</em>"); |
406 | mCategoriesLabel->setText(str); | 416 | mCategoriesLabel->setText(str); |
407 | } | 417 | } |
408 | 418 | ||
409 | void KOEditorGeneral::setDefaults(bool allDay) | 419 | void KOEditorGeneral::setDefaults(bool allDay) |
410 | { | 420 | { |
411 | #if 0 | 421 | #if 0 |
412 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); | 422 | mOwnerLabel->setText(i18n("Owner: ") + KOPrefs::instance()->fullName()); |
413 | #endif | 423 | #endif |
414 | 424 | ||
415 | mAlarmMessage = i18n("Edit new item"); | 425 | mAlarmMessage = i18n("Edit new item"); |
416 | enableAlarmEdit( !allDay ); | 426 | enableAlarmEdit( !allDay ); |
417 | 427 | ||
418 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 428 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
419 | int alarmTime; | 429 | int alarmTime; |
420 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 430 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
421 | int index = KOPrefs::instance()->mAlarmTime; | 431 | int index = KOPrefs::instance()->mAlarmTime; |
422 | if (index < 0 || index > 7) { | 432 | if (index < 0 || index > 7) { |
423 | alarmTime = 15; | 433 | alarmTime = 15; |
424 | } else { | 434 | } else { |
425 | alarmTime = a[index]; | 435 | alarmTime = a[index]; |
426 | } | 436 | } |
427 | mAlarmButton ->setChecked( false ); | 437 | mAlarmButton ->setChecked( false ); |
428 | mAlarmTimeEdit->setValue(alarmTime); | 438 | mAlarmTimeEdit->setValue(alarmTime); |
429 | mAlarmIncrCombo->setCurrentItem(0); | 439 | mAlarmIncrCombo->setCurrentItem(0); |
430 | enableAlarmEdit( false ); | 440 | enableAlarmEdit( false ); |
431 | //alarmDisable (false); | 441 | //alarmDisable (false); |
432 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); | 442 | mSecrecyCombo->setCurrentItem(Incidence::SecrecyPublic); |
433 | mCancelBox->setChecked( false ); | 443 | mCancelBox->setChecked( false ); |
434 | mSummaryEdit->setEditText(""); | 444 | mSummaryEdit->setEditText(""); |
435 | mLocationEdit->setEditText(""); | 445 | mLocationEdit->setEditText(""); |
436 | mDescriptionEdit->setText(""); | 446 | mDescriptionEdit->setText(""); |
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 ) |
441 | { | 452 | { |
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() ) |
449 | mAlarmMessage += " ("+event->location()+")"; | 499 | mAlarmMessage += " ("+event->location()+")"; |
450 | mAlarmIncrCombo->setCurrentItem(0); | 500 | mAlarmIncrCombo->setCurrentItem(0); |
451 | mSummaryEdit->setEditText(event->summary()); | 501 | mSummaryEdit->setEditText(event->summary()); |
452 | mLocationEdit->setEditText(event->location()); | 502 | mLocationEdit->setEditText(event->location()); |
453 | mDescriptionEdit->setText(event->description()); | 503 | mDescriptionEdit->setText(event->description()); |
454 | 504 | ||
455 | #if 0 | 505 | #if 0 |
456 | // organizer information | 506 | // organizer information |
457 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); | 507 | mOwnerLabel->setText(i18n("Owner: ") + event->organizer()); |
458 | #endif | 508 | #endif |
459 | 509 | ||
460 | enableAlarmEdit( event->isAlarmEnabled() ); | 510 | enableAlarmEdit( event->isAlarmEnabled() ); |
461 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); | 511 | //qDebug("KOEditorGeneral::readIncidence(Incidence *event) "); |
462 | if(!event->isAlarmEnabled()) { | 512 | if(!event->isAlarmEnabled()) { |
463 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. | 513 | // TODO: Implement a KPrefsComboItem to solve this in a clean way. |
464 | int alarmTime; | 514 | int alarmTime; |
465 | int a[] = { 1,5,10,15,30,60,180, 1440 }; | 515 | int a[] = { 1,5,10,15,30,60,180, 1440 }; |
466 | int index = KOPrefs::instance()->mAlarmTime; | 516 | int index = KOPrefs::instance()->mAlarmTime; |
467 | if (index < 0 || index > 7) { | 517 | if (index < 0 || index > 7) { |
468 | alarmTime = 15; | 518 | alarmTime = 15; |
469 | } else { | 519 | } else { |
470 | alarmTime = a[index]; | 520 | alarmTime = a[index]; |
471 | } | 521 | } |
472 | mAlarmTimeEdit->setValue(alarmTime); | 522 | mAlarmTimeEdit->setValue(alarmTime); |
473 | } | 523 | } |
474 | mAlarmButton->setChecked( event->isAlarmEnabled() ); | 524 | mAlarmButton->setChecked( event->isAlarmEnabled() ); |
475 | mSecrecyCombo->setCurrentItem(event->secrecy()); | 525 | mSecrecyCombo->setCurrentItem(event->secrecy()); |
476 | mCancelBox->setChecked( event->cancelled() ); | 526 | mCancelBox->setChecked( event->cancelled() ); |
477 | mAlarmProgramButton->setOn(false); | 527 | mAlarmProgramButton->setOn(false); |
478 | mAlarmSoundButton->setOn(false); | 528 | mAlarmSoundButton->setOn(false); |
479 | 529 | ||
480 | // set up alarm stuff | 530 | // set up alarm stuff |
481 | QPtrList<Alarm> alarms = event->alarms(); | 531 | QPtrList<Alarm> alarms = event->alarms(); |
482 | Alarm* alarm; | 532 | Alarm* alarm; |
483 | mAlarmIncrCombo->setCurrentItem(0); | 533 | mAlarmIncrCombo->setCurrentItem(0); |
484 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 534 | for ( alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
485 | int offset; | 535 | int offset; |
486 | if ( alarm->hasTime() ) { | 536 | if ( alarm->hasTime() ) { |
487 | QDateTime t = alarm->time(); | 537 | QDateTime t = alarm->time(); |
488 | offset = event->dtStart().secsTo( t ); | 538 | offset = event->dtStart().secsTo( t ); |
489 | } else { | 539 | } else { |
490 | offset = alarm->startOffset().asSeconds(); | 540 | offset = alarm->startOffset().asSeconds(); |
491 | } | 541 | } |
492 | if ( offset != 0 ) { | 542 | if ( offset != 0 ) { |
493 | offset = offset / -60; // make minutes | 543 | offset = offset / -60; // make minutes |
494 | if (offset % 60 == 0) { // divides evenly into hours? | 544 | if (offset % 60 == 0) { // divides evenly into hours? |
@@ -524,49 +574,50 @@ void KOEditorGeneral::readIncidence(Incidence *event) | |||
524 | } | 574 | } |
525 | 575 | ||
526 | setCategories(event->categoriesStr()); | 576 | setCategories(event->categoriesStr()); |
527 | } | 577 | } |
528 | 578 | ||
529 | void KOEditorGeneral::writeIncidence(Incidence *event) | 579 | void KOEditorGeneral::writeIncidence(Incidence *event) |
530 | { | 580 | { |
531 | // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; | 581 | // kdDebug() << "KOEditorGeneral::writeEvent()" << endl; |
532 | mLocationEdit->save(KOLocationBox::LOCATION); | 582 | mLocationEdit->save(KOLocationBox::LOCATION); |
533 | event->setSummary(mSummaryEdit->currentText()); | 583 | event->setSummary(mSummaryEdit->currentText()); |
534 | event->setLocation(mLocationEdit->currentText()); | 584 | event->setLocation(mLocationEdit->currentText()); |
535 | event->setDescription(mDescriptionEdit->text()); | 585 | event->setDescription(mDescriptionEdit->text()); |
536 | event->setCategories(mCategoriesLabel->text()); | 586 | event->setCategories(mCategoriesLabel->text()); |
537 | event->setSecrecy(mSecrecyCombo->currentItem()); | 587 | event->setSecrecy(mSecrecyCombo->currentItem()); |
538 | event->setCancelled(mCancelBox->isChecked() );; | 588 | event->setCancelled(mCancelBox->isChecked() );; |
539 | // alarm stuff | 589 | // alarm stuff |
540 | if (mAlarmButton->isChecked()) { | 590 | if (mAlarmButton->isChecked()) { |
541 | if (event->alarms().count() == 0) | 591 | if (event->alarms().count() == 0) |
542 | event->newAlarm(); | 592 | event->newAlarm(); |
543 | QPtrList<Alarm> alarms = event->alarms(); | 593 | QPtrList<Alarm> alarms = event->alarms(); |
544 | Alarm *alarm; | 594 | Alarm *alarm; |
545 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 595 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
546 | alarm->setEnabled(true); | 596 | alarm->setEnabled(true); |
547 | int j = mAlarmTimeEdit->value()* -60; | 597 | int j = mAlarmTimeEdit->value()* -60; |
548 | if (mAlarmIncrCombo->currentItem() == 1) | 598 | if (mAlarmIncrCombo->currentItem() == 1) |
549 | j = j * 60; | 599 | j = j * 60; |
550 | else if (mAlarmIncrCombo->currentItem() == 2) | 600 | else if (mAlarmIncrCombo->currentItem() == 2) |
551 | j = j * (60 * 24); | 601 | j = j * (60 * 24); |
552 | alarm->setStartOffset( j ); | 602 | alarm->setStartOffset( j ); |
553 | 603 | ||
554 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { | 604 | if (!mAlarmProgram.isEmpty() && mAlarmProgramButton->isOn()) { |
555 | alarm->setProcedureAlarm(mAlarmProgram); | 605 | alarm->setProcedureAlarm(mAlarmProgram); |
556 | } | 606 | } |
557 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) | 607 | else if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) |
558 | alarm->setAudioAlarm(mAlarmSound); | 608 | alarm->setAudioAlarm(mAlarmSound); |
559 | else | 609 | else |
560 | alarm->setType(Alarm::Invalid); | 610 | alarm->setType(Alarm::Invalid); |
561 | //alarm->setAudioAlarm("default"); | 611 | //alarm->setAudioAlarm("default"); |
562 | // TODO: Deal with multiple alarms | 612 | // TODO: Deal with multiple alarms |
563 | break; // For now, stop after the first alarm | 613 | break; // For now, stop after the first alarm |
564 | } | 614 | } |
565 | } else { | 615 | } else { |
566 | Alarm* alarm = event->alarms().first(); | 616 | Alarm* alarm = event->alarms().first(); |
567 | if ( alarm ) { | 617 | if ( alarm ) { |
568 | alarm->setEnabled(false); | 618 | alarm->setEnabled(false); |
569 | alarm->setType(Alarm::Invalid); | 619 | alarm->setType(Alarm::Invalid); |
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 | |||
@@ -1,121 +1,125 @@ | |||
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 | #ifndef KOEDITORGENERAL_H | 23 | #ifndef KOEDITORGENERAL_H |
24 | #define KOEDITORGENERAL_H | 24 | #define KOEDITORGENERAL_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
31 | #include <qgroupbox.h> | 31 | #include <qgroupbox.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qradiobutton.h> | 35 | #include <qradiobutton.h> |
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> |
40 | #include <krestrictedline.h> | 41 | #include <krestrictedline.h> |
41 | 42 | ||
42 | #include <libkcal/incidence.h> | 43 | #include <libkcal/incidence.h> |
43 | 44 | ||
44 | #include "ktimeedit.h" | 45 | #include "ktimeedit.h" |
45 | 46 | ||
46 | class KDateEdit; | 47 | class KDateEdit; |
47 | class KOLocationBox; | 48 | class KOLocationBox; |
48 | using namespace KCal; | 49 | using namespace KCal; |
49 | 50 | ||
50 | class KOEditorGeneral : public QObject | 51 | class KOEditorGeneral : public QObject |
51 | { | 52 | { |
52 | Q_OBJECT | 53 | Q_OBJECT |
53 | public: | 54 | public: |
54 | KOEditorGeneral (QObject* parent=0,const char* name=0); | 55 | KOEditorGeneral (QObject* parent=0,const char* name=0); |
55 | virtual ~KOEditorGeneral(); | 56 | virtual ~KOEditorGeneral(); |
56 | void setFocusOn( int i ); | 57 | void setFocusOn( int i ); |
57 | void initHeader(QWidget *,QBoxLayout *); | 58 | void initHeader(QWidget *,QBoxLayout *); |
58 | void initDescription(QWidget *,QBoxLayout *); | 59 | void initDescription(QWidget *,QBoxLayout *); |
59 | void initSecrecy(QWidget *,QBoxLayout *); | 60 | void initSecrecy(QWidget *,QBoxLayout *); |
60 | void initCategories(QWidget *,QBoxLayout *); | 61 | void initCategories(QWidget *,QBoxLayout *); |
61 | void initAlarm(QWidget *,QBoxLayout *); | 62 | void initAlarm(QWidget *,QBoxLayout *); |
62 | 63 | ||
63 | /** Set widgets to default values */ | 64 | /** Set widgets to default values */ |
64 | void setDefaults(bool allDay); | 65 | void setDefaults(bool allDay); |
65 | /** Read event object and setup widgets accordingly */ | 66 | /** Read event object and setup widgets accordingly */ |
66 | void readIncidence(Incidence *); | 67 | void readIncidence(Incidence *); |
67 | /** Write event settings to event object */ | 68 | /** Write event settings to event object */ |
68 | void writeIncidence(Incidence *); | 69 | void writeIncidence(Incidence *); |
69 | 70 | ||
70 | /** Check if the input is valid. */ | 71 | /** Check if the input is valid. */ |
71 | bool validateInput() { return true; } | 72 | bool validateInput() { return true; } |
72 | 73 | ||
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 &); |
77 | void editCategories(); | 79 | void editCategories(); |
78 | 80 | ||
79 | protected slots: | 81 | protected slots: |
80 | void enableAlarmEdit( bool enable ); | 82 | void enableAlarmEdit( bool enable ); |
81 | void disableAlarmEdit( bool disable ); | 83 | void disableAlarmEdit( bool disable ); |
82 | void alarmDisable( bool disable ); | 84 | void alarmDisable( bool disable ); |
83 | void pickAlarmSound(); | 85 | void pickAlarmSound(); |
84 | void pickAlarmProgram(); | 86 | void pickAlarmProgram(); |
85 | void slotSetFocusOn(); | 87 | void slotSetFocusOn(); |
86 | void showCatPopup(); | 88 | void showCatPopup(); |
87 | void selectedCatPopup( int ); | 89 | void selectedCatPopup( int ); |
88 | 90 | ||
89 | signals: | 91 | signals: |
90 | void openCategoryDialog(); | 92 | void openCategoryDialog(); |
91 | void allAccepted(); | 93 | void allAccepted(); |
92 | void dateTimesChanged(QDateTime,QDateTime); | 94 | void dateTimesChanged(QDateTime,QDateTime); |
93 | 95 | ||
94 | protected: | 96 | protected: |
97 | void fillCalCombo( int setToID = 0 ); | ||
95 | int mNextFocus; | 98 | int mNextFocus; |
96 | //QLineEdit *mSummaryEdit; | 99 | //QLineEdit *mSummaryEdit; |
97 | //QLineEdit *mLocationEdit; | 100 | //QLineEdit *mLocationEdit; |
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; |
102 | QSpinBox *mAlarmTimeEdit; | 106 | QSpinBox *mAlarmTimeEdit; |
103 | QPushButton *mAlarmSoundButton; | 107 | QPushButton *mAlarmSoundButton; |
104 | QPushButton *mAlarmProgramButton; | 108 | QPushButton *mAlarmProgramButton; |
105 | QComboBox *mAlarmIncrCombo; | 109 | QComboBox *mAlarmIncrCombo; |
106 | KTextEdit *mDescriptionEdit; | 110 | KTextEdit *mDescriptionEdit; |
107 | QLabel *mOwnerLabel; | 111 | QLabel *mOwnerLabel; |
108 | QComboBox *mSecrecyCombo; | 112 | QComboBox *mSecrecyCombo; |
109 | QCheckBox *mCancelBox; | 113 | QCheckBox *mCancelBox; |
110 | QPushButton *mCategoriesButton; | 114 | QPushButton *mCategoriesButton; |
111 | QPushButton *mCategoriesLabel; | 115 | QPushButton *mCategoriesLabel; |
112 | 116 | ||
113 | private: | 117 | private: |
114 | QPopupMenu * mCatPopup; | 118 | QPopupMenu * mCatPopup; |
115 | QString getFittingPath( const QString ) ; | 119 | QString getFittingPath( const QString ) ; |
116 | QString mAlarmSound; | 120 | QString mAlarmSound; |
117 | QString mAlarmProgram; | 121 | QString mAlarmProgram; |
118 | QString mAlarmMessage; | 122 | QString mAlarmMessage; |
119 | }; | 123 | }; |
120 | 124 | ||
121 | #endif | 125 | #endif |
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp index 77322e7..fc4d9a4 100644 --- a/korganizer/koeventpopupmenu.cpp +++ b/korganizer/koeventpopupmenu.cpp | |||
@@ -33,97 +33,96 @@ | |||
33 | #include "koprefs.h" | 33 | #include "koprefs.h" |
34 | 34 | ||
35 | KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() | 35 | KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu() |
36 | { | 36 | { |
37 | mCurrentIncidence = 0; | 37 | mCurrentIncidence = 0; |
38 | mHasAdditionalItems = false; | 38 | mHasAdditionalItems = false; |
39 | 39 | ||
40 | 40 | ||
41 | mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); | 41 | mSingleOnlyItems.append( insertItem (i18n("&Show"),this,SLOT(popupShow()))); |
42 | mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); | 42 | mEditOnlyItems.append(insertItem (i18n("&Edit..."),this,SLOT(popupEdit()))); |
43 | mEditOnlyItems.append(insertItem (i18n("&Delete..."), | 43 | mEditOnlyItems.append(insertItem (i18n("&Delete..."), |
44 | this,SLOT(popupDelete()))); | 44 | this,SLOT(popupDelete()))); |
45 | mEditOnlyItems.append(insertItem (i18n("&Clone..."), | 45 | mEditOnlyItems.append(insertItem (i18n("&Clone..."), |
46 | this,SLOT(popupClone()))); | 46 | this,SLOT(popupClone()))); |
47 | mEditOnlyItems.append(insertItem (i18n("&Move..."), | 47 | mEditOnlyItems.append(insertItem (i18n("&Move..."), |
48 | this,SLOT(popupMove()))); | 48 | this,SLOT(popupMove()))); |
49 | #ifndef DESKTOP_VERSION | 49 | #ifndef DESKTOP_VERSION |
50 | mEditOnlyItems.append(insertItem (i18n("&Beam..."), | 50 | mEditOnlyItems.append(insertItem (i18n("&Beam..."), |
51 | this,SLOT(popupBeam()))); | 51 | this,SLOT(popupBeam()))); |
52 | #endif | 52 | #endif |
53 | mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), | 53 | mEditOnlyItems.append(insertItem (i18n("&Toggle Cancel"), |
54 | this,SLOT(popupCancel()))); | 54 | this,SLOT(popupCancel()))); |
55 | isDisabled = false; | 55 | isDisabled = false; |
56 | mCatPopup = new QPopupMenu ( this ); | 56 | mCatPopup = new QPopupMenu ( this ); |
57 | mCatPopup->setCheckable (true); | 57 | mCatPopup->setCheckable (true); |
58 | connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); | 58 | connect(mCatPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCatPopup())); |
59 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); | 59 | connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCatPopup( int ))); |
60 | mCalPopup = new QPopupMenu ( this ); | 60 | mCalPopup = new QPopupMenu ( this ); |
61 | mCalPopup->setCheckable (true); | 61 | mCalPopup->setCheckable (true); |
62 | connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); | 62 | connect(mCalPopup,SIGNAL( aboutToShow ()), this ,SLOT( fillCalPopup())); |
63 | connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); | 63 | connect(mCalPopup,SIGNAL( activated ( int ) ), this ,SLOT( computeCalPopup( int ))); |
64 | //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); | 64 | //mEditOnlyItems.append(insertItem (i18n("Categories"),mCatPopup )); |
65 | //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); | 65 | //mEditOnlyItems.append(insertItem (i18n("Calendar"),mCalPopup )); |
66 | insertItem (i18n("Categories"),mCatPopup ); | 66 | insertItem (i18n("Categories"),mCatPopup ); |
67 | insertItem (i18n("Calendar"),mCalPopup ); | 67 | insertItem (i18n("Calendar"),mCalPopup ); |
68 | QValueList<int>::Iterator it; | 68 | QValueList<int>::Iterator it; |
69 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { | 69 | for( it = mEditOnlyItems.begin(); it != mEditOnlyItems.end(); ++it ) { |
70 | mSingleOnlyItems.append(*it); | 70 | mSingleOnlyItems.append(*it); |
71 | } | 71 | } |
72 | 72 | ||
73 | } | 73 | } |
74 | void KOEventPopupMenu::enableDefault( bool enable ) | 74 | void KOEventPopupMenu::enableDefault( bool enable ) |
75 | { | 75 | { |
76 | isDisabled = !enable; | 76 | isDisabled = !enable; |
77 | QValueList<int>::Iterator it; | 77 | QValueList<int>::Iterator it; |
78 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { | 78 | for( it = mSingleOnlyItems.begin(); it != mSingleOnlyItems.end(); ++it ) { |
79 | setItemEnabled(*it,enable); | 79 | setItemEnabled(*it,enable); |
80 | } | 80 | } |
81 | |||
82 | } | 81 | } |
83 | 82 | ||
84 | void KOEventPopupMenu::fillCalPopup() // CAL | 83 | void KOEventPopupMenu::fillCalPopup() // CAL |
85 | { | 84 | { |
86 | mCalPopup->clear(); | 85 | mCalPopup->clear(); |
87 | if (!mCurrentIncidence) return; | 86 | if (!mCurrentIncidence) return; |
88 | bool readO = mCurrentIncidence->isReadOnly()|| isDisabled; | 87 | bool readO = mCurrentIncidence->isReadOnly()|| isDisabled; |
89 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 88 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
90 | while ( kkf ) { | 89 | while ( kkf ) { |
91 | int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); | 90 | int index = mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); |
92 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) | 91 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) |
93 | mCalPopup->setItemEnabled( index, false ); | 92 | mCalPopup->setItemEnabled( index, false ); |
94 | mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); | 93 | mCalPopup->setItemChecked (index, kkf->mCalNumber == mCurrentIncidence->calID()); |
95 | kkf = KOPrefs::instance()->mCalendars.next(); | 94 | kkf = KOPrefs::instance()->mCalendars.next(); |
96 | } | 95 | } |
97 | } | 96 | } |
98 | void KOEventPopupMenu::computeCalPopup( int index ) // CAL | 97 | void KOEventPopupMenu::computeCalPopup( int index ) // CAL |
99 | { | 98 | { |
100 | if (!mCurrentIncidence) return; | 99 | if (!mCurrentIncidence) return; |
101 | mCurrentIncidence->setCalID( index ); | 100 | mCurrentIncidence->setCalID( index ); |
102 | emit categoryChanged( mCurrentIncidence ); | 101 | emit categoryChanged( mCurrentIncidence ); |
103 | } | 102 | } |
104 | void KOEventPopupMenu::fillCatPopup() | 103 | void KOEventPopupMenu::fillCatPopup() |
105 | { | 104 | { |
106 | mCatPopup->clear(); | 105 | mCatPopup->clear(); |
107 | if (!mCurrentIncidence) return; | 106 | if (!mCurrentIncidence) return; |
108 | bool readO = mCurrentIncidence->isReadOnly() || isDisabled; | 107 | bool readO = mCurrentIncidence->isReadOnly() || isDisabled; |
109 | QStringList checkedCategories = mCurrentIncidence->categories(); | 108 | QStringList checkedCategories = mCurrentIncidence->categories(); |
110 | int index = 0; | 109 | int index = 0; |
111 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 110 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
112 | it != KOPrefs::instance()->mCustomCategories.end (); | 111 | it != KOPrefs::instance()->mCustomCategories.end (); |
113 | ++it) { | 112 | ++it) { |
114 | mCatPopup->insertItem (*it, index ); | 113 | mCatPopup->insertItem (*it, index ); |
115 | if (checkedCategories.find (*it) != checkedCategories.end ()) { | 114 | if (checkedCategories.find (*it) != checkedCategories.end ()) { |
116 | mCatPopup->setItemChecked (index, true); | 115 | mCatPopup->setItemChecked (index, true); |
117 | } | 116 | } |
118 | if ( readO ) | 117 | if ( readO ) |
119 | mCatPopup->setItemEnabled( index, false ); | 118 | mCatPopup->setItemEnabled( index, false ); |
120 | ++index; | 119 | ++index; |
121 | } | 120 | } |
122 | } | 121 | } |
123 | void KOEventPopupMenu::computeCatPopup( int index ) | 122 | void KOEventPopupMenu::computeCatPopup( int index ) |
124 | { | 123 | { |
125 | if (!mCurrentIncidence) return; | 124 | if (!mCurrentIncidence) return; |
126 | QStringList categories = mCurrentIncidence->categories(); | 125 | QStringList categories = mCurrentIncidence->categories(); |
127 | QString colcat = categories.first(); | 126 | QString colcat = categories.first(); |
128 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) | 127 | if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) |
129 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); | 128 | categories.remove (KOPrefs::instance()->mCustomCategories[index]); |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index ca64e66..cce798f 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -178,150 +178,152 @@ bool CalendarLocal::addAnniversaryNoDup( Event *event ) | |||
178 | { | 178 | { |
179 | QString cat; | 179 | QString cat; |
180 | bool isBirthday = true; | 180 | bool isBirthday = true; |
181 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | 181 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { |
182 | isBirthday = false; | 182 | isBirthday = false; |
183 | cat = i18n( "Anniversary" ); | 183 | cat = i18n( "Anniversary" ); |
184 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | 184 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { |
185 | isBirthday = true; | 185 | isBirthday = true; |
186 | cat = i18n( "Birthday" ); | 186 | cat = i18n( "Birthday" ); |
187 | } else { | 187 | } else { |
188 | qDebug("addAnniversaryNoDup called without fitting category! "); | 188 | qDebug("addAnniversaryNoDup called without fitting category! "); |
189 | return false; | 189 | return false; |
190 | } | 190 | } |
191 | Event * eve; | 191 | Event * eve; |
192 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 192 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
193 | if ( !(eve->categories().contains( cat ) )) | 193 | if ( !(eve->categories().contains( cat ) )) |
194 | continue; | 194 | continue; |
195 | // now we have an event with fitting category | 195 | // now we have an event with fitting category |
196 | if ( eve->dtStart().date() != event->dtStart().date() ) | 196 | if ( eve->dtStart().date() != event->dtStart().date() ) |
197 | continue; | 197 | continue; |
198 | // now we have an event with fitting category+date | 198 | // now we have an event with fitting category+date |
199 | if ( eve->summary() != event->summary() ) | 199 | if ( eve->summary() != event->summary() ) |
200 | continue; | 200 | continue; |
201 | // now we have an event with fitting category+date+summary | 201 | // now we have an event with fitting category+date+summary |
202 | return false; | 202 | return false; |
203 | } | 203 | } |
204 | return addEvent( event ); | 204 | return addEvent( event ); |
205 | 205 | ||
206 | } | 206 | } |
207 | bool CalendarLocal::addEventNoDup( Event *event ) | 207 | bool CalendarLocal::addEventNoDup( Event *event ) |
208 | { | 208 | { |
209 | Event * eve; | 209 | Event * eve; |
210 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { | 210 | for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { |
211 | if ( *eve == *event ) { | 211 | if ( *eve == *event ) { |
212 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); | 212 | //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); |
213 | return false; | 213 | return false; |
214 | } | 214 | } |
215 | } | 215 | } |
216 | return addEvent( event ); | 216 | return addEvent( event ); |
217 | } | 217 | } |
218 | 218 | ||
219 | bool CalendarLocal::addEvent( Event *event ) | 219 | bool CalendarLocal::addEvent( Event *event ) |
220 | { | 220 | { |
221 | insertEvent( event ); | 221 | insertEvent( event ); |
222 | 222 | ||
223 | event->registerObserver( this ); | 223 | event->registerObserver( this ); |
224 | 224 | ||
225 | setModified( true ); | 225 | setModified( true ); |
226 | event->setCalID( mDefaultCalendar ); | 226 | if ( event->calID() == 0 ) |
227 | event->setCalID( mDefaultCalendar ); | ||
227 | event->setCalEnabled( true ); | 228 | event->setCalEnabled( true ); |
228 | 229 | ||
229 | return true; | 230 | return true; |
230 | } | 231 | } |
231 | 232 | ||
232 | void CalendarLocal::deleteEvent( Event *event ) | 233 | void CalendarLocal::deleteEvent( Event *event ) |
233 | { | 234 | { |
234 | if ( mUndoIncidence ) delete mUndoIncidence; | 235 | if ( mUndoIncidence ) delete mUndoIncidence; |
235 | mUndoIncidence = event->clone(); | 236 | mUndoIncidence = event->clone(); |
236 | if ( mEventList.removeRef( event ) ) { | 237 | if ( mEventList.removeRef( event ) ) { |
237 | setModified( true ); | 238 | setModified( true ); |
238 | } | 239 | } |
239 | } | 240 | } |
240 | 241 | ||
241 | 242 | ||
242 | Event *CalendarLocal::event( const QString &uid ) | 243 | Event *CalendarLocal::event( const QString &uid ) |
243 | { | 244 | { |
244 | Event *event; | 245 | Event *event; |
245 | Event *retVal = 0; | 246 | Event *retVal = 0; |
246 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 247 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
247 | if ( event->calEnabled() && event->uid() == uid ) { | 248 | if ( event->calEnabled() && event->uid() == uid ) { |
248 | if ( retVal ) { | 249 | if ( retVal ) { |
249 | if ( retVal->calID() > event->calID() ) { | 250 | if ( retVal->calID() > event->calID() ) { |
250 | retVal = event; | 251 | retVal = event; |
251 | } | 252 | } |
252 | } else { | 253 | } else { |
253 | retVal = event; | 254 | retVal = event; |
254 | } | 255 | } |
255 | } | 256 | } |
256 | } | 257 | } |
257 | return retVal; | 258 | return retVal; |
258 | } | 259 | } |
259 | bool CalendarLocal::addTodoNoDup( Todo *todo ) | 260 | bool CalendarLocal::addTodoNoDup( Todo *todo ) |
260 | { | 261 | { |
261 | Todo * eve; | 262 | Todo * eve; |
262 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { | 263 | for ( eve = mTodoList.first(); eve ; eve = mTodoList.next() ) { |
263 | if ( *eve == *todo ) { | 264 | if ( *eve == *todo ) { |
264 | //qDebug("duplicate todo found! not inserted! "); | 265 | //qDebug("duplicate todo found! not inserted! "); |
265 | return false; | 266 | return false; |
266 | } | 267 | } |
267 | } | 268 | } |
268 | return addTodo( todo ); | 269 | return addTodo( todo ); |
269 | } | 270 | } |
270 | bool CalendarLocal::addTodo( Todo *todo ) | 271 | bool CalendarLocal::addTodo( Todo *todo ) |
271 | { | 272 | { |
272 | mTodoList.append( todo ); | 273 | mTodoList.append( todo ); |
273 | 274 | ||
274 | todo->registerObserver( this ); | 275 | todo->registerObserver( this ); |
275 | 276 | ||
276 | // Set up subtask relations | 277 | // Set up subtask relations |
277 | setupRelations( todo ); | 278 | setupRelations( todo ); |
278 | 279 | ||
279 | setModified( true ); | 280 | setModified( true ); |
281 | if ( todo->calID() == 0 ) | ||
280 | todo->setCalID( mDefaultCalendar ); | 282 | todo->setCalID( mDefaultCalendar ); |
281 | todo->setCalEnabled( true ); | 283 | todo->setCalEnabled( true ); |
282 | return true; | 284 | return true; |
283 | } | 285 | } |
284 | 286 | ||
285 | void CalendarLocal::deleteTodo( Todo *todo ) | 287 | void CalendarLocal::deleteTodo( Todo *todo ) |
286 | { | 288 | { |
287 | // Handle orphaned children | 289 | // Handle orphaned children |
288 | if ( mUndoIncidence ) delete mUndoIncidence; | 290 | if ( mUndoIncidence ) delete mUndoIncidence; |
289 | removeRelations( todo ); | 291 | removeRelations( todo ); |
290 | mUndoIncidence = todo->clone(); | 292 | mUndoIncidence = todo->clone(); |
291 | 293 | ||
292 | if ( mTodoList.removeRef( todo ) ) { | 294 | if ( mTodoList.removeRef( todo ) ) { |
293 | setModified( true ); | 295 | setModified( true ); |
294 | } | 296 | } |
295 | } | 297 | } |
296 | 298 | ||
297 | QPtrList<Todo> CalendarLocal::rawTodos() | 299 | QPtrList<Todo> CalendarLocal::rawTodos() |
298 | { | 300 | { |
299 | QPtrList<Todo> el; | 301 | QPtrList<Todo> el; |
300 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | 302 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) |
301 | if ( it->calEnabled() ) el.append( it ); | 303 | if ( it->calEnabled() ) el.append( it ); |
302 | return el; | 304 | return el; |
303 | } | 305 | } |
304 | Todo *CalendarLocal::todo( QString syncProf, QString id ) | 306 | Todo *CalendarLocal::todo( QString syncProf, QString id ) |
305 | { | 307 | { |
306 | Todo *todo; | 308 | Todo *todo; |
307 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 309 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
308 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; | 310 | if ( todo->calEnabled() && todo->getID( syncProf ) == id ) return todo; |
309 | } | 311 | } |
310 | 312 | ||
311 | return 0; | 313 | return 0; |
312 | } | 314 | } |
313 | void CalendarLocal::removeSyncInfo( QString syncProfile) | 315 | void CalendarLocal::removeSyncInfo( QString syncProfile) |
314 | { | 316 | { |
315 | QPtrList<Incidence> all = rawIncidences() ; | 317 | QPtrList<Incidence> all = rawIncidences() ; |
316 | Incidence *inc; | 318 | Incidence *inc; |
317 | for ( inc = all.first(); inc; inc = all.next() ) { | 319 | for ( inc = all.first(); inc; inc = all.next() ) { |
318 | inc->removeID( syncProfile ); | 320 | inc->removeID( syncProfile ); |
319 | } | 321 | } |
320 | if ( syncProfile.isEmpty() ) { | 322 | if ( syncProfile.isEmpty() ) { |
321 | QPtrList<Event> el; | 323 | QPtrList<Event> el; |
322 | Event *todo; | 324 | Event *todo; |
323 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { | 325 | for ( todo = mEventList.first(); todo; todo = mEventList.next() ) { |
324 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) | 326 | if ( todo->uid().left( 15 ) == QString("last-syncEvent-") ) |
325 | el.append( todo ); | 327 | el.append( todo ); |
326 | } | 328 | } |
327 | for ( todo = el.first(); todo; todo = el.next() ) { | 329 | for ( todo = el.first(); todo; todo = el.next() ) { |
@@ -736,97 +738,98 @@ QPtrList<Event> CalendarLocal::rawEvents( const QDate &start, const QDate &end, | |||
736 | // For now include all events with a duration. | 738 | // For now include all events with a duration. |
737 | found = true; | 739 | found = true; |
738 | } | 740 | } |
739 | } | 741 | } |
740 | */ | 742 | */ |
741 | 743 | ||
742 | } | 744 | } |
743 | 745 | ||
744 | if ( found ) eventList.append( event ); | 746 | if ( found ) eventList.append( event ); |
745 | } else { | 747 | } else { |
746 | QDate s = event->dtStart().date(); | 748 | QDate s = event->dtStart().date(); |
747 | QDate e = event->dtEnd().date(); | 749 | QDate e = event->dtEnd().date(); |
748 | 750 | ||
749 | if ( inclusive ) { | 751 | if ( inclusive ) { |
750 | if ( s >= start && e <= end ) { | 752 | if ( s >= start && e <= end ) { |
751 | eventList.append( event ); | 753 | eventList.append( event ); |
752 | } | 754 | } |
753 | } else { | 755 | } else { |
754 | if ( ( e >= start && s <= end ) ) { | 756 | if ( ( e >= start && s <= end ) ) { |
755 | eventList.append( event ); | 757 | eventList.append( event ); |
756 | } | 758 | } |
757 | } | 759 | } |
758 | } | 760 | } |
759 | } | 761 | } |
760 | 762 | ||
761 | return eventList; | 763 | return eventList; |
762 | } | 764 | } |
763 | 765 | ||
764 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) | 766 | QPtrList<Event> CalendarLocal::rawEventsForDate( const QDateTime &qdt ) |
765 | { | 767 | { |
766 | return rawEventsForDate( qdt.date() ); | 768 | return rawEventsForDate( qdt.date() ); |
767 | } | 769 | } |
768 | 770 | ||
769 | QPtrList<Event> CalendarLocal::rawEvents() | 771 | QPtrList<Event> CalendarLocal::rawEvents() |
770 | { | 772 | { |
771 | QPtrList<Event> el; | 773 | QPtrList<Event> el; |
772 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) | 774 | for ( Event *it = mEventList.first(); it; it = mEventList.next() ) |
773 | if ( it->calEnabled() ) el.append( it ); | 775 | if ( it->calEnabled() ) el.append( it ); |
774 | return el; | 776 | return el; |
775 | } | 777 | } |
776 | 778 | ||
777 | bool CalendarLocal::addJournal(Journal *journal) | 779 | bool CalendarLocal::addJournal(Journal *journal) |
778 | { | 780 | { |
779 | mJournalList.append(journal); | 781 | mJournalList.append(journal); |
780 | 782 | ||
781 | journal->registerObserver( this ); | 783 | journal->registerObserver( this ); |
782 | 784 | ||
783 | setModified( true ); | 785 | setModified( true ); |
784 | journal->setCalID( mDefaultCalendar ); | 786 | if ( journal->calID() == 0 ) |
787 | journal->setCalID( mDefaultCalendar ); | ||
785 | journal->setCalEnabled( true ); | 788 | journal->setCalEnabled( true ); |
786 | return true; | 789 | return true; |
787 | } | 790 | } |
788 | 791 | ||
789 | void CalendarLocal::deleteJournal( Journal *journal ) | 792 | void CalendarLocal::deleteJournal( Journal *journal ) |
790 | { | 793 | { |
791 | if ( mUndoIncidence ) delete mUndoIncidence; | 794 | if ( mUndoIncidence ) delete mUndoIncidence; |
792 | mUndoIncidence = journal->clone(); | 795 | mUndoIncidence = journal->clone(); |
793 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); | 796 | mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); |
794 | if ( mJournalList.removeRef(journal) ) { | 797 | if ( mJournalList.removeRef(journal) ) { |
795 | setModified( true ); | 798 | setModified( true ); |
796 | } | 799 | } |
797 | } | 800 | } |
798 | 801 | ||
799 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) | 802 | QPtrList<Journal> CalendarLocal::journals4Date( const QDate & date ) |
800 | { | 803 | { |
801 | QPtrList<Journal> el; | 804 | QPtrList<Journal> el; |
802 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 805 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
803 | if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); | 806 | if ( it->calEnabled() && it->dtStart().date() == date) el.append( it ); |
804 | return el; | 807 | return el; |
805 | } | 808 | } |
806 | Journal *CalendarLocal::journal( const QDate &date ) | 809 | Journal *CalendarLocal::journal( const QDate &date ) |
807 | { | 810 | { |
808 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; | 811 | // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; |
809 | 812 | ||
810 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 813 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
811 | if ( it->calEnabled() && it->dtStart().date() == date ) | 814 | if ( it->calEnabled() && it->dtStart().date() == date ) |
812 | return it; | 815 | return it; |
813 | 816 | ||
814 | return 0; | 817 | return 0; |
815 | } | 818 | } |
816 | 819 | ||
817 | Journal *CalendarLocal::journal( const QString &uid ) | 820 | Journal *CalendarLocal::journal( const QString &uid ) |
818 | { | 821 | { |
819 | Journal * retVal = 0; | 822 | Journal * retVal = 0; |
820 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 823 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
821 | if ( it->calEnabled() && it->uid() == uid ) { | 824 | if ( it->calEnabled() && it->uid() == uid ) { |
822 | if ( retVal ) { | 825 | if ( retVal ) { |
823 | if ( retVal->calID() > it->calID() ) { | 826 | if ( retVal->calID() > it->calID() ) { |
824 | retVal = it; | 827 | retVal = it; |
825 | } | 828 | } |
826 | } else { | 829 | } else { |
827 | retVal = it; | 830 | retVal = it; |
828 | } | 831 | } |
829 | } | 832 | } |
830 | return retVal; | 833 | return retVal; |
831 | } | 834 | } |
832 | 835 | ||