summaryrefslogtreecommitdiffstats
path: root/source/kde/patch/calligra/0070-Plan-Guard-against-trying-to-move-a-task-into-the-sa.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/kde/patch/calligra/0070-Plan-Guard-against-trying-to-move-a-task-into-the-sa.patch')
-rw-r--r--source/kde/patch/calligra/0070-Plan-Guard-against-trying-to-move-a-task-into-the-sa.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/kde/patch/calligra/0070-Plan-Guard-against-trying-to-move-a-task-into-the-sa.patch b/source/kde/patch/calligra/0070-Plan-Guard-against-trying-to-move-a-task-into-the-sa.patch
new file mode 100644
index 000000000..debb62b78
--- /dev/null
+++ b/source/kde/patch/calligra/0070-Plan-Guard-against-trying-to-move-a-task-into-the-sa.patch
@@ -0,0 +1,50 @@
+From a9134500e4e599ba316617941bcd04f640ed3999 Mon Sep 17 00:00:00 2001
+From: Dag Andersen <danders@get2net.dk>
+Date: Tue, 23 Aug 2016 13:30:13 +0200
+Subject: [PATCH 70/80] Plan: Guard against trying to move a task into the same
+ porition
+
+QAbstractItemModel cannot handle this and it causes a crash (later)
+---
+ plan/libs/kernel/kptproject.cpp | 4 ++++
+ plan/libs/models/kptnodeitemmodel.cpp | 9 +++++++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/plan/libs/kernel/kptproject.cpp b/plan/libs/kernel/kptproject.cpp
+index 451e897..fdf43bc 100644
+--- a/plan/libs/kernel/kptproject.cpp
++++ b/plan/libs/kernel/kptproject.cpp
+@@ -1565,6 +1565,10 @@ bool Project::moveTask( Node* node, Node *newParent, int newPos )
+ Node *oldParent = node->parentNode();
+ int oldPos = oldParent->indexOf( node );
+ int i = newPos < 0 ? newParent->numChildren() : newPos;
++ if ( oldParent == newParent && i == oldPos ) {
++ // no need to move to where it already is
++ return false;
++ }
+ int newRow = i;
+ if ( oldParent == newParent && newPos > oldPos ) {
+ ++newRow; // itemmodels wants new row *before* node is removed from old position
+diff --git a/plan/libs/models/kptnodeitemmodel.cpp b/plan/libs/models/kptnodeitemmodel.cpp
+index e66277f..5581f8f 100644
+--- a/plan/libs/models/kptnodeitemmodel.cpp
++++ b/plan/libs/models/kptnodeitemmodel.cpp
+@@ -4036,6 +4036,15 @@ bool NodeItemModel::dropMimeData( const QMimeData *data, Qt::DropAction action,
+ if ( pos >= 0 && n->parentNode() == par && par->indexOf( n ) < pos ) {
+ --pos;
+ }
++ if ( n->parentNode() == par ) {
++ // avoid drop into the same position, QAbstractItemModel does not like it
++ int crow = par->indexOf( n );
++ if ( ( ( pos == -1 ) && ( crow == par->numChildren() - 1 ) ) || ( pos == crow ) ) {
++ delete cmd;
++ cmd = 0;
++ continue;
++ }
++ }
+ cmd->addCommand( new NodeMoveCmd( m_project, n, par, pos ) );
+ offset++;
+ }
+--
+2.7.4
+