summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorrecurrence.cpp12
-rw-r--r--korganizer/koeditorrecurrence.h3
-rw-r--r--libkcal/calendarlocal.cpp2
-rw-r--r--libkcal/icalformatimpl.cpp11
-rw-r--r--libkcal/journal.cpp2
5 files changed, 21 insertions, 9 deletions
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp
index 89504db..0e74a99 100644
--- a/korganizer/koeditorrecurrence.cpp
+++ b/korganizer/koeditorrecurrence.cpp
@@ -473,135 +473,139 @@ DateList ExceptionsWidget::dates()
473 return mExceptionDates; 473 return mExceptionDates;
474} 474}
475 475
476///////////////////////// ExceptionsDialog /////////////////////////// 476///////////////////////// ExceptionsDialog ///////////////////////////
477 477
478ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) : 478ExceptionsDialog::ExceptionsDialog( QWidget *parent, const char *name ) :
479 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel ) 479 KDialogBase( parent, name, true, i18n("Edit exceptions"), Ok|Cancel )
480{ 480{
481 mExceptions = new ExceptionsWidget( this ); 481 mExceptions = new ExceptionsWidget( this );
482 setMainWidget( mExceptions ); 482 setMainWidget( mExceptions );
483 resize(220,10); 483 resize(220,10);
484} 484}
485 485
486void ExceptionsDialog::setDefaults( const QDateTime &from ) 486void ExceptionsDialog::setDefaults( const QDateTime &from )
487{ 487{
488 mExceptions->setDefaults( from ); 488 mExceptions->setDefaults( from );
489} 489}
490 490
491void ExceptionsDialog::setDates( const DateList &dates ) 491void ExceptionsDialog::setDates( const DateList &dates )
492{ 492{
493 mExceptions->setDates( dates ); 493 mExceptions->setDates( dates );
494} 494}
495 495
496DateList ExceptionsDialog::dates() 496DateList ExceptionsDialog::dates()
497{ 497{
498 return mExceptions->dates(); 498 return mExceptions->dates();
499} 499}
500 500
501///////////////////////// RecurrenceRangeWidget /////////////////////////// 501///////////////////////// RecurrenceRangeWidget ///////////////////////////
502 502
503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent, 503RecurrenceRangeWidget::RecurrenceRangeWidget( QWidget *parent,
504 const char *name ) 504 const char *name )
505 : QWidget( parent, name ) 505 : QWidget( parent, name )
506{ 506{
507 QBoxLayout *topLayout = new QVBoxLayout( this ); 507 QBoxLayout *topLayout = new QVBoxLayout( this );
508 508
509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"), 509 mRangeGroupBox = new QGroupBox( 1, Horizontal, i18n("Recurrence Range"),
510 this ); 510 this );
511 topLayout->addWidget( mRangeGroupBox ); 511 topLayout->addWidget( mRangeGroupBox );
512 512
513 QWidget *rangeBox = new QWidget( mRangeGroupBox ); 513 QWidget *rangeBox = new QWidget( mRangeGroupBox );
514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox ); 514 QVBoxLayout *rangeLayout = new QVBoxLayout( rangeBox );
515 rangeLayout->setSpacing( KDialog::spacingHint() ); 515 rangeLayout->setSpacing( KDialog::spacingHint() );
516 rangeLayout->setMargin( KDialog::marginHintSmall() ); 516 rangeLayout->setMargin( KDialog::marginHintSmall() );
517 517
518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox ); 518 mStartDateLabel = new QLabel( i18n("Begin on:"), rangeBox );
519 rangeLayout->addWidget( mStartDateLabel ); 519 rangeLayout->addWidget( mStartDateLabel );
520 520
521 QButtonGroup *rangeButtonGroup = new QButtonGroup; 521 mRangeButtonGroup = new QButtonGroup;
522 522
523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox ); 523 mNoEndDateButton = new QRadioButton( i18n("No ending date"), rangeBox );
524 rangeButtonGroup->insert( mNoEndDateButton ); 524 mRangeButtonGroup->insert( mNoEndDateButton );
525 rangeLayout->addWidget( mNoEndDateButton ); 525 rangeLayout->addWidget( mNoEndDateButton );
526 526
527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout ); 527 QBoxLayout *durationLayout = new QHBoxLayout( rangeLayout );
528 durationLayout->setSpacing( KDialog::spacingHint() ); 528 durationLayout->setSpacing( KDialog::spacingHint() );
529 529
530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox ); 530 mEndDurationButton = new QRadioButton( i18n("End after"), rangeBox );
531 rangeButtonGroup->insert( mEndDurationButton ); 531 mRangeButtonGroup->insert( mEndDurationButton );
532 durationLayout->addWidget( mEndDurationButton ); 532 durationLayout->addWidget( mEndDurationButton );
533 533
534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox ); 534 mEndDurationEdit = new QSpinBox( 1, 9999, 1, rangeBox );
535 durationLayout->addWidget( mEndDurationEdit ); 535 durationLayout->addWidget( mEndDurationEdit );
536 536
537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox ); 537 QLabel *endDurationLabel = new QLabel( i18n("occurrence(s)"), rangeBox );
538 durationLayout ->addWidget( endDurationLabel ); 538 durationLayout ->addWidget( endDurationLabel );
539 539
540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout ); 540 QBoxLayout *endDateLayout = new QHBoxLayout( rangeLayout );
541 endDateLayout->setSpacing( KDialog::spacingHint() ); 541 endDateLayout->setSpacing( KDialog::spacingHint() );
542 542
543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox ); 543 mEndDateButton = new QRadioButton( i18n("End by:"), rangeBox );
544 rangeButtonGroup->insert( mEndDateButton ); 544 mRangeButtonGroup->insert( mEndDateButton );
545 endDateLayout->addWidget( mEndDateButton ); 545 endDateLayout->addWidget( mEndDateButton );
546 546
547 mEndDateEdit = new KDateEdit( rangeBox ); 547 mEndDateEdit = new KDateEdit( rangeBox );
548 endDateLayout->addWidget( mEndDateEdit ); 548 endDateLayout->addWidget( mEndDateEdit );
549 549
550 //endDateLayout->addStretch( 1 ); 550 //endDateLayout->addStretch( 1 );
551 551
552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ), 552 connect( mNoEndDateButton, SIGNAL( toggled( bool ) ),
553 SLOT( showCurrentRange() ) ); 553 SLOT( showCurrentRange() ) );
554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ), 554 connect( mEndDurationButton, SIGNAL( toggled( bool ) ),
555 SLOT( showCurrentRange() ) ); 555 SLOT( showCurrentRange() ) );
556 connect( mEndDateButton, SIGNAL( toggled( bool ) ), 556 connect( mEndDateButton, SIGNAL( toggled( bool ) ),
557 SLOT( showCurrentRange() ) ); 557 SLOT( showCurrentRange() ) );
558} 558}
559 559
560RecurrenceRangeWidget::~RecurrenceRangeWidget()
561{
562 delete mRangeButtonGroup;
563}
560void RecurrenceRangeWidget::setDefaults( const QDateTime &from ) 564void RecurrenceRangeWidget::setDefaults( const QDateTime &from )
561{ 565{
562 mNoEndDateButton->setChecked( true ); 566 mNoEndDateButton->setChecked( true );
563 567
564 setDateTimes( from ); 568 setDateTimes( from );
565 mEndDateEdit->setDate( from.date() ); 569 mEndDateEdit->setDate( from.date() );
566} 570}
567 571
568void RecurrenceRangeWidget::setDuration( int duration ) 572void RecurrenceRangeWidget::setDuration( int duration )
569{ 573{
570 if ( duration == -1 ) { 574 if ( duration == -1 ) {
571 mNoEndDateButton->setChecked( true ); 575 mNoEndDateButton->setChecked( true );
572 } else if ( duration == 0 ) { 576 } else if ( duration == 0 ) {
573 mEndDateButton->setChecked( true ); 577 mEndDateButton->setChecked( true );
574 } else { 578 } else {
575 mEndDurationButton->setChecked( true ); 579 mEndDurationButton->setChecked( true );
576 mEndDurationEdit->setValue( duration ); 580 mEndDurationEdit->setValue( duration );
577 } 581 }
578} 582}
579 583
580int RecurrenceRangeWidget::duration() 584int RecurrenceRangeWidget::duration()
581{ 585{
582 if ( mNoEndDateButton->isChecked() ) { 586 if ( mNoEndDateButton->isChecked() ) {
583 return -1; 587 return -1;
584 } else if ( mEndDurationButton->isChecked() ) { 588 } else if ( mEndDurationButton->isChecked() ) {
585 return mEndDurationEdit->value(); 589 return mEndDurationEdit->value();
586 } else { 590 } else {
587 return 0; 591 return 0;
588 } 592 }
589} 593}
590 594
591void RecurrenceRangeWidget::setEndDate( const QDate &date ) 595void RecurrenceRangeWidget::setEndDate( const QDate &date )
592{ 596{
593 mEndDateEdit->setDate( date ); 597 mEndDateEdit->setDate( date );
594} 598}
595 599
596QDate RecurrenceRangeWidget::endDate() 600QDate RecurrenceRangeWidget::endDate()
597{ 601{
598 return mEndDateEdit->date(); 602 return mEndDateEdit->date();
599} 603}
600 604
601void RecurrenceRangeWidget::showCurrentRange() 605void RecurrenceRangeWidget::showCurrentRange()
602{ 606{
603 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() ); 607 mEndDurationEdit->setEnabled( mEndDurationButton->isChecked() );
604 mEndDateEdit->setEnabled( mEndDateButton->isChecked() ); 608 mEndDateEdit->setEnabled( mEndDateButton->isChecked() );
605} 609}
606 610
607void RecurrenceRangeWidget::setDateTimes( const QDateTime &start, 611void RecurrenceRangeWidget::setDateTimes( const QDateTime &start,
diff --git a/korganizer/koeditorrecurrence.h b/korganizer/koeditorrecurrence.h
index f398f62..75e0c73 100644
--- a/korganizer/koeditorrecurrence.h
+++ b/korganizer/koeditorrecurrence.h
@@ -1,83 +1,84 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000-2003 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 _KOEDITORRECURRENCE_H 23#ifndef _KOEDITORRECURRENCE_H
24#define _KOEDITORRECURRENCE_H 24#define _KOEDITORRECURRENCE_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 <qgroupbox.h> 30#include <qgroupbox.h>
31#include <qlineedit.h> 31#include <qlineedit.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qmultilineedit.h> 33#include <qmultilineedit.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qradiobutton.h> 35#include <qradiobutton.h>
36#include <qbuttongroup.h>
36 37
37#include <kdialogbase.h> 38#include <kdialogbase.h>
38 39
39#include <libkcal/event.h> 40#include <libkcal/event.h>
40 41
41#include "ktimeedit.h" 42#include "ktimeedit.h"
42 43
43class QWidgetStack; 44class QWidgetStack;
44class QSpinBox; 45class QSpinBox;
45 46
46class KDateEdit; 47class KDateEdit;
47 48
48using namespace KCal; 49using namespace KCal;
49 50
50class RecurBase : public QWidget 51class RecurBase : public QWidget
51{ 52{
52 public: 53 public:
53 RecurBase( QWidget *parent = 0, const char *name = 0 ); 54 RecurBase( QWidget *parent = 0, const char *name = 0 );
54 55
55 void setFrequency( int ); 56 void setFrequency( int );
56 int frequency(); 57 int frequency();
57 58
58 QWidget *frequencyEdit(); 59 QWidget *frequencyEdit();
59 60
60 private: 61 private:
61 QSpinBox *mFrequencyEdit; 62 QSpinBox *mFrequencyEdit;
62}; 63};
63 64
64class RecurDaily : public RecurBase 65class RecurDaily : public RecurBase
65{ 66{
66 public: 67 public:
67 RecurDaily( QWidget *parent = 0, const char *name = 0 ); 68 RecurDaily( QWidget *parent = 0, const char *name = 0 );
68}; 69};
69 70
70class RecurWeekly : public RecurBase 71class RecurWeekly : public RecurBase
71{ 72{
72 public: 73 public:
73 RecurWeekly( QWidget *parent = 0, const char *name = 0 ); 74 RecurWeekly( QWidget *parent = 0, const char *name = 0 );
74 75
75 void setDays( const QBitArray & ); 76 void setDays( const QBitArray & );
76 QBitArray days(); 77 QBitArray days();
77 78
78 private: 79 private:
79 QCheckBox *mDayBoxes[7]; 80 QCheckBox *mDayBoxes[7];
80}; 81};
81 82
82class RecurMonthly : public RecurBase 83class RecurMonthly : public RecurBase
83{ 84{
@@ -172,112 +173,114 @@ class ExceptionsWidget : public QWidget, public ExceptionsBase
172 void setDates( const DateList & ); 173 void setDates( const DateList & );
173 DateList dates(); 174 DateList dates();
174 175
175 protected slots: 176 protected slots:
176 void addException(); 177 void addException();
177 void changeException(); 178 void changeException();
178 void deleteException(); 179 void deleteException();
179 180
180 private: 181 private:
181 KDateEdit *mExceptionDateEdit; 182 KDateEdit *mExceptionDateEdit;
182 QListBox *mExceptionList; 183 QListBox *mExceptionList;
183 DateList mExceptionDates; 184 DateList mExceptionDates;
184}; 185};
185 186
186class ExceptionsDialog : public KDialogBase, public ExceptionsBase 187class ExceptionsDialog : public KDialogBase, public ExceptionsBase
187{ 188{
188 public: 189 public:
189 ExceptionsDialog( QWidget *parent, const char *name = 0 ); 190 ExceptionsDialog( QWidget *parent, const char *name = 0 );
190 191
191 void setDefaults( const QDateTime &from ); 192 void setDefaults( const QDateTime &from );
192 193
193 void setDates( const DateList & ); 194 void setDates( const DateList & );
194 DateList dates(); 195 DateList dates();
195 196
196 private: 197 private:
197 ExceptionsWidget *mExceptions; 198 ExceptionsWidget *mExceptions;
198}; 199};
199 200
200class RecurrenceRangeBase 201class RecurrenceRangeBase
201{ 202{
202 public: 203 public:
203 virtual void setDefaults( const QDateTime &from ) = 0; 204 virtual void setDefaults( const QDateTime &from ) = 0;
204 205
205 virtual void setDuration( int ) = 0; 206 virtual void setDuration( int ) = 0;
206 virtual int duration() = 0; 207 virtual int duration() = 0;
207 208
208 virtual void setEndDate( const QDate & ) = 0; 209 virtual void setEndDate( const QDate & ) = 0;
209 virtual QDate endDate() = 0; 210 virtual QDate endDate() = 0;
210 211
211 virtual void setDateTimes( const QDateTime &start, 212 virtual void setDateTimes( const QDateTime &start,
212 const QDateTime &end = QDateTime() ) = 0; 213 const QDateTime &end = QDateTime() ) = 0;
213}; 214};
214 215
215class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase 216class RecurrenceRangeWidget : public QWidget, public RecurrenceRangeBase
216{ 217{
217 Q_OBJECT 218 Q_OBJECT
218 public: 219 public:
219 RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 ); 220 RecurrenceRangeWidget( QWidget *parent = 0, const char *name = 0 );
221 ~RecurrenceRangeWidget();
220 222
221 void setDefaults( const QDateTime &from ); 223 void setDefaults( const QDateTime &from );
222 224
223 void setDuration( int ); 225 void setDuration( int );
224 int duration(); 226 int duration();
225 227
226 void setEndDate( const QDate & ); 228 void setEndDate( const QDate & );
227 QDate endDate(); 229 QDate endDate();
228 230
229 void setDateTimes( const QDateTime &start, 231 void setDateTimes( const QDateTime &start,
230 const QDateTime &end = QDateTime() ); 232 const QDateTime &end = QDateTime() );
231 233
232 protected slots: 234 protected slots:
233 void showCurrentRange(); 235 void showCurrentRange();
234 236
235 private: 237 private:
238 QButtonGroup *mRangeButtonGroup;
236 QGroupBox *mRangeGroupBox; 239 QGroupBox *mRangeGroupBox;
237 QLabel *mStartDateLabel; 240 QLabel *mStartDateLabel;
238 QRadioButton *mNoEndDateButton; 241 QRadioButton *mNoEndDateButton;
239 QRadioButton *mEndDurationButton; 242 QRadioButton *mEndDurationButton;
240 QSpinBox *mEndDurationEdit; 243 QSpinBox *mEndDurationEdit;
241 QRadioButton *mEndDateButton; 244 QRadioButton *mEndDateButton;
242 KDateEdit *mEndDateEdit; 245 KDateEdit *mEndDateEdit;
243}; 246};
244 247
245class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase 248class RecurrenceRangeDialog : public KDialogBase, public RecurrenceRangeBase
246{ 249{
247 public: 250 public:
248 RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 ); 251 RecurrenceRangeDialog( QWidget *parent = 0, const char *name = 0 );
249 252
250 void setDefaults( const QDateTime &from ); 253 void setDefaults( const QDateTime &from );
251 254
252 void setDuration( int ); 255 void setDuration( int );
253 int duration(); 256 int duration();
254 257
255 void setEndDate( const QDate & ); 258 void setEndDate( const QDate & );
256 QDate endDate(); 259 QDate endDate();
257 260
258 void setDateTimes( const QDateTime &start, 261 void setDateTimes( const QDateTime &start,
259 const QDateTime &end = QDateTime() ); 262 const QDateTime &end = QDateTime() );
260 263
261 private: 264 private:
262 RecurrenceRangeWidget *mRecurrenceRangeWidget; 265 RecurrenceRangeWidget *mRecurrenceRangeWidget;
263}; 266};
264 267
265class KOEditorRecurrence : public QWidget 268class KOEditorRecurrence : public QWidget
266{ 269{
267 Q_OBJECT 270 Q_OBJECT
268 public: 271 public:
269 KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 ); 272 KOEditorRecurrence ( QWidget *parent = 0, const char *name = 0 );
270 virtual ~KOEditorRecurrence(); 273 virtual ~KOEditorRecurrence();
271 274
272 enum { Daily, Weekly, Monthly, Yearly }; 275 enum { Daily, Weekly, Monthly, Yearly };
273 276
274 /** Read event object and setup widgets accordingly */ 277 /** Read event object and setup widgets accordingly */
275 void readEvent( Incidence * ); 278 void readEvent( Incidence * );
276 /** Write event settings to event object */ 279 /** Write event settings to event object */
277 void writeEvent( Incidence * ); 280 void writeEvent( Incidence * );
278 281
279 /** Check if the input is valid. */ 282 /** Check if the input is valid. */
280 bool validateInput(); 283 bool validateInput();
281 284
282 public slots: 285 public slots:
283 void setDefaultsDates( QDateTime from, QDateTime to ); 286 void setDefaultsDates( QDateTime from, QDateTime to );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index eef8327..5baa7dc 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -211,97 +211,97 @@ void CalendarLocal::addCalendar( Calendar* cal )
211 //TodoList = cal->rawTodos(); 211 //TodoList = cal->rawTodos();
212 ev = TodoList.first(); 212 ev = TodoList.first();
213 while ( ev ) { 213 while ( ev ) {
214 ev->unRegisterObserver( cal ); 214 ev->unRegisterObserver( cal );
215 ev->registerObserver( this ); 215 ev->registerObserver( this );
216 mTodoList.append( ev ); 216 mTodoList.append( ev );
217 setupRelations( ev ); 217 setupRelations( ev );
218 ev = TodoList.next(); 218 ev = TodoList.next();
219 } 219 }
220 } 220 }
221 { 221 {
222 QPtrList<Journal> JournalList = cal->journals(); 222 QPtrList<Journal> JournalList = cal->journals();
223 Journal * ev = JournalList.first(); 223 Journal * ev = JournalList.first();
224 while ( ev ) { 224 while ( ev ) {
225 ev->unRegisterObserver( cal ); 225 ev->unRegisterObserver( cal );
226 ev->registerObserver( this ); 226 ev->registerObserver( this );
227 mJournalList.append( ev ); 227 mJournalList.append( ev );
228 ev = JournalList.next(); 228 ev = JournalList.next();
229 } 229 }
230 } 230 }
231 setModified( true ); 231 setModified( true );
232} 232}
233bool CalendarLocal::load( const QString &fileName ) 233bool CalendarLocal::load( const QString &fileName )
234{ 234{
235 FileStorage storage( this, fileName ); 235 FileStorage storage( this, fileName );
236 return storage.load(); 236 return storage.load();
237} 237}
238 238
239bool CalendarLocal::save( const QString &fileName, CalFormat *format ) 239bool CalendarLocal::save( const QString &fileName, CalFormat *format )
240{ 240{
241 FileStorage storage( this, fileName, format ); 241 FileStorage storage( this, fileName, format );
242 return storage.save(); 242 return storage.save();
243} 243}
244 244
245void CalendarLocal::stopAllTodos() 245void CalendarLocal::stopAllTodos()
246{ 246{
247 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) 247 for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
248 it->setRunning( false ); 248 it->setRunning( false );
249 249
250} 250}
251void CalendarLocal::close() 251void CalendarLocal::close()
252{ 252{
253 253
254 Todo * i; 254 Todo * i;
255 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); 255 for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
256 256
257 mEventList.setAutoDelete( true ); 257 mEventList.setAutoDelete( true );
258 mTodoList.setAutoDelete( true ); 258 mTodoList.setAutoDelete( true );
259 mJournalList.setAutoDelete( false ); 259 mJournalList.setAutoDelete( true );
260 260
261 mEventList.clear(); 261 mEventList.clear();
262 mTodoList.clear(); 262 mTodoList.clear();
263 mJournalList.clear(); 263 mJournalList.clear();
264 264
265 mEventList.setAutoDelete( false ); 265 mEventList.setAutoDelete( false );
266 mTodoList.setAutoDelete( false ); 266 mTodoList.setAutoDelete( false );
267 mJournalList.setAutoDelete( false ); 267 mJournalList.setAutoDelete( false );
268 268
269 setModified( false ); 269 setModified( false );
270} 270}
271 271
272bool CalendarLocal::addAnniversaryNoDup( Event *event ) 272bool CalendarLocal::addAnniversaryNoDup( Event *event )
273{ 273{
274 QString cat; 274 QString cat;
275 bool isBirthday = true; 275 bool isBirthday = true;
276 if( event->categoriesStr() == i18n( "Anniversary" ) ) { 276 if( event->categoriesStr() == i18n( "Anniversary" ) ) {
277 isBirthday = false; 277 isBirthday = false;
278 cat = i18n( "Anniversary" ); 278 cat = i18n( "Anniversary" );
279 } else if( event->categoriesStr() == i18n( "Birthday" ) ) { 279 } else if( event->categoriesStr() == i18n( "Birthday" ) ) {
280 isBirthday = true; 280 isBirthday = true;
281 cat = i18n( "Birthday" ); 281 cat = i18n( "Birthday" );
282 } else { 282 } else {
283 qDebug("addAnniversaryNoDup called without fitting category! "); 283 qDebug("addAnniversaryNoDup called without fitting category! ");
284 return false; 284 return false;
285 } 285 }
286 Event * eve; 286 Event * eve;
287 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 287 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
288 if ( !(eve->categories().contains( cat ) )) 288 if ( !(eve->categories().contains( cat ) ))
289 continue; 289 continue;
290 // now we have an event with fitting category 290 // now we have an event with fitting category
291 if ( eve->dtStart().date() != event->dtStart().date() ) 291 if ( eve->dtStart().date() != event->dtStart().date() )
292 continue; 292 continue;
293 // now we have an event with fitting category+date 293 // now we have an event with fitting category+date
294 if ( eve->summary() != event->summary() ) 294 if ( eve->summary() != event->summary() )
295 continue; 295 continue;
296 // now we have an event with fitting category+date+summary 296 // now we have an event with fitting category+date+summary
297 return false; 297 return false;
298 } 298 }
299 return addEvent( event ); 299 return addEvent( event );
300 300
301} 301}
302bool CalendarLocal::addEventNoDup( Event *event ) 302bool CalendarLocal::addEventNoDup( Event *event )
303{ 303{
304 Event * eve; 304 Event * eve;
305 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) { 305 for ( eve = mEventList.first(); eve ; eve = mEventList.next() ) {
306 if ( *eve == *event ) { 306 if ( *eve == *event ) {
307 //qDebug("CalendarLocal::Duplicate event found! Not inserted! "); 307 //qDebug("CalendarLocal::Duplicate event found! Not inserted! ");
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index f349681..53aa039 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -957,97 +957,97 @@ Event *ICalFormatImpl::readEvent(icalcomponent *vevent)
957 event->setDtEnd(endDate.addDays(-1)); 957 event->setDtEnd(endDate.addDays(-1));
958 } 958 }
959 } 959 }
960 960
961 // some stupid vCal exporters ignore the standard and use Description 961 // some stupid vCal exporters ignore the standard and use Description
962 // instead of Summary for the default field. Correct for this. 962 // instead of Summary for the default field. Correct for this.
963 if (event->summary().isEmpty() && 963 if (event->summary().isEmpty() &&
964 !(event->description().isEmpty())) { 964 !(event->description().isEmpty())) {
965 QString tmpStr = event->description().simplifyWhiteSpace(); 965 QString tmpStr = event->description().simplifyWhiteSpace();
966 event->setDescription(""); 966 event->setDescription("");
967 event->setSummary(tmpStr); 967 event->setSummary(tmpStr);
968 } 968 }
969 969
970 return event; 970 return event;
971} 971}
972 972
973FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy) 973FreeBusy *ICalFormatImpl::readFreeBusy(icalcomponent *vfreebusy)
974{ 974{
975 FreeBusy *freebusy = new FreeBusy; 975 FreeBusy *freebusy = new FreeBusy;
976 976
977 readIncidenceBase(vfreebusy,freebusy); 977 readIncidenceBase(vfreebusy,freebusy);
978 978
979 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY); 979 icalproperty *p = icalcomponent_get_first_property(vfreebusy,ICAL_ANY_PROPERTY);
980 980
981 icaltimetype icaltime; 981 icaltimetype icaltime;
982 icalperiodtype icalperiod; 982 icalperiodtype icalperiod;
983 QDateTime period_start, period_end; 983 QDateTime period_start, period_end;
984 984
985 while (p) { 985 while (p) {
986 icalproperty_kind kind = icalproperty_isa(p); 986 icalproperty_kind kind = icalproperty_isa(p);
987 switch (kind) { 987 switch (kind) {
988 988
989 case ICAL_DTSTART_PROPERTY: // start date and time 989 case ICAL_DTSTART_PROPERTY: // start date and time
990 icaltime = icalproperty_get_dtstart(p); 990 icaltime = icalproperty_get_dtstart(p);
991 freebusy->setDtStart(readICalDateTime(icaltime)); 991 freebusy->setDtStart(readICalDateTime(icaltime));
992 break; 992 break;
993 993
994 case ICAL_DTEND_PROPERTY: // start End Date and Time 994 case ICAL_DTEND_PROPERTY: // start End Date and Time
995 icaltime = icalproperty_get_dtend(p); 995 icaltime = icalproperty_get_dtend(p);
996 freebusy->setDtEnd(readICalDateTime(icaltime)); 996 freebusy->setDtEnd(readICalDateTime(icaltime));
997 break; 997 break;
998 998
999 case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times 999 case ICAL_FREEBUSY_PROPERTY: //Any FreeBusy Times
1000 icalperiod = icalproperty_get_freebusy(p); 1000 icalperiod = icalproperty_get_freebusy(p);
1001 period_start = readICalDateTime(icalperiod.start); 1001 period_start = readICalDateTime(icalperiod.start);
1002 period_end = readICalDateTime(icalperiod.end); 1002 period_end = readICalDateTime(icalperiod.end);
1003 freebusy->addPeriod(period_start, period_end); 1003 freebusy->addPeriod(period_start, period_end);
1004 break; 1004 break;
1005 1005
1006 default: 1006 default:
1007 kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind 1007 kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind
1008 << endl; 1008 << endl;
1009 break; 1009 break;
1010 } 1010 }
1011 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY); 1011 p = icalcomponent_get_next_property(vfreebusy,ICAL_ANY_PROPERTY);
1012 } 1012 }
1013 1013
1014 return freebusy; 1014 return freebusy;
1015} 1015}
1016 1016
1017Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal) 1017Journal *ICalFormatImpl::readJournal(icalcomponent *vjournal)
1018{ 1018{
1019 Journal *journal = new Journal; 1019 Journal *journal = new Journal;
1020 1020
1021 readIncidence(vjournal,journal); 1021 readIncidence(vjournal,journal);
1022 1022
1023 if ( !journal->dtStart().isValid() && journal->created().isValid() ) { 1023 if ( !journal->dtStart().isValid() && journal->created().isValid() ) {
1024 journal->setDtStart( journal->created() ); 1024 journal->setDtStart( journal->created() );
1025 } 1025 }
1026 return journal; 1026 return journal;
1027} 1027}
1028 1028
1029Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee) 1029Attendee *ICalFormatImpl::readAttendee(icalproperty *attendee)
1030{ 1030{
1031 icalparameter *p = 0; 1031 icalparameter *p = 0;
1032 1032
1033 QString email = QString::fromUtf8(icalproperty_get_attendee(attendee)); 1033 QString email = QString::fromUtf8(icalproperty_get_attendee(attendee));
1034 1034
1035 QString name; 1035 QString name;
1036 QString uid = QString::null; 1036 QString uid = QString::null;
1037 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER); 1037 p = icalproperty_get_first_parameter(attendee,ICAL_CN_PARAMETER);
1038 if (p) { 1038 if (p) {
1039 name = QString::fromUtf8(icalparameter_get_cn(p)); 1039 name = QString::fromUtf8(icalparameter_get_cn(p));
1040 } else { 1040 } else {
1041 } 1041 }
1042 1042
1043 bool rsvp=false; 1043 bool rsvp=false;
1044 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER); 1044 p = icalproperty_get_first_parameter(attendee,ICAL_RSVP_PARAMETER);
1045 if (p) { 1045 if (p) {
1046 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p); 1046 icalparameter_rsvp rsvpParameter = icalparameter_get_rsvp(p);
1047 if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true; 1047 if (rsvpParameter == ICAL_RSVP_TRUE) rsvp = true;
1048 } 1048 }
1049 1049
1050 Attendee::PartStat status = Attendee::NeedsAction; 1050 Attendee::PartStat status = Attendee::NeedsAction;
1051 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER); 1051 p = icalproperty_get_first_parameter(attendee,ICAL_PARTSTAT_PARAMETER);
1052 if (p) { 1052 if (p) {
1053 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p); 1053 icalparameter_partstat partStatParameter = icalparameter_get_partstat(p);
@@ -1899,115 +1899,118 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
1899 } else if (strcmp(version,"2.0") != 0) { 1899 } else if (strcmp(version,"2.0") != 0) {
1900 mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown)); 1900 mParent->setException(new ErrorFormat(ErrorFormat::CalVersionUnknown));
1901 return false; 1901 return false;
1902 } 1902 }
1903 } 1903 }
1904 1904
1905 1905
1906// TODO: check for calendar format version 1906// TODO: check for calendar format version
1907#if 0 1907#if 0
1908 // warn the user we might have trouble reading this unknown version. 1908 // warn the user we might have trouble reading this unknown version.
1909 if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) { 1909 if ((curVO = isAPropertyOf(vcal, VCVersionProp)) != 0) {
1910 char *s = fakeCString(vObjectUStringZValue(curVO)); 1910 char *s = fakeCString(vObjectUStringZValue(curVO));
1911 if (strcmp(_VCAL_VERSION, s) != 0) 1911 if (strcmp(_VCAL_VERSION, s) != 0)
1912 if (mEnableDialogs) 1912 if (mEnableDialogs)
1913 KMessageBox::sorry(mTopWidget, 1913 KMessageBox::sorry(mTopWidget,
1914 i18n("This vCalendar file has version %1.\n" 1914 i18n("This vCalendar file has version %1.\n"
1915 "We only support %2.") 1915 "We only support %2.")
1916 .arg(s).arg(_VCAL_VERSION), 1916 .arg(s).arg(_VCAL_VERSION),
1917 i18n("%1: Unknown vCalendar Version").arg(CalFormat::application())); 1917 i18n("%1: Unknown vCalendar Version").arg(CalFormat::application()));
1918 deleteStr(s); 1918 deleteStr(s);
1919 } 1919 }
1920#endif 1920#endif
1921 1921
1922 // custom properties 1922 // custom properties
1923 readCustomProperties(calendar, cal); 1923 readCustomProperties(calendar, cal);
1924 1924
1925// TODO: set time zone 1925// TODO: set time zone
1926#if 0 1926#if 0
1927 // set the time zone 1927 // set the time zone
1928 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) { 1928 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) != 0) {
1929 char *s = fakeCString(vObjectUStringZValue(curVO)); 1929 char *s = fakeCString(vObjectUStringZValue(curVO));
1930 cal->setTimeZone(s); 1930 cal->setTimeZone(s);
1931 deleteStr(s); 1931 deleteStr(s);
1932 } 1932 }
1933#endif 1933#endif
1934 1934
1935 // Store all events with a relatedTo property in a list for post-processing 1935 // Store all events with a relatedTo property in a list for post-processing
1936 mEventsRelate.clear(); 1936 mEventsRelate.clear();
1937 mTodosRelate.clear(); 1937 mTodosRelate.clear();
1938 // TODO: make sure that only actually added ecvens go to this lists. 1938 // TODO: make sure that only actually added ecvens go to this lists.
1939 1939
1940 icalcomponent *c; 1940 icalcomponent *c;
1941 1941
1942 // Iterate through all todos 1942 // Iterate through all todos
1943 c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT); 1943 c = icalcomponent_get_first_component(calendar,ICAL_VTODO_COMPONENT);
1944 while (c) { 1944 while (c) {
1945// kdDebug(5800) << "----Todo found" << endl; 1945// kdDebug(5800) << "----Todo found" << endl;
1946 Todo *todo = readTodo(c); 1946 Todo *todo = readTodo(c);
1947 if (!cal->todo(todo->uid())) cal->addTodo(todo); 1947 if (!cal->todo(todo->uid()))
1948 cal->addTodo(todo);
1948 c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT); 1949 c = icalcomponent_get_next_component(calendar,ICAL_VTODO_COMPONENT);
1949 } 1950 }
1950 1951
1951 // Iterate through all events 1952 // Iterate through all events
1952 c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT); 1953 c = icalcomponent_get_first_component(calendar,ICAL_VEVENT_COMPONENT);
1953 while (c) { 1954 while (c) {
1954// kdDebug(5800) << "----Event found" << endl; 1955// kdDebug(5800) << "----Event found" << endl;
1955 Event *event = readEvent(c); 1956 Event *event = readEvent(c);
1956 if (!cal->event(event->uid())) cal->addEvent(event); 1957 if (!cal->event(event->uid()))
1958 cal->addEvent(event);
1957 c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT); 1959 c = icalcomponent_get_next_component(calendar,ICAL_VEVENT_COMPONENT);
1958 } 1960 }
1959 1961
1960 // Iterate through all journals 1962 // Iterate through all journals
1961 c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT); 1963 c = icalcomponent_get_first_component(calendar,ICAL_VJOURNAL_COMPONENT);
1962 while (c) { 1964 while (c) {
1963// kdDebug(5800) << "----Journal found" << endl; 1965// kdDebug(5800) << "----Journal found" << endl;
1964 Journal *journal = readJournal(c); 1966 Journal *journal = readJournal(c);
1965 if (!cal->journal(journal->uid())) cal->addJournal(journal); 1967 if (!cal->journal(journal->uid()))
1968 cal->addJournal(journal);
1966 c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT); 1969 c = icalcomponent_get_next_component(calendar,ICAL_VJOURNAL_COMPONENT);
1967 } 1970 }
1968 1971
1969#if 0 1972#if 0
1970 initPropIterator(&i, vcal); 1973 initPropIterator(&i, vcal);
1971 1974
1972 // go through all the vobjects in the vcal 1975 // go through all the vobjects in the vcal
1973 while (moreIteration(&i)) { 1976 while (moreIteration(&i)) {
1974 curVO = nextVObject(&i); 1977 curVO = nextVObject(&i);
1975 1978
1976 /************************************************************************/ 1979 /************************************************************************/
1977 1980
1978 // now, check to see that the object is an event or todo. 1981 // now, check to see that the object is an event or todo.
1979 if (strcmp(vObjectName(curVO), VCEventProp) == 0) { 1982 if (strcmp(vObjectName(curVO), VCEventProp) == 0) {
1980 1983
1981 if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { 1984 if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) {
1982 char *s; 1985 char *s;
1983 s = fakeCString(vObjectUStringZValue(curVOProp)); 1986 s = fakeCString(vObjectUStringZValue(curVOProp));
1984 // check to see if event was deleted by the kpilot conduit 1987 // check to see if event was deleted by the kpilot conduit
1985 if (atoi(s) == Event::SYNCDEL) { 1988 if (atoi(s) == Event::SYNCDEL) {
1986 deleteStr(s); 1989 deleteStr(s);
1987 goto SKIP; 1990 goto SKIP;
1988 } 1991 }
1989 deleteStr(s); 1992 deleteStr(s);
1990 } 1993 }
1991 1994
1992 // this code checks to see if we are trying to read in an event 1995 // this code checks to see if we are trying to read in an event
1993 // that we already find to be in the calendar. If we find this 1996 // that we already find to be in the calendar. If we find this
1994 // to be the case, we skip the event. 1997 // to be the case, we skip the event.
1995 if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { 1998 if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) {
1996 char *s = fakeCString(vObjectUStringZValue(curVOProp)); 1999 char *s = fakeCString(vObjectUStringZValue(curVOProp));
1997 QString tmpStr(s); 2000 QString tmpStr(s);
1998 deleteStr(s); 2001 deleteStr(s);
1999 2002
2000 if (cal->event(tmpStr)) { 2003 if (cal->event(tmpStr)) {
2001 goto SKIP; 2004 goto SKIP;
2002 } 2005 }
2003 if (cal->todo(tmpStr)) { 2006 if (cal->todo(tmpStr)) {
2004 goto SKIP; 2007 goto SKIP;
2005 } 2008 }
2006 } 2009 }
2007 2010
2008 if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) && 2011 if ((!(curVOProp = isAPropertyOf(curVO, VCDTstartProp))) &&
2009 (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) { 2012 (!(curVOProp = isAPropertyOf(curVO, VCDTendProp)))) {
2010 kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl; 2013 kdDebug(5800) << "found a VEvent with no DTSTART and no DTEND! Skipping..." << endl;
2011 goto SKIP; 2014 goto SKIP;
2012 } 2015 }
2013 2016
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 859161f..c4e4474 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -1,49 +1,51 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21#include "journal.h" 21#include "journal.h"
22 22
23using namespace KCal; 23using namespace KCal;
24 24
25Journal::Journal() 25Journal::Journal()
26{ 26{
27 qDebug("New JJJ ");
27} 28}
28 29
29Journal::~Journal() 30Journal::~Journal()
30{ 31{
32 qDebug("delete JJJ ");
31} 33}
32 34
33Incidence *Journal::clone() 35Incidence *Journal::clone()
34{ 36{
35 return new Journal(*this); 37 return new Journal(*this);
36} 38}
37 39
38 40
39bool KCal::operator==( const Journal& j1, const Journal& j2 ) 41bool KCal::operator==( const Journal& j1, const Journal& j2 )
40{ 42{
41 return operator==( (const Incidence&)j1, (const Incidence&)j2 ); 43 return operator==( (const Incidence&)j1, (const Incidence&)j2 );
42} 44}
43 45
44 46
45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const 47QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
46{ 48{
47 *ok = false; 49 *ok = false;
48 return QDateTime (); 50 return QDateTime ();
49} 51}