+bool MainWindow::eventRequest(QVariant param, PluginRequest req)
+{
+ if (req == qtrapids::PluginHostInterface::OPEN_FILE) {
+ QString sourceFile = param.toString();
+
+ // Get the source files name from the full path:
+ QFileInfo fInfo(sourceFile);
+ QString targetFile = fInfo.fileName();
+ targetFile = settings_.value("download/directory").toString() + targetFile;
+
+ // Copy temoporary file to Downloads directory...
+ if (!QFile::copy(sourceFile, targetFile)) {
+ qDebug() << "File copying failed";
+ return false;
+ } else {
+ // If copying was successful, remove the original temporary file.
+ QFile::remove(sourceFile);
+ }
+
+ // ...and start the torrent:
+ on_torrentFileSelected(targetFile);
+ }
+
+ return true;
+}
+
+