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

@ -35,7 +35,8 @@
#include "AddLinksDialog.h"
#endif
#include "RetroShareLink.h"
#include "RemoteDirModel.h"
#include "RemoteDirModel.h"
#include "ShareDialog.h"
#include "common/PeerDefs.h"
#include <retroshare/rspeers.h>
@ -52,9 +53,10 @@
#define IMAGE_FRIEND ":/images/peers_16x16.png"
#define IMAGE_PROGRESS ":/images/browse-looking.gif"
#define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_OPENFOLDER ":/images/folderopen.png"
#define IMAGE_OPENFOLDER ":/images/folderopen.png"
#define IMAGE_OPENFILE ":/images/fileopen.png"
#define IMAGE_COLLECTION ":/images/mimetypes/rscollection-16.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.
//
@ -228,7 +230,9 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
openfileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
connect(openfileAct, SIGNAL(triggered()), this, SLOT(openfile()));
openfolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
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 *)
@ -429,7 +433,8 @@ void SharedFilesDialog::createCollectionFile()
std::cerr << "Creating a collection file!" << std::endl;
QModelIndexList lst = getLocalSelected();
localModel->createCollectionFile(this, lst);
}
}
void SharedFilesDialog::downloadRemoteSelected()
{
/* call back to the model (which does all the interfacing? */
@ -440,6 +445,24 @@ void SharedFilesDialog::downloadRemoteSelected()
QModelIndexList lst = getRemoteSelected();
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)
{
@ -736,9 +759,11 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
switch (type) {
case DIR_TYPE_DIR:
contextMnu.addAction(openfolderAct);
contextMnu.addAction(openfolderAct);
contextMnu.addSeparator();
contextMnu.addAction(editshareAct) ;
contextMnu.addSeparator();
contextMnu.addAction(createcollectionfileAct) ;
contextMnu.addAction(createcollectionfileAct) ;
break;
case DIR_TYPE_FILE:
contextMnu.addAction(openfileAct);

View File

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