mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 08:59:37 -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>
|
||||
|
||||
//***********
|
||||
#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)
|
||||
|
@ -26,7 +26,10 @@
|
||||
#include <QContextMenuEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QComboBox>
|
||||
#include <QSizePolicy>
|
||||
#include <QGroupBox>
|
||||
|
||||
#include <gui/common/GroupSelectionBox.h>
|
||||
@ -48,16 +51,26 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
|
||||
|
||||
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) ;
|
||||
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) ;
|
||||
|
||||
ui.shareflags_GB->setLayout(hbox) ;
|
||||
|
||||
connect(groupselectionbox,SIGNAL(itemSelectionChanged()),this,SLOT(updateInfoMessage())) ;
|
||||
connect(groupflagsbox,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateInfoMessage())) ;
|
||||
|
||||
if (!filename.empty())
|
||||
{
|
||||
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()
|
||||
{
|
||||
/* select a dir*/
|
||||
|
@ -28,26 +28,28 @@
|
||||
|
||||
class GroupFlagsWidget ;
|
||||
class GroupSelectionBox ;
|
||||
class QTextEdit ;
|
||||
|
||||
class ShareDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/** Default constructor */
|
||||
ShareDialog( std::string filename, QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
/** Default destructor */
|
||||
public:
|
||||
/** Default constructor */
|
||||
ShareDialog( std::string filename, QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||
|
||||
private slots:
|
||||
void browseDirectory();
|
||||
void addDirectory();
|
||||
private slots:
|
||||
void browseDirectory();
|
||||
void addDirectory();
|
||||
void updateInfoMessage() ;
|
||||
|
||||
private:
|
||||
/** Qt Designer generated object */
|
||||
Ui::ShareDialog ui;
|
||||
private:
|
||||
/** Qt Designer generated object */
|
||||
Ui::ShareDialog ui;
|
||||
|
||||
GroupSelectionBox *groupselectionbox ;
|
||||
GroupFlagsWidget *groupflagsbox ;
|
||||
GroupSelectionBox *groupselectionbox ;
|
||||
GroupFlagsWidget *groupflagsbox ;
|
||||
QTextEdit *messageBox ;
|
||||
};
|
||||
|
||||
#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_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() ; }
|
||||
|
@ -16,6 +16,7 @@ class GroupFlagsWidget: public QWidget
|
||||
FileStorageFlags flags() const ;
|
||||
void setFlags(FileStorageFlags flags) ;
|
||||
|
||||
static QString groupInfoString(FileStorageFlags flags,const std::list<std::string>& groups) ;
|
||||
public slots:
|
||||
void updated() ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user