diff --git a/retroshare-gui/src/gui/ShareManager.cpp b/retroshare-gui/src/gui/ShareManager.cpp index 526a8c4c6..4a5302c2a 100644 --- a/retroshare-gui/src/gui/ShareManager.cpp +++ b/retroshare-gui/src/gui/ShareManager.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -76,6 +77,7 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags) ui.shareddirList->setRangeSelected(QTableWidgetSelectionRange(0, 0, 0, COLUMN_COUNT), true); + setAcceptDrops(true); setAttribute(Qt::WA_DeleteOnClose, true); } @@ -306,3 +308,57 @@ void ShareManager::shareddirListCurrentCellChanged(int currentRow, int currentCo ui.removeButton->setEnabled(false); } } + +void ShareManager::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } +} + +void ShareManager::dropEvent(QDropEvent *event) +{ + if (!(Qt::CopyAction & event->possibleActions())) { + /* can't do it */ + return; + } + + QStringList formats = event->mimeData()->formats(); + QStringList::iterator it; + + bool errorShown = false; + + if (event->mimeData()->hasUrls()) { + QList urls = event->mimeData()->urls(); + QList::iterator it; + for (it = urls.begin(); it != urls.end(); it++) { + QString localpath = it->toLocalFile(); + + if (localpath.isEmpty() == false) { + QDir dir(localpath); + if (dir.exists()) { + SharedDirInfo sdi; + sdi.filename = localpath.toUtf8().constData(); + sdi.virtualname.clear(); + + sdi.shareflags = 0; + + /* add new share */ + rsFiles->addSharedDirectory(sdi); + } else if (QFile::exists(localpath)) { + if (errorShown == false) { + QMessageBox mb(tr("Drop file error."), tr("File can't be dropped, only directories are accepted."), QMessageBox::Information, QMessageBox::Ok, 0, 0, this); + mb.exec(); + errorShown = true; + } + } else { + QMessageBox mb(tr("Drop file error."), tr("Directory not found or directory name not accepted."), QMessageBox::Information, QMessageBox::Ok, 0, 0, this); + mb.exec(); + } + } + } + } + + event->setDropAction(Qt::CopyAction); + event->accept(); +} diff --git a/retroshare-gui/src/gui/ShareManager.h b/retroshare-gui/src/gui/ShareManager.h index 962a9e009..885962b2f 100644 --- a/retroshare-gui/src/gui/ShareManager.h +++ b/retroshare-gui/src/gui/ShareManager.h @@ -48,6 +48,9 @@ private: protected: virtual void showEvent(QShowEvent * event); + virtual void dragEnterEvent(QDragEnterEvent *event); + virtual void dropEvent(QDropEvent *event); + private slots: /** Create the context popup menu and it's submenus */ void shareddirListCurrentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn); diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index 0d622fd87..ea1dafac8 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index cbc98de8d..5acde3eec 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -3365,37 +3365,37 @@ p, li { white-space: pre-wrap; } Friends Directories - Dateien von Freunden + Dateien von Freunden My Directories - Meine Ordner + Meine Ordner Size - Grösse + Grösse Age - Alter + Alter Friend - Freund + Freund Share Type - Freigabe Typ + Freigabe Typ Directory - Ordner + Ordner @@ -3689,7 +3689,7 @@ p, li { white-space: pre-wrap; } Copy RetroShare Link - Kopiere RetroShare Link + Kopiere RetroShare Link @@ -10281,7 +10281,7 @@ p, li { white-space: pre-wrap; } Freigabe entfernen - + If checked, the share is anonymously shared to anybody. Wenn aktiviert, dann ist dieser Ordner anonym feigegeben. @@ -10295,9 +10295,25 @@ p, li { white-space: pre-wrap; } Do you really want to stop sharing this directory ? Möchtes Du die Freigabe dieses Ordners wirklich aufheben ? + + + + Drop file error. + Dateifehler bei Drag'n'Drop. + + + + File can't be dropped, only directories are accepted. + Dateien können nicht für Drag'n'Drop genutzt werden. Nur Ordner werden akzeptiert. + + + + Directory not found or directory name not accepted. + Ordner nicht gefunden oder Ordnername nicht akzeptiert. + - + Remove Entfernen @@ -10335,7 +10351,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt;">You can separately setup share flags for each shared directory:</span><span style=" font-size:8pt;"> </span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">Browsable</span><span style=" font-family:'Sans'; font-size:8pt;">: files are browsable from your direct friends.</span></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:8pt; font-weight:600;">Network Wide</span><span style=" font-family:'Sans'; font-size:8pt;">: files can be downloaded by anybody through anonymous tunnels.</span></p></body></html> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> @@ -10466,12 +10482,12 @@ p, li { white-space: pre-wrap; } Tree view - + Baumansicht Flat view - + Listenansicht @@ -11862,58 +11878,58 @@ p, li { white-space: pre-wrap; } FILE - DATEI + DATEI Files - Dateien + Dateien File - Datei + Datei DIR - ORDNER + ORDNER Friends Directories - Dateien von Freunden + Dateien von Freunden My Directories - Meine Ordner + Meine Ordner Size - Grösse + Grösse Age - Alter + Alter Friend - Freund + Freund Share Type - Freigabe Typ + Freigabe Typ What's new - Was ist neu + Was ist neu