From bd105711d4553451b2742f9aa70215d20b2aa46f Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 19 Sep 2015 22:10:49 +0200 Subject: [PATCH] + delete helper file for copy/paste on application exit --- src/Gui/MainWindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index c1735a4d1..69d45305f 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -958,6 +958,14 @@ void MainWindow::closeEvent (QCloseEvent * e) delete d->assistant; d->assistant = 0; + // See createMimeDataFromSelection + QVariant prop = this->property("x-documentobject-file"); + if (!prop.isNull()) { + Base::FileInfo fi((const char*)prop.toByteArray()); + if (fi.exists()) + fi.deleteFile(); + } + /*emit*/ mainWindowClosed(); qApp->quit(); // stop the event loop } @@ -1342,6 +1350,10 @@ QMimeData * MainWindow::createMimeDataFromSelection () const doc->exportObjects(sel, str); str.close(); res = fi.filePath().c_str(); + + // store the path name as a custom property and + // delete this file when closing the application + const_cast(this)->setProperty("x-documentobject-file", res); } QMimeData *mimeData = new QMimeData();