[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] kexi/formeditor: Kexi Form Designer: fix crash when Cut, Undo, Cut is executed for a widg
From: Jaroslaw Staniek <staniek () kde ! org>
Date: 2015-11-01 1:26:18
Message-ID: E1ZshPW-0007q3-JY () scm ! kde ! org
[Download RAW message or body]
Git commit 2c224a48c013e596afddc57a3026943f7fd58b03 by Jaroslaw Staniek.
Committed on 01/11/2015 at 01:22.
Pushed by staniek into branch 'master'.
Kexi Form Designer: fix crash when Cut, Undo, Cut is executed for a widget
BUG:288589
FIXED-IN:2.9.9
from Calligra 2.9 d52e37f27d45864
M +3 -2 kexi/formeditor/commands.cpp
M +4 -5 kexi/formeditor/utils.cpp
M +2 -2 kexi/formeditor/utils.h
http://commits.kde.org/calligra/2c224a48c013e596afddc57a3026943f7fd58b03
diff --git a/kexi/formeditor/commands.cpp b/kexi/formeditor/commands.cpp
index df7347c..0c93364 100644
--- a/kexi/formeditor/commands.cpp
+++ b/kexi/formeditor/commands.cpp
@@ -1586,7 +1586,8 @@ void CutWidgetCommand::execute()
{
DeleteWidgetCommand::execute();
delete d2->data;
- d2->data = KFormDesigner::deepCopyOfClipboardData(); // save clipboard contents
+ QClipboard *cb = QApplication::clipboard();
+ d2->data = KFormDesigner::deepCopyOfMimeData(cb->mimeData()); // save clipboard contents
// d->domDoc has been filled in DeleteWidgetCommand ctor
KFormDesigner::copyToClipboard(d->domDoc.toString());
}
@@ -1595,7 +1596,7 @@ void CutWidgetCommand::undo()
{
DeleteWidgetCommand::undo();
QClipboard *cb = QApplication::clipboard();
- cb->setMimeData( d2->data ); // restore prev. clipboard contents
+ cb->setMimeData(KFormDesigner::deepCopyOfMimeData(d2->data)); // restore prev. clipboard contents
}
KFORMDESIGNER_EXPORT QDebug KFormDesigner::operator<<(QDebug dbg, const CutWidgetCommand &c)
diff --git a/kexi/formeditor/utils.cpp b/kexi/formeditor/utils.cpp
index 835be43..aa5a9c8 100644
--- a/kexi/formeditor/utils.cpp
+++ b/kexi/formeditor/utils.cpp
@@ -194,14 +194,13 @@ void VerticalWidgetList::sort()
// ----
-QMimeData *KFormDesigner::deepCopyOfClipboardData()
+QMimeData *KFormDesigner::deepCopyOfMimeData(const QMimeData *data)
{
- //QClipboard *cb = QApplication::clipboard();
- QMimeData *data = new QMimeData();
+ QMimeData *newData = new QMimeData();
foreach(const QString& format, data->formats()) {
- data->setData(format, data->data(format));
+ newData->setData(format, data->data(format));
}
- return data;
+ return newData;
}
void KFormDesigner::copyToClipboard(const QString& xml)
diff --git a/kexi/formeditor/utils.h b/kexi/formeditor/utils.h
index cae09e5..0d92068 100644
--- a/kexi/formeditor/utils.h
+++ b/kexi/formeditor/utils.h
@@ -122,8 +122,8 @@ KFORMDESIGNER_EXPORT QSize getSizeFromChildren(QWidget *widget, const char *inhe
//! @return mimetype for the forms XML format
inline QString mimeType() { return "application/x-kexi-form"; }
-//! @returns deep copy of the current clipboard contents (for all formats)
-KFORMDESIGNER_EXPORT QMimeData *deepCopyOfClipboardData();
+//! @return deep copy of the mime data @a data (for all formats)
+KFORMDESIGNER_EXPORT QMimeData *deepCopyOfMimeData(const QMimeData *data);
//! Copies @a xml data to the clipboard both in the plain text format and forms XML format
KFORMDESIGNER_EXPORT void copyToClipboard(const QString& xml);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic