Hello community,

here is the log from the commit of package kdepim3 for openSUSE:Factory checked 
in at 2015-09-11 09:04:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kdepim3 (Old)
 and      /work/SRC/openSUSE:Factory/.kdepim3.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kdepim3"

Changes:
--------
--- /work/SRC/openSUSE:Factory/kdepim3/kdepim3.changes  2015-09-08 
18:10:05.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kdepim3.new/kdepim3.changes     2015-09-11 
09:04:52.000000000 +0200
@@ -1,0 +2,9 @@
+Thu Sep 10 14:54:56 UTC 2015 - [email protected]
+
+- Add two patches from Trinity:
+  * Speed up kalarm startup       
+    kdepim-trinity-speed-up-kalarm.patch
+  * Fix potential error and compiler warnings      
+    kdepim-trinity-fix-kalarm-events-error.patch
+
+-------------------------------------------------------------------

New:
----
  kdepim-trinity-fix-kalarm-events-error.patch
  kdepim-trinity-speed-up-kalarm.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kdepim3.spec ++++++
--- /var/tmp/diff_new_pack.ipzSoh/_old  2015-09-11 09:04:54.000000000 +0200
+++ /var/tmp/diff_new_pack.ipzSoh/_new  2015-09-11 09:04:54.000000000 +0200
@@ -85,6 +85,8 @@
 Patch145:       kdepim-trinity-fix-memory-leak.diff
 Patch146:       trinity-fix-kmail-crash-when-started-offline.patch
 Patch147:       fix-perl-no-defined-array.diff
+Patch148:       kdepim-trinity-speed-up-kalarm.patch
+Patch149:       kdepim-trinity-fix-kalarm-events-error.patch
 
 Provides:       cryptplug
 Obsoletes:      cryptplug
@@ -293,6 +295,8 @@
 %patch145 -p1
 %patch146 -p1
 %patch147 -p1
+%patch148 -p1
+%patch149 -p1
 
 . /etc/opt/kde3/common_options
 update_admin

++++++ kdepim-trinity-fix-kalarm-events-error.patch ++++++
>From c036d97d35d25c4511d9569d40c1de07dab96bb6 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <[email protected]>
Date: Fri, 07 Aug 2015 08:06:29 +0000
Subject: Fixed KAlarm building warnings. Minor style patch up. Fixed possible 
error in treating deferred evens (see kalarm/alarmevent.cpp:1739).

Signed-off-by: Michele Calgaro <[email protected]>
---
@@ -1736,7 +1736,7 @@ bool KAEvent::setDisplaying(const KAEvent& event, 
KAAlarm::Type alarmType, const
                        setUid(DISPLAYING);
                        mDisplaying     = true;
                        mDisplayingTime = (alarmType == 
KAAlarm::AT_LOGIN_ALARM) ? repeatAtLoginTime : al.dateTime();
-                       switch (al.type())
+                       switch (al.subType())
                        {
                                case KAAlarm::AT_LOGIN__ALARM:                
mDisplayingFlags = REPEAT_AT_LOGIN;  break;
                                case KAAlarm::REMINDER__ALARM:                
mDisplayingFlags = REMINDER;  break;

diff --git a/kalarm/editdlg.cpp b/kalarm/editdlg.cpp
index 8e0cbde..ff35e91 100644
--- a/kalarm/editdlg.cpp
+++ b/kalarm/editdlg.cpp
@@ -1052,8 +1052,8 @@ bool EditAlarmDlg::stateChanged() const
        {
                if (mSavedTemplateName     != mTemplateName->text()
                ||  mSavedTemplateTimeType != mTemplateTimeGroup->selected()
-               ||  mTemplateUseTime->isOn()  &&  mSavedTemplateTime != 
mTemplateTime->time()
-               ||  mTemplateUseTimeAfter->isOn()  &&  mSavedTemplateAfterTime 
!= mTemplateTimeAfter->value())
+               ||  (mTemplateUseTime->isOn()  &&  mSavedTemplateTime != 
mTemplateTime->time())
+               ||  (mTemplateUseTimeAfter->isOn()  &&  mSavedTemplateAfterTime 
!= mTemplateTimeAfter->value()))
                        return true;
        }
        else
@@ -1061,7 +1061,7 @@ bool EditAlarmDlg::stateChanged() const
                        return true;
        if (mSavedTypeRadio        != mActionGroup->selected()
        ||  mSavedLateCancel       != mLateCancel->minutes()
-       ||  mShowInKorganizer && mSavedShowInKorganizer != 
mShowInKorganizer->isChecked()
+       ||  (mShowInKorganizer && mSavedShowInKorganizer != 
mShowInKorganizer->isChecked())
        ||  textFileCommandMessage != mSavedTextFileCommandMessage
        ||  mSavedRecurrenceType   != mRecurrenceEdit->repeatType())
                return true;
@@ -1114,7 +1114,7 @@ bool EditAlarmDlg::stateChanged() const
                QStringList emailAttach;
                for (int i = 0;  i < mEmailAttachList->count();  ++i)
                        emailAttach += mEmailAttachList->text(i);
-               if (mEmailFromList  &&  mSavedEmailFrom != 
mEmailFromList->currentIdentityName()
+               if ((mEmailFromList  &&  mSavedEmailFrom != 
mEmailFromList->currentIdentityName())
                ||  mSavedEmailTo      != mEmailToEdit->text()
                ||  mSavedEmailSubject != mEmailSubjectEdit->text()
                ||  mSavedEmailAttach  != emailAttach
@@ -1214,8 +1214,8 @@ void EditAlarmDlg::setEvent(KAEvent& event, const 
QString& text, bool trial)
                        mRecurrenceEdit->updateEvent(event, !mTemplate);
                        QDateTime now = QDateTime::currentDateTime();
                        bool dateOnly = mAlarmDateTime.isDateOnly();
-                       if (dateOnly  &&  mAlarmDateTime.date() < now.date()
-                       ||  !dateOnly  &&  mAlarmDateTime.rawDateTime() < now)
+                       if ((dateOnly && mAlarmDateTime.date() < now.date())
+                       ||  (!dateOnly && mAlarmDateTime.rawDateTime() < now))
                        {
                                // A timed recurrence has an entered start date 
which has
                                // already expired, so we must adjust the next 
repetition.
@@ -1449,7 +1449,7 @@ void EditAlarmDlg::slotOk()
                                return;
                        }
                        if (recurEvent.repeatInterval() % 1440
-                       &&  (mTemplate && mTemplateAnyTime->isOn()  ||  
!mTemplate && mAlarmDateTime.isDateOnly()))
+                       &&  ((mTemplate && mTemplateAnyTime->isOn()) || 
(!mTemplate && mAlarmDateTime.isDateOnly())))
                        {
                                KMessageBox::sorry(this, i18n("For a repetition 
within the recurrence, its period must be in units of days or weeks for a 
date-only alarm"));
                                mRecurrenceEdit->activateSubRepetition();   // 
display the alarm repetition dialog again
diff --git a/kalarm/eventlistviewbase.cpp b/kalarm/eventlistviewbase.cpp
index eea2f87..14a7afd 100644
--- a/kalarm/eventlistviewbase.cpp
+++ b/kalarm/eventlistviewbase.cpp
@@ -459,7 +459,7 @@ QString EventListWhatsThisBase::text(const QPoint& pt)
        QPoint viewportPt = mListView->viewport()->mapFrom(mListView, pt);
        QRect frame = mListView->header()->frameGeometry();
        if (frame.contains(pt)
-       ||  mListView->itemAt(QPoint(mListView->itemMargin(), viewportPt.y())) 
&& frame.contains(QPoint(pt.x(), frame.y())))
+       ||  (mListView->itemAt(QPoint(mListView->itemMargin(), viewportPt.y())) 
&& frame.contains(QPoint(pt.x(), frame.y()))))
                column = mListView->header()->sectionAt(pt.x());
        return mListView->whatsThisText(column);
 }
diff --git a/kalarm/find.cpp b/kalarm/find.cpp
index 9a469e5..8e35cbe 100644
--- a/kalarm/find.cpp
+++ b/kalarm/find.cpp
@@ -298,8 +298,8 @@ void Find::findNext(bool forward, bool sort, bool checkEnd, 
bool fromCurrent)
                        last = true;    // we've wrapped round and reached the 
starting alarm again
                fromCurrent = false;
                bool live = !event.expired();
-               if (live  &&  !(mOptions & FIND_LIVE)
-               ||  !live  &&  !(mOptions & FIND_EXPIRED))
+               if ((live && !(mOptions & FIND_LIVE))
+               ||  (!live && !(mOptions & FIND_EXPIRED)))
                        continue;     // we're not searching this type of alarm
                switch (event.action())
                {
diff --git a/kalarm/functions.cpp b/kalarm/functions.cpp
index cd1f95d..b92e3f3 100644
--- a/kalarm/kalarmapp.cpp
+++ b/kalarm/kalarmapp.cpp
@@ -229,7 +229,7 @@ bool KAlarmApp::restoreSession()
        // Try to display the system tray icon if it is configured to be 
autostarted,
        // or if we're in run-in-system-tray mode.
        if (Preferences::autostartTrayIcon()
-       ||  MainWindow::count()  &&  wantRunInSystemTray())
+       ||  (MainWindow::count() && wantRunInSystemTray()))
        {
                displayTrayIcon(true, trayParent);
                // Occasionally for no obvious reason, the main main window is
@@ -786,7 +786,7 @@ void KAlarmApp::quitIf(int exitCode, bool force)
                        return;
                int mwcount = MainWindow::count();
                MainWindow* mw = mwcount ? MainWindow::firstWindow() : 0;
-               if (mwcount > 1  ||  mwcount && (!mw->isHidden() || 
!mw->isTrayParent()))
+               if (mwcount > 1 || (mwcount && (!mw->isHidden() || 
!mw->isTrayParent())))
                        return;
                // There are no windows left except perhaps a main window which 
is a hidden tray icon parent
                if (mTrayWindow)
@@ -1328,7 +1328,7 @@ bool KAlarmApp::handleEvent(const QString& eventID, 
EventFunc function)
                                                                        if (now 
>= limit)
                                                                        {
                                                                                
if (type == KAEvent::LAST_RECURRENCE
-                                                                               
||  type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs())
+                                                                               
||  (type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs()))
                                                                                
        cancel = true;   // last occurrence (and there are no repetitions)
                                                                                
else
                                                                                
        late = true;
@@ -1360,7 +1360,7 @@ bool KAlarmApp::handleEvent(const QString& eventID, 
EventFunc function)
                                                                        if 
(next.dateTime().secsTo(now) > maxlate)
                                                                        {
                                                                                
if (type == KAEvent::LAST_RECURRENCE
-                                                                               
||  type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs())
+                                                                               
||  (type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event.recurs()))
                                                                                
        cancel = true;   // last occurrence (and there are no repetitions)
                                                                                
else
                                                                                
        late = true;
@@ -1621,7 +1621,7 @@ void* KAlarmApp::execAlarm(KAEvent& event, const KAAlarm& 
alarm, bool reschedule
                        if (!event.enabled())
                                delete win;        // event is disabled - close 
its window
                        else if (!win
-                            ||  !win->hasDefer() && !alarm.repeatAtLogin()
+                            ||  (!win->hasDefer() && !alarm.repeatAtLogin())
                             ||  replaceReminder)
                        {
                                // Either there isn't already a message for 
this event,
diff --git a/kalarm/kalarmd/adcalendar.cpp b/kalarm/kalarmd/adcalendar.cpp
index a2cc483..b1033eb 100644
--- a/kalarm/kalarmd/adcalendar.cpp
+++ b/kalarm/kalarmd/adcalendar.cpp
@@ -153,8 +153,8 @@ bool ADCalendar::eventHandled(const KCal::Event* event, 
const QValueList<QDate
                if (alarmtimes[i].isValid()
                &&  (i >= oldCount                             // is it an 
additional alarm?
                     || !it.data().alarmTimes[i].isValid()     // or has it 
just become due?
-                    || it.data().alarmTimes[i].isValid()      // or has it 
changed?
-                       && alarmtimes[i] != it.data().alarmTimes[i]))
+                    || (it.data().alarmTimes[i].isValid()     // or has it 
changed?
+                       && alarmtimes[i] != it.data().alarmTimes[i])))
                        return false;     // this alarm has changed
        }
        return true;
diff --git a/kalarm/kalarmd/alarmdaemon.cpp b/kalarm/kalarmd/alarmdaemon.cpp
index 4af7f0d..3b7f745 100644
--- a/kalarm/kalarmd/alarmdaemon.cpp
+++ b/kalarm/kalarmd/alarmdaemon.cpp
@@ -449,7 +449,7 @@ void AlarmDaemon::checkAlarms(ADCalendar* cal)
                                        }
                                }
                                if (!dt.isValid()  ||  dt > now
-                               ||  dt1.isValid()  &&  dt1 > dt)  // already 
tested dt1 <= now
+                               ||  (dt1.isValid()  &&  dt1 > dt))  // already 
tested dt1 <= now
                                        dt = dt1;
                        }
                        alarmtimes.append(dt);
diff --git a/kalarm/karecurrence.cpp b/kalarm/karecurrence.cpp
index 8b7e906..b6051ca 100644
--- a/kalarm/karecurrence.cpp
+++ b/kalarm/karecurrence.cpp
@@ -110,8 +110,8 @@ bool KARecurrence::init(RecurrenceRule::PeriodType 
recurType, int freq, int coun
        if (count < -1)
                return false;
        bool dateOnly = start.isDateOnly();
-       if (!count  &&  (!dateOnly && !end.isValid()
-                     || dateOnly && !end.date().isValid()))
+       if (!count  &&  ((!dateOnly && !end.isValid())
+                     || (dateOnly && !end.date().isValid())))
                return false;
        switch (recurType)
        {
@@ -134,8 +134,8 @@ bool KARecurrence::init(RecurrenceRule::PeriodType 
recurType, int freq, int coun
        else
                setEndDateTime(end);
        QDateTime startdt = start.dateTime();
-       if (recurType == RecurrenceRule::rYearly
-       &&  feb29Type == FEB29_FEB28  ||  feb29Type == FEB29_MAR1)
+       if ((recurType == RecurrenceRule::rYearly
+       &&  feb29Type == FEB29_FEB28) || feb29Type == FEB29_MAR1)
        {
                int year = startdt.date().year();
                if (!QDate::leapYear(year)
@@ -257,7 +257,7 @@ void KARecurrence::fix()
                                        {
                                                // This is the second rule.
                                                // Ensure that it can be 
combined with the first one.
-                                               if (day == days[0]  ||  day == 
-1 && days[0] == 60
+                                               if (day == days[0]  ||  (day == 
-1 && days[0] == 60)
                                                ||  rrule->frequency() != 
rrules[0]->frequency()
                                                ||  rrule->startDt()   != 
rrules[0]->startDt())
                                                        break;
diff --git a/kalarm/lib/datetime.h b/kalarm/lib/datetime.h
index bcfa434..d75aa94 100644
--- a/kalarm/lib/datetime.h
+++ b/kalarm/lib/datetime.h
@@ -73,7 +73,7 @@ class DateTime
                /** Returns true if the date is null and, if it is a date-time 
value, the time is also null. */
                bool      isNull() const       { return 
mDateTime.date().isNull()  &&  (mDateOnly || mDateTime.time().isNull()); }
                /** Returns true if the date is valid and, if it is a date-time 
value, the time is also valid. */
-               bool      isValid() const      { return 
mDateTime.date().isValid()  &&  (mDateOnly || mTimeValid && 
mDateTime.time().isValid()); }
+               bool      isValid() const      { return 
mDateTime.date().isValid()  &&  (mDateOnly || (mTimeValid && 
mDateTime.time().isValid())); }
                /** Returns true if it is date-only value. */
                bool      isDateOnly() const   { return mDateOnly; }
                /** Sets the value to be either date-only or date-time.
@@ -209,8 +209,8 @@ class DateTime
        private:
                static QTime mStartOfDay;
                QDateTime    mDateTime;
-               bool         mDateOnly;
-               bool         mTimeValid;    // whether the time is potentially 
valid - applicable only if mDateOnly false
+               bool          mDateOnly;
+               bool          mTimeValid;    // whether the time is potentially 
valid - applicable only if mDateOnly false
 };
 
 /** Returns true if the two values are equal. */
diff --git a/kalarm/lib/lineedit.cpp b/kalarm/lib/lineedit.cpp
index 4e40e2c..f561540 100644
--- a/kalarm/lib/lineedit.cpp
+++ b/kalarm/lib/lineedit.cpp
@@ -99,8 +99,8 @@ void LineEdit::dragEnterEvent(QDragEnterEvent* e)
                e->accept(false);   // don't accept "text/calendar" objects
        e->accept(QTextDrag::canDecode(e)
               || KURLDrag::canDecode(e)
-              || mType != Url && KPIM::MailListDrag::canDecode(e)
-              || mType == Emails && KVCardDrag::canDecode(e));
+              || (mType != Url && KPIM::MailListDrag::canDecode(e))
+              || (mType == Emails && KVCardDrag::canDecode(e)));
 }
 
 void LineEdit::dropEvent(QDropEvent* e)
diff --git a/kalarm/lib/shellprocess.cpp b/kalarm/lib/shellprocess.cpp
index c8ea891..1ed64df 100644
--- a/kalarm/lib/shellprocess.cpp
+++ b/kalarm/lib/shellprocess.cpp
@@ -86,8 +86,8 @@ void ShellProcess::slotExited(TDEProcess* proc)
        {
                // Some shells report if the command couldn't be found, or is 
not executable
                int status = proc->exitStatus();
-               if (mShellName == "bash"  &&  (status == 126 || status == 127)
-               ||  mShellName == "ksh"  &&  status == 127)
+               if ((mShellName == "bash" && (status == 126 || status == 127))
+               ||  (mShellName == "ksh" && status == 127))
                {
                        kdWarning(5950) << "ShellProcess::slotExited(" << 
mCommand << ") " << mShellName << ": not found or not executable\n";
                        mStatus = NOT_FOUND;
diff --git a/kalarm/lib/timeedit.cpp b/kalarm/lib/timeedit.cpp
index 51760fc..80713f2 100644
--- a/kalarm/lib/timeedit.cpp
+++ b/kalarm/lib/timeedit.cpp
@@ -77,8 +77,7 @@ bool TimeEdit::isValid() const
 void TimeEdit::setValid(bool valid)
 {
        bool oldValid = mSpinBox->isValid();
-       if (valid  &&  !oldValid
-       ||  !valid  &&  oldValid)
+       if ((valid && !oldValid) || (!valid && oldValid))
        {
                mSpinBox->setValid(valid);
                if (mAmPm)
diff --git a/kalarm/lib/timeperiod.cpp b/kalarm/lib/timeperiod.cpp
index 7f37063..37c7870 100644
--- a/kalarm/lib/timeperiod.cpp
+++ b/kalarm/lib/timeperiod.cpp
@@ -207,7 +207,7 @@ void TimePeriod::setMinutes(int mins, bool dateOnly, 
TimePeriod::Units defaultUn
                else if (item > mMaxUnitShown)
                        item = mMaxUnitShown;
                mUnitsCombo->setCurrentItem(item - mDateOnlyOffset);
-               if (dateOnly && !mDateOnlyOffset  ||  !dateOnly && 
mDateOnlyOffset)
+               if ((dateOnly && !mDateOnlyOffset) || (!dateOnly && 
mDateOnlyOffset))
                        item = setDateOnly(mins, dateOnly, false);
        }
        showHourMin(item == HOURS_MINUTES  &&  !mNoHourMinute);
diff --git a/kalarm/recurrenceedit.cpp b/kalarm/recurrenceedit.cpp
index 1389f54..4a61ed6 100644
--- a/kalarm/recurrenceedit.cpp
+++ b/kalarm/recurrenceedit.cpp
@@ -453,8 +453,8 @@ void RecurrenceEdit::periodClicked(int id)
 void RecurrenceEdit::slotAnyTimeToggled(bool on)
 {
        QButton* button = mRuleButtonGroup->selected();
-       mEndTimeEdit->setEnabled(button == mAtLoginButton && !on
-                            ||  button == mSubDailyButton && 
mEndDateButton->isChecked());
+       mEndTimeEdit->setEnabled((button == mAtLoginButton && !on)
+                            ||  (button == mSubDailyButton && 
mEndDateButton->isChecked()));
 }
 
 /******************************************************************************
@@ -465,7 +465,7 @@ void RecurrenceEdit::rangeTypeClicked()
        bool endDate = mEndDateButton->isOn();
        mEndDateEdit->setEnabled(endDate);
        mEndTimeEdit->setEnabled(endDate
-                                &&  (mAtLoginButton->isOn() && 
!mEndAnyTimeCheckBox->isChecked()
+                                &&  ((mAtLoginButton->isOn() && 
!mEndAnyTimeCheckBox->isChecked())
                                      ||  mSubDailyButton->isOn()));
        bool repeatCount = mRepeatCountButton->isOn();
        mRepeatCountEntry->setEnabled(repeatCount);
@@ -1090,7 +1090,7 @@ bool RecurrenceEdit::stateChanged() const
 {
        if (mSavedRuleButton  != mRuleButtonGroup->selected()
        ||  mSavedRangeButton != mRangeButtonGroup->selected()
-       ||  mRule  &&  mRule->stateChanged())
+       ||  (mRule  &&  mRule->stateChanged()))
                return true;
        if (mSavedRangeButton == mRepeatCountButton
        &&  mSavedRecurCount  != mRepeatCountEntry->value())
diff --git a/kalarm/traywindow.cpp b/kalarm/traywindow.cpp
index 7eb6d2a..93afa2e 100644
--
cgit v0.9.0.2-52-g1de3
++++++ kdepim-trinity-speed-up-kalarm.patch ++++++
>From c2ad4a056c3fecc0643b92755bc851b2fa299c49 Mon Sep 17 00:00:00 2001
From: Michele Calgaro <[email protected]>
Date: Sun, 23 Aug 2015 11:19:11 +0000
Subject: Sped up KAlarm startup mechanism. This resolves bug 1610.

Signed-off-by: Michele Calgaro <[email protected]>
---
diff --git a/kalarm/daemon.cpp b/kalarm/daemon.cpp
index c5769f9..842514d 100644
--- a/kalarm/daemon.cpp
+++ b/kalarm/daemon.cpp
@@ -64,21 +64,21 @@ class NotificationHandler : public QObject, virtual public 
AlarmGuiIface
 };
 
 
-Daemon*              Daemon::mInstance = 0;
-NotificationHandler* Daemon::mDcopHandler = 0;
-QValueList<QString>  Daemon::mQueuedEvents;
-QValueList<QString>  Daemon::mSavingEvents;
+Daemon*               Daemon::mInstance = 0;
+NotificationHandler*  Daemon::mDcopHandler = 0;
+QValueList<QString> Daemon::mQueuedEvents;
+QValueList<QString> Daemon::mSavingEvents;
 QTimer*              Daemon::mStartTimer = 0;
 QTimer*              Daemon::mRegisterTimer = 0;
 QTimer*              Daemon::mStatusTimer = 0;
-int                  Daemon::mStatusTimerCount = 0;
-int                  Daemon::mStatusTimerInterval;
-int                  Daemon::mStartTimeout = 0;
-Daemon::Status       Daemon::mStatus = Daemon::STOPPED;
-bool                 Daemon::mRunning = false;
-bool                 Daemon::mCalendarDisabled = false;
-bool                 Daemon::mEnableCalPending = false;
-bool                 Daemon::mRegisterFailMsg = false;
+int                   Daemon::mStatusTimerCount = 0;
+int                   Daemon::mStatusTimerInterval;
+int                   Daemon::mStartTimeout = 0;
+Daemon::Status        Daemon::mStatus = Daemon::STOPPED;
+bool                  Daemon::mRunning = false;
+bool                  Daemon::mCalendarDisabled = false;
+bool                  Daemon::mEnableCalPending = false;
+bool                  Daemon::mRegisterFailMsg = false;
 
 // How frequently to check the daemon's status after starting it.
 // This is equal to the length of time we wait after the daemon is registered 
with DCOP
@@ -655,7 +655,7 @@ int Daemon::maxTimeSinceCheck()
 =============================================================================*/
 
 NotificationHandler::NotificationHandler()
-       : DCOPObject(NOTIFY_DCOP_OBJECT), 
+       : DCOPObject(NOTIFY_DCOP_OBJECT),
          QObject()
 {
        kdDebug(5950) << "NotificationHandler::NotificationHandler()\n";
diff --git a/kalarm/kalarmd/alarmdaemon.cpp b/kalarm/kalarmd/alarmdaemon.cpp
index 3b7f745..573cac0 100644
--- a/kalarm/kalarmd/alarmdaemon.cpp
+++ b/kalarm/kalarmd/alarmdaemon.cpp
@@ -73,23 +73,54 @@ AlarmDaemon::AlarmDaemon(bool autostart, QObject *parent, 
const char *name)
 #ifdef AUTOSTART_KALARM
        if (autostart)
        {
-               /* The alarm daemon is being autostarted.
-                * Check if KAlarm needs to be autostarted in the system tray.
+               /* The alarm daemon has been autostarted.
+                * Check if also KAlarm needs to be autostarted (by the daemon) 
in the system tray.
                 * This should ideally be handled internally by KAlarm, but is 
done by kalarmd
-                * for the following reason:
-                * KAlarm needs to be both session restored and autostarted, 
but KDE doesn't
-                * currently cater properly for this - there is no guarantee 
that the session
-                * restoration activation will come before the autostart 
activation. If they
-                * come in the wrong order, KAlarm won't know that it is 
supposed to restore
-                * itself and instead will simply open a new window.
+                * to correctly handle the cases when KAlarm is restored and 
when it is autostarted.
+                * If the autostart request comes before the restoring one, 
KAlarm would not know
+                * that it is supposed to restore itself and instead would 
simply open a new window.
+                * So we first check if the session has been fully restored by 
the session manager
+                * and if so we can continue safely. If the session hasn't yet 
been fully restored
+                * or created, we wait for up to 30 seconds and then continue 
as normal.
                 */
                KConfig kaconfig(locate("config", "kalarmrc"));
                kaconfig.setGroup(QString::fromLatin1("General"));
                autostart = kaconfig.readBoolEntry(AUTOSTART_TRAY, false);
                if (autostart)
                {
-                       kdDebug(5900) << "AlarmDaemon::AlarmDaemon(): wait to 
autostart KAlarm\n";
-                       QTimer::singleShot(KALARM_AUTOSTART_TIMEOUT * 1000, 
this, SLOT(autostartKAlarm()));
+                       bool done = false;
+                       DCOPClient* client = kapp->dcopClient();
+                       if (client->isApplicationRegistered("ksmserver"))
+                       {
+                               QByteArray callData;
+                               QCString replyType;
+                               QByteArray replyData;
+                               for (int i=0; !done && 
i<KALARM_AUTOSTART_TIMEOUT; ++i)
+                               {
+                                       // Check if the session has been fully 
created/restored. If not, wait a little and try again
+                                       if 
(!kapp->dcopClient()->call("ksmserver", "ksmserver", "startupCompleted()", 
callData, replyType, replyData) ||
+                                                       replyType != "bool")
+                                       {
+                                               done = true;    // In case of 
DCOP call error, just continue normally
+                                       }
+                                       else
+                                       {
+                                               bool result;
+                                               QDataStream 
replyStream(replyData, IO_ReadOnly);
+                                               replyStream >> result;
+                                               if (result)
+                                               {
+                                                       done = true;    // 
Session created/restored ==> continue
+                                               }
+                                               else
+                                               {
+                                                       sleep(1); // Session 
not yet fully created/restored ==> wait and retry
+                                               }
+                                       }
+                               }
+                       // Give some extra time to KAlarm to be fully restored, 
then proceed as usual
+                       QTimer::singleShot(3000, this, SLOT(autostartKAlarm()));
+                       }
                }
        }
        if (!autostart)
--
cgit v0.9.0.2-52-g1de3

Reply via email to