From c437f19f371b5678e0772a5f922fc3587864ca4e Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 24 Aug 2010 19:33:28 +0000 Subject: [PATCH] Fixed CalDAV crash when event editor left open during automatic reload git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1167492 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korganizer/kocore.cpp | 12 ++++++++++++ korganizer/kocore.h | 3 +++ korganizer/koeditorgeneral.cpp | 3 +++ kresources/caldav/Makefile.am | 2 +- kresources/caldav/resource.cpp | 4 ++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/korganizer/kocore.cpp b/korganizer/kocore.cpp index b9d404e7..d5ed4f39 100644 --- a/korganizer/kocore.cpp +++ b/korganizer/kocore.cpp @@ -41,6 +41,8 @@ #include +static bool m_editoropen = false; + KOCore *KOCore::mSelf = 0; KOCore *KOCore::self() @@ -62,6 +64,16 @@ KOCore::~KOCore() mSelf = 0; } +bool KOCore::editorWindowOpen() +{ + return m_editoropen; +} + +void KOCore::setEditorWindowOpen(bool open) +{ + m_editoropen = open; +} + KTrader::OfferList KOCore::availablePlugins( const TQString &type, int version ) { TQString constraint; diff --git a/korganizer/kocore.h b/korganizer/kocore.h index f2838263..1d6a4ebe 100644 --- a/korganizer/kocore.h +++ b/korganizer/kocore.h @@ -84,6 +84,9 @@ class KDE_EXPORT KOCore KPIM::IdentityManager* identityManager(); + bool editorWindowOpen(); + void setEditorWindowOpen(bool open); + protected: KOCore(); diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index adaea125..26ec5a51 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -60,6 +60,7 @@ #include "koprefs.h" #include "koglobals.h" +#include "kocore.h" #include "koeditorgeneral.h" #include "koeditoralarms.h" @@ -70,11 +71,13 @@ KOEditorGeneral::KOEditorGeneral(TQObject* parent, const char* name) : TQObject( parent, name ), mAttachments(0) { + KOCore::self()->setEditorWindowOpen(true); mAlarmList.setAutoDelete( true ); } KOEditorGeneral::~KOEditorGeneral() { + KOCore::self()->setEditorWindowOpen(false); } diff --git a/kresources/caldav/Makefile.am b/kresources/caldav/Makefile.am index 45c0f2c7..604976cd 100644 --- a/kresources/caldav/Makefile.am +++ b/kresources/caldav/Makefile.am @@ -15,7 +15,7 @@ libkcal_caldav_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) \ libkcal_caldav_la_LIBADD = \ $(top_builddir)/libkcal/libkcal.la \ $(top_builddir)/libkdepim/libkdepim.la \ - -lcaldav + -lcaldav -lkorganizer libkcal_caldav_la_COMPILE_FIRST = prefsskel.h kde_module_LTLIBRARIES = kcal_caldav.la diff --git a/kresources/caldav/resource.cpp b/kresources/caldav/resource.cpp index 4e154202..58ea5838 100644 --- a/kresources/caldav/resource.cpp +++ b/kresources/caldav/resource.cpp @@ -38,6 +38,7 @@ #include "resource.h" #include "reader.h" #include "writer.h" +#include /*========================================================================= | NAMESPACE @@ -143,6 +144,9 @@ bool ResourceCalDav::isSaving() { bool ResourceCalDav::doLoad() { bool syncCache = true; + // Make sure no editor windows are open + if (KOCore::self()->editorWindowOpen() == true) return true; + if ((mLoadingQueueReady == false) || (mLoadingQueue.isEmpty() == false) || (mLoader->running() == true) || (isSaving() == true)) { return true; // Silently fail; the user has obviously not responded to a dialog and we don't need to pop up more of them! }