mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
addednew flag for anonymous search. Merged the two browsable flags in one single flag.
This commit is contained in:
parent
5b9ef04358
commit
e8e054eeae
@ -338,7 +338,7 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
|
|||||||
/* for each item, check it exists ....
|
/* for each item, check it exists ....
|
||||||
* - remove any that are dead (or flag?)
|
* - remove any that are dead (or flag?)
|
||||||
*/
|
*/
|
||||||
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_PERMISSIONS_MASK;
|
||||||
|
|
||||||
#ifdef DEBUG_FILE_HIERARCHY
|
#ifdef DEBUG_FILE_HIERARCHY
|
||||||
P3FILELISTS_DEBUG() << "Load list" << std::endl;
|
P3FILELISTS_DEBUG() << "Load list" << std::endl;
|
||||||
@ -388,7 +388,6 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
|
|||||||
info.virtualname = fi->file.name;
|
info.virtualname = fi->file.name;
|
||||||
info.shareflags = FileStorageFlags(fi->flags) ;
|
info.shareflags = FileStorageFlags(fi->flags) ;
|
||||||
info.shareflags &= PERMISSION_MASK ;
|
info.shareflags &= PERMISSION_MASK ;
|
||||||
info.shareflags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ; // disabling this flag for know, for consistency reasons
|
|
||||||
|
|
||||||
for(std::set<RsNodeGroupId>::const_iterator itt(fi->parent_groups.ids.begin());itt!=fi->parent_groups.ids.end();++itt)
|
for(std::set<RsNodeGroupId>::const_iterator itt(fi->parent_groups.ids.begin());itt!=fi->parent_groups.ids.end();++itt)
|
||||||
info.parent_groups.push_back(*itt) ;
|
info.parent_groups.push_back(*itt) ;
|
||||||
|
@ -1611,7 +1611,7 @@ bool ftController::FileDetails(const RsFileHash &hash, FileInfo &info)
|
|||||||
info.queue_position = it->second->mQueuePosition ;
|
info.queue_position = it->second->mQueuePosition ;
|
||||||
|
|
||||||
if(it->second->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
if(it->second->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||||
info.storage_permission_flags |= DIR_FLAGS_NETWORK_WIDE_OTHERS ; // file being downloaded anonymously are always anonymously available.
|
info.storage_permission_flags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD ; // file being downloaded anonymously are always anonymously available.
|
||||||
|
|
||||||
/* get list of sources from transferModule */
|
/* get list of sources from transferModule */
|
||||||
std::list<RsPeerId> peerIds;
|
std::list<RsPeerId> peerIds;
|
||||||
|
@ -350,9 +350,10 @@ bool ftExtraList::search(const RsFileHash &hash, FileSearchFlags /*hintflags*
|
|||||||
|
|
||||||
// Now setup the file storage flags so that the client can know how to handle permissions
|
// Now setup the file storage flags so that the client can know how to handle permissions
|
||||||
//
|
//
|
||||||
info.storage_permission_flags = DIR_FLAGS_BROWSABLE_OTHERS ;
|
#warning make sure this is right
|
||||||
|
info.storage_permission_flags = FileStorageFlags(0) ;//DIR_FLAGS_BROWSABLE_OTHERS ;
|
||||||
|
|
||||||
if(info.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) info.storage_permission_flags |= DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
if(info.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) info.storage_permission_flags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +644,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags
|
|||||||
{
|
{
|
||||||
return mFileDatabase->RequestDirDetails(ref,details,flags) ;
|
return mFileDatabase->RequestDirDetails(ref,details,flags) ;
|
||||||
}
|
}
|
||||||
uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
|
uint32_t ftServer::getType(void *ref, FileSearchFlags /* flags */)
|
||||||
{
|
{
|
||||||
return mFileDatabase->getType(ref) ;
|
return mFileDatabase->getType(ref) ;
|
||||||
}
|
}
|
||||||
@ -797,7 +797,7 @@ bool ftServer::shareDownloadDirectory(bool share)
|
|||||||
/* Share */
|
/* Share */
|
||||||
SharedDirInfo inf ;
|
SharedDirInfo inf ;
|
||||||
inf.filename = mFtController->getDownloadDirectory();
|
inf.filename = mFtController->getDownloadDirectory();
|
||||||
inf.shareflags = DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
inf.shareflags = DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||||
|
|
||||||
return addSharedDirectory(inf);
|
return addSharedDirectory(inf);
|
||||||
}
|
}
|
||||||
|
@ -155,12 +155,13 @@ const FileStorageFlags DIR_FLAGS_PARENT ( 0x0001 );
|
|||||||
const FileStorageFlags DIR_FLAGS_DETAILS ( 0x0002 ); // apparently unused
|
const FileStorageFlags DIR_FLAGS_DETAILS ( 0x0002 ); // apparently unused
|
||||||
const FileStorageFlags DIR_FLAGS_CHILDREN ( 0x0004 ); // apparently unused
|
const FileStorageFlags DIR_FLAGS_CHILDREN ( 0x0004 ); // apparently unused
|
||||||
|
|
||||||
const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_OTHERS ( 0x0080 ); // Flags for directory sharing permissions. The last
|
const FileStorageFlags DIR_FLAGS_ANONYMOUS_DOWNLOAD ( 0x0080 ); // Flags for directory sharing permissions. The last
|
||||||
const FileStorageFlags DIR_FLAGS_BROWSABLE_OTHERS ( 0x0100 ); // one should be the OR of the all four flags.
|
//const FileStorageFlags DIR_FLAGS_BROWSABLE_OTHERS ( 0x0100 ); // one should be the OR of the all four flags.
|
||||||
const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_GROUPS ( 0x0200 );
|
//const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_GROUPS ( 0x0200 );
|
||||||
const FileStorageFlags DIR_FLAGS_BROWSABLE_GROUPS ( 0x0400 );
|
const FileStorageFlags DIR_FLAGS_BROWSABLE ( 0x0400 );
|
||||||
const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK ( DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_OTHERS
|
const FileStorageFlags DIR_FLAGS_ANONYMOUS_SEARCH ( 0x0800 );
|
||||||
| DIR_FLAGS_NETWORK_WIDE_GROUPS | DIR_FLAGS_BROWSABLE_GROUPS );
|
const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK ( DIR_FLAGS_ANONYMOUS_DOWNLOAD | /*DIR_FLAGS_BROWSABLE_OTHERS
|
||||||
|
DIR_FLAGS_NETWORK_WIDE_GROUPS*/ DIR_FLAGS_BROWSABLE | DIR_FLAGS_ANONYMOUS_SEARCH);
|
||||||
|
|
||||||
const FileStorageFlags DIR_FLAGS_LOCAL ( 0x1000 );
|
const FileStorageFlags DIR_FLAGS_LOCAL ( 0x1000 );
|
||||||
const FileStorageFlags DIR_FLAGS_REMOTE ( 0x2000 );
|
const FileStorageFlags DIR_FLAGS_REMOTE ( 0x2000 );
|
||||||
|
@ -1359,7 +1359,7 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||||||
// very simple algorithm.
|
// very simple algorithm.
|
||||||
//
|
//
|
||||||
|
|
||||||
bool found = false ;
|
bool found = directory_parent_groups.empty() ; // by default, empty list means browsable by everyone.
|
||||||
RsPgpId pgp_id = getGPGId(peer_ssl_id) ;
|
RsPgpId pgp_id = getGPGId(peer_ssl_id) ;
|
||||||
|
|
||||||
for(std::list<RsNodeGroupId>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
for(std::list<RsNodeGroupId>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
|
||||||
@ -1378,8 +1378,8 @@ FileSearchFlags p3Peers::computePeerPermissionFlags(const RsPeerId& peer_ssl_id,
|
|||||||
// found = true ;
|
// found = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool network_wide = (share_flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) ;//|| ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ;
|
bool network_wide = (share_flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) ;//|| ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ;
|
||||||
bool browsable = (share_flags & DIR_FLAGS_BROWSABLE_OTHERS) || ( (share_flags & DIR_FLAGS_BROWSABLE_GROUPS) && found) ;
|
bool browsable = (share_flags & DIR_FLAGS_BROWSABLE) && found ;
|
||||||
|
|
||||||
FileSearchFlags final_flags ;
|
FileSearchFlags final_flags ;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ void QuickStartWizard::on_pushButtonSharesAdd_clicked()
|
|||||||
{
|
{
|
||||||
SharedDirInfo sdi ;
|
SharedDirInfo sdi ;
|
||||||
sdi.filename = dir ;
|
sdi.filename = dir ;
|
||||||
sdi.shareflags = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
sdi.shareflags = DIR_FLAGS_BROWSABLE | DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||||
|
|
||||||
rsFiles->addSharedDirectory(sdi);
|
rsFiles->addSharedDirectory(sdi);
|
||||||
|
|
||||||
@ -331,8 +331,8 @@ void QuickStartWizard::loadShare()
|
|||||||
QCheckBox *cb1 = new QCheckBox ;
|
QCheckBox *cb1 = new QCheckBox ;
|
||||||
QCheckBox *cb2 = new QCheckBox ;
|
QCheckBox *cb2 = new QCheckBox ;
|
||||||
|
|
||||||
cb1->setChecked( (*it).shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS ) ;
|
cb1->setChecked( (*it).shareflags & DIR_FLAGS_ANONYMOUS_DOWNLOAD ) ;
|
||||||
cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE_OTHERS ) ;
|
cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE ) ;
|
||||||
|
|
||||||
cb1->setToolTip(tr("If checked, the share is anonymously shared to anybody.")) ;
|
cb1->setToolTip(tr("If checked, the share is anonymously shared to anybody.")) ;
|
||||||
cb2->setToolTip(tr("If checked, the share is browsable by your friends.")) ;
|
cb2->setToolTip(tr("If checked, the share is browsable by your friends.")) ;
|
||||||
@ -364,8 +364,8 @@ void QuickStartWizard::updateFlags(bool b)
|
|||||||
{
|
{
|
||||||
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
|
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
|
||||||
FileStorageFlags current_flags(0u) ;
|
FileStorageFlags current_flags(0u) ;
|
||||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? DIR_FLAGS_NETWORK_WIDE_OTHERS:(FileStorageFlags)0u ;
|
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? DIR_FLAGS_ANONYMOUS_DOWNLOAD:(FileStorageFlags)0u ;
|
||||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? DIR_FLAGS_BROWSABLE_OTHERS :(FileStorageFlags)0u ;
|
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? DIR_FLAGS_BROWSABLE :(FileStorageFlags)0u ;
|
||||||
|
|
||||||
if( ((*it).shareflags ^ current_flags).toUInt32() )
|
if( ((*it).shareflags ^ current_flags).toUInt32() )
|
||||||
{
|
{
|
||||||
|
@ -216,10 +216,9 @@ QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
|
|||||||
{
|
{
|
||||||
char str[11] = "- - -" ;
|
char str[11] = "- - -" ;
|
||||||
|
|
||||||
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
|
if(flags & DIR_FLAGS_BROWSABLE) str[0] = 'B' ;
|
||||||
//if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[3] = 'N' ;
|
if(flags & DIR_FLAGS_ANONYMOUS_SEARCH) str[3] = 'S' ;
|
||||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[3] = 'B' ;
|
if(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) str[6] = 'N' ;
|
||||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[6] = 'N' ;
|
|
||||||
|
|
||||||
return QString(str) ;
|
return QString(str) ;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent)
|
|||||||
hb2->addWidget(new QLabel(tr("Share flags and groups:")+" ")) ;
|
hb2->addWidget(new QLabel(tr("Share flags and groups:")+" ")) ;
|
||||||
|
|
||||||
groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ;
|
groupflagsbox = new GroupFlagsWidget(ui.shareflags_GB) ;
|
||||||
groupflagsbox->setFlags(DIR_FLAGS_NETWORK_WIDE_OTHERS) ; // default value
|
groupflagsbox->setFlags(DIR_FLAGS_ANONYMOUS_DOWNLOAD) ; // default value
|
||||||
|
|
||||||
messageBox = new QTextEdit(ui.shareflags_GB) ;
|
messageBox = new QTextEdit(ui.shareflags_GB) ;
|
||||||
messageBox->setReadOnly(true) ;
|
messageBox->setReadOnly(true) ;
|
||||||
|
@ -3,31 +3,26 @@
|
|||||||
#include "GroupFlagsWidget.h"
|
#include "GroupFlagsWidget.h"
|
||||||
#include <retroshare/rsfiles.h>
|
#include <retroshare/rsfiles.h>
|
||||||
|
|
||||||
#define FLAGS_GROUP_NETWORK_WIDE_ICON ":images/anonymous_128_green.png"
|
#define FLAGS_ANONYMOUS_SEARCH_ON ":icons/search_red_128.png"
|
||||||
#define FLAGS_GROUP_BROWSABLE_ICON ":images/browsable_128_green.png"
|
#define FLAGS_ANONYMOUS_SEARCH_OFF ":icons/blank_red_128.png"
|
||||||
#define FLAGS_GROUP_UNCHECKED ":images/blank_128_green.png"
|
#define FLAGS_BROWSABLE_ON ":icons/browsable_green_128.png"
|
||||||
#define FLAGS_OTHER_NETWORK_WIDE_ICON ":images/anonymous_128_blue.png"
|
#define FLAGS_BROWSABLE_OFF ":icons/blank_green_128.png"
|
||||||
#define FLAGS_OTHER_BROWSABLE_ICON ":images/browsable_128_blue.png"
|
#define FLAGS_ANONYMOUS_DL_ON ":icons/anonymous_blue_128.png"
|
||||||
#define FLAGS_OTHER_UNCHECKED ":images/blank_128_blue.png"
|
#define FLAGS_ANONYMOUS_DL_OFF ":icons/blank_blue_128.png"
|
||||||
|
|
||||||
#define INDEX_GROUP_BROWSABLE 0
|
#define INDEX_BROWSABLE 0
|
||||||
#define INDEX_GROUP_NETWORK_W 1
|
#define INDEX_ANON_SEARCH 1
|
||||||
#define INDEX_OTHER_BROWSABLE 2
|
#define INDEX_ANON_DL 2
|
||||||
#define INDEX_OTHER_NETWORK_W 3
|
|
||||||
#define INDEX_GROUP_UNCHECKED 4
|
|
||||||
#define INDEX_OTHER_UNCHECKED 5
|
|
||||||
|
|
||||||
/*QString GroupFlagsWidget::_tooltips_on[4] = {
|
/*QString GroupFlagsWidget::_tooltips_on[4] = {
|
||||||
QObject::tr("Directory is browsable for friends from groups"),
|
QObject::tr("Directory is visible to friends"),
|
||||||
QObject::tr("Directory is accessible by anonymous tunnels from friends from groups"),
|
QObject::tr("Directory can be search anonymously"),
|
||||||
QObject::tr("Directory is browsable for any friend"),
|
QObject::tr("Directory is accessible by anonymous tunnels")
|
||||||
QObject::tr("Directory is accessible by anonymous tunnels from any friend")
|
|
||||||
};
|
};
|
||||||
QString GroupFlagsWidget::_tooltips_off[4] = {
|
QString GroupFlagsWidget::_tooltips_off[4] = {
|
||||||
QObject::tr("Directory is NOT browsable for friends from groups"),
|
QObject::tr("Directory is not visible to friends"),
|
||||||
QObject::tr("Directory is NOT accessible by anonymous tunnels from friends from groups"),
|
QObject::tr("Directory cannot be searched anonymously"),
|
||||||
QObject::tr("Directory is NOT browsable for any friend"),
|
QObject::tr("Directory is NOT accessible by anonymous tunnels")
|
||||||
QObject::tr("Directory is NOT accessible by anonymous tunnels from any friend")
|
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
|
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
|
||||||
@ -39,35 +34,33 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
|
|||||||
setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
|
setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
|
||||||
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
|
||||||
|
|
||||||
_icons[INDEX_GROUP_BROWSABLE] = new QIcon(FLAGS_GROUP_BROWSABLE_ICON) ;
|
_icons[2*INDEX_BROWSABLE+0] = new QIcon(FLAGS_BROWSABLE_OFF) ;
|
||||||
_icons[INDEX_GROUP_NETWORK_W] = new QIcon(FLAGS_GROUP_NETWORK_WIDE_ICON) ;
|
_icons[2*INDEX_BROWSABLE+1] = new QIcon(FLAGS_BROWSABLE_ON) ;
|
||||||
_icons[INDEX_OTHER_BROWSABLE] = new QIcon(FLAGS_OTHER_BROWSABLE_ICON) ;
|
_icons[2*INDEX_ANON_SEARCH+0] = new QIcon(FLAGS_ANONYMOUS_SEARCH_OFF) ;
|
||||||
_icons[INDEX_OTHER_NETWORK_W] = new QIcon(FLAGS_OTHER_NETWORK_WIDE_ICON) ;
|
_icons[2*INDEX_ANON_SEARCH+1] = new QIcon(FLAGS_ANONYMOUS_SEARCH_ON) ;
|
||||||
_icons[INDEX_GROUP_UNCHECKED] = new QIcon(FLAGS_GROUP_UNCHECKED) ;
|
_icons[2*INDEX_ANON_DL+0] = new QIcon(FLAGS_ANONYMOUS_DL_OFF) ;
|
||||||
_icons[INDEX_OTHER_UNCHECKED] = new QIcon(FLAGS_OTHER_UNCHECKED) ;
|
_icons[2*INDEX_ANON_DL+1] = new QIcon(FLAGS_ANONYMOUS_DL_ON) ;
|
||||||
|
|
||||||
setLayout(_layout) ;
|
setLayout(_layout) ;
|
||||||
|
|
||||||
_flags[0] = DIR_FLAGS_BROWSABLE_GROUPS ;
|
_flags[INDEX_BROWSABLE ] = DIR_FLAGS_BROWSABLE ;
|
||||||
_flags[1] = DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
_flags[INDEX_ANON_SEARCH] = DIR_FLAGS_ANONYMOUS_SEARCH ;
|
||||||
_flags[2] = DIR_FLAGS_BROWSABLE_OTHERS ;
|
_flags[INDEX_ANON_DL ] = DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
|
||||||
_flags[3] = DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
|
||||||
|
|
||||||
for(int i=0;i<4;++i)
|
for(int i=0;i<3;++i)
|
||||||
{
|
{
|
||||||
_buttons[i] = new QPushButton(this) ;
|
_buttons[i] = new QPushButton(this) ;
|
||||||
_buttons[i]->setCheckable(true) ;
|
_buttons[i]->setCheckable(true) ;
|
||||||
_buttons[i]->setChecked(flags & _flags[i]) ;
|
_buttons[i]->setChecked(flags & _flags[i]) ;
|
||||||
_buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));
|
_buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));
|
||||||
|
|
||||||
update_button_state(_buttons[i]->isChecked(),i) ;
|
update_button_state(_buttons[i]->isChecked(),i) ;
|
||||||
_layout->addWidget(_buttons[i]) ;
|
_layout->addWidget(_buttons[i]) ;
|
||||||
}
|
}
|
||||||
_buttons[INDEX_GROUP_NETWORK_W]->setHidden(true);
|
|
||||||
|
|
||||||
connect(_buttons[INDEX_GROUP_NETWORK_W],SIGNAL(toggled(bool)),this,SLOT(update_GN_button(bool))) ;
|
connect(_buttons[INDEX_ANON_DL ],SIGNAL(toggled(bool)),this,SLOT(update_DL_button(bool))) ;
|
||||||
connect(_buttons[INDEX_OTHER_NETWORK_W],SIGNAL(toggled(bool)),this,SLOT(update_ON_button(bool))) ;
|
connect(_buttons[INDEX_ANON_SEARCH],SIGNAL(toggled(bool)),this,SLOT(update_SR_button(bool))) ;
|
||||||
connect(_buttons[INDEX_GROUP_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_GB_button(bool))) ;
|
connect(_buttons[INDEX_BROWSABLE ],SIGNAL(toggled(bool)),this,SLOT(update_BR_button(bool))) ;
|
||||||
connect(_buttons[INDEX_OTHER_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_OB_button(bool))) ;
|
|
||||||
|
|
||||||
_layout->setSpacing(0);
|
_layout->setSpacing(0);
|
||||||
_layout->setContentsMargins(0, 0, 0, 0);
|
_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
@ -84,16 +77,15 @@ FileStorageFlags GroupFlagsWidget::flags() const
|
|||||||
{
|
{
|
||||||
FileStorageFlags flags ;
|
FileStorageFlags flags ;
|
||||||
|
|
||||||
for(int i=0;i<4;++i)
|
for(int i=0;i<3;++i)
|
||||||
if(_buttons[i]->isChecked()) flags |= _flags[i] ;
|
if(_buttons[i]->isChecked()) flags |= _flags[i] ;
|
||||||
|
|
||||||
flags &= ~DIR_FLAGS_NETWORK_WIDE_GROUPS ;
|
|
||||||
return flags ;
|
return flags ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupFlagsWidget::setFlags(FileStorageFlags flags)
|
void GroupFlagsWidget::setFlags(FileStorageFlags flags)
|
||||||
{
|
{
|
||||||
for(int i=0;i<4;++i)
|
for(int i=0;i<3;++i)
|
||||||
{
|
{
|
||||||
_buttons[i]->setChecked(flags & _flags[i]) ;
|
_buttons[i]->setChecked(flags & _flags[i]) ;
|
||||||
update_button_state(_buttons[i]->isChecked(),i) ;
|
update_button_state(_buttons[i]->isChecked(),i) ;
|
||||||
@ -105,40 +97,23 @@ void GroupFlagsWidget::update_button_state(bool b,int button_id)
|
|||||||
QString tip_on, tip_off;
|
QString tip_on, tip_off;
|
||||||
switch (button_id) {
|
switch (button_id) {
|
||||||
case 0:
|
case 0:
|
||||||
tip_on = tr("Directory is browsable for friends from groups");
|
tip_on = tr("Directory is visible to friends");
|
||||||
tip_off = tr("Directory is NOT browsable for friends from groups");
|
tip_off = tr("Directory is NOT visible to friends");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
tip_on = tr("Directory is accessible by anonymous tunnels from friends from groups");
|
tip_on = tr("Directory can be searched anonymously");
|
||||||
tip_off = tr("Directory is NOT accessible by anonymous tunnels from friends from groups");
|
tip_off = tr("Directory cannot be searched anonymously");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
tip_on = tr("Directory is browsable for any friend");
|
tip_on = tr("Files can be downloaded anonymously");
|
||||||
tip_off = tr("Directory is NOT browsable for any friend");
|
tip_off = tr("Files cannot be downloaded anonymously");
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
tip_on = tr("Directory is accessible by anonymous tunnels from any friend");
|
|
||||||
tip_off = tr("Directory is NOT accessible by anonymous tunnels from any friend");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tip_on = "";
|
tip_on = "";
|
||||||
tip_off = "";
|
tip_off = "";
|
||||||
}
|
}
|
||||||
if(b)
|
_buttons[button_id]->setIcon(*_icons[2*button_id+(int)b]) ;
|
||||||
{
|
_buttons[button_id]->setToolTip(b?tip_on:tip_off) ;
|
||||||
_buttons[button_id]->setIcon(*_icons[button_id]) ;
|
|
||||||
_buttons[button_id]->setToolTip(tip_on) ;
|
|
||||||
}
|
|
||||||
else if(button_id == INDEX_GROUP_NETWORK_W || button_id == INDEX_GROUP_BROWSABLE)
|
|
||||||
{
|
|
||||||
_buttons[button_id]->setIcon(*_icons[INDEX_GROUP_UNCHECKED]) ;
|
|
||||||
_buttons[button_id]->setToolTip(tip_off) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_buttons[button_id]->setIcon(*_icons[INDEX_OTHER_UNCHECKED]) ;
|
|
||||||
_buttons[button_id]->setToolTip(tip_off) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags, const QList<QString>& groupNames)
|
QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags, const QList<QString>& groupNames)
|
||||||
@ -155,42 +130,39 @@ QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags, const QList<QS
|
|||||||
groups_string += *it ;
|
groups_string += *it ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS)
|
if(flags & DIR_FLAGS_BROWSABLE)
|
||||||
res += tr("All friend nodes can browse this directory") + "\n" ;
|
{
|
||||||
else if(flags & DIR_FLAGS_BROWSABLE_GROUPS)
|
if(groupNames.empty())
|
||||||
if(!groupNames.empty())
|
res += tr("All friend nodes can see this directory") + "\n" ;
|
||||||
res += tr("Only friend nodes in groups %1 can browse this directory").arg(groups_string) + "\n" ;
|
else
|
||||||
else
|
res += tr("Only visible to friend nodes in groups: %1").arg(groups_string) + "\n" ;
|
||||||
res += tr("No one can browse this directory") + "\n" ;
|
}
|
||||||
else
|
else
|
||||||
res += tr("No one can browse this directory") + "\n" ;
|
res += tr("Not visible to friend nodes") + "\n" ;
|
||||||
|
|
||||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS)
|
if((flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) && !(flags & DIR_FLAGS_ANONYMOUS_SEARCH))
|
||||||
res += tr("All friend nodes can relay anonymous tunnels to this directory") ;
|
res += tr("Files can be downloaded (but not searched) anonymously") ;
|
||||||
else if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS)
|
else if((flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) && (flags & DIR_FLAGS_ANONYMOUS_SEARCH))
|
||||||
res += tr("Only friend nodes in groups")+" " + groups_string +" "+ tr("can relay anonymous tunnels to this directory") ;
|
res += tr("Files can be downloaded and searched anonymously") ;
|
||||||
else
|
else if(!(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) && (flags & DIR_FLAGS_ANONYMOUS_SEARCH))
|
||||||
res += tr("No one can anonymously access this directory.") ;
|
res += tr("Files can be searched (but not downloaded) anonymously") ;
|
||||||
|
else
|
||||||
//if(flags.toUInt32() == 0)
|
res += tr("No one can anonymously access/search these files.") ;
|
||||||
// res += tr("No friends can access nor see this directory.") ;
|
|
||||||
|
|
||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupFlagsWidget::update_GN_button(bool b) { update_button_state(b,INDEX_GROUP_NETWORK_W) ; updated() ; }
|
void GroupFlagsWidget::update_DL_button(bool b) { update_button_state(b,INDEX_ANON_DL ) ; updated() ; }
|
||||||
void GroupFlagsWidget::update_GB_button(bool b) { update_button_state(b,INDEX_GROUP_BROWSABLE) ; updated() ; }
|
void GroupFlagsWidget::update_SR_button(bool b) { update_button_state(b,INDEX_ANON_SEARCH) ; updated() ; }
|
||||||
void GroupFlagsWidget::update_ON_button(bool b) { update_button_state(b,INDEX_OTHER_NETWORK_W) ; updated() ; }
|
void GroupFlagsWidget::update_BR_button(bool b) { update_button_state(b,INDEX_BROWSABLE ) ; updated() ; }
|
||||||
void GroupFlagsWidget::update_OB_button(bool b) { update_button_state(b,INDEX_OTHER_BROWSABLE) ; updated() ; }
|
|
||||||
|
|
||||||
GroupFlagsWidget::~GroupFlagsWidget()
|
GroupFlagsWidget::~GroupFlagsWidget()
|
||||||
{
|
{
|
||||||
for(int i=0;i<4;++i)
|
for(int i=0;i<3;++i)
|
||||||
{
|
{
|
||||||
delete _buttons[i] ;
|
delete _buttons[i] ;
|
||||||
delete _icons[i] ;
|
delete _icons[2*i+0] ;
|
||||||
}
|
delete _icons[2*i+1] ;
|
||||||
delete _icons[INDEX_GROUP_UNCHECKED] ;
|
}
|
||||||
delete _icons[INDEX_OTHER_UNCHECKED] ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,9 @@ class GroupFlagsWidget: public QWidget
|
|||||||
void updated() ;
|
void updated() ;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void update_GN_button(bool) ;
|
void update_DL_button(bool) ;
|
||||||
void update_GB_button(bool) ;
|
void update_SR_button(bool) ;
|
||||||
void update_ON_button(bool) ;
|
void update_BR_button(bool) ;
|
||||||
void update_OB_button(bool) ;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void flagsChanged(FileStorageFlags) const ;
|
void flagsChanged(FileStorageFlags) const ;
|
||||||
|
@ -25,15 +25,15 @@
|
|||||||
<file>icons/settings/sound.svg</file>
|
<file>icons/settings/sound.svg</file>
|
||||||
<file>icons/settings/webinterface.svg</file>
|
<file>icons/settings/webinterface.svg</file>
|
||||||
<file>icons/add_user_256.png</file>
|
<file>icons/add_user_256.png</file>
|
||||||
<file>icons/anonymous_blue_128.png</file>
|
|
||||||
<file>icons/anonymous_green_128.png</file>
|
|
||||||
<file>icons/aol.png</file>
|
<file>icons/aol.png</file>
|
||||||
<file>icons/avatar_128.png</file>
|
<file>icons/avatar_128.png</file>
|
||||||
<file>icons/avatar_grey_128.png</file>
|
<file>icons/avatar_grey_128.png</file>
|
||||||
<file>icons/blank_blue_128.png</file>
|
<file>icons/blank_red_128.png</file>
|
||||||
<file>icons/blank_green_128.png</file>
|
<file>icons/blank_green_128.png</file>
|
||||||
<file>icons/browsable_blue_128.png</file>
|
<file>icons/blank_blue_128.png</file>
|
||||||
<file>icons/browsable_green_128.png</file>
|
<file>icons/browsable_green_128.png</file>
|
||||||
|
<file>icons/search_red_128.png</file>
|
||||||
|
<file>icons/anonymous_blue_128.png</file>
|
||||||
<file>icons/bullet_blue_128.png</file>
|
<file>icons/bullet_blue_128.png</file>
|
||||||
<file>icons/bullet_green_128.png</file>
|
<file>icons/bullet_green_128.png</file>
|
||||||
<file>icons/bullet_grey_128.png</file>
|
<file>icons/bullet_grey_128.png</file>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
echo '<RCC>'
|
echo '<RCC>'
|
||||||
echo '\t<qresource prefix="/">'
|
echo '\t<qresource prefix="/">'
|
||||||
|
|
||||||
for i in `ls *.png`; do
|
for i in `ls *.png */*png */*svg`; do
|
||||||
echo '\t\t<file>icons/'$i'</file>'
|
echo '\t\t<file>icons/'$i'</file>'
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ int MenuListShared::getEntryDesc(int idx, std::string &desc)
|
|||||||
for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++);
|
for (it = dirs.begin(); (i < idx) && (it != dirs.end()); it++, i++);
|
||||||
if (it != dirs.end())
|
if (it != dirs.end())
|
||||||
{
|
{
|
||||||
bool networkwide = (it->shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS);
|
bool networkwide = (it->shareflags & DIR_FLAGS_ANONYMOUS_DOWNLOAD);
|
||||||
bool browsable = (it->shareflags & DIR_FLAGS_BROWSABLE_OTHERS);
|
bool browsable = (it->shareflags & DIR_FLAGS_BROWSABLE_OTHERS);
|
||||||
if (networkwide && browsable)
|
if (networkwide && browsable)
|
||||||
{
|
{
|
||||||
@ -759,7 +759,7 @@ uint32_t MenuListSharedTogglePublic::op_basic(std::string key)
|
|||||||
return MENU_OP_ERROR;
|
return MENU_OP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
mls->toggleFlagSelected(DIR_FLAGS_NETWORK_WIDE_OTHERS);
|
mls->toggleFlagSelected(DIR_FLAGS_ANONYMOUS_DOWNLOAD);
|
||||||
|
|
||||||
return MENU_OP_INSTANT;
|
return MENU_OP_INSTANT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user