summaryrefslogtreecommitdiff
path: root/source/kde/patch/calligra/0068-Backport-Plan-Fix-task-module-load-and-save.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/kde/patch/calligra/0068-Backport-Plan-Fix-task-module-load-and-save.patch')
-rw-r--r--source/kde/patch/calligra/0068-Backport-Plan-Fix-task-module-load-and-save.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/source/kde/patch/calligra/0068-Backport-Plan-Fix-task-module-load-and-save.patch b/source/kde/patch/calligra/0068-Backport-Plan-Fix-task-module-load-and-save.patch
new file mode 100644
index 00000000..ca6ae192
--- /dev/null
+++ b/source/kde/patch/calligra/0068-Backport-Plan-Fix-task-module-load-and-save.patch
@@ -0,0 +1,68 @@
+From fd5b8dca68d0a418aac926fe60814ebe537ee032 Mon Sep 17 00:00:00 2001
+From: Dag Andersen <danders@get2net.dk>
+Date: Mon, 22 Aug 2016 10:00:52 +0200
+Subject: [PATCH 68/80] Backport: Plan: Fix task module load and save
+
+Workaround: saveTaskModules destroys project
+---
+ plan/kptview.cpp | 19 ++++++++++++-------
+ plan/libs/models/kptnodeitemmodel.cpp | 6 +++++-
+ 2 files changed, 17 insertions(+), 8 deletions(-)
+
+diff --git a/plan/kptview.cpp b/plan/kptview.cpp
+index b38d8b6..af606f6 100644
+--- a/plan/kptview.cpp
++++ b/plan/kptview.cpp
+@@ -114,6 +114,7 @@
+ #include "kptviewlistdocker.h"
+ #include "kptviewlist.h"
+ #include "kptschedulesdocker.h"
++#include "kptpart.h"
+ #include "kptdebug.h"
+
+ #include "plansettings.h"
+@@ -3033,13 +3034,17 @@ void View::saveTaskModule( const KUrl &url, Project *project )
+ QString dir = Factory::global().dirs()->saveLocation( "plan_taskmodules" );
+ kDebug(planDbg())<<"dir="<<dir;
+ if ( ! dir.isEmpty() ) {
+- MainDocument part(getKoPart());
+- part.insertProject( *project, 0, 0 );
+- part.getProject().setName( project->name() );
+- part.getProject().setLeader( project->leader() );
+- part.getProject().setDescription( project->description() );
+- part.saveNativeFormat( dir + url.fileName() );
+- kDebug(planDbg())<<dir + url.fileName();
++ Part *part = new Part( this );
++ MainDocument *doc = new MainDocument( part );
++ part->setDocument( doc );
++ doc->disconnect(); // doc shall not handle feedback from openUrl()
++ doc->setAutoSave( 0 ); //disable
++ doc->insertProject( *project, 0, 0 );
++ doc->getProject().setName( project->name() );
++ doc->getProject().setLeader( project->leader() );
++ doc->getProject().setDescription( project->description() );
++ doc->saveNativeFormat( dir + url.fileName() );
++ part->deleteLater(); // also deletes document
+ } else {
+ kDebug(planDbg())<<"Could not find a location";
+ }
+diff --git a/plan/libs/models/kptnodeitemmodel.cpp b/plan/libs/models/kptnodeitemmodel.cpp
+index 834e45a..45b1650 100644
+--- a/plan/libs/models/kptnodeitemmodel.cpp
++++ b/plan/libs/models/kptnodeitemmodel.cpp
+@@ -4990,7 +4990,11 @@ bool TaskModuleModel::importProject( const KUrl &url, bool emitsignal )
+ stripProject( project );
+ addTaskModule( project );
+ if ( emitsignal ) {
+- emit saveTaskModule( url, project );
++ // FIXME: save modifies the project, so give it a copy (see kptview.cpp)
++ Project p;
++ status.setProject( &p );
++ p.load( element, status );
++ emit saveTaskModule( url, &p );
+ }
+ } else {
+ kDebug(planDbg())<<"Failed to load project from:"<<url;
+--
+2.7.4
+