[SCM] KDE PIM module packaging branch, master, updated. debian/4.10.5-1-5-g471d205

Pino Toscano pino at alioth.debian.org
Sun Jul 21 16:33:58 UTC 2013


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-sc/kdepim.git;a=commitdiff;h=471d205

The following commit has been merged in the master branch:
commit 471d205ee4533b04aaf91a9b267ff3a0e425c3e3
Author: Pino Toscano <pino at debian.org>
Date:   Sun Jul 21 18:33:22 2013 +0200

    make the dates in organizer templates not override the user's choice (#717093)
    
    backport upstream commits 2b160d53fe9c83fc2a0e65e510d0f02cb8670552 and 596c0df2933c1af13944d9a0c8e70d0f3e9966b0
---
 debian/changelog                                   |    5 +
 debian/patches/korganizer_templates.diff           |  157 ++++++++++++++++++++
 debian/patches/series                              |    2 +
 ...m_Use-the-template-time-in-a-special-case.patch |  141 ++++++++++++++++++
 4 files changed, 305 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7e8df68..ee0b1a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,11 @@ kdepim (4:4.10.5-2) UNRELEASED; urgency=low
     switch off the default value of the "Reply using HTML if present" option
     in KMail; patch kmail_reply-as-html.diff. (Closes: #717113)
   * Update lintian overrides.
+  * Backport upstream commits 2b160d53fe9c83fc2a0e65e510d0f02cb8670552 and
+    596c0df2933c1af13944d9a0c8e70d0f3e9966b0 to make the dates in organizer
+    templates not override the user's choice; patches korganizer_templates.diff
+    and upstream_Use-the-template-time-in-a-special-case.patch.
+    (Closes: #717093)
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sun, 21 Jul 2013 13:24:07 +0200
 
diff --git a/debian/patches/korganizer_templates.diff b/debian/patches/korganizer_templates.diff
new file mode 100644
index 0000000..f957b77
--- /dev/null
+++ b/debian/patches/korganizer_templates.diff
@@ -0,0 +1,157 @@
+Author: Sergio Martins <iamsergio at gmail.com>
+Description: Don't let templates override the dates that the user chose.
+ .
+ Dates should never be overriden by templates.
+ .
+ BUG: 190545
+ BUG: 294169
+Origin: upstream, commit:2b160d53fe9c83fc2a0e65e510d0f02cb8670552
+Bug-Debian: http://bugs.debian.org/717093
+Applied-Upstream: 4.11
+
+--- a/incidenceeditor-ng/incidencedatetime.cpp
++++ b/incidenceeditor-ng/incidencedatetime.cpp
+@@ -31,6 +31,8 @@
+ //#include "ui_incidencedatetime.h"
+ //#endif
+ 
++#include <calendarsupport/kcalprefs.h>
++
+ #include <KCalCore/ICalTimeZones>
+ #include <KCalUtils/IncidenceFormatter>
+ 
+@@ -39,6 +41,40 @@
+ 
+ using namespace IncidenceEditorNG;
+ 
++
++/**
++ * Returns true if the incidence's dates are equal to the default ones specified in config.
++ */
++static bool incidenceHasDefaultTimes( const KCalCore::Incidence::Ptr &incidence )
++{
++  if (incidence->allDay())
++    return false;
++
++  QTime defaultDuration = CalendarSupport::KCalPrefs::instance()->defaultDuration().time();
++  if ( !defaultDuration.isValid() )
++    return false;
++
++  QTime defaultStart = CalendarSupport::KCalPrefs::instance()->defaultDuration().time();
++  if ( !defaultStart.isValid() )
++    return false;
++
++  if ( incidence->dtStart().time() == defaultStart ) {
++    if ( incidence->type() == KCalCore::Incidence::TypeJournal )
++      return true; // no duration to compare with
++
++    const KDateTime start = incidence->dtStart();
++    const KDateTime end   = incidence->dateTime( KCalCore::Incidence::RoleEnd );
++    if (!end.isValid() || !start.isValid())
++      return false;
++
++    const int durationInSeconds = defaultDuration.hour()*3600 + defaultDuration.minute()*60;
++    return start.secsTo(end) == durationInSeconds;
++  }
++
++  return false;
++}
++
++
+ IncidenceDateTime::IncidenceDateTime( Ui::EventOrTodoDesktop *ui )
+   : IncidenceEditor( 0 ), mTimeZones( new KCalCore::ICalTimeZones ), mUi( ui ),
+     mTimezoneCombosWhereVisibile( false )
+@@ -540,8 +576,13 @@ void IncidenceDateTime::load( const KCal
+   mUi->mWholeDayCheck->setChecked( event->allDay() );
+   enableTimeEdits();
+ 
+-  bool isTemplate = false; // TODO
+-  if ( !isTemplate ) {
++  const bool isTemplate = event->customProperty( "kdepim", "isTemplate" ) == "true";
++  if ( isTemplate ) {
++    if ( incidenceHasDefaultTimes( event ) ) {
++        // We only use the template times if the user didn't override them.
++        setTimes( event->dtStart(), event->dtEnd() );
++    }
++  } else {
+     KDateTime startDT = event->dtStart();
+     KDateTime endDT = event->dtEnd();
+     /*
+@@ -562,13 +603,7 @@ void IncidenceDateTime::load( const KCal
+       }
+     }
+     */
+-
+     setDateTimes( startDT, endDT );
+-  } else {
+-    // set the start/end time from the template, only as a last resort #190545
+-    if ( !event->dtStart().isValid() || !event->dtEnd().isValid() ) {
+-      setTimes( event->dtStart(), event->dtEnd() );
+-    }
+   }
+ 
+   switch( event->transparency() ) {
+@@ -605,8 +640,13 @@ void IncidenceDateTime::load( const KCal
+   mUi->mWholeDayCheck->setChecked( journal->allDay() );
+   enableTimeEdits();
+ 
+-  bool isTemplate = false; // TODO
+-  if ( !isTemplate ) {
++  const bool isTemplate = journal->customProperty( "kdepim", "isTemplate" ) == "true";
++  if ( isTemplate ) {
++    if ( incidenceHasDefaultTimes( journal ) ) {
++        // We only use the template times if the user didn't override them.
++        setTimes( journal->dtStart(), KDateTime() );
++    }
++  } else {
+     KDateTime startDT = journal->dtStart();
+ 
+     /*
+@@ -622,11 +662,6 @@ void IncidenceDateTime::load( const KCal
+       startDT = startDT.toLocalZone();
+     }
+     setDateTimes( startDT, KDateTime() );
+-  } else {
+-    // set the start/end time from the template, only as a last resort #190545
+-    if ( !journal->dtStart().isValid() ) {
+-      setTimes( journal->dtStart(), KDateTime() );
+-    }
+   }
+ }
+ 
+@@ -670,9 +705,18 @@ void IncidenceDateTime::load( const KCal
+ 
+   const KDateTime rightNow = KDateTime( QDate::currentDate(), QTime::currentTime() ).toLocalZone();
+ 
+-  const KDateTime endDT   = todo->hasDueDate() ? todo->dtDue( true/** first */ ) : rightNow;
+-  const KDateTime startDT = todo->hasStartDate() ? todo->dtStart( true/** first */ ) : rightNow;
+-  setDateTimes( startDT, endDT );
++
++  const bool isTemplate = todo->customProperty( "kdepim", "isTemplate" ) == "true";
++  if ( isTemplate ) {
++    if ( incidenceHasDefaultTimes( todo ) ) {
++        // We only use the template times if the user didn't override them.
++        setTimes( todo->dtStart(), todo->dateTime(KCalCore::Incidence::RoleEnd) );
++    }
++  } else {
++    const KDateTime endDT   = todo->hasDueDate() ? todo->dtDue( true/** first */ ) : rightNow;
++    const KDateTime startDT = todo->hasStartDate() ? todo->dtStart( true/** first */ ) : rightNow;
++    setDateTimes( startDT, endDT );
++  }
+ }
+ 
+ void IncidenceDateTime::save( const KCalCore::Event::Ptr &event )
+--- a/incidenceeditor-ng/eventortododialog.cpp
++++ b/incidenceeditor-ng/eventortododialog.cpp
+@@ -303,7 +303,11 @@ void EventOrTodoDialogPrivate::loadTempl
+   mIeDateTime->setActiveDate( QDate() );
+   KCalCore::Incidence::Ptr newInc = KCalCore::Incidence::Ptr( incidences.first()->clone() );
+   newInc->setUid( KCalCore::CalFormat::createUniqueId() );
++
++  // We add a custom property so that some fields aren't loaded, dates for example
++  newInc->setCustomProperty( QByteArray("kdepim"), "isTemplate", "true");
+   mEditor->load( newInc );
++  newInc->removeCustomProperty( QByteArray(), "isTemplate");
+ }
+ 
+ void EventOrTodoDialogPrivate::manageTemplates()
diff --git a/debian/patches/series b/debian/patches/series
index 7a32ff1..e61c968 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
 debianize_akregator_default.diff
 kmail_reply-as-html.diff
+korganizer_templates.diff
+upstream_Use-the-template-time-in-a-special-case.patch
diff --git a/debian/patches/upstream_Use-the-template-time-in-a-special-case.patch b/debian/patches/upstream_Use-the-template-time-in-a-special-case.patch
new file mode 100644
index 0000000..1b220a9
--- /dev/null
+++ b/debian/patches/upstream_Use-the-template-time-in-a-special-case.patch
@@ -0,0 +1,141 @@
+From 596c0df2933c1af13944d9a0c8e70d0f3e9966b0 Mon Sep 17 00:00:00 2001
+From: Sergio Martins <iamsergio at gmail.com>
+Date: Sun, 21 Jul 2013 16:20:21 +0100
+Subject: [PATCH] Use the template time in a special case.
+
+Templates dates are never use, but it's useful to use the time
+if the user didn't choose any time yet.
+---
+ incidenceeditor-ng/incidencedatetime.cpp |   33 ++++++++++++++++--------------
+ incidenceeditor-ng/incidencedatetime.h   |    6 +++---
+ 2 files changed, 21 insertions(+), 18 deletions(-)
+
+diff --git a/incidenceeditor-ng/incidencedatetime.cpp b/incidenceeditor-ng/incidencedatetime.cpp
+index d9af494..d99ba95 100644
+--- a/incidenceeditor-ng/incidencedatetime.cpp
++++ b/incidenceeditor-ng/incidencedatetime.cpp
+@@ -48,14 +48,14 @@ using namespace IncidenceEditorNG;
+  */
+ static bool incidenceHasDefaultTimes( const KCalCore::Incidence::Ptr &incidence )
+ {
+-  if (incidence->allDay())
++  if (!incidence || incidence->allDay())
+     return false;
+ 
+   QTime defaultDuration = CalendarSupport::KCalPrefs::instance()->defaultDuration().time();
+   if ( !defaultDuration.isValid() )
+     return false;
+ 
+-  QTime defaultStart = CalendarSupport::KCalPrefs::instance()->defaultDuration().time();
++  QTime defaultStart = CalendarSupport::KCalPrefs::instance()->mStartTime.time();
+   if ( !defaultStart.isValid() )
+     return false;
+ 
+@@ -158,16 +158,23 @@ bool IncidenceDateTime::eventFilter( QObject *obj, QEvent *event )
+ 
+ void IncidenceDateTime::load( const KCalCore::Incidence::Ptr &incidence )
+ {
++  if (mLoadedIncidence && *mLoadedIncidence == *incidence) {
++    return;
++  }
++
++  const bool isTemplate             = incidence->customProperty( "kdepim", "isTemplate" ) == "true";
++  const bool templateOverridesTimes = incidenceHasDefaultTimes( mLoadedIncidence );
++
+   mLoadedIncidence = incidence;
+   mLoadingIncidence = true;
+ 
+   // We can only handle events or todos.
+   if ( KCalCore::Todo::Ptr todo = IncidenceDateTime::incidence<KCalCore::Todo>() ) {
+-    load( todo );
++    load( todo, isTemplate, templateOverridesTimes );
+   } else if ( KCalCore::Event::Ptr event = IncidenceDateTime::incidence<KCalCore::Event>() ) {
+-    load( event );
++    load( event, isTemplate, templateOverridesTimes );
+   } else if ( KCalCore::Journal::Ptr journal = IncidenceDateTime::incidence<KCalCore::Journal>() ) {
+-    load( journal );
++    load( journal, isTemplate, templateOverridesTimes );
+   } else {
+     kDebug() << "Not an Incidence.";
+   }
+@@ -541,7 +548,7 @@ KDateTime IncidenceDateTime::currentEndDateTime() const
+     mUi->mTimeZoneComboEnd->selectedTimeSpec() );
+ }
+ 
+-void IncidenceDateTime::load( const KCalCore::Event::Ptr &event )
++void IncidenceDateTime::load( const KCalCore::Event::Ptr &event, bool isTemplate, bool templateOverridesTimes )
+ {
+   // First en/disable the necessary ui bits and pieces
+   mUi->mStartCheck->setVisible( false );
+@@ -577,9 +584,8 @@ void IncidenceDateTime::load( const KCalCore::Event::Ptr &event )
+   mUi->mWholeDayCheck->setChecked( event->allDay() );
+   enableTimeEdits();
+ 
+-  const bool isTemplate = event->customProperty( "kdepim", "isTemplate" ) == "true";
+   if ( isTemplate ) {
+-    if ( incidenceHasDefaultTimes( event ) ) {
++    if ( templateOverridesTimes ) {
+         // We only use the template times if the user didn't override them.
+         setTimes( event->dtStart(), event->dtEnd() );
+     }
+@@ -599,7 +605,7 @@ void IncidenceDateTime::load( const KCalCore::Event::Ptr &event )
+   }
+ }
+ 
+-void IncidenceDateTime::load( const KCalCore::Journal::Ptr &journal )
++void IncidenceDateTime::load( const KCalCore::Journal::Ptr &journal, bool isTemplate, bool templateOverridesTimes )
+ {
+   // First en/disable the necessary ui bits and pieces
+   mUi->mStartCheck->setVisible( false );
+@@ -623,9 +629,8 @@ void IncidenceDateTime::load( const KCalCore::Journal::Ptr &journal )
+   mUi->mWholeDayCheck->setChecked( journal->allDay() );
+   enableTimeEdits();
+ 
+-  const bool isTemplate = journal->customProperty( "kdepim", "isTemplate" ) == "true";
+   if ( isTemplate ) {
+-    if ( incidenceHasDefaultTimes( journal ) ) {
++    if ( templateOverridesTimes ) {
+         // We only use the template times if the user didn't override them.
+         setTimes( journal->dtStart(), KDateTime() );
+     }
+@@ -640,7 +645,7 @@ void IncidenceDateTime::load( const KCalCore::Journal::Ptr &journal )
+   }
+ }
+ 
+-void IncidenceDateTime::load( const KCalCore::Todo::Ptr &todo )
++void IncidenceDateTime::load( const KCalCore::Todo::Ptr &todo, bool isTemplate, bool templateOverridesTimes )
+ {
+   // First en/disable the necessary ui bits and pieces
+   mUi->mStartCheck->setVisible( true );
+@@ -680,10 +685,8 @@ void IncidenceDateTime::load( const KCalCore::Todo::Ptr &todo )
+ 
+   const KDateTime rightNow = KDateTime( QDate::currentDate(), QTime::currentTime() ).toLocalZone();
+ 
+-
+-  const bool isTemplate = todo->customProperty( "kdepim", "isTemplate" ) == "true";
+   if ( isTemplate ) {
+-    if ( incidenceHasDefaultTimes( todo ) ) {
++    if ( templateOverridesTimes ) {
+         // We only use the template times if the user didn't override them.
+         setTimes( todo->dtStart(), todo->dateTime(KCalCore::Incidence::RoleEnd) );
+     }
+diff --git a/incidenceeditor-ng/incidencedatetime.h b/incidenceeditor-ng/incidencedatetime.h
+index 6642ba2..48e768c 100644
+--- a/incidenceeditor-ng/incidencedatetime.h
++++ b/incidenceeditor-ng/incidencedatetime.h
+@@ -111,9 +111,9 @@ class INCIDENCEEDITORS_NG_EXPORT IncidenceDateTime : public IncidenceEditor
+     bool eventFilter( QObject *obj, QEvent *event );
+ 
+   private:
+-    void load( const KCalCore::Event::Ptr &event );
+-    void load( const KCalCore::Todo::Ptr &todo );
+-    void load( const KCalCore::Journal::Ptr &journal );
++    void load( const KCalCore::Event::Ptr &event, bool isTemplate = false, bool templateOverridesTimes = false );
++    void load( const KCalCore::Todo::Ptr &todo, bool isTemplate = false, bool templateOverridesTimes = false );
++    void load( const KCalCore::Journal::Ptr &journal, bool isTemplate = false, bool templateOverridesTimes = false );
+     void save( const KCalCore::Event::Ptr &event );
+     void save( const KCalCore::Todo::Ptr &todo );
+     void save( const KCalCore::Journal::Ptr &journal );
+-- 
+1.7.10.4
+

-- 
KDE PIM module packaging



More information about the pkg-kde-commits mailing list