Skip to content

Commit

Permalink
+ delete helper file for copy/paste on application exit
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 19, 2015
1 parent b9a5123 commit bd10571
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Gui/MainWindow.cpp
Expand Up @@ -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
}
Expand Down Expand Up @@ -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<MainWindow*>(this)->setProperty("x-documentobject-file", res);
}

QMimeData *mimeData = new QMimeData();
Expand Down

0 comments on commit bd10571

Please sign in to comment.