[meego-commits] 11189: Changes to Trunk:Testing/mkcal

Bernd Wachter no_reply at build.meego.com
Wed Dec 22 14:55:56 UTC 2010


Hi,
I have made the following changes to mkcal in project Trunk:Testing. Please review and accept ASAP.

Thank You,
Bernd Wachter

[This message was auto-generated]

---

Request #11189:

  submit:   home:bwachter:branches:Trunk:Testing/mkcal(r2)(cleanup) -> Trunk:Testing/mkcal


Message:
    Update version, fixing BMC#11660

State:   new          2010-12-22T06:55:56 bwachter
Comment: None



changes files:
--------------
--- mkcal.changes
+++ mkcal.changes
@@ -0,0 +1,3 @@
+* Wed Dec 22 2010 Bernd Wachter <ext-bernd.wachter at nokia.com> - 0.2.12
+- Update version, fixing BMC#11660
+

old:
----
  mkcal-0.2.6.tar.gz

new:
----
  mkcal-0.2.12.tar.gz

spec files:
-----------
--- mkcal.spec
+++ mkcal.spec
@@ -2,7 +2,7 @@
 
 %define ver_maj 0
 %define ver_min 2
-%define ver_pat 6
+%define ver_pat 12
 
 Name:           mkcal
 Version:        %{ver_maj}.%{ver_min}.%{ver_pat}

other changes:
--------------

++++++ mkcal-0.2.6.tar.gz -> mkcal-0.2.12.tar.gz
--- debian/changelog
+++ debian/changelog
@@ -1,3 +1,42 @@
+libmkcal (0.2.12) unstable; urgency=low
+
+  * Fixes: NB#212065 - Alarm notification not shown in device for events synchronized from N900
+  * Fixes: NB#211142 - Created calendar item is not displayed, but reminder is played
+
+ -- Meng Sun <meng.5.sun at nokia.com>  Thu, 16 Dec 2010 12:32:43 +0200
+
+libmkcal (0.2.11) unstable; urgency=low
+
+  * Fixes: NB#211142 - Created calendar item is not displayed, but
+    reminder is played
+
+ -- Alexander Chumakov <alexander.chumakov at teleca.com>  Wed, 15 Dec 2010 15:33:23 +0300
+
+libmkcal (0.2.10) unstable; urgency=low
+
+  * Check possible null params NO_REVIEWBOARD
+
+ -- Meng Sun <meng.5.sun at nokia.com>  Fri, 03 Dec 2010 10:20:34 +0200
+
+libmkcal (0.2.9) unstable; urgency=low
+
+  * Small optimization on default plugin. Postpone Qmf connection until needed
+  * Fixes: NB#199435 - Events in the inactive calendar is listed in the list view.
+
+ -- Meng Sun <meng.5.sun at nokia.com>  Wed, 01 Dec 2010 14:55:43 +0200
+
+libmkcal (0.2.8) unstable; urgency=low
+
+  * Fixes: NB#200009 - MfE: Allday recurrent event instances moved to one day
+
+ -- Meng Sun <meng.5.sun at nokia.com>  Mon, 29 Nov 2010 14:24:02 +0200
+
+libmkcal (0.2.7) unstable; urgency=low
+
+  * Allow setting next alarm without clearing old alarms.
+
+ -- Meng Sun <meng.5.sun at nokia.com>  Fri, 26 Nov 2010 10:02:50 +0200
+
 libmkcal (0.2.6) unstable; urgency=low
 
   * Pass by value does not delete the contents
--- plugins/defaultinvitationplugin/defaultinvitationplugin.cpp
+++ plugins/defaultinvitationplugin/defaultinvitationplugin.cpp
@@ -39,8 +39,6 @@
   Private() : mStore( 0 ), mDefaultAccount( 0 ), mInit ( false ),
   mErrorCode( ServiceInterface::ErrorOk )
   {
-    init();  //Doing the init on the constructor means that
-             //if default account is changed, we won't know until reconstucted
   }
   ~Private() {
     uninit();
@@ -97,14 +95,21 @@
     QMailMessage message;
     // Setup account which should be used to send a message
     message.setParentAccountId( mDefaultAccount->id() );
+    // Get the outbox folder ID
+    QMailFolderId folderId = mDefaultAccount->standardFolder(QMailFolder::OutboxFolder);
+    if (!folderId.isValid()) {
+        folderId = QMailFolder::LocalStorageFolderId;
+    }
     // Put message to standard outbox folder fo that account
-    message.setParentFolderId( QMailFolderId( QMailFolder::OutboxFolder ) );
+    message.setParentFolderId( folderId );
+
     // Setup message status
-    message.setStatus((QMailMessage::Outbox | QMailMessage::Draft ), true);
+    message.setStatus(QMailMessage::Outbox, true);
     message.setStatus(QMailMessage::Outgoing, true);
     message.setStatus(QMailMessage::ContentAvailable, true);
     message.setStatus(QMailMessage::PartialContentAvailable, true);
     message.setStatus(QMailMessage::Read, true);
+    message.setDate(QMailTimeStamp(QDateTime::currentDateTime()));
 
     // Define recipeint's address
     QList<QMailAddress> addresses;
@@ -116,23 +121,29 @@
     message.setFrom( mDefaultAccount->fromAddress() );
     // Define subject
     message.setSubject( subject );
-    // Define message body
-    QMailMessagePart msg = QMailMessagePart::fromData( body,
-                               QMailMessageContentDisposition::Attachment,
-                               QMailMessageContentType( "plain/text" ),
-                               QMailMessageBodyFwd::QuotedPrintable );
-    message.appendPart(msg);
-    // add attachment
-
-    QMailBase64Codec encoder( QMailBase64Codec::Text );
-    QByteArray base64Data = encoder.encode( attachment );
-    QMailMessagePart att = QMailMessagePart::fromData( base64Data,
-                               QMailMessageContentDisposition::Attachment,
-                               QMailMessageContentType( "application/ics" ),
-                               QMailMessageBodyFwd::Base64 );
-    message.appendPart(att);
-    message.setMultipartType(QMailMessagePartContainer::MultipartMixed);
-    message.setStatus(QMailMessage::LocalOnly, true);
+    message.setMessageType(QMailMessage::Email);
+    message.setMultipartType(QMailMessagePartContainerFwd::MultipartAlternative);
+
+    // Create the MIME part representing the message body
+    QMailMessagePart bodyPart = QMailMessagePart::fromData(
+        body,
+        QMailMessageContentDisposition(QMailMessageContentDisposition::None),
+        QMailMessageContentType("text/plain; charset=\"utf-8\""),
+        QMailMessageBody::QuotedPrintable);
+    bodyPart.removeHeaderField("Content-Disposition");
+
+    // Create the calendar MIME part
+    QMailMessagePart calendarPart = QMailMessagePart::fromData(
+        attachment,
+        QMailMessageContentDisposition(QMailMessageContentDisposition::None),
+        QMailMessageContentType("text/calendar; charset=\"utf-8\"; method=REQUEST"),
+        QMailMessageBody::Base64);
+    calendarPart.removeHeaderField("Content-Disposition");
+    calendarPart.appendHeaderField("Content-Class","urn:content-classes:calendarmessage");
+
+    message.appendPart(bodyPart);
+    message.appendPart(calendarPart);
+
     // send (to outbox)
     if (!mStore->addMessage(&message))
       return false;
@@ -169,6 +180,7 @@
 bool DefaultInvitationPlugin::sendInvitation(const QString &accountId, const QString &notebookUid, const Incidence::Ptr &invitation, const QString &body)
 {
 
+  Q_UNUSED( body );
   Q_UNUSED( accountId );
   Q_UNUSED( notebookUid );
 
@@ -180,7 +192,7 @@
     return false;
   }
 
-//  d->init();
+  d->init();
 
   ICalFormat icf;
   QString ical =  icf.createScheduleMessage( invitation, iTIPPublish ) ;
@@ -190,7 +202,8 @@
     emails.append( att->email() );
   }
 
-  bool res = d->sendMail(emails, invitation->summary(), body, ical);
+  const QString &description = invitation->description();
+  const bool res = d->sendMail( emails, invitation->summary(), description, ical );
 
 //  d->uninit();
   return res;
@@ -208,7 +221,7 @@
 
   d->mErrorCode = ServiceInterface::ErrorOk;
 
-//  d->init();
+  d->init();
   // Is there an organizer?
   Person::Ptr organizer = invitation->organizer();
   if (organizer->isEmpty() || organizer->email().isEmpty()) { // we do not have an organizer
@@ -254,7 +267,7 @@
 QString DefaultInvitationPlugin::emailAddress(const mKCal::Notebook::Ptr &notebook)
 {
   Q_UNUSED( notebook );
-//  d->init();
+  d->init();
   QString email ( d->defaultAddress() );
 //  d->uninit();
   return email;
--- src/extendedcalendar.cpp
+++ src/extendedcalendar.cpp
@@ -1839,7 +1839,7 @@
   while ( i1.hasNext() ) {
     i1.next();
     Todo::Ptr todo = i1.value();
-    if ( hasDate && todo->hasDueDate() ) { // todos with due date
+    if ( hasDate && todo->hasDueDate() && isVisible( todo )) { // todos with due date
       if ( !todo->recurs() ) { // non-recurring todos
         if ( ( !start.isValid() || start <= todo->dtDue() ) &&
              ( !end.isValid() || end >= todo->dtDue() ) ) {
@@ -1873,7 +1873,7 @@
   while ( i2.hasNext() ) {
     i2.next();
     Event::Ptr event = i2.value();
-    if ( hasDate && // events with end and start dates
+    if ( hasDate &&  isVisible( event ) && // events with end and start dates
          event->dtStart().isValid() && event->dtEnd().isValid() ) {
       if ( !event->recurs() ) { // non-recurring events
         if ( ( !start.isValid() || start <= event->dtEnd() ) &&
@@ -1909,7 +1909,7 @@
   while ( i3.hasNext() ) {
     i3.next();
     Journal::Ptr journal = i3.value();
-    if ( hasDate && // journals with end and start dates
+    if ( hasDate &&  isVisible( journal ) && // journals with end and start dates
 // PENDING(kdab) Review
 #ifdef KDAB_TEMPORARILY_REMOVED
          journal->dtStart().isValid() && journal->dtEnd().isValid() ) {
--- src/extendedstorage.cpp
+++ src/extendedstorage.cpp
@@ -536,10 +536,19 @@
 
 void ExtendedStorage::resetAlarms( const Incidence::List &incidences )
 {
+  foreach(const Incidence::Ptr incidence, incidences) {
+    clearAlarms( incidence );
+    setAlarms( incidence );
+
+  }
+}
+
+void ExtendedStorage::setAlarms( const Incidence::Ptr &incidence )
+{
 #if defined(TIMED_SUPPORT)
   Timed::Interface timed;
   if ( !timed.isValid() ) {
-    kError() << "cannot reset alarms for number of incidences: " << incidences.size()
+    kError() << "cannot set alarm for incidence: "
              << "alarm interface is not valid" << timed.lastError();
     return;
   }
@@ -547,111 +556,95 @@
   // list of all timed events
   Timed::Event::List events;
 
-  foreach(const Incidence::Ptr incidence, incidences) {
-    clearAlarms( incidence );
+  Alarm::List alarms = incidence->alarms();
+  foreach ( const Alarm::Ptr alarm, alarms ) {
+    if ( !alarm->enabled() ) {
+      continue;
+    }
 
-    Alarm::List alarms = incidence->alarms();
-    foreach ( const Alarm::Ptr alarm, alarms ) {
-      if ( !alarm->enabled() ) {
-        continue;
-      }
+    KDateTime now = KDateTime::currentLocalDateTime();
+    KDateTime alarmTime = alarm->nextTime( now, true );
+    if ( !alarmTime.isValid() ) {
+      continue;
+    }
 
-      KDateTime now = KDateTime::currentLocalDateTime();
-      KDateTime alarmTime = alarm->nextTime( now, true );
+    if ( now.addSecs( 60 ) > alarmTime ) {
+      // don't allow alarms at the same minute -> take next alarm if so
+      alarmTime = alarm->nextTime( now.addSecs( 60 ), true );
       if ( !alarmTime.isValid() ) {
         continue;
       }
-
-      if ( now.addSecs( 60 ) > alarmTime ) {
-        // don't allow alarms at the same minute -> take next alarm if so
-        alarmTime = alarm->nextTime( now.addSecs( 60 ), true );
-        if ( !alarmTime.isValid() ) {
-          continue;
-        }
-      }
-      Timed::Event& e = events.append();
-      if ( alarmTime.isUtc() ) {
-        e.setTicker( alarmTime.toTime_t() );
-      } else {
-        QDate date = alarmTime.date();
-        QTime time = alarmTime.time();
-
-        try {
-          e.setTime(date.year(), date.month(), date.day(), time.hour(), time.minute());
-        } catch (Timed::Exception &e) {
-          qDebug() << "Got Maemo::Timed::Exception" << e.message();
-          return;
-        }
-
-        if ( !alarmTime.isClockTime() ) {
-          e.setTimezone( alarmTime.timeZone().name() );
-        }
-      }
-      // The code'll crash (=exception) iff the content is empty. So
-      // we have to check here.
-      QString s;
-
-      s = incidence->summary();
-      // Timed braindeath: Required field, BUT if empty, it asserts
-      if ( s.isEmpty() ) {
-        s = ' ';
-      }
-      e.setAttribute( "TITLE", s );
-      e.setAttribute( "PLUGIN", "libCalendarReminder" );
-      e.setAttribute( "APPLICATION", "libextendedkcal" );
-      //e.setAttribute( "translation", "organiser" );
-      // This really has to exist or code is badly broken
-      Q_ASSERT( !incidence->uid().isEmpty() );
-      e.setAttribute( "uid", incidence->uid() );
+    }
+    Timed::Event& e = events.append();
+    if ( alarmTime.isUtc() ) {
+      e.setTicker( alarmTime.toTime_t() );
+    } else {
+      e.setTicker( alarmTime.toUtc().toTime_t() );
+    }
+    // The code'll crash (=exception) iff the content is empty. So
+    // we have to check here.
+    QString s;
+
+    s = incidence->summary();
+    // Timed braindeath: Required field, BUT if empty, it asserts
+    if ( s.isEmpty() ) {
+      s = ' ';
+    }
+    e.setAttribute( "TITLE", s );
+    e.setAttribute( "PLUGIN", "libCalendarReminder" );
+    e.setAttribute( "APPLICATION", "libextendedkcal" );
+    //e.setAttribute( "translation", "organiser" );
+    // This really has to exist or code is badly broken
+    Q_ASSERT( !incidence->uid().isEmpty() );
+    e.setAttribute( "uid", incidence->uid() );
 #ifndef QT_NO_DEBUG_OUTPUT //Helps debuggin
-      e.setAttribute( "alarmtime", alarmTime.toString() );
+    e.setAttribute( "alarmtime", alarmTime.toString() );
 #endif
-      if ( !incidence->location().isEmpty() ) {
-        e.setAttribute( "location", incidence->location() );
-      }
-      if ( incidence->recurs() ) {
-        e.setAttribute( "recurs", "true" );
-      }
+    if ( !incidence->location().isEmpty() ) {
+      e.setAttribute( "location", incidence->location() );
+    }
+    if ( incidence->recurs() ) {
+      e.setAttribute( "recurs", "true" );
+    }
 
-      // TODO - consider this how it should behave for recurrence
-      if ( ( incidence->type() == Incidence::TypeTodo ) ) {
-        Todo::Ptr todo = incidence.staticCast<Todo>();
-
-        if ( todo->hasDueDate() ) {
-          e.setAttribute( "time", todo->dtDue( true ).toString() );
-        }
-        e.setAttribute( "type", "todo" );
-      } else if ( incidence->dtStart().isValid() ) {
-        e.setAttribute( "time", incidence->dtStart().toString() );
-        e.setAttribute( "type", "event" );
-      }
+    // TODO - consider this how it should behave for recurrence
+    if ( ( incidence->type() == Incidence::TypeTodo ) ) {
+      Todo::Ptr todo = incidence.staticCast<Todo>();
+
+      if ( todo->hasDueDate() ) {
+        e.setAttribute( "time", todo->dtDue( true ).toString() );
+      }
+      e.setAttribute( "type", "todo" );
+    } else if ( incidence->dtStart().isValid() ) {
+      e.setAttribute( "time", incidence->dtStart().toString() );
+      e.setAttribute( "type", "event" );
+    }
 
-      if ( incidence->hasRecurrenceId() ) {
-        e.setAttribute( "recurrenceId", incidence->recurrenceId().toString() );
-      }
-      e.setAttribute( "notebook", calendar()->notebook( incidence->uid() ) );
+    if ( incidence->hasRecurrenceId() ) {
+      e.setAttribute( "recurrenceId", incidence->recurrenceId().toString() );
+    }
+    e.setAttribute( "notebook", calendar()->notebook( incidence->uid() ) );
 
-      Timed::Event::Button &s15 = e.addButton();
-      s15.setAttribute( "snooze_value", "15" );
-      s15.setSnooze( 900 );
-      s15.setAttribute( "label", "Snooze 15 minutes" );
-
-      Timed::Event::Button &s10 = e.addButton();
-      s10.setAttribute( "snooze_value", "10" );
-      s10.setSnooze( 600 );
-      s10.setAttribute( "label", "Snooze 10 minutes" );
-
-      Timed::Event::Button &s05 = e.addButton();
-      s05.setAttribute( "snooze_value", "5" );
-      s05.setSnooze( 300 );
-      s05.setAttribute( "label", "Snooze 5 minutes" );
+    Timed::Event::Button &s15 = e.addButton();
+    s15.setAttribute( "snooze_value", "15" );
+    s15.setSnooze( 900 );
+    s15.setAttribute( "label", "Snooze 15 minutes" );
+
+    Timed::Event::Button &s10 = e.addButton();
+    s10.setAttribute( "snooze_value", "10" );
+    s10.setSnooze( 600 );
+    s10.setAttribute( "label", "Snooze 10 minutes" );
+
+    Timed::Event::Button &s05 = e.addButton();
+    s05.setAttribute( "snooze_value", "5" );
+    s05.setSnooze( 300 );
+    s05.setAttribute( "label", "Snooze 5 minutes" );
 
-      Timed::Event::Button &open = e.addButton();
-      open.setAttribute( "label", "Close" );
+    Timed::Event::Button &open = e.addButton();
+    open.setAttribute( "label", "Close" );
 
-      e.hideSnoozeButton1();
-      e.setAlignedSnoozeFlag();
-    }
+    e.hideSnoozeButton1();
+    e.setAlignedSnoozeFlag();
   }
 
   QDBusReply < QList<QVariant> > reply = timed.add_events_sync( events );
@@ -673,7 +666,6 @@
 #endif
 }
 
-
 void ExtendedStorage::clearAlarms( const Incidence::Ptr &incidence )
 {
     clearAlarms(Incidence::List(1, incidence));
--- src/extendedstorage.h
+++ src/extendedstorage.h
@@ -607,6 +607,12 @@
     void resetAlarms( const KCalCore::Incidence::List &incidences );
 
     /**
+      Set alarms for the incidence without removing old alarms. This is the
+      same as resetAlarms except that the old alarms are not removed.
+    */
+    void setAlarms( const KCalCore::Incidence::Ptr &incidence );
+
+    /**
       Creates and sets a default notebook. Usually called for an empty
       calendar.
 
--- src/servicehandler.cpp
+++ src/servicehandler.cpp
@@ -84,6 +84,10 @@
 
 bool ServiceHandlerPrivate::executePlugin(const Incidence::Ptr &invitation, const QString body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 {
+
+  if ( storage.isNull() || invitation.isNull() || calendar.isNull() )
+    return false;
+
   QString pluginName;
   QString accountId;
 
@@ -135,6 +139,9 @@
 
 ServiceInterface* ServiceHandlerPrivate::getServicePlugin( const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return 0;
+
   if (!storage->isValidNotebook(notebook->uid()))
     return 0;
 
@@ -168,6 +175,9 @@
 
 bool ServiceHandler::sendInvitation(const Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || invitation.isNull() || calendar.isNull() )
+    return false;
+
   if (!d->mLoaded)
     d->loadPlugins();
 
@@ -178,6 +188,9 @@
 
 bool ServiceHandler::sendUpdate(const Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || invitation.isNull() || calendar.isNull() )
+    return false;
+
   if (!d->mLoaded)
     d->loadPlugins();
 
@@ -188,6 +201,9 @@
 
 bool ServiceHandler::sendResponse(const Incidence::Ptr &invitation, const QString &body, const ExtendedCalendar::Ptr &calendar, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || invitation.isNull() || calendar.isNull() )
+    return false;
+
   if (!d->mLoaded)
     d->loadPlugins();
 
@@ -198,6 +214,9 @@
 
 QIcon ServiceHandler::icon(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return QIcon();
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
@@ -214,6 +233,9 @@
 
 bool ServiceHandler::multiCalendar(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return false;
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
@@ -229,6 +251,9 @@
 
 QString ServiceHandler::emailAddress(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return QString();
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
@@ -244,6 +269,9 @@
 
 QString ServiceHandler::displayName(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return false;
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
@@ -259,6 +287,9 @@
 
 bool ServiceHandler::downloadAttachment(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage, const QString &uri, const QString &path)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return false;
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
@@ -274,6 +305,9 @@
 
 bool ServiceHandler::deleteAttachment(const KCalCore::Incidence::Ptr &incidence, const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage, const QString &uri)
 {
+  if ( storage.isNull() || notebook.isNull() || incidence.isNull() )
+    return false;
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
@@ -289,6 +323,9 @@
 
 bool ServiceHandler::shareNotebook(const Notebook::Ptr &notebook, const QStringList &sharedWith, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return false;
+
   kDebug() <<  "shareNotebook";
 
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
@@ -306,6 +343,9 @@
 
 QStringList ServiceHandler::sharedWith(const Notebook::Ptr &notebook, const ExtendedStorage::Ptr &storage)
 {
+  if ( storage.isNull() || notebook.isNull() )
+    return QStringList();
+
   ServiceInterface* service = d->getServicePlugin(notebook, storage);
 
   if ( service ) {
--- src/sqliteformat.cpp
+++ src/sqliteformat.cpp
@@ -221,7 +221,11 @@
         sqlite3_bind_int64(stmt1, index, secs);
         secs = d->mStorage->toLocalOriginTime(incidence->dtStart());
         sqlite3_bind_int64(stmt1, index, secs);
-        tzStart = incidence->dtStart().timeZone().name().toUtf8();
+        if ( incidence->dtStart().isDateOnly() && incidence->dtStart().timeSpec().isClockTime() ) {
+          tzStart = FLOATING_DATE;
+        } else {
+          tzStart = incidence->dtStart().timeZone().name().toUtf8();
+        }
         sqlite3_bind_text(stmt1, index, tzStart.constData(), tzStart.length(), SQLITE_STATIC);
       } else {
         sqlite3_bind_int(stmt1, index, 0);
@@ -236,11 +240,15 @@
         Event::Ptr event = incidence.staticCast<Event>();
         if ( event->hasEndDate() ) {
           dt = event->dtEnd();
-          tzEnd = dt.timeZone().name().toUtf8();
           secs = d->mStorage->toOriginTime( dt );
           sqlite3_bind_int64( stmt1, index, secs );
           secs = d->mStorage->toLocalOriginTime( dt );
           sqlite3_bind_int64( stmt1, index, secs);
+          if ( dt.isDateOnly() && dt.timeSpec().isClockTime() ) {
+            tzEnd = FLOATING_DATE;
+          } else {
+            tzEnd = dt.timeZone().name().toUtf8();
+          }
           sqlite3_bind_text( stmt1, index, tzEnd.constData(), tzEnd.length(), SQLITE_STATIC );
         } else {
           // No end date, use start date if possible
@@ -249,7 +257,11 @@
             sqlite3_bind_int64( stmt1, index, secs );
             secs = d->mStorage->toLocalOriginTime(incidence->dtStart() );
             sqlite3_bind_int64( stmt1, index, secs );
-            tzEnd = incidence->dtStart().timeZone().name().toUtf8();
+            if ( incidence->dtStart().isDateOnly()  && incidence->dtStart().timeSpec().isClockTime() ) {
+              tzEnd = FLOATING_DATE;
+            } else {
+              tzEnd = incidence->dtStart().timeZone().name().toUtf8();
+            }
             sqlite3_bind_text( stmt1, index, tzEnd.constData(), tzEnd.length(), SQLITE_STATIC );
           } else {
             sqlite3_bind_int( stmt1, index, 0);
@@ -270,7 +282,11 @@
         sqlite3_bind_int64( stmt1, index, secs );
         secs = d->mStorage->toLocalOriginTime( dtStart );
         sqlite3_bind_int64( stmt1, index, secs );
-        tzStart = dtStart.timeZone().name().toUtf8();
+        if ( incidence->dtStart().isDateOnly()  && incidence->dtStart().timeSpec().isClockTime() ) {
+          tzStart = FLOATING_DATE;
+        } else {
+          tzStart = incidence->dtStart().timeZone().name().toUtf8();
+        }
         sqlite3_bind_text( stmt1, index, tzStart.constData(), tzStart.length(), SQLITE_STATIC );
       } else {
         sqlite3_bind_int( stmt1, index, 0 );
@@ -286,7 +302,11 @@
         sqlite3_bind_int64( stmt1, index, secs );
         secs = d->mStorage->toLocalOriginTime( dtDue );
         sqlite3_bind_int64( stmt1, index, secs );
-        tzEnd =  dtDue .timeZone().name().toUtf8();
+        if ( dtDue.isDateOnly()  && dtDue.timeSpec().isClockTime() ) {
+          tzEnd = FLOATING_DATE;
+        } else {
+          tzEnd = dtDue.timeZone().name().toUtf8();
+        }
         sqlite3_bind_text( stmt1, index, tzEnd.constData(), tzEnd.length(), SQLITE_STATIC );
       } else {
         // No due date, use start date if possible.
@@ -296,7 +316,11 @@
           sqlite3_bind_int64(stmt1, index, secs);
           secs = d->mStorage->toLocalOriginTime( dtStart );
           sqlite3_bind_int64(stmt1, index, secs);
-          tzEnd =  dtStart.timeZone().name().toUtf8();
+          if ( dtStart.isDateOnly() && dtStart.timeSpec().isClockTime()  ) {
+            tzEnd = FLOATING_DATE;
+          } else {
+            tzEnd = dtStart.timeZone().name().toUtf8();
+          }
           sqlite3_bind_text(stmt1, index, tzEnd.constData(), tzEnd.length(), SQLITE_STATIC);
         } else {
           sqlite3_bind_int(stmt1, index, 0);
--- src/sqlitestorage.cpp
+++ src/sqlitestorage.cpp
@@ -3008,7 +3008,6 @@
 
 sqlite3_int64 SqliteStorage::toOriginTime( KDateTime dt )
 {
-  //kDebug() << "toOriginTime" << dt << d->mOriginTime.secsTo_long( dt );
   return d->mOriginTime.secsTo_long(dt);
 }
 
@@ -3034,21 +3033,28 @@
 
   if ( seconds != 0 ) {
     if ( !zonename.isEmpty() ) {
-      // First try system zones.
-      KTimeZone ktimezone = KSystemTimeZones::zone(zonename);
-      if ( ktimezone.isValid() ) {
-        dt =
-          d->mOriginTime.addSecs( seconds ).toUtc().toTimeSpec( KDateTime::Spec( ktimezone ) );
+      if ( zonename == QLatin1String(FLOATING_DATE) ) {
+          QDate originDate = d->mOriginTime.date();
+          originDate.addDays( seconds / 86400 );
+          KDateTime dateOnly(originDate, KDateTime::ClockTime );
+          return dateOnly;
       } else {
-        // Then try calendar specific zones.
-        ICalTimeZones::ZoneMap zones = d->mCalendar->timeZones()->zones();
-        ICalTimeZone icaltimezone = zones.value( zonename );
-        if ( icaltimezone.isValid() ) {
+        // First try system zones.
+        KTimeZone ktimezone = KSystemTimeZones::zone(zonename);
+        if ( ktimezone.isValid() ) {
           dt =
-            d->mOriginTime.addSecs( seconds ).toUtc().toTimeSpec( KDateTime::Spec( icaltimezone ) );
+            d->mOriginTime.addSecs( seconds ).toUtc().toTimeSpec( KDateTime::Spec( ktimezone ) );
         } else {
-          // Invalid zone, fall back to UTC.
-          dt = d->mOriginTime.addSecs( seconds ).toUtc();
+          // Then try calendar specific zones.
+          ICalTimeZones::ZoneMap zones = d->mCalendar->timeZones()->zones();
+          ICalTimeZone icaltimezone = zones.value( zonename );
+          if ( icaltimezone.isValid() ) {
+            dt =
+              d->mOriginTime.addSecs( seconds ).toUtc().toTimeSpec( KDateTime::Spec( icaltimezone ) );
+          } else {
+            // Invalid zone, fall back to UTC.
+            dt = d->mOriginTime.addSecs( seconds ).toUtc();
+          }
         }
       }
     } else {
@@ -3056,7 +3062,7 @@
       dt = d->mOriginTime.addSecs( seconds ).toClockTime();
     }
   }
-  //kDebug() << "fromOriginTime" << seconds << zonename << dt;
+//  kDebug() << "fromOriginTime" << seconds << zonename << dt;
   return dt;
 }
 
--- src/sqlitestorage.h
+++ src/sqlitestorage.h
@@ -663,6 +663,7 @@
 #define COMMIT_TRANSACTION \
 "END;"
 
+#define FLOATING_DATE "FloatingDate"
 }
 
 #endif
--- src/trackermodify.cpp
+++ src/trackermodify.cpp
@@ -232,13 +232,13 @@
 
       foreach (const QChar ch, in ) {
           if (ch == QLatin1Char('\t'))
-              literal.append(QLatin1String("\\\t"));
+              literal.append(QLatin1String("\\t"));
           else if (ch == QLatin1Char('\n'))
-              literal.append(QLatin1String("\\\n"));
+              literal.append(QLatin1String("\\n"));
           else if (ch == QLatin1Char('\r'))
-              literal.append(QLatin1String("\\\b"));
+              literal.append(QLatin1String("\\b"));
           else if (ch == QLatin1Char('\f'))
-              literal.append(QLatin1String("\\\f"));
+              literal.append(QLatin1String("\\f"));
           else if (ch == QLatin1Char('\"'))
               literal.append(QLatin1String("\\\""));
           else if (ch == QLatin1Char('\''))




More information about the MeeGo-commits mailing list