author | zautrix <zautrix> | 2005-07-27 23:40:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-27 23:40:19 (UTC) |
commit | 27ffa2e08ebb38e71f613af3a214750442418e2c (patch) (side-by-side diff) | |
tree | de2bb4c541ab8795ee3739526e82ca8f4e952c09 | |
parent | 0e38cffd7ba745f237c659e1c48080fcb25b126c (diff) | |
download | kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.zip kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.tar.gz kdepimpi-27ffa2e08ebb38e71f613af3a214750442418e2c.tar.bz2 |
fixcxcx
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 1 | ||||
-rw-r--r-- | libkcal/icalformat.cpp | 9 | ||||
-rw-r--r-- | libkcal/icalformat.h | 3 | ||||
-rw-r--r-- | libkcal/todo.cpp | 5 |
5 files changed, 19 insertions, 5 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index eea9a4d..4aeb20c 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -1048,129 +1048,133 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) } else { mLabel->resize( mLabelSize ); text = QString::number( mDate.day() ); } mLabel->setText( text ); int size = height() - mLabel->height() - lineWidth()-1; //qDebug("LW %d ", lineWidth()); if ( size > 0 ) verticalScrollBar()->setMaximumHeight( size ); size = width() - mLabel->width() -lineWidth()-1; if ( size > 0 ) horizontalScrollBar()->setMaximumWidth( size ); mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); // mItemList->resize ( width(), height () ); if ( e ) KNoScrollListBox::resizeEvent ( e ); } void MonthViewCell::defaultAction( QListBoxItem *item ) { if ( !item ) { QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); emit newEventSignal( dt ); return; } MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); Incidence *incidence = eventItem->incidence(); if ( incidence ) mMonthView->defaultAction( incidence ); } void MonthViewCell::showDay() { emit showDaySignal( date() ); } void MonthViewCell::newEvent() { QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); emit newEventSignal( dt ); } void MonthViewCell::cellClicked( QListBoxItem *item ) { mMonthView->setSelectedCell( this ); if ( item == 0 ) { QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); emit newEventSignal( dt ); return; } } void MonthViewCell::contextMenu( QListBoxItem *item ) { mMonthView->setPopupCell( this ); if ( !item ) { mMonthView->showContextMenu( 0 ); return; } //selection( item ); //qApp->processEvents(); MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); Incidence *incidence = eventItem->incidence(); - if ( incidence ) mMonthView->showContextMenu( incidence ); + if ( incidence ) { + mMonthView->showContextMenu( incidence ); + selection( item ); + doHighLight( incidence ); + } } void MonthViewCell::selection( QListBoxItem *item ) { if ( !item ) { emit highlightIncidence( 0 , this, 0 ); return; } MonthViewItem * it = (static_cast<MonthViewItem *>( item )); emit highlightIncidence( it->incidence(), this, it->multiDay() ); mMonthView->setSelectedCell( this ); } void MonthViewCell::deHighLight() { MonthViewItem *mitem = (MonthViewItem*) firstItem (); while ( mitem ) { if ( mitem->setHighlightedFalse() ) updateItem ( mitem ); mitem = (MonthViewItem *)mitem->next(); } } // returns true if no inc found bool MonthViewCell::doHighLight( Incidence * inc ) { MonthViewItem *mitem = (MonthViewItem*) firstItem (); while ( mitem ) { if ( mitem->incidence() == inc ) { if ( mitem->setHighlighted( inc ) ) updateItem ( mitem ); return false; } mitem = (MonthViewItem *)mitem->next(); } return true; } // ******************************************************************************* // ******************************************************************************* // ******************************************************************************* KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) : KOEventView( calendar, parent, name ), mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) { mFlagKeyPressed = false; mShortDayLabelsM = false; mShortDayLabelsW = false; skipResize = false; clPending = true; mPopupCell = 0; mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); mWidStack = new QWidgetStack( this ); QVBoxLayout* hb = new QVBoxLayout( this ); mMonthView = new QWidget( mWidStack ); mWeekView = new QWidget( mWidStack ); #if QT_VERSION >= 0x030000 mWidStack->addWidget(mMonthView ); mWidStack->addWidget(mWeekView ); #else mWidStack->addWidget( mMonthView, 1 ); mWidStack->addWidget( mWeekView , 1 ); diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index e37a7ad..eef8327 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -4,128 +4,129 @@ Copyright (c) 1998 Preston Brown Copyright (c) 2001,2003 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qdatetime.h> #include <qstring.h> #include <qptrlist.h> #include <kdebug.h> #include <kconfig.h> #include <kglobal.h> #include <klocale.h> #include "vcaldrag.h" #include "vcalformat.h" #include "icalformat.h" #include "exceptions.h" #include "incidence.h" #include "journal.h" #include "filestorage.h" #include "calfilter.h" #include "calendarlocal.h" // #ifndef DESKTOP_VERSION // #include <qtopia/alarmserver.h> // #endif using namespace KCal; CalendarLocal::CalendarLocal() : Calendar() { init(); } CalendarLocal::CalendarLocal(const QString &timeZoneId) : Calendar(timeZoneId) { init(); } void CalendarLocal::init() { mNextAlarmIncidence = 0; } CalendarLocal::~CalendarLocal() { + registerObserver( 0 ); if ( mDeleteIncidencesOnClose ) close(); } bool CalendarLocal::mergeCalendarFile( QString name ) { CalendarLocal calendar( timeZoneId() ); calendar.setDefaultCalendar( 1 ); if ( calendar.load( name ) ) { mergeCalendar( &calendar ); return true; } return false; } Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) { Todo *todo;; Incidence *retVal = 0; for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { if ( todo->uid() == uid ) { if ( doNotCheckDuplicates ) return todo; if ( retVal ) { if ( retVal->calID() > todo->calID() ) { retVal = todo; } } else { retVal = todo; } } } if ( retVal ) return retVal; Event *event; for ( event = mEventList.first(); event; event = mEventList.next() ) { if ( event->uid() == uid ) { if ( doNotCheckDuplicates ) return event; if ( retVal ) { if ( retVal->calID() > event->calID() ) { retVal = event; } } else { retVal = event; } } } if ( retVal ) return retVal; for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) if ( it->uid() == uid ) { if ( doNotCheckDuplicates ) return it; if ( retVal ) { if ( retVal->calID() > it->calID() ) { retVal = it; } } else { retVal = it; } } return retVal; } bool CalendarLocal::mergeCalendar( Calendar* remote ) { // 1 look for raw inc in local // if inc not in remote, delete in local // 2 look for raw inc in remote diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 5877406..6f3a799 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp @@ -1,118 +1,119 @@ /* This file is part of libkcal. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qdatetime.h> #include <qstring.h> #include <qptrlist.h> #include <qregexp.h> #include <qclipboard.h> #include <qfile.h> #include <qtextstream.h> #include <qtextcodec.h> #include <stdlib.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> extern "C" { #include <ical.h> #include <icalss.h> #include <icalparser.h> #include <icalrestriction.h> } #include "calendar.h" #include "calendarlocal.h" #include "journal.h" #include "icalformat.h" #include "icalformatimpl.h" #define _ICAL_VERSION "2.0" using namespace KCal; -ICalFormat::ICalFormat( ) +ICalFormat::ICalFormat( bool pe ) { + mProcessEvents = pe; mImpl = new ICalFormatImpl( this ); tzOffsetMin = 0; //qDebug("new ICalFormat() "); } ICalFormat::~ICalFormat() { delete mImpl; //qDebug("delete ICalFormat "); } bool ICalFormat::load( Calendar *calendar, const QString &fileName) { clearException(); QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { setException(new ErrorFormat(ErrorFormat::LoadError)); return false; } QTextStream ts( &file ); QString text; ts.setEncoding( QTextStream::Latin1 ); text = ts.read(); file.close(); return fromString( calendar, text ); } //#include <qdatetime.h> bool ICalFormat::save( Calendar *calendar, const QString &fileName ) { //kdDebug(5800) << "ICalFormat::save(): " << fileName << endl; //qDebug("ICalFormat::save "); clearException(); QString text = toString( calendar ); //return false; // qDebug("to string takes ms: %d ",is.elapsed() ); if ( text.isNull() ) return false; // TODO: write backup file //is.restart(); QFile file( fileName ); if (!file.open( IO_WriteOnly ) ) { setException(new ErrorFormat(ErrorFormat::SaveError, i18n("Could not open file '%1'").arg(fileName))); return false; } QTextStream ts( &file ); ts.setEncoding( QTextStream::Latin1 ); ts << text; file.close(); //qDebug("saving file takes ms: %d ", is.elapsed() ); return true; } bool ICalFormat::fromString( Calendar *cal, const QString &text ) { setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); // qDebug("ICalFormat::fromString tz: %s ", cal->timeZoneId().latin1()); // Get first VCALENDAR component. @@ -128,152 +129,158 @@ bool ICalFormat::fromString( Calendar *cal, const QString &text ) } bool success = true; if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) { setException(new ErrorFormat(ErrorFormat::NoCalendar)); success = false; } else { // put all objects into their proper places if ( !mImpl->populate( cal, calendar ) ) { if ( !exception() ) { setException(new ErrorFormat(ErrorFormat::ParseErrorKcal)); } success = false; } else mLoadedProductId = mImpl->loadedProductId(); } icalcomponent_free( calendar ); icalmemory_free_ring(); return success; } Incidence *ICalFormat::fromString( const QString &text ) { CalendarLocal cal( mTimeZoneId ); fromString(&cal, text); Incidence *ical = 0; QPtrList<Event> elist = cal.events(); if ( elist.count() > 0 ) { ical = elist.first(); } else { QPtrList<Todo> tlist = cal.todos(); if ( tlist.count() > 0 ) { ical = tlist.first(); } else { QPtrList<Journal> jlist = cal.journals(); if ( jlist.count() > 0 ) { ical = jlist.first(); } } } return ical; } #include <qapp.h> QString ICalFormat::toString( Calendar *cal ) { setTimeZone( cal->timeZoneId(), !cal->isLocalTime() ); icalcomponent *calendar = mImpl->createCalendarComponent(cal); icalcomponent *component; // todos QPtrList<Todo> todoList = cal->rawTodos(); QPtrListIterator<Todo> qlt(todoList); for (; qlt.current(); ++qlt) { component = mImpl->writeTodo(qlt.current()); icalcomponent_add_component(calendar,component); //qDebug(" todos "); + if ( mProcessEvents ) { + //qDebug("mProcessEvents "); qApp->processEvents(); } + } // events QPtrList<Event> events = cal->rawEvents(); Event *ev; for(ev=events.first();ev;ev=events.next()) { component = mImpl->writeEvent(ev); icalcomponent_add_component(calendar,component); //qDebug("events "); + if ( mProcessEvents ) qApp->processEvents(); } // journals QPtrList<Journal> journals = cal->journals(); Journal *j; for(j=journals.first();j;j=journals.next()) { component = mImpl->writeJournal(j); icalcomponent_add_component(calendar,component); //qDebug("journals "); + if ( mProcessEvents ) qApp->processEvents(); } const char *text; QString ret =""; text = icalcomponent_as_ical_string( calendar ); + if ( mProcessEvents ) qApp->processEvents(); // text = "BEGIN:VCALENDAR\nPRODID\n :-//K Desktop Environment//NONSGML libkcal 3.1//EN\nVERSION\n :2.0\nBEGIN:VEVENT\nDTSTAMP\n :20031231T213514Z\nORGANIZER\n :MAILTO:lutz@putz.de\nCREATED\n :20031231T213513Z\nUID\n :libkcal-1295166342.120\nSEQUENCE\n :0\nLAST-MODIFIED\n :20031231T213513Z\nSUMMARY\n :test1\nCLASS\n :PUBLIC\nPRIORITY\n :3\nDTSTART\n :20040101T090000Z\nDTEND\n :20040101T110000Z\nTRANSP\n :OPAQUE\nEND:VEVENT\nEND:VCALENDAR\n"; if ( text ) { ret = QString ( text ); } icalcomponent_free( calendar ); if (!text) { setException(new ErrorFormat(ErrorFormat::SaveError, i18n("libical error"))); icalmemory_free_ring(); return QString::null; } icalmemory_free_ring(); return ret; } QString ICalFormat::toICalString( Incidence *incidence ) { CalendarLocal cal( mTimeZoneId ); cal.addIncidence( incidence->clone() ); return toString( &cal ); } QString ICalFormat::toString( Incidence *incidence ) { icalcomponent *component; component = mImpl->writeIncidence( incidence ); const char *text = icalcomponent_as_ical_string( component ); icalcomponent_free( component ); return QString::fromLocal8Bit( text ); } QString ICalFormat::toString( Recurrence *recurrence ) { icalproperty *property; property = mImpl->writeRecurrenceRule( recurrence ); const char *text = icalproperty_as_ical_string( property ); icalproperty_free( property ); return QString::fromLocal8Bit( text ); } /* bool ICalFormat::fromString( Recurrence * recurrence, const QString& rrule ) { bool success = true; icalerror_clear_errno(); struct icalrecurrencetype recur = icalrecurrencetype_from_string( rrule ); if ( icalerrno != ICAL_NO_ERROR ) { kdDebug() << "Recurrence parsing error: " << icalerror_strerror( icalerrno ) << endl; success = false; } if ( success ) { mImpl->readRecurrence( recur, recurrence ); } return success; diff --git a/libkcal/icalformat.h b/libkcal/icalformat.h index 485ab6e..a770dbb 100644 --- a/libkcal/icalformat.h +++ b/libkcal/icalformat.h @@ -1,115 +1,116 @@ /* This file is part of libkcal. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef ICALFORMAT_H #define ICALFORMAT_H #include <qstring.h> #include "scheduler.h" #include "calformat.h" namespace KCal { class ICalFormatImpl; /** This class implements the iCalendar format. It provides methods for loading/saving/converting iCalendar format data into the internal KOrganizer representation as Calendar and Events. @short iCalendar format implementation */ class ICalFormat : public CalFormat { public: /** Create new iCalendar format. */ - ICalFormat( ); + ICalFormat( bool pe = true); virtual ~ICalFormat(); /** Loads a calendar on disk in iCalendar format into calendar. Returns true if successful, else returns false. Provides more error information by exception(). @param calendar Calendar object to be filled. @param fileName The name of the calendar file on disk. */ bool load( Calendar *, const QString &fileName ); /** Writes out the calendar to disk in iCalendar format. Returns true if successful and false on error. @param calendar The Calendar object to be written. @param fileName The name of the calendar file on disk. */ bool save( Calendar *, const QString &fileName ); /** Parse string and populate calendar with that information. */ bool fromString( Calendar *, const QString & ); /** Parse string and return first ical component. */ Incidence *fromString( const QString & ); /** Return calendar information as string. */ QString toString( Calendar * ); /** Return incidence as full iCalendar formatted text. */ QString toICalString( Incidence * ); /** Return incidence as iCalendar formatted text. */ QString toString( Incidence * ); /** Return recurrence as iCalendar formatted text. */ QString toString( Recurrence * ); /** Parse string and fill recurrence object with that information */ //bool fromString ( Recurrence *, const QString& ); /** Create a scheduling message for event \a e using method \m */ QString createScheduleMessage(IncidenceBase *e,Scheduler::Method m); /** Parse scheduling message provided as string \s */ ScheduleMessage *parseScheduleMessage( Calendar *, const QString &s); /** Set id of used time zone and whether this time zone is UTC or not. */ void setTimeZone( const QString &id, bool utc ); QString timeZoneId() const; int timeOffset(); const char * tzString(); bool utc() const; private: + bool mProcessEvents; ICalFormatImpl *mImpl; QString mTimeZoneId; QCString mTzString; int tzOffsetMin; bool mUtc; }; } #endif diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 4ada2d8..7bf756a 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -5,230 +5,231 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <kglobal.h> #include <kglobalsettings.h> #include <klocale.h> #include <kdebug.h> #include <qregexp.h> #include <qfileinfo.h> #include "calendarlocal.h" #include "icalformat.h" #include "todo.h" using namespace KCal; Todo::Todo(): QObject(), Incidence() { // mStatus = TENTATIVE; mHasDueDate = false; setHasStartDate( false ); mCompleted = getEvenTime(QDateTime::currentDateTime()); mHasCompletedDate = false; mPercentComplete = 0; mRunning = false; mRunSaveTimer = 0; } Todo::Todo(const Todo &t) : QObject(),Incidence(t) { mDtDue = t.mDtDue; mHasDueDate = t.mHasDueDate; mCompleted = t.mCompleted; mHasCompletedDate = t.mHasCompletedDate; mPercentComplete = t.mPercentComplete; mRunning = false; mRunSaveTimer = 0; } Todo::~Todo() { setRunning( false ); //qDebug("Todo::~Todo() "); } void Todo::setRunningFalse( QString s ) { if ( ! mRunning ) return; mRunning = false; + if ( mRunSaveTimer ) mRunSaveTimer->stop(); saveRunningInfoToFile( s ); } void Todo::stopRunning() { if ( !mRunning ) return; if ( mRunSaveTimer ) mRunSaveTimer->stop(); mRunning = false; } void Todo::setRunning( bool run ) { if ( run == mRunning ) return; //qDebug("Todo::setRunning %d ", run); if ( !mRunSaveTimer ) { mRunSaveTimer = new QTimer ( this ); connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); } mRunning = 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 ( 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 ); } cal.addIncidence( to ); - ICalFormat format; + ICalFormat format( false ); file = dir +"/" +file +".ics"; format.save( &cal, file ); saveParents(); } void Todo::saveParents() { if (!relatedTo() ) return; Incidence * inc = relatedTo(); if ( inc->typeID() != todoID ) return; Todo* to = (Todo*)inc; bool saveTodo = false; QString file = KGlobalSettings::timeTrackerDir() + "/"+ to->uid() + ".ics"; QFileInfo fi ( file ); if ( fi.exists() ) { if ( fi.lastModified () < to->lastModified ()) saveTodo = true; } else { saveTodo = true; } if ( saveTodo ) { CalendarLocal cal; cal.setLocalTime(); Todo * par = (Todo *) to->clone(); cal.addIncidence( par ); - ICalFormat format; + ICalFormat format( false ); format.save( &cal, file ); } to->saveParents(); } int Todo::runTime() { if ( !mRunning ) return 0; return mRunStart.secsTo( QDateTime::currentDateTime() ); } bool Todo::hasRunningSub() { if ( mRunning ) return true; Incidence *aTodo; for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { if ( ((Todo*)aTodo)->hasRunningSub() ) return true; } return false; } Incidence *Todo::clone() { return new Todo(*this); } bool Todo::contains ( Todo* from ) { if ( !from->summary().isEmpty() ) if ( !summary().startsWith( from->summary() )) return false; if ( from->hasStartDate() ) { if ( !hasStartDate() ) return false; if ( from->dtStart() != dtStart()) return false; } if ( from->hasDueDate() ){ if ( !hasDueDate() ) return false; if ( from->dtDue() != dtDue()) return false; } if ( !from->location().isEmpty() ) if ( !location().startsWith( from->location() ) ) return false; if ( !from->description().isEmpty() ) if ( !description().startsWith( from->description() )) return false; if ( from->alarms().count() ) { Alarm *a = from->alarms().first(); if ( a->enabled() ){ if ( !alarms().count() ) return false; Alarm *b = alarms().first(); if( ! b->enabled() ) return false; if ( ! (a->offset() == b->offset() )) return false; } } |