[kalarm/Applications/19.08] /: Bug 411296: Fix D-Bus alarm creation failing if time zone is omitted

David Jarvie null at kde.org
Sun Aug 25 23:35:16 BST 2019


Git commit bfee8785549b17201fb139bb72a9dd20a117cb4b by David Jarvie.
Committed on 25/08/2019 at 22:32.
Pushed by djarvie into branch 'Applications/19.08'.

Bug 411296: Fix D-Bus alarm creation failing if time zone is omitted

M  +2    -1    Changelog
M  +12   -12   doc/index.docbook
M  +7    -2    src/dbushandler.cpp

https://commits.kde.org/kalarm/bfee8785549b17201fb139bb72a9dd20a117cb4b

diff --git a/Changelog b/Changelog
index 6ea1a49d..012f87c1 100644
--- a/Changelog
+++ b/Changelog
@@ -1,7 +1,8 @@
 KAlarm Change Log
 
-=== Version 2.12.6 (KDE Applications 19.08.1) --- 15 August 2019 ===
+=== Version 2.12.6 (KDE Applications 19.08.1) --- 25 August 2019 ===
 + Fix crash sometimes when a resource is enabled [KDE Bug 410596]
++ Fix D-Bus alarm creation failing if time zone is omitted from start time [KDE Bug 411296]
 
 === Version 2.12.5 (KDE Applications 19.08) --- 26 July 2019 ===
 + Enable alarm list columns to be hidden using context menu on list header [KDE Bug 397093]
diff --git a/doc/index.docbook b/doc/index.docbook
index f8b61689..f0bb9998 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -3181,8 +3181,8 @@ time.</para>
   <replaceable>date/time</replaceable></option></entry>
   <entry>Trigger alarm on the date or at the date/time specified.
   Specify a date without a time in the format
-  <replaceable>yyyy-mm-dd [TZ]</replaceable>; specify a date and time
-  by <replaceable>[[[yyyy-]mm-]dd-]hh:mm [TZ]</replaceable> (where
+  <replaceable>yyyy-mm-dd[ TZ]</replaceable>; specify a date and time
+  by <replaceable>[[[yyyy-]mm-]dd-]hh:mm[ TZ]</replaceable> (where
   omitted, date fields default to the values for today).
   If no time zone is specified, the local system time zone is
   assumed. If a time zone specifier <replaceable>TZ</replaceable> is
@@ -3490,10 +3490,10 @@ line to execute to generate the message text.</para>
 <listitem>
 <para>Specifies the scheduled date, or date and time, at which the
 message should be displayed. For a date-only alarm, the string should
-be in the format <replaceable>YYYY-MM-DD [TZ]</replaceable> (as
+be in the format <replaceable>YYYY-MM-DD[ TZ]</replaceable> (as
 returned by <methodname>QDate::toString(Qt::ISODate)</methodname>). For
 an alarm with a date and time, the string should be in the format
-<replaceable>YYYY-MM-DDTHH:MM[:SS] [TZ]</replaceable> (as returned by
+<replaceable>YYYY-MM-DDTHH:MM[:SS][ TZ]</replaceable> (as returned by
 <methodname>QDateTime::toString(Qt::ISODate)</methodname>) or
 <replaceable>HH:MM[:SS]</replaceable> (as returned by
 <methodname>QTime::toString(Qt::ISODate)</methodname>). If no date is
@@ -3742,10 +3742,10 @@ displayed in the message to be scheduled.</para>
 <listitem>
 <para>Specifies the scheduled date, or date and time, at which the
 message should be displayed. For a date-only alarm, the string should
-be in the format <replaceable>YYYY-MM-DD [TZ]</replaceable> (as
+be in the format <replaceable>YYYY-MM-DD[ TZ]</replaceable> (as
 returned by <methodname>QDate::toString(Qt::ISODate)</methodname>). For
 an alarm with a date and time, the string should be in the format
-<replaceable>YYYY-MM-DDTHH:MM[:SS] [TZ]</replaceable> (as returned by
+<replaceable>YYYY-MM-DDTHH:MM[:SS][ TZ]</replaceable> (as returned by
 <methodname>QDateTime::toString(Qt::ISODate)</methodname>) or
 <replaceable>HH:MM[:SS]</replaceable> (as returned by
 <methodname>QTime::toString(Qt::ISODate)</methodname>). If no date is
@@ -3958,10 +3958,10 @@ parameter contains a shell command line or a command script.</para>
 <listitem>
 <para>Specifies the scheduled date, or date and time, at which the
 message should be displayed. For a date-only alarm, the string should
-be in the format <replaceable>YYYY-MM-DD [TZ]</replaceable> (as
+be in the format <replaceable>YYYY-MM-DD[ TZ]</replaceable> (as
 returned by <methodname>QDate::toString(Qt::ISODate)</methodname>). For
 an alarm with a date and time, the string should be in the format
-<replaceable>YYYY-MM-DDTHH:MM[:SS] [TZ]</replaceable> (as returned by
+<replaceable>YYYY-MM-DDTHH:MM[:SS][ TZ]</replaceable> (as returned by
 <methodname>QDateTime::toString(Qt::ISODate)</methodname>) or
 <replaceable>HH:MM[:SS]</replaceable> (as returned by
 <methodname>QTime::toString(Qt::ISODate)</methodname>). If no date is
@@ -4182,10 +4182,10 @@ email attachments.</para>
 <listitem>
 <para>Specifies the scheduled date, or date and time, at which the
 message should be displayed. For a date-only alarm, the string should
-be in the format <replaceable>YYYY-MM-DD [TZ]</replaceable> (as
+be in the format <replaceable>YYYY-MM-DD[ TZ]</replaceable> (as
 returned by <methodname>QDate::toString(Qt::ISODate)</methodname>). For
 an alarm with a date and time, the string should be in the format
-<replaceable>YYYY-MM-DDTHH:MM[:SS] [TZ]</replaceable> (as returned by
+<replaceable>YYYY-MM-DDTHH:MM[:SS][ TZ]</replaceable> (as returned by
 <methodname>QDateTime::toString(Qt::ISODate)</methodname>) or
 <replaceable>HH:MM[:SS]</replaceable> (as returned by
 <methodname>QTime::toString(Qt::ISODate)</methodname>). If no date is
@@ -4374,10 +4374,10 @@ volume. Specify -1 to use the default volume.</para>
 <listitem>
 <para>Specifies the scheduled date, or date and time, at which the
 message should be displayed. For a date-only alarm, the string should
-be in the format <replaceable>YYYY-MM-DD [TZ]</replaceable> (as
+be in the format <replaceable>YYYY-MM-DD[ TZ]</replaceable> (as
 returned by <methodname>QDate::toString(Qt::ISODate)</methodname>). For
 an alarm with a date and time, the string should be in the format
-<replaceable>YYYY-MM-DDTHH:MM[:SS] [TZ]</replaceable> (as returned by
+<replaceable>YYYY-MM-DDTHH:MM[:SS][ TZ]</replaceable> (as returned by
 <methodname>QDateTime::toString(Qt::ISODate)</methodname>) or
 <replaceable>HH:MM[:SS]</replaceable> (as returned by
 <methodname>QTime::toString(Qt::ISODate)</methodname>). If no date is
diff --git a/src/dbushandler.cpp b/src/dbushandler.cpp
index 1ce397dc..0d64033f 100644
--- a/src/dbushandler.cpp
+++ b/src/dbushandler.cpp
@@ -419,8 +419,13 @@ bool DBusHandler::scheduleAudio(const QString& audioUrl, int volumePercent,
 KADateTime DBusHandler::convertDateTime(const QString& dateTime, const KADateTime& defaultDt)
 {
     int i = dateTime.indexOf(QLatin1Char(' '));
-    QString dtString = dateTime.left(i);
-    QString zone = dateTime.mid(i);
+    QString dtString = dateTime;
+    QString zone;
+    if (i >= 0)
+    {
+        dtString = dateTime.left(i);
+        zone     = dateTime.mid(i);
+    }
     QDate date;
     QTime time;
     bool haveTime = true;


More information about the kde-doc-english mailing list