summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-04-09 20:54:29 (UTC)
committer zautrix <zautrix>2005-04-09 20:54:29 (UTC)
commitae58b2fe29fcd8b3690dcbb6d64976674f6294e0 (patch) (unidiff)
tree7a321b610fa1f7cab980370a44bf78fea88bf481 /libkcal
parent9e43ebbe5867b2da957bb17c35bd357715424cba (diff)
downloadkdepimpi-ae58b2fe29fcd8b3690dcbb6d64976674f6294e0.zip
kdepimpi-ae58b2fe29fcd8b3690dcbb6d64976674f6294e0.tar.gz
kdepimpi-ae58b2fe29fcd8b3690dcbb6d64976674f6294e0.tar.bz2
cool
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/todo.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7dee4cd..c008fe1 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -6,34 +6,36 @@
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 <kglobal.h> 21#include <kglobal.h>
22#include <kglobalsettings.h>
22#include <klocale.h> 23#include <klocale.h>
23#include <kdebug.h> 24#include <kdebug.h>
25#include <qregexp.h>
24 26
25#include "todo.h" 27#include "todo.h"
26 28
27using namespace KCal; 29using namespace KCal;
28 30
29Todo::Todo(): Incidence() 31Todo::Todo(): Incidence()
30{ 32{
31// mStatus = TENTATIVE; 33// mStatus = TENTATIVE;
32 34
33 mHasDueDate = false; 35 mHasDueDate = false;
34 setHasStartDate( false ); 36 setHasStartDate( false );
35 mCompleted = getEvenTime(QDateTime::currentDateTime()); 37 mCompleted = getEvenTime(QDateTime::currentDateTime());
36 mHasCompletedDate = false; 38 mHasCompletedDate = false;
37 mPercentComplete = 0; 39 mPercentComplete = 0;
38 mRunning = false; 40 mRunning = false;
39 mRunSaveTimer = 0; 41 mRunSaveTimer = 0;
@@ -62,33 +64,45 @@ void Todo::setRunning( bool run )
62 if ( !mRunSaveTimer ) { 64 if ( !mRunSaveTimer ) {
63 mRunSaveTimer = new QTimer ( this ); 65 mRunSaveTimer = new QTimer ( this );
64 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); 66 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
65 } 67 }
66 mRunning = run; 68 mRunning = run;
67 if ( mRunning ) { 69 if ( mRunning ) {
68 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min 70 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
69 mRunStart = QDateTime::currentDateTime(); 71 mRunStart = QDateTime::currentDateTime();
70 } else { 72 } else {
71 mRunSaveTimer->stop(); 73 mRunSaveTimer->stop();
72 saveRunningInfoToFile(); 74 saveRunningInfoToFile();
73 } 75 }
74} 76}
75 77
76void Todo::saveRunningInfoToFile() 78void Todo::saveRunningInfoToFile()
77{ 79{
78 qDebug("Todo::saveRunningInfoToFile() "); 80 qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
81
82 QString dir = KGlobalSettings::timeTrackerDir();
83 qDebug("%s ", dir.latin1());
84 QString file = "%1-%2-%3-%4-%5-%6-%7.tt";
85
86 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 ).arg( mRunStart.time().msec(), 3 );
87 file.replace ( QRegExp (" "), "0" );
88 file = dir +"/" +file;
89 qDebug("%s ", file.latin1());
90
91
92
79} 93}
80 94
81int Todo::runTime() 95int Todo::runTime()
82{ 96{
83 if ( !mRunning ) 97 if ( !mRunning )
84 return 0; 98 return 0;
85 return mRunStart.secsTo( QDateTime::currentDateTime() ); 99 return mRunStart.secsTo( QDateTime::currentDateTime() );
86} 100}
87bool Todo::hasRunningSub() 101bool Todo::hasRunningSub()
88{ 102{
89 if ( mRunning ) 103 if ( mRunning )
90 return true; 104 return true;
91 Incidence *aTodo; 105 Incidence *aTodo;
92 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { 106 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
93 if ( ((Todo*)aTodo)->hasRunningSub() ) 107 if ( ((Todo*)aTodo)->hasRunningSub() )
94 return true; 108 return true;