summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-13 23:07:29 (UTC)
committer zautrix <zautrix>2005-06-13 23:07:29 (UTC)
commitb3743f5abe0a95c9ffeadf6701c9943f604febd6 (patch) (unidiff)
treeca7b4fa180795d5d6fb7b212eea74e0ddf2e73ad
parent35d40d945aed8c9e7c3389182014a2d99edb5254 (diff)
downloadkdepimpi-b3743f5abe0a95c9ffeadf6701c9943f604febd6.zip
kdepimpi-b3743f5abe0a95c9ffeadf6701c9943f604febd6.tar.gz
kdepimpi-b3743f5abe0a95c9ffeadf6701c9943f604febd6.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp1
-rw-r--r--libkcal/todo.cpp4
-rw-r--r--libkcal/todo.h3
3 files changed, 6 insertions, 2 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 19d731f..9633b2c 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -309,97 +309,96 @@ void KOCalEditView::readConfig()
309 cb->setChecked( kkf->isEnabled ); 309 cb->setChecked( kkf->isEnabled );
310 cb->setNum( kkf->mCalNumber ); 310 cb->setNum( kkf->mCalNumber );
311 if ( kkf->mErrorOnLoad ) 311 if ( kkf->mErrorOnLoad )
312 cb->setEnabled( false ); 312 cb->setEnabled( false );
313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 313 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
314 KOCalButton* name = new KOCalButton( mw ); 314 KOCalButton* name = new KOCalButton( mw );
315 name->setNum( kkf->mCalNumber ); 315 name->setNum( kkf->mCalNumber );
316 name->setText( kkf->mName ); 316 name->setText( kkf->mName );
317 mainLayout->addWidget( name,row,2 ); 317 mainLayout->addWidget( name,row,2 );
318 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 318 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
319 cb = new KOCalCheckButton( mw ); 319 cb = new KOCalCheckButton( mw );
320 mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); 320 mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb );
321 cb->setChecked( kkf->isAlarmEnabled ); 321 cb->setChecked( kkf->isAlarmEnabled );
322 cb->setNum( kkf->mCalNumber ); 322 cb->setNum( kkf->mCalNumber );
323 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 323 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
324 if ( kkf->mErrorOnLoad ) 324 if ( kkf->mErrorOnLoad )
325 cb->setEnabled( false ); 325 cb->setEnabled( false );
326 cb = new KOCalCheckButton( mw ); 326 cb = new KOCalCheckButton( mw );
327 mainLayout->addWidget( cb,row,4 );mROB.append( cb ); 327 mainLayout->addWidget( cb,row,4 );mROB.append( cb );
328 cb->setChecked( kkf->isReadOnly ); 328 cb->setChecked( kkf->isReadOnly );
329 cb->setNum( kkf->mCalNumber ); 329 cb->setNum( kkf->mCalNumber );
330 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 330 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
331 if ( kkf->mErrorOnLoad ) 331 if ( kkf->mErrorOnLoad )
332 cb->setEnabled( false ); 332 cb->setEnabled( false );
333 KColorButton *colb = new KColorButton( mw ); 333 KColorButton *colb = new KColorButton( mw );
334 mainLayout->addWidget( colb,row,5 ); 334 mainLayout->addWidget( colb,row,5 );
335 colb->setID( kkf->mCalNumber ); 335 colb->setID( kkf->mCalNumber );
336 colb->setColor( kkf->mDefaultColor ); 336 colb->setColor( kkf->mDefaultColor );
337 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); 337 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
338 if ( row > 1) { 338 if ( row > 1) {
339 KOCalButton* calb = new KOCalButton( mw ); 339 KOCalButton* calb = new KOCalButton( mw );
340 mainLayout->addWidget( calb,row,6 ); 340 mainLayout->addWidget( calb,row,6 );
341 calb->setNum( kkf->mCalNumber ); 341 calb->setNum( kkf->mCalNumber );
342 calb->setPixmap ( SmallIcon("minus")); 342 calb->setPixmap ( SmallIcon("minus"));
343 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 343 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
344 int hei = calb->sizeHint().height(); 344 int hei = calb->sizeHint().height();
345 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 345 //calb->setMaximumSize( hei*9/10, hei*9/10 );
346 } 346 }
347 ++row; 347 ++row;
348 kkf = KOPrefs::instance()->mCalendars.next(); 348 kkf = KOPrefs::instance()->mCalendars.next();
349 } 349 }
350 lab = new QLabel ( "", mw ); 350 lab = new QLabel ( "", mw );
351 mainLayout->addWidget( lab,row,0 ); 351 mainLayout->addWidget( lab,row,0 );
352 mw->show(); 352 mw->show();
353 353
354} 354}
355void KOCalEditView::addCal() 355void KOCalEditView::addCal()
356{ 356{
357 qDebug("addcal ");
358 KONewCalPrefs prefs ( this ); 357 KONewCalPrefs prefs ( this );
359 if ( ! prefs.exec() ) 358 if ( ! prefs.exec() )
360 return; 359 return;
361 QString name = prefs.calName(); 360 QString name = prefs.calName();
362 QString file = prefs.calFileName(); 361 QString file = prefs.calFileName();
363 QFileInfo fi ( file ); 362 QFileInfo fi ( file );
364 if (!fi.exists() ) { 363 if (!fi.exists() ) {
365 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); 364 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
366 return; 365 return;
367 } 366 }
368 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 367 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
369 kkf->mName = name; 368 kkf->mName = name;
370 kkf->mFileName = file; 369 kkf->mFileName = file;
371 emit calendarAdded( kkf->mCalNumber ); 370 emit calendarAdded( kkf->mCalNumber );
372 readConfig(); 371 readConfig();
373 emit needsUpdate(); 372 emit needsUpdate();
374} 373}
375void KOCalEditView::enableAll() 374void KOCalEditView::enableAll()
376{ 375{
377 toggleList( mEnabledB ); 376 toggleList( mEnabledB );
378} 377}
379void KOCalEditView::enableAlarm() 378void KOCalEditView::enableAlarm()
380{ 379{
381 toggleList( mAlarmB ); 380 toggleList( mAlarmB );
382} 381}
383void KOCalEditView::disableRO() 382void KOCalEditView::disableRO()
384{ 383{
385 toggleList( mROB ); 384 toggleList( mROB );
386} 385}
387void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) 386void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
388{ 387{
389 bool dis = false; 388 bool dis = false;
390 KOCalCheckButton* it = list.first(); 389 KOCalCheckButton* it = list.first();
391 while ( it ) { 390 while ( it ) {
392 if ( !it->isChecked() ) { 391 if ( !it->isChecked() ) {
393 dis = true; 392 dis = true;
394 break; 393 break;
395 } 394 }
396 it = list.next(); 395 it = list.next();
397 } 396 }
398 it = list.first(); 397 it = list.first();
399 while ( it ) { 398 while ( it ) {
400 it->setChecked(dis); 399 it->setChecked(dis);
401 it = list.next(); 400 it = list.next();
402 } 401 }
403} 402}
404void KOCalEditView::deleteAll() 403void KOCalEditView::deleteAll()
405{ 404{
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 42274ff..e98af3c 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -43,96 +43,100 @@ Todo::Todo(): QObject(), Incidence()
43 mRunning = false; 43 mRunning = false;
44 mRunSaveTimer = 0; 44 mRunSaveTimer = 0;
45} 45}
46 46
47Todo::Todo(const Todo &t) : QObject(),Incidence(t) 47Todo::Todo(const Todo &t) : QObject(),Incidence(t)
48{ 48{
49 mDtDue = t.mDtDue; 49 mDtDue = t.mDtDue;
50 mHasDueDate = t.mHasDueDate; 50 mHasDueDate = t.mHasDueDate;
51 mCompleted = t.mCompleted; 51 mCompleted = t.mCompleted;
52 mHasCompletedDate = t.mHasCompletedDate; 52 mHasCompletedDate = t.mHasCompletedDate;
53 mPercentComplete = t.mPercentComplete; 53 mPercentComplete = t.mPercentComplete;
54 mRunning = false; 54 mRunning = false;
55 mRunSaveTimer = 0; 55 mRunSaveTimer = 0;
56} 56}
57 57
58Todo::~Todo() 58Todo::~Todo()
59{ 59{
60 setRunning( false ); 60 setRunning( false );
61 //qDebug("Todo::~Todo() "); 61 //qDebug("Todo::~Todo() ");
62} 62}
63 63
64void Todo::setRunningFalse( QString s ) 64void Todo::setRunningFalse( QString s )
65{ 65{
66 if ( ! mRunning ) 66 if ( ! mRunning )
67 return; 67 return;
68 mRunning = false; 68 mRunning = false;
69 mRunSaveTimer->stop(); 69 mRunSaveTimer->stop();
70 saveRunningInfoToFile( s ); 70 saveRunningInfoToFile( s );
71} 71}
72void Todo::setRunning( bool run ) 72void Todo::setRunning( bool run )
73{ 73{
74 if ( run == mRunning ) 74 if ( run == mRunning )
75 return; 75 return;
76 //qDebug("Todo::setRunning %d ", run); 76 //qDebug("Todo::setRunning %d ", run);
77 if ( !mRunSaveTimer ) { 77 if ( !mRunSaveTimer ) {
78 mRunSaveTimer = new QTimer ( this ); 78 mRunSaveTimer = new QTimer ( this );
79 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); 79 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
80 } 80 }
81 mRunning = run; 81 mRunning = run;
82 if ( mRunning ) { 82 if ( mRunning ) {
83 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min 83 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
84 mRunStart = QDateTime::currentDateTime(); 84 mRunStart = QDateTime::currentDateTime();
85 } else { 85 } else {
86 mRunSaveTimer->stop(); 86 mRunSaveTimer->stop();
87 saveRunningInfoToFile(); 87 saveRunningInfoToFile();
88 } 88 }
89} 89}
90 90
91void Todo::saveRunningInfoToFile()
92{
93 saveRunningInfoToFile( QString::null );
94}
91void Todo::saveRunningInfoToFile( QString comment ) 95void Todo::saveRunningInfoToFile( QString comment )
92{ 96{
93 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); 97 //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
94 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { 98 if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) {
95 qDebug("Running time < 30 seconds. Skipped. "); 99 qDebug("Running time < 30 seconds. Skipped. ");
96 return; 100 return;
97 } 101 }
98 QString dir = KGlobalSettings::timeTrackerDir(); 102 QString dir = KGlobalSettings::timeTrackerDir();
99 //qDebug("%s ", dir.latin1()); 103 //qDebug("%s ", dir.latin1());
100 QString file = "%1%2%3-%4%5%6-"; 104 QString file = "%1%2%3-%4%5%6-";
101 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); 105 file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 );
102 file.replace ( QRegExp (" "), "0" ); 106 file.replace ( QRegExp (" "), "0" );
103 file += uid(); 107 file += uid();
104 //qDebug("File %s ",file.latin1() ); 108 //qDebug("File %s ",file.latin1() );
105 CalendarLocal cal; 109 CalendarLocal cal;
106 cal.setLocalTime(); 110 cal.setLocalTime();
107 Todo * to = (Todo*) clone(); 111 Todo * to = (Todo*) clone();
108 to->setFloats( false ); 112 to->setFloats( false );
109 to->setDtStart( mRunStart ); 113 to->setDtStart( mRunStart );
110 to->setHasStartDate( true ); 114 to->setHasStartDate( true );
111 to->setDtDue( QDateTime::currentDateTime() ); 115 to->setDtDue( QDateTime::currentDateTime() );
112 to->setHasDueDate( true ); 116 to->setHasDueDate( true );
113 to->setUid( file ); 117 to->setUid( file );
114 if ( !comment.isEmpty() ) { 118 if ( !comment.isEmpty() ) {
115 QString des = to->description(); 119 QString des = to->description();
116 if ( des.isEmpty () ) 120 if ( des.isEmpty () )
117 to->setDescription( "TT-Note: " + comment ); 121 to->setDescription( "TT-Note: " + comment );
118 else 122 else
119 to->setDescription( "TT-Note: " + comment +"\n" + des ); 123 to->setDescription( "TT-Note: " + comment +"\n" + des );
120 } 124 }
121 cal.addIncidence( to ); 125 cal.addIncidence( to );
122 ICalFormat format; 126 ICalFormat format;
123 file = dir +"/" +file +".ics"; 127 file = dir +"/" +file +".ics";
124 format.save( &cal, file ); 128 format.save( &cal, file );
125 saveParents(); 129 saveParents();
126 130
127} 131}
128void Todo::saveParents() 132void Todo::saveParents()
129{ 133{
130 if (!relatedTo() ) 134 if (!relatedTo() )
131 return; 135 return;
132 Incidence * inc = relatedTo(); 136 Incidence * inc = relatedTo();
133 if ( inc->typeID() != todoID ) 137 if ( inc->typeID() != todoID )
134 return; 138 return;
135 Todo* to = (Todo*)inc; 139 Todo* to = (Todo*)inc;
136 bool saveTodo = false; 140 bool saveTodo = false;
137 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; 141 QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics";
138 QFileInfo fi ( file ); 142 QFileInfo fi ( file );
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 501c2ba..6fc4d4b 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -80,72 +80,73 @@ namespace KCal {
80 80
81 81
82 /** sets the event's status to the string specified. The string 82 /** sets the event's status to the string specified. The string
83 * must be a recognized value for the status field, i.e. a string 83 * must be a recognized value for the status field, i.e. a string
84 * equivalent of the possible status enumerations previously described. */ 84 * equivalent of the possible status enumerations previously described. */
85// void setStatus(const QString &statStr); 85// void setStatus(const QString &statStr);
86 /** sets the event's status to the value specified. See the enumeration 86 /** sets the event's status to the value specified. See the enumeration
87 * above for possible values. */ 87 * above for possible values. */
88// void setStatus(int); 88// void setStatus(int);
89 /** return the event's status. */ 89 /** return the event's status. */
90// int status() const; 90// int status() const;
91 /** return the event's status in string format. */ 91 /** return the event's status in string format. */
92// QString statusStr() const; 92// QString statusStr() const;
93 93
94 /** return, if this todo is completed */ 94 /** return, if this todo is completed */
95 bool isCompleted() const; 95 bool isCompleted() const;
96 /** set completed state of this todo */ 96 /** set completed state of this todo */
97 void setCompleted(bool); 97 void setCompleted(bool);
98 98
99 /** 99 /**
100 Return how many percent of the task are completed. Returns a value 100 Return how many percent of the task are completed. Returns a value
101 between 0 and 100. 101 between 0 and 100.
102 */ 102 */
103 int percentComplete() const; 103 int percentComplete() const;
104 /** 104 /**
105 Set how many percent of the task are completed. Valid values are in the 105 Set how many percent of the task are completed. Valid values are in the
106 range from 0 to 100. 106 range from 0 to 100.
107 */ 107 */
108 void setPercentComplete(int); 108 void setPercentComplete(int);
109 109
110 /** return date and time when todo was completed */ 110 /** return date and time when todo was completed */
111 QDateTime completed() const; 111 QDateTime completed() const;
112 QString completedStr(bool shortF = true) const; 112 QString completedStr(bool shortF = true) const;
113 /** set date and time of completion */ 113 /** set date and time of completion */
114 void setCompleted(const QDateTime &completed); 114 void setCompleted(const QDateTime &completed);
115 115
116 /** Return true, if todo has a date associated with completion */ 116 /** Return true, if todo has a date associated with completion */
117 bool hasCompletedDate() const; 117 bool hasCompletedDate() const;
118 bool contains ( Todo*); 118 bool contains ( Todo*);
119 void checkSetCompletedFalse(); 119 void checkSetCompletedFalse();
120 bool setRecurDates(); 120 bool setRecurDates();
121 bool isRunning() {return mRunning;} 121 bool isRunning() {return mRunning;}
122 bool hasRunningSub(); 122 bool hasRunningSub();
123 void setRunning( bool ); 123 void setRunning( bool );
124 void setRunningFalse( QString ); 124 void setRunningFalse( QString );
125 int runTime(); 125 int runTime();
126 QDateTime runStart () const { return mRunStart;} 126 QDateTime runStart () const { return mRunStart;}
127 public slots: 127 public slots:
128 void saveRunningInfoToFile( QString st = QString::null ); 128 void saveRunningInfoToFile( QString st );
129 void saveRunningInfoToFile( );
129 void saveParents(); 130 void saveParents();
130 private: 131 private:
131 bool mRunning; 132 bool mRunning;
132 QTimer * mRunSaveTimer; 133 QTimer * mRunSaveTimer;
133 QDateTime mRunStart; 134 QDateTime mRunStart;
134 bool accept(Visitor &v) { return v.visit(this); } 135 bool accept(Visitor &v) { return v.visit(this); }
135 136
136 QDateTime mDtDue; // due date of todo 137 QDateTime mDtDue; // due date of todo
137 138
138 bool mHasDueDate; // if todo has associated due date 139 bool mHasDueDate; // if todo has associated due date
139 140
140// int mStatus; // confirmed/delegated/tentative/etc 141// int mStatus; // confirmed/delegated/tentative/etc
141 142
142 QDateTime mCompleted; 143 QDateTime mCompleted;
143 bool mHasCompletedDate; 144 bool mHasCompletedDate;
144 145
145 int mPercentComplete; 146 int mPercentComplete;
146}; 147};
147 148
148 bool operator==( const Todo&, const Todo& ); 149 bool operator==( const Todo&, const Todo& );
149} 150}
150 151
151#endif 152#endif