summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-04 08:17:48 (UTC)
committer zautrix <zautrix>2005-07-04 08:17:48 (UTC)
commite19b410f43c4fcf35d3d62fc312d1b5251068691 (patch) (unidiff)
treec3aecb6089dbb2e068ad072226e227c14cd8c2cf
parent068a89b64d8ef4cb49702ed53ab4e415a0b90a80 (diff)
downloadkdepimpi-e19b410f43c4fcf35d3d62fc312d1b5251068691.zip
kdepimpi-e19b410f43c4fcf35d3d62fc312d1b5251068691.tar.gz
kdepimpi-e19b410f43c4fcf35d3d62fc312d1b5251068691.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--korganizer/koeditorgeneral.cpp65
-rw-r--r--korganizer/koeditorgeneral.h4
-rw-r--r--korganizer/koeventpopupmenu.cpp1
-rw-r--r--libkcal/calendarlocal.cpp7
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,17 +1,19 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.1.13 ************ 3********** VERSION 2.1.13 ************
4 4
5Fixed a problem in KA/Pi search. 5Fixed a problem in KA/Pi search.
6Fixed some minor problems in KO/Pi.
7Added 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
10KO/Pi: 12KO/Pi:
11Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus. 13Many small usability fixes, e.g. rearranged the popup menus such that they are better to use on the Zaurus.
12Fixed a problem with the month view when file was saved but KO/Pi was not the active window. 14Fixed a problem with the month view when file was saved but KO/Pi was not the active window.
13Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only). 15Fixed some problems in the resource config dialog (e.g. added a warning if you set all calendars to read-only).
14Fixed some other small problems. 16Fixed some other small problems.
15 17
16********** VERSION 2.1.11 ************ 18********** VERSION 2.1.11 ************
17 19
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 29e68b3..753630b 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -72,61 +72,71 @@ KOEditorGeneral::~KOEditorGeneral()
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void 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}
122void KOEditorGeneral::setFocusOn( int i ) 132void 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}
127void KOEditorGeneral::slotSetFocusOn() 137void 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);
@@ -427,32 +437,72 @@ void KOEditorGeneral::setDefaults(bool allDay)
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}
440void KOEditorGeneral::setSecrecy( int num ) 451void KOEditorGeneral::setSecrecy( int num )
441{ 452{
442 mSecrecyCombo->setCurrentItem(num); 453 mSecrecyCombo->setCurrentItem(num);
443} 454}
444void KOEditorGeneral::readIncidence(Incidence *event) 455void 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}
483int 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
494void 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
@@ -560,13 +610,14 @@ void KOEditorGeneral::writeIncidence(Incidence *event)
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
@@ -26,24 +26,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
46class KDateEdit; 47class KDateEdit;
47class KOLocationBox; 48class KOLocationBox;
48using namespace KCal; 49using namespace KCal;
49 50
@@ -63,49 +64,52 @@ class KOEditorGeneral : public QObject
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;
diff --git a/korganizer/koeventpopupmenu.cpp b/korganizer/koeventpopupmenu.cpp
index 77322e7..fc4d9a4 100644
--- a/korganizer/koeventpopupmenu.cpp
+++ b/korganizer/koeventpopupmenu.cpp
@@ -69,25 +69,24 @@ KOEventPopupMenu::KOEventPopupMenu(): QPopupMenu()
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}
74void KOEventPopupMenu::enableDefault( bool enable ) 74void 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
84void KOEventPopupMenu::fillCalPopup() // CAL 83void 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 );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index ca64e66..cce798f 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -214,25 +214,26 @@ bool CalendarLocal::addEventNoDup( Event *event )
214 } 214 }
215 } 215 }
216 return addEvent( event ); 216 return addEvent( event );
217} 217}
218 218
219bool CalendarLocal::addEvent( Event *event ) 219bool 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
232void CalendarLocal::deleteEvent( Event *event ) 233void 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 }
@@ -268,24 +269,25 @@ bool CalendarLocal::addTodoNoDup( Todo *todo )
268 return addTodo( todo ); 269 return addTodo( todo );
269} 270}
270bool CalendarLocal::addTodo( Todo *todo ) 271bool 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
285void CalendarLocal::deleteTodo( Todo *todo ) 287void 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
@@ -772,25 +774,26 @@ QPtrList<Event> CalendarLocal::rawEvents()
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
777bool CalendarLocal::addJournal(Journal *journal) 779bool 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
789void CalendarLocal::deleteJournal( Journal *journal ) 792void 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 }