summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-07-28 10:38:58 (UTC)
committer zautrix <zautrix>2005-07-28 10:38:58 (UTC)
commitfee4c893fe8fd01af1b55c1ccd40213fc18a36b4 (patch) (unidiff)
tree83a3018d54d60e880d441a6f91ef8fe54254aaff /libkcal
parent27ffa2e08ebb38e71f613af3a214750442418e2c (diff)
downloadkdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.zip
kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.tar.gz
kdepimpi-fee4c893fe8fd01af1b55c1ccd40213fc18a36b4.tar.bz2
fixxxx
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp2
-rw-r--r--libkcal/event.cpp8
-rw-r--r--libkcal/event.h1
-rw-r--r--libkcal/incidence.cpp29
-rw-r--r--libkcal/incidence.h3
-rw-r--r--libkcal/todo.cpp10
-rw-r--r--libkcal/todo.h1
7 files changed, 52 insertions, 2 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 79e0464..3157214 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -349,9 +349,9 @@ int Alarm::offset()
349 return mOffset.asSeconds(); 349 return mOffset.asSeconds();
350 } 350 }
351 351
352} 352}
353QString Alarm::offsetText() 353QString Alarm::offsetText()
354{ 354{
355 int min = -offset()/60; 355 int min = -offset()/60;
356 int hours = min /60; 356 int hours = min /60;
357 min = min % 60; 357 min = min % 60;
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index 0766fd9..fdf5657 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -413,4 +413,12 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_
413 *ok = false; 413 *ok = false;
414 return QDateTime (); 414 return QDateTime ();
415 415
416} 416}
417
418QString Event::durationText()
419{
420 int sec = mDtStart.secsTo( mDtEnd );
421 if ( doesFloat() )
422 sec += 86400;
423 return durationText4Time( sec );
424}
diff --git a/libkcal/event.h b/libkcal/event.h
index 2da9770..6a58618 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -75,8 +75,9 @@ class Event : public Incidence
75 75
76 bool contains ( Event*); 76 bool contains ( Event*);
77 77
78 bool isOverlapping ( Event*, QDateTime*, QDateTime* ); 78 bool isOverlapping ( Event*, QDateTime*, QDateTime* );
79 QString durationText();
79 80
80 private: 81 private:
81 bool accept(Visitor &v) { return v.visit(this); } 82 bool accept(Visitor &v) { return v.visit(this); }
82 83
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 4643a3a..201f593 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -99,9 +99,38 @@ Incidence::~Incidence()
99 if ( mRecurrence ) 99 if ( mRecurrence )
100 delete mRecurrence; 100 delete mRecurrence;
101 101
102} 102}
103QString Incidence::durationText()
104{
105 return "---";
106}
107QString Incidence::durationText4Time( int offset )
108{
109 int min = offset/60;
110 int hours = min /60;
111 min = min % 60;
112 int days = hours /24;
113 hours = hours % 24;
114
115 if ( doesFloat() || ( min == 0 && hours == 0 ) ) {
116 if ( days == 1 )
117 return "1" + i18n(" day");
118 else
119 return QString::number( days )+ i18n(" days");
103 120
121 }
122 QString message = QString::number ( hours ) +":";
123 if ( min < 10 ) message += "0";
124 message += QString::number ( min );
125 if ( days > 0 ) {
126 if ( days == 1 )
127 message = "1" + i18n(" day") + " "+message;
128 else
129 message = QString::number( days )+ i18n(" days") + " "+message;
130 }
131 return message;
132}
104bool Incidence::isHoliday() const 133bool Incidence::isHoliday() const
105{ 134{
106 return mHoliday; 135 return mHoliday;
107} 136}
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 8519f01..88df217 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -280,9 +280,10 @@ class Incidence : public IncidenceBase
280 QDateTime lastModifiedSub(); 280 QDateTime lastModifiedSub();
281 QString recurrenceText() const; 281 QString recurrenceText() const;
282 void setLastModifiedSubInvalid(); 282 void setLastModifiedSubInvalid();
283 283
284 284 virtual QString durationText();
285 QString durationText4Time( int secs );
285 Recurrence *mRecurrence; 286 Recurrence *mRecurrence;
286protected: 287protected:
287 QPtrList<Alarm> mAlarms; 288 QPtrList<Alarm> mAlarms;
288 QPtrList<Incidence> mRelations; 289 QPtrList<Incidence> mRelations;
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7bf756a..e4508a0 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -613,4 +613,14 @@ void Todo::checkSetCompletedFalse()
613 qDebug("Todo::checkSetCompletedFalse "); 613 qDebug("Todo::checkSetCompletedFalse ");
614 } 614 }
615 } 615 }
616} 616}
617QString Todo::durationText()
618{
619 if ( mHasDueDate && hasStartDate() ) {
620 int sec = dtStart().secsTo( dtDue() );
621 if ( doesFloat() )
622 sec += 86400;
623 return durationText4Time( sec );
624 }
625 return "---";
626}
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 425dfad..7feb32e 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -129,8 +129,9 @@ namespace KCal {
129 public slots: 129 public slots:
130 void saveRunningInfoToFile( QString st ); 130 void saveRunningInfoToFile( QString st );
131 void saveRunningInfoToFile( ); 131 void saveRunningInfoToFile( );
132 void saveParents(); 132 void saveParents();
133 QString durationText();
133 private: 134 private:
134 bool mRunning; 135 bool mRunning;
135 QTimer * mRunSaveTimer; 136 QTimer * mRunSaveTimer;
136 QDateTime mRunStart; 137 QDateTime mRunStart;