summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calendar.h1
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/calendarlocal.h1
-rw-r--r--libkcal/todo.cpp4
4 files changed, 10 insertions, 2 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h
index 3b7b183..2efa355 100644
--- a/libkcal/calendar.h
+++ b/libkcal/calendar.h
@@ -56,48 +56,49 @@ namespace KCal {
as pointers, that means all changes to the returned events are immediately
visible in the Calendar. You shouldn't delete any Event object you get from
Calendar.
*/
class Calendar : public QObject, public CustomProperties,
public IncidenceBase::Observer
{
Q_OBJECT
public:
Calendar();
Calendar(const QString &timeZoneId);
virtual ~Calendar();
Incidence * undoIncidence() { return mUndoIncidence; };
bool undoDeleteIncidence();
void deleteIncidence(Incidence *in);
void resetTempSyncStat();
void resetPilotStat(int id);
/**
Clears out the current calendar, freeing all used memory etc.
*/
virtual void close() = 0;
virtual void addCalendar( Calendar* ) = 0;
virtual bool addCalendarFile( QString name, int id ) = 0;
virtual void setSyncEventsReadOnly() = 0;
+ virtual void stopAllTodos() = 0;
/**
Sync changes in memory to persistant storage.
*/
virtual void save() = 0;
virtual QPtrList<Event> getExternLastSyncEvents() = 0;
virtual void removeSyncInfo( QString syncProfile) = 0;
virtual bool isSaving() { return false; }
/**
Return the owner of the calendar's full name.
*/
const QString &getOwner() const;
/**
Set the owner of the calendar. Should be owner's full name.
*/
void setOwner( const QString &os );
/**
Return the email address of the calendar owner.
*/
const QString &getEmail();
/**
Set the email address of the calendar owner.
*/
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index 8c4dde1..18f1af8 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -126,48 +126,54 @@ void CalendarLocal::addCalendar( Calendar* cal )
{
QPtrList<Journal> JournalList = cal->journals();
Journal * ev = JournalList.first();
while ( ev ) {
ev->unRegisterObserver( cal );
ev->registerObserver( this );
mJournalList.append( ev );
ev = JournalList.next();
}
}
setModified( true );
}
bool CalendarLocal::load( const QString &fileName )
{
FileStorage storage( this, fileName );
return storage.load();
}
bool CalendarLocal::save( const QString &fileName, CalFormat *format )
{
FileStorage storage( this, fileName, format );
return storage.save();
}
+void CalendarLocal::stopAllTodos()
+{
+ for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() )
+ it->setRunning( false );
+
+}
void CalendarLocal::close()
{
Todo * i;
for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false);
mEventList.setAutoDelete( true );
mTodoList.setAutoDelete( true );
mJournalList.setAutoDelete( false );
mEventList.clear();
mTodoList.clear();
mJournalList.clear();
mEventList.setAutoDelete( false );
mTodoList.setAutoDelete( false );
mJournalList.setAutoDelete( false );
setModified( false );
}
bool CalendarLocal::addAnniversaryNoDup( Event *event )
{
QString cat;
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h
index 0286b48..d32597f 100644
--- a/libkcal/calendarlocal.h
+++ b/libkcal/calendarlocal.h
@@ -25,48 +25,49 @@
#include "calendar.h"
namespace KCal {
class CalFormat;
/**
This class provides a calendar stored as a local file.
*/
class CalendarLocal : public Calendar
{
public:
/**
Constructs a new calendar, with variables initialized to sane values.
*/
CalendarLocal();
/**
Constructs a new calendar, with variables initialized to sane values.
*/
CalendarLocal( const QString &timeZoneId );
~CalendarLocal();
void addCalendar( Calendar* );
bool addCalendarFile( QString name, int id );
void setSyncEventsReadOnly();
+ void stopAllTodos();
/**
Loads a calendar on disk in vCalendar or iCalendar format into the current
calendar. Any information already present is lost.
@return true, if successfull, false on error.
@param fileName the name of the calendar on disk.
*/
bool load( const QString &fileName );
/**
Writes out the calendar to disk in the specified \a format.
CalendarLocal takes ownership of the CalFormat object.
@return true, if successfull, false on error.
@param fileName the name of the file
*/
bool save( const QString &fileName, CalFormat *format = 0 );
/**
Clears out the current calendar, freeing all used memory etc. etc.
*/
void close();
void save() {}
/**
Add Event to calendar.
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 9a8b6e4..5260051 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -90,50 +90,50 @@ void Todo::setRunning( bool run )
if ( mRunning ) {
mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
mRunStart = QDateTime::currentDateTime();
} else {
mRunSaveTimer->stop();
saveRunningInfoToFile();
}
}
void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end )
{
if ( !mRunning) return;
mRunning = false;
mRunStart = start;
mRunEnd = end;
saveRunningInfoToFile( comment );
}
void Todo::saveRunningInfoToFile()
{
mRunEnd = QDateTime::currentDateTime();
saveRunningInfoToFile( QString::null );
}
void Todo::saveRunningInfoToFile( QString comment )
{
//qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1());
- if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 10 ) {
- qDebug("Running time < 30 seconds. Skipped. ");
+ if ( mRunStart.secsTo ( mRunEnd) < 15 ) {
+ qDebug("Running time < 15 seconds. Skipped. ");
return;
}
QString dir = KGlobalSettings::timeTrackerDir();
//qDebug("%s ", dir.latin1());
QString file = "%1%2%3-%4%5%6-";
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 );
file.replace ( QRegExp (" "), "0" );
file += uid();
//qDebug("File %s ",file.latin1() );
CalendarLocal cal;
cal.setLocalTime();
Todo * to = (Todo*) clone();
to->setFloats( false );
to->setDtStart( mRunStart );
to->setHasStartDate( true );
to->setDtDue( mRunEnd );
to->setHasDueDate( true );
to->setUid( file );
if ( !comment.isEmpty() ) {
QString des = to->description();
if ( des.isEmpty () )
to->setDescription( "TT-Note: " + comment );
else
to->setDescription( "TT-Note: " + comment +"\n" + des );