mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Enabled drag and drop in ShareManager to add folders to the share.
Fixed german language. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4172 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
993e0d225c
commit
f29b41f303
@ -26,6 +26,7 @@
|
||||
#include <QPoint>
|
||||
#include <QHeaderView>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
|
||||
@ -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<QUrl> urls = event->mimeData()->urls();
|
||||
QList<QUrl>::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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
Binary file not shown.
@ -3365,37 +3365,37 @@ p, li { white-space: pre-wrap; }
|
||||
<message>
|
||||
<location filename="../gui/RemoteDirModel.cpp" line="+664"/>
|
||||
<source>Friends Directories</source>
|
||||
<translation type="unfinished">Dateien von Freunden</translation>
|
||||
<translation>Dateien von Freunden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>My Directories</source>
|
||||
<translation type="unfinished">Meine Ordner</translation>
|
||||
<translation>Meine Ordner</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Size</source>
|
||||
<translation type="unfinished">Grösse</translation>
|
||||
<translation>Grösse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Age</source>
|
||||
<translation type="unfinished">Alter</translation>
|
||||
<translation>Alter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Friend</source>
|
||||
<translation type="unfinished">Freund</translation>
|
||||
<translation>Freund</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Share Type</source>
|
||||
<translation type="unfinished">Freigabe Typ</translation>
|
||||
<translation>Freigabe Typ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Directory</source>
|
||||
<translation type="unfinished">Ordner</translation>
|
||||
<translation>Ordner</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
@ -3689,7 +3689,7 @@ p, li { white-space: pre-wrap; }
|
||||
<location line="+6"/>
|
||||
<location line="+93"/>
|
||||
<source>Copy RetroShare Link</source>
|
||||
<translation type="unfinished">Kopiere RetroShare Link</translation>
|
||||
<translation>Kopiere RetroShare Link</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-88"/>
|
||||
@ -10281,7 +10281,7 @@ p, li { white-space: pre-wrap; }
|
||||
<translation>Freigabe entfernen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/ShareManager.cpp" line="+125"/>
|
||||
<location filename="../gui/ShareManager.cpp" line="+127"/>
|
||||
<source>If checked, the share is anonymously shared to anybody.</source>
|
||||
<translation>Wenn aktiviert, dann ist dieser Ordner anonym feigegeben.</translation>
|
||||
</message>
|
||||
@ -10295,9 +10295,25 @@ p, li { white-space: pre-wrap; }
|
||||
<source>Do you really want to stop sharing this directory ?</source>
|
||||
<translation>Möchtes Du die Freigabe dieses Ordners wirklich aufheben ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+75"/>
|
||||
<location line="+5"/>
|
||||
<source>Drop file error.</source>
|
||||
<translation>Dateifehler bei Drag'n'Drop.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-5"/>
|
||||
<source>File can't be dropped, only directories are accepted.</source>
|
||||
<translation>Dateien können nicht für Drag'n'Drop genutzt werden. Nur Ordner werden akzeptiert.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Directory not found or directory name not accepted.</source>
|
||||
<translation>Ordner nicht gefunden oder Ordnername nicht akzeptiert.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui/ShareManager.ui" line="+3"/>
|
||||
<location filename="../gui/ShareManager.cpp" line="-176"/>
|
||||
<location filename="../gui/ShareManager.cpp" line="-256"/>
|
||||
<source>Remove</source>
|
||||
<translation>Entfernen</translation>
|
||||
</message>
|
||||
@ -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></source>
|
||||
<translation type="unfinished"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<translation><!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; }
|
||||
<message>
|
||||
<location line="+28"/>
|
||||
<source>Tree view</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Baumansicht</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>Flat view</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Listenansicht</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+173"/>
|
||||
@ -11862,58 +11878,58 @@ p, li { white-space: pre-wrap; }
|
||||
<location filename="../gui/RemoteDirModel.cpp" line="+136"/>
|
||||
<location line="+108"/>
|
||||
<source>FILE</source>
|
||||
<translation type="unfinished">DATEI</translation>
|
||||
<translation>DATEI</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-95"/>
|
||||
<source>Files</source>
|
||||
<translation type="unfinished">Dateien</translation>
|
||||
<translation>Dateien</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>File</source>
|
||||
<translation type="unfinished">Datei</translation>
|
||||
<translation>Datei</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+6"/>
|
||||
<location line="+103"/>
|
||||
<source>DIR</source>
|
||||
<translation type="unfinished">ORDNER</translation>
|
||||
<translation>ORDNER</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+145"/>
|
||||
<source>Friends Directories</source>
|
||||
<translation type="unfinished">Dateien von Freunden</translation>
|
||||
<translation>Dateien von Freunden</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>My Directories</source>
|
||||
<translation type="unfinished">Meine Ordner</translation>
|
||||
<translation>Meine Ordner</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Size</source>
|
||||
<translation type="unfinished">Grösse</translation>
|
||||
<translation>Grösse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Age</source>
|
||||
<translation type="unfinished">Alter</translation>
|
||||
<translation>Alter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Friend</source>
|
||||
<translation type="unfinished">Freund</translation>
|
||||
<translation>Freund</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>Share Type</source>
|
||||
<translation type="unfinished">Freigabe Typ</translation>
|
||||
<translation>Freigabe Typ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>What's new</source>
|
||||
<translation type="unfinished">Was ist neu</translation>
|
||||
<translation>Was ist neu</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
Loading…
Reference in New Issue
Block a user