author | zautrix <zautrix> | 2005-04-15 20:51:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-15 20:51:58 (UTC) |
commit | 85bdc33419eef0ffa9f00eb7222944518fe39b6c (patch) (unidiff) | |
tree | 57000de41f5e29c5ebd07f3ed2951a7b89730fb1 /libkcal | |
parent | e1d62b2afac2b625a3e0b8d4df137647de34e04f (diff) | |
download | kdepimpi-85bdc33419eef0ffa9f00eb7222944518fe39b6c.zip kdepimpi-85bdc33419eef0ffa9f00eb7222944518fe39b6c.tar.gz kdepimpi-85bdc33419eef0ffa9f00eb7222944518fe39b6c.tar.bz2 |
fixxx
-rw-r--r-- | libkcal/calendarlocal.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.cpp | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 00a43e5..e75df70 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -61,48 +61,52 @@ void CalendarLocal::init() | |||
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | close(); | 68 | close(); |
69 | } | 69 | } |
70 | 70 | ||
71 | bool CalendarLocal::load( const QString &fileName ) | 71 | bool CalendarLocal::load( const QString &fileName ) |
72 | { | 72 | { |
73 | FileStorage storage( this, fileName ); | 73 | FileStorage storage( this, fileName ); |
74 | return storage.load(); | 74 | return storage.load(); |
75 | } | 75 | } |
76 | 76 | ||
77 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 77 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
78 | { | 78 | { |
79 | FileStorage storage( this, fileName, format ); | 79 | FileStorage storage( this, fileName, format ); |
80 | return storage.save(); | 80 | return storage.save(); |
81 | } | 81 | } |
82 | 82 | ||
83 | void CalendarLocal::close() | 83 | void CalendarLocal::close() |
84 | { | 84 | { |
85 | |||
86 | Todo * i; | ||
87 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); | ||
88 | |||
85 | mEventList.setAutoDelete( true ); | 89 | mEventList.setAutoDelete( true ); |
86 | mTodoList.setAutoDelete( true ); | 90 | mTodoList.setAutoDelete( true ); |
87 | mJournalList.setAutoDelete( false ); | 91 | mJournalList.setAutoDelete( false ); |
88 | 92 | ||
89 | mEventList.clear(); | 93 | mEventList.clear(); |
90 | mTodoList.clear(); | 94 | mTodoList.clear(); |
91 | mJournalList.clear(); | 95 | mJournalList.clear(); |
92 | 96 | ||
93 | mEventList.setAutoDelete( false ); | 97 | mEventList.setAutoDelete( false ); |
94 | mTodoList.setAutoDelete( false ); | 98 | mTodoList.setAutoDelete( false ); |
95 | mJournalList.setAutoDelete( false ); | 99 | mJournalList.setAutoDelete( false ); |
96 | 100 | ||
97 | setModified( false ); | 101 | setModified( false ); |
98 | } | 102 | } |
99 | 103 | ||
100 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) | 104 | bool CalendarLocal::addAnniversaryNoDup( Event *event ) |
101 | { | 105 | { |
102 | QString cat; | 106 | QString cat; |
103 | bool isBirthday = true; | 107 | bool isBirthday = true; |
104 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { | 108 | if( event->categoriesStr() == i18n( "Anniversary" ) ) { |
105 | isBirthday = false; | 109 | isBirthday = false; |
106 | cat = i18n( "Anniversary" ); | 110 | cat = i18n( "Anniversary" ); |
107 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { | 111 | } else if( event->categoriesStr() == i18n( "Birthday" ) ) { |
108 | isBirthday = true; | 112 | isBirthday = true; |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index b89abce..5e6ac22 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -44,48 +44,49 @@ Todo::Todo(): QObject(), Incidence() | |||
44 | mRunSaveTimer = 0; | 44 | mRunSaveTimer = 0; |
45 | } | 45 | } |
46 | 46 | ||
47 | Todo::Todo(const Todo &t) : QObject(),Incidence(t) | 47 | Todo::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 | ||
58 | Todo::~Todo() | 58 | Todo::~Todo() |
59 | { | 59 | { |
60 | setRunning( false ); | 60 | setRunning( false ); |
61 | //qDebug("Todo::~Todo() "); | 61 | //qDebug("Todo::~Todo() "); |
62 | } | 62 | } |
63 | 63 | ||
64 | void Todo::setRunning( bool run ) | 64 | void Todo::setRunning( bool run ) |
65 | { | 65 | { |
66 | if ( run == mRunning ) | 66 | if ( run == mRunning ) |
67 | return; | 67 | return; |
68 | //qDebug("Todo::setRunning %d ", run); | ||
68 | if ( !mRunSaveTimer ) { | 69 | if ( !mRunSaveTimer ) { |
69 | mRunSaveTimer = new QTimer ( this ); | 70 | mRunSaveTimer = new QTimer ( this ); |
70 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); | 71 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); |
71 | } | 72 | } |
72 | mRunning = run; | 73 | mRunning = run; |
73 | if ( mRunning ) { | 74 | if ( mRunning ) { |
74 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min | 75 | mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min |
75 | mRunStart = QDateTime::currentDateTime(); | 76 | mRunStart = QDateTime::currentDateTime(); |
76 | } else { | 77 | } else { |
77 | mRunSaveTimer->stop(); | 78 | mRunSaveTimer->stop(); |
78 | saveRunningInfoToFile(); | 79 | saveRunningInfoToFile(); |
79 | } | 80 | } |
80 | } | 81 | } |
81 | 82 | ||
82 | void Todo::saveRunningInfoToFile() | 83 | void Todo::saveRunningInfoToFile() |
83 | { | 84 | { |
84 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 85 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
85 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { | 86 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { |
86 | qDebug("Running time < 30 seconds. Skipped. "); | 87 | qDebug("Running time < 30 seconds. Skipped. "); |
87 | return; | 88 | return; |
88 | } | 89 | } |
89 | QString dir = KGlobalSettings::timeTrackerDir(); | 90 | QString dir = KGlobalSettings::timeTrackerDir(); |
90 | //qDebug("%s ", dir.latin1()); | 91 | //qDebug("%s ", dir.latin1()); |
91 | QString file = "%1%2%3-%4%5%6-"; | 92 | QString file = "%1%2%3-%4%5%6-"; |