Added "Edit Share Permissions" Context Menu entry to My Directions, to edit easily share permissions for each directory

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5944 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2012-12-05 13:26:26 +00:00
parent bf70038ad2
commit 8cdefe9764
2 changed files with 36 additions and 9 deletions

View File

@ -36,6 +36,7 @@
#endif
#include "RetroShareLink.h"
#include "RemoteDirModel.h"
#include "ShareDialog.h"
#include "common/PeerDefs.h"
#include <retroshare/rspeers.h>
@ -55,6 +56,7 @@
#define IMAGE_OPENFOLDER ":/images/folderopen.png"
#define IMAGE_OPENFILE ":/images/fileopen.png"
#define IMAGE_COLLECTION ":/images/mimetypes/rscollection-16.png"
#define IMAGE_EDITSHARE ":/images/edit_16.png"
// Define to avoid using the search in treeview, because it is really slow for now.
//
@ -229,6 +231,8 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openfile()));
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
editshareAct = new QAction(QIcon(IMAGE_EDITSHARE), tr("Edit Share Permissions"), this);
connect(editshareAct, SIGNAL(triggered()), this, SLOT(editSharePermissions()));
}
void SharedFilesDialog::hideEvent(QHideEvent *)
@ -430,6 +434,7 @@ void SharedFilesDialog::createCollectionFile()
QModelIndexList lst = getLocalSelected();
localModel->createCollectionFile(this, lst);
}
void SharedFilesDialog::downloadRemoteSelected()
{
/* call back to the model (which does all the interfacing? */
@ -441,6 +446,24 @@ void SharedFilesDialog::downloadRemoteSelected()
model -> downloadSelected(lst);
}
void SharedFilesDialog::editSharePermissions()
{
std::list<SharedDirInfo> dirs;
rsFiles->getSharedDirectories(dirs);
std::list<SharedDirInfo>::const_iterator it;
for (it = dirs.begin(); it != dirs.end(); it++) {
if (currentFile == currentFile) {
/* file name found, show dialog */
ShareDialog sharedlg (it->filename, this);
sharedlg.setWindowTitle(tr("Edit Shared Folder"));
sharedlg.exec();
break;
}
}
}
void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
{
std::vector<DirDetails> dirVec;
@ -737,6 +760,8 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
switch (type) {
case DIR_TYPE_DIR:
contextMnu.addAction(openfolderAct);
contextMnu.addSeparator();
contextMnu.addAction(editshareAct) ;
contextMnu.addSeparator();
contextMnu.addAction(createcollectionfileAct) ;
break;

View File

@ -78,6 +78,7 @@ private slots:
void playselectedfiles();
void openfile();
void openfolder();
void editSharePermissions();
void recommendFilesToMsg();
void runCommandForFile();
@ -120,6 +121,7 @@ private:
QAction* copyremotelinkAct;
QAction* copylinklocalAct;
QAction* sendlinkAct;
QAction* editshareAct;
#ifdef RS_USE_LINKS
QAction* sendlinkCloudAct;
QAction* addlinkCloudAct;