mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-16 18:07:11 -05:00
added contextual message to explain current group sharing permissions
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5771 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d77c73adf4
commit
6b6f961e94
@ -46,7 +46,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
//***********
|
//***********
|
||||||
#define FIM_DEBUG 1
|
//#define FIM_DEBUG 1
|
||||||
// ***********/
|
// ***********/
|
||||||
|
|
||||||
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid,const std::string& config_dir)
|
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid,const std::string& config_dir)
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QTextEdit>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QSizePolicy>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
|
||||||
#include <gui/common/GroupSelectionBox.h>
|
#include <gui/common/GroupSelectionBox.h>
|
||||||
@ -48,16 +51,26 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
|
|||||||
|
|
||||||
ui.okButton->setEnabled(false);
|
ui.okButton->setEnabled(false);
|
||||||
|
|
||||||
QHBoxLayout *hbox = new QHBoxLayout(ui.shareflags_GB) ;
|
QVBoxLayout *vbox = new QVBoxLayout() ;
|
||||||
|
|
||||||
groupselectionbox = new GroupSelectionBox(ui.shareflags_GB);
|
|
||||||
groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ;
|
groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ;
|
||||||
|
messageBox = new QTextEdit(ui.shareflags_GB) ;
|
||||||
|
messageBox->setReadOnly(true) ;
|
||||||
|
messageBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Preferred)) ;
|
||||||
|
|
||||||
hbox->addWidget(groupflagsbox) ;
|
vbox->addWidget(groupflagsbox) ;
|
||||||
|
vbox->addWidget(messageBox) ;
|
||||||
|
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout() ;
|
||||||
|
groupselectionbox = new GroupSelectionBox(ui.shareflags_GB);
|
||||||
|
hbox->addLayout(vbox) ;
|
||||||
hbox->addWidget(groupselectionbox) ;
|
hbox->addWidget(groupselectionbox) ;
|
||||||
|
|
||||||
ui.shareflags_GB->setLayout(hbox) ;
|
ui.shareflags_GB->setLayout(hbox) ;
|
||||||
|
|
||||||
|
connect(groupselectionbox,SIGNAL(itemSelectionChanged()),this,SLOT(updateInfoMessage())) ;
|
||||||
|
connect(groupflagsbox,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateInfoMessage())) ;
|
||||||
|
|
||||||
if (!filename.empty())
|
if (!filename.empty())
|
||||||
{
|
{
|
||||||
std::list<SharedDirInfo> dirs;
|
std::list<SharedDirInfo> dirs;
|
||||||
@ -84,6 +97,11 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShareDialog::updateInfoMessage()
|
||||||
|
{
|
||||||
|
messageBox->setText(GroupFlagsWidget::groupInfoString(groupflagsbox->flags(),groupselectionbox->selectedGroups())) ;
|
||||||
|
}
|
||||||
|
|
||||||
void ShareDialog::browseDirectory()
|
void ShareDialog::browseDirectory()
|
||||||
{
|
{
|
||||||
/* select a dir*/
|
/* select a dir*/
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
class GroupFlagsWidget ;
|
class GroupFlagsWidget ;
|
||||||
class GroupSelectionBox ;
|
class GroupSelectionBox ;
|
||||||
|
class QTextEdit ;
|
||||||
|
|
||||||
class ShareDialog : public QDialog
|
class ShareDialog : public QDialog
|
||||||
{
|
{
|
||||||
@ -36,11 +37,11 @@ class ShareDialog : public QDialog
|
|||||||
public:
|
public:
|
||||||
/** Default constructor */
|
/** Default constructor */
|
||||||
ShareDialog( std::string filename, QWidget *parent = 0, Qt::WFlags flags = 0);
|
ShareDialog( std::string filename, QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
/** Default destructor */
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void browseDirectory();
|
void browseDirectory();
|
||||||
void addDirectory();
|
void addDirectory();
|
||||||
|
void updateInfoMessage() ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
@ -48,6 +49,7 @@ private:
|
|||||||
|
|
||||||
GroupSelectionBox *groupselectionbox ;
|
GroupSelectionBox *groupselectionbox ;
|
||||||
GroupFlagsWidget *groupflagsbox ;
|
GroupFlagsWidget *groupflagsbox ;
|
||||||
|
QTextEdit *messageBox ;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -117,6 +117,36 @@ void GroupFlagsWidget::update_button_state(bool b,int button_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags,const std::list<std::string>& groups)
|
||||||
|
{
|
||||||
|
// makes a string that explains how files are shared / visible.
|
||||||
|
|
||||||
|
QString res ;
|
||||||
|
QString groups_string ;
|
||||||
|
|
||||||
|
for(std::list<std::string>::const_iterator it(groups.begin());it!=groups.end();++it)
|
||||||
|
{
|
||||||
|
if(it != groups.begin())
|
||||||
|
groups_string += ", " ;
|
||||||
|
groups_string += QString::fromStdString(*it) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((flags & DIR_FLAGS_BROWSABLE_OTHERS) && !groups.empty())
|
||||||
|
res += tr("All your friends can browse this directory\n") ;
|
||||||
|
else if((flags & DIR_FLAGS_BROWSABLE_GROUPS) && !groups.empty())
|
||||||
|
res += tr("Friends in groups ") + groups_string + tr(" can browse this directory\n") ;
|
||||||
|
|
||||||
|
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS)
|
||||||
|
res += tr("All your friends can relay anonymous tunnels to this directory") ;
|
||||||
|
else if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS)
|
||||||
|
res += tr("Friends in groups ") + groups_string + tr(" can relay anonymous tunnels to this directory") ;
|
||||||
|
|
||||||
|
if(flags.toUInt32() == 0)
|
||||||
|
res += tr("No friends can access nor see this directory.") ;
|
||||||
|
|
||||||
|
return res ;
|
||||||
|
}
|
||||||
|
|
||||||
void GroupFlagsWidget::update_GN_button(bool b) { update_button_state(b,INDEX_GROUP_NETWORK_W) ; updated() ; }
|
void GroupFlagsWidget::update_GN_button(bool b) { update_button_state(b,INDEX_GROUP_NETWORK_W) ; updated() ; }
|
||||||
void GroupFlagsWidget::update_GB_button(bool b) { update_button_state(b,INDEX_GROUP_BROWSABLE) ; updated() ; }
|
void GroupFlagsWidget::update_GB_button(bool b) { update_button_state(b,INDEX_GROUP_BROWSABLE) ; updated() ; }
|
||||||
void GroupFlagsWidget::update_ON_button(bool b) { update_button_state(b,INDEX_OTHER_NETWORK_W) ; updated() ; }
|
void GroupFlagsWidget::update_ON_button(bool b) { update_button_state(b,INDEX_OTHER_NETWORK_W) ; updated() ; }
|
||||||
|
@ -16,6 +16,7 @@ class GroupFlagsWidget: public QWidget
|
|||||||
FileStorageFlags flags() const ;
|
FileStorageFlags flags() const ;
|
||||||
void setFlags(FileStorageFlags flags) ;
|
void setFlags(FileStorageFlags flags) ;
|
||||||
|
|
||||||
|
static QString groupInfoString(FileStorageFlags flags,const std::list<std::string>& groups) ;
|
||||||
public slots:
|
public slots:
|
||||||
void updated() ;
|
void updated() ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user