summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
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
@@ -10,26 +10,28 @@
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());
@@ -66,25 +68,37 @@ void Todo::setRunning( bool run )
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;