mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-06 05:14:21 -04:00
fixed flags conflicts
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5758 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dc82cee700
commit
e753f22909
43 changed files with 383 additions and 386 deletions
|
@ -261,8 +261,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
|
|||
y += text_height ; painter->drawText(20,y,tr("Chunk strategy") + ":") ; painter->drawText(tab_size,y,(info.strategy==FileChunksInfo::CHUNK_STRATEGY_RANDOM)?"Random":"Streaming") ;
|
||||
y += block_sep ;
|
||||
y += text_height ; painter->drawText(20,y,tr("Transfer type") + ":") ;
|
||||
if(info.flags & RS_FILE_HINTS_NETWORK_WIDE) painter->drawText(tab_size,y,tr("Anonymous F2F")) ;
|
||||
if(info.flags & RS_FILE_HINTS_ASSUME_AVAILABILITY) painter->drawText(tab_size,y,tr("Direct friend transfer / Availability assumed")) ;
|
||||
if(nfo.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) painter->drawText(tab_size,y,tr("Anonymous F2F")) ;
|
||||
if(nfo.transfer_info_flags & RS_FILE_REQ_ASSUME_AVAILABILITY) painter->drawText(tab_size,y,tr("Direct friend transfer / Availability assumed")) ;
|
||||
y += text_height ;
|
||||
y += block_sep ;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
#include "settings/rsharesettings.h"
|
||||
|
||||
|
||||
|
@ -211,7 +212,7 @@ void QuickStartWizard::on_pushButtonSharesAdd_clicked()
|
|||
{
|
||||
SharedDirInfo sdi ;
|
||||
sdi.filename = dir ;
|
||||
sdi.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ;
|
||||
sdi.shareflags = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS ;
|
||||
|
||||
rsFiles->addSharedDirectory(sdi);
|
||||
|
||||
|
@ -307,8 +308,8 @@ void QuickStartWizard::loadShare()
|
|||
QCheckBox *cb1 = new QCheckBox ;
|
||||
QCheckBox *cb2 = new QCheckBox ;
|
||||
|
||||
cb1->setChecked( (*it).shareflags & RS_FILE_HINTS_NETWORK_WIDE ) ;
|
||||
cb2->setChecked( (*it).shareflags & RS_FILE_HINTS_BROWSABLE ) ;
|
||||
cb1->setChecked( (*it).shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS ) ;
|
||||
cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE_OTHERS ) ;
|
||||
|
||||
cb1->setToolTip(QString("If checked, the share is anonymously shared to anybody.")) ;
|
||||
cb2->setToolTip(QString("If checked, the share is browsable by your friends.")) ;
|
||||
|
@ -339,11 +340,11 @@ void QuickStartWizard::updateFlags(bool b)
|
|||
for(it = dirs.begin(); it != dirs.end(); it++,++row)
|
||||
{
|
||||
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
|
||||
TransferInfoFlags current_flags = 0u ;
|
||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? RS_FILE_HINTS_NETWORK_WIDE:(TransferInfoFlags)0u ;
|
||||
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? RS_FILE_HINTS_BROWSABLE:(TransferInfoFlags)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,2)))->isChecked()? DIR_FLAGS_BROWSABLE_OTHERS :(FileStorageFlags)0u ;
|
||||
|
||||
if( (*it).shareflags ^ current_flags )
|
||||
if( ((*it).shareflags ^ current_flags).toUInt32() )
|
||||
{
|
||||
(*it).shareflags = current_flags ;
|
||||
rsFiles->updateShareFlags(*it) ; // modifies the flags
|
||||
|
|
|
@ -91,11 +91,7 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
|
|||
void *ref = parent.internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -152,11 +148,7 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
|
|||
void *ref = (parent.isValid())? parent.internalPointer() : NULL ;
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -202,14 +194,14 @@ int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const
|
|||
{
|
||||
return 5;
|
||||
}
|
||||
QString RetroshareDirModel::getFlagsString(uint32_t flags)
|
||||
QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
|
||||
{
|
||||
char str[8] = "- - - -" ;
|
||||
char str[11] = "- - - -" ;
|
||||
|
||||
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[2] = 'N' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[4] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[6] = 'N' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[3] = 'N' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[6] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[9] = 'N' ;
|
||||
|
||||
return QString(str) ;
|
||||
}
|
||||
|
@ -377,7 +369,7 @@ QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
|
|||
{
|
||||
QString dir ;
|
||||
DirDetails det(details) ;
|
||||
uint32_t flags = (RemoteMode)?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if(!requestDirDetails(det.parent,det,flags))
|
||||
return QString();
|
||||
|
@ -518,11 +510,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
|||
int coln = index.column();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
return QVariant();
|
||||
|
@ -582,12 +570,8 @@ void RetroshareDirModel::getAgeIndicatorRec(DirDetails &details, QString &ret) c
|
|||
for (it = details.children.begin(); it != details.children.end(); it++) {
|
||||
void *ref = it->ref;
|
||||
DirDetails childDetails;
|
||||
uint32_t flags;
|
||||
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (requestDirDetails(ref, childDetails, flags) && ret == tr(""))
|
||||
getAgeIndicatorRec(childDetails, ret);
|
||||
|
@ -704,11 +688,7 @@ QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent
|
|||
********/
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -787,7 +767,7 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
|
|||
void *ref = index.internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = (RemoteMode)?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -838,11 +818,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
|
|||
void *ref = index.internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
return Qt::ItemIsSelectable; // Error.
|
||||
|
@ -892,7 +868,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
|
|||
#endif
|
||||
}
|
||||
|
||||
bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,uint32_t flags) const
|
||||
bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,FileSearchFlags flags) const
|
||||
{
|
||||
// We should use a cache instead of calling RsFiles::RequestDirDetails(), which is very costly
|
||||
// due to some pointer checking crap.
|
||||
|
@ -950,7 +926,7 @@ void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
|
|||
std::list<std::string> srcIds;
|
||||
srcIds.push_back(details.id);
|
||||
rsFiles -> FileRequest(details.name, details.hash,
|
||||
details.count, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds);
|
||||
details.count, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
/* if it is a dir, copy all files included*/
|
||||
else if (details.type == DIR_TYPE_DIR)
|
||||
|
@ -971,7 +947,7 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
|
|||
QString cleanPath = QDir::cleanPath(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()) + "/" + QString::fromUtf8(dirDetails.path.substr(prefixLen).c_str()));
|
||||
|
||||
srcIds.push_back(dirDetails.id);
|
||||
rsFiles->FileRequest(dirDetails.name, dirDetails.hash, dirDetails.count, cleanPath.toUtf8().constData(), RS_FILE_HINTS_NETWORK_WIDE, srcIds);
|
||||
rsFiles->FileRequest(dirDetails.name, dirDetails.hash, dirDetails.count, cleanPath.toUtf8().constData(), RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
else if (dirDetails.type & DIR_TYPE_DIR)
|
||||
{
|
||||
|
@ -986,7 +962,7 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
|
|||
if (!it->ref) continue;
|
||||
|
||||
DirDetails subDirDetails;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN | DIR_FLAGS_REMOTE;
|
||||
FileSearchFlags flags = RS_FILE_HINTS_REMOTE ;
|
||||
|
||||
if (!requestDirDetails(it->ref, subDirDetails, flags)) continue;
|
||||
|
||||
|
@ -1008,20 +984,10 @@ void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, s
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
{
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
dirVec.push_back(details);
|
||||
}
|
||||
|
@ -1056,12 +1022,7 @@ void RetroshareDirModel::getFileInfoFromIndexList(const QModelIndexList& list, s
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
continue;
|
||||
|
@ -1157,10 +1118,8 @@ void RetroshareDirModel::getFilePaths(const QModelIndexList &list, std::list<std
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
if (!requestDirDetails(ref, details, RS_FILE_HINTS_LOCAL))
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "getFilePaths() Bad Request" << std::endl;
|
||||
|
@ -1214,15 +1173,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
{
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -1299,7 +1250,7 @@ int RetroshareDirModel::getType ( const QModelIndex & index ) const
|
|||
//if (RemoteMode) // only local files can be opened
|
||||
// return ;
|
||||
|
||||
uint32_t flags = RemoteMode?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
return rsFiles->getType(index.internalPointer(),flags);
|
||||
}
|
||||
|
@ -1348,10 +1299,9 @@ void FlatStyle_RDM::updateRefs()
|
|||
std::cerr << "FlatStyle_RDM::postMods(): poped ref " << ref << std::endl;
|
||||
#endif
|
||||
_ref_stack.pop_back() ;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
DirDetails details ;
|
||||
|
||||
if (requestDirDetails(ref, details, flags))
|
||||
if (requestDirDetails(ref, details, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_REMOTE))
|
||||
{
|
||||
if(details.type == DIR_TYPE_FILE) // only push files, not directories nor persons.
|
||||
_ref_entries.push_back(std::pair<void*,QString>(ref,computeDirectoryPath(details)));
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <QIcon>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class DirDetails;
|
||||
|
||||
|
@ -65,7 +66,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
void getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths);
|
||||
void changeAgeIndicator(uint32_t indicator) { ageIndicator = indicator; }
|
||||
|
||||
bool requestDirDetails(void *ref,DirDetails& details,uint32_t flags) const;
|
||||
bool requestDirDetails(void *ref,DirDetails& details,FileSearchFlags flags) const;
|
||||
void update() ;
|
||||
public:
|
||||
|
||||
|
@ -79,7 +80,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
|
||||
void treeStyle();
|
||||
void downloadDirectory(const DirDetails & details, int prefixLen);
|
||||
static QString getFlagsString(uint32_t) ;
|
||||
static QString getFlagsString(FileStorageFlags f) ;
|
||||
static QString getGroupsString(const std::list<std::string>&) ;
|
||||
QString getAgeIndicatorString(const DirDetails &) const;
|
||||
void getAgeIndicatorRec(DirDetails &details, QString &ret) const;
|
||||
|
|
|
@ -973,7 +973,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
srcIds.push_back((*it).peerId) ;
|
||||
}
|
||||
|
||||
if (rsFiles->FileRequest(link.name().toUtf8().constData(), link.hash().toStdString(), link.size(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) {
|
||||
if (rsFiles->FileRequest(link.name().toUtf8().constData(), link.hash().toStdString(), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) {
|
||||
fileAdded.append(link.name());
|
||||
} else {
|
||||
fileExist.append(link.name());
|
||||
|
|
|
@ -360,7 +360,7 @@ void SearchDialog::download()
|
|||
std::string hash = item->text(SR_HASH_COL).toStdString();
|
||||
getSourceFriendsForHash(hash,srcIds) ;
|
||||
|
||||
if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toUtf8().constData(), hash, (item->text(SR_SIZE_COL)).toULongLong(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
|
||||
if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toUtf8().constData(), hash, (item->text(SR_SIZE_COL)).toULongLong(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds))
|
||||
attemptDownloadLocal = true ;
|
||||
else
|
||||
{
|
||||
|
@ -391,7 +391,7 @@ void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString
|
|||
rsFiles->FileRequest(item->text(SR_NAME_COL).toUtf8().constData(),
|
||||
hash,
|
||||
item->text(SR_SIZE_COL).toULongLong(),
|
||||
cleanPath.toUtf8().constData(),RS_FILE_HINTS_NETWORK_WIDE, srcIds);
|
||||
cleanPath.toUtf8().constData(),RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
|
||||
std::cout << "SearchDialog::downloadDirectory(): "\
|
||||
"issuing file request from search dialog: -"
|
||||
|
@ -614,7 +614,7 @@ void SearchDialog::advancedSearch(Expression* expression)
|
|||
// The text "bool exp" should be replaced by an appropriate text describing the actual search.
|
||||
initSearchResult("bool exp",req_id, ui.FileTypeComboBox->currentIndex(), true) ;
|
||||
|
||||
rsFiles -> SearchBoolExp(expression, results, DIR_FLAGS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
|
||||
rsFiles -> SearchBoolExp(expression, results, RS_FILE_HINTS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
|
||||
|
||||
/* abstraction to allow reusee of tree rendering code */
|
||||
resultsToTree(advSearchDialog->getSearchAsString(),req_id, results);
|
||||
|
@ -696,7 +696,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
|
|||
{
|
||||
std::list<DirDetails> initialResults;
|
||||
|
||||
rsFiles->SearchBoolExp(&exprs, initialResults, DIR_FLAGS_REMOTE) ;
|
||||
rsFiles->SearchBoolExp(&exprs, initialResults, RS_FILE_HINTS_REMOTE) ;
|
||||
|
||||
/* which extensions do we use? */
|
||||
DirDetails dd;
|
||||
|
@ -712,7 +712,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
|
|||
{
|
||||
std::list<DirDetails> initialResults;
|
||||
|
||||
rsFiles->SearchBoolExp(&exprs, initialResults, DIR_FLAGS_LOCAL);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ;
|
||||
rsFiles->SearchBoolExp(&exprs, initialResults, RS_FILE_HINTS_LOCAL);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ;
|
||||
|
||||
/* which extensions do we use? */
|
||||
DirDetails dd;
|
||||
|
@ -866,7 +866,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
|
|||
/* go through all children directories/files for a recursive call */
|
||||
for (std::list<DirStub>::const_iterator it(dir.children.begin()); it != dir.children.end(); it ++) {
|
||||
DirDetails details;
|
||||
rsFiles->RequestDirDetails(it->ref, details, 0);
|
||||
rsFiles->RequestDirDetails(it->ref, details, FileSearchFlags(0u));
|
||||
insertDirectory(txt, searchId, details, child);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "ShareDialog.h"
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
#include <QFileDialog>
|
||||
|
@ -61,8 +62,8 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
|
|||
ui.browseButton->setDisabled(true);
|
||||
ui.virtualpath_lineEdit->setText(QString::fromUtf8(it->virtualname.c_str()));
|
||||
|
||||
ui.browsableCheckBox->setChecked(it->shareflags & RS_FILE_HINTS_BROWSABLE);
|
||||
ui.networkwideCheckBox->setChecked(it->shareflags & RS_FILE_HINTS_NETWORK_WIDE);
|
||||
ui.browsableCheckBox->setChecked(it->shareflags & DIR_FLAGS_BROWSABLE_OTHERS);
|
||||
ui.networkwideCheckBox->setChecked(it->shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -89,13 +90,13 @@ void ShareDialog::addDirectory()
|
|||
sdi.filename = ui.localpath_lineEdit->text().toUtf8().constData();
|
||||
sdi.virtualname = ui.virtualpath_lineEdit->text().toUtf8().constData();
|
||||
|
||||
sdi.shareflags = 0;
|
||||
sdi.shareflags.clear() ;
|
||||
|
||||
if (ui.browsableCheckBox->isChecked()) {
|
||||
sdi.shareflags |= RS_FILE_HINTS_BROWSABLE ;
|
||||
sdi.shareflags |= DIR_FLAGS_BROWSABLE_OTHERS ;
|
||||
}
|
||||
if (ui.networkwideCheckBox->isChecked()) {
|
||||
sdi.shareflags |= RS_FILE_HINTS_NETWORK_WIDE;
|
||||
sdi.shareflags |= DIR_FLAGS_NETWORK_WIDE_OTHERS;
|
||||
}
|
||||
|
||||
if (ui.localpath_lineEdit->isEnabled()) {
|
||||
|
@ -119,7 +120,7 @@ void ShareDialog::addDirectory()
|
|||
rsFiles->addSharedDirectory(sdi);
|
||||
break;
|
||||
}
|
||||
if (it->shareflags ^ sdi.shareflags) {
|
||||
if (it->shareflags != sdi.shareflags) {
|
||||
/* modifies the flags */
|
||||
it->shareflags = sdi.shareflags;
|
||||
rsFiles->updateShareFlags(*it);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QUrl>
|
||||
|
||||
#include <retroshare/rsfiles.h>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
#include "ShareManager.h"
|
||||
#include "ShareDialog.h"
|
||||
|
@ -121,21 +122,21 @@ void ShareManager::load()
|
|||
/* set new row count */
|
||||
listWidget->setRowCount(dirs.size());
|
||||
|
||||
connect(this,SIGNAL(itemClicked(QTableWidgetItem*)),this,SLOT(updateFlags(QTableWidgetItem*))) ;
|
||||
|
||||
int row=0 ;
|
||||
for(it = dirs.begin(); it != dirs.end(); it++,++row)
|
||||
{
|
||||
listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str())));
|
||||
listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8((*it).virtualname.c_str())));
|
||||
|
||||
QWidget* widget = new GroupFlagsWidget(NULL,(*it).shareflags);
|
||||
GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags);
|
||||
|
||||
listWidget->setRowHeight(row, 32);
|
||||
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
|
||||
|
||||
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem(QString(" - "))) ; // no groups!
|
||||
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;
|
||||
|
||||
connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
|
||||
}
|
||||
|
||||
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ;
|
||||
|
@ -168,12 +169,12 @@ void ShareManager::showYourself()
|
|||
}
|
||||
}
|
||||
|
||||
void ShareManager::updateFlags(bool b)
|
||||
void ShareManager::updateFlags()
|
||||
{
|
||||
if(isLoading)
|
||||
return ;
|
||||
|
||||
std::cerr << "Updating flags (b=" << b << ") !!!" << std::endl ;
|
||||
std::cerr << "Updating flags" << std::endl;
|
||||
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
|
@ -182,10 +183,10 @@ void ShareManager::updateFlags(bool b)
|
|||
int row=0 ;
|
||||
for(it = dirs.begin(); it != dirs.end(); it++,++row)
|
||||
{
|
||||
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
|
||||
uint32_t current_flags = (dynamic_cast<GroupFlagsWidget*>(ui.shareddirList->cellWidget(row,COLUMN_SHARE_FLAGS)->children().front()))->flags() ;
|
||||
//std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
|
||||
FileStorageFlags current_flags = (dynamic_cast<GroupFlagsWidget*>(ui.shareddirList->cellWidget(row,COLUMN_SHARE_FLAGS)))->flags() ;
|
||||
|
||||
if( (*it).shareflags ^ current_flags )
|
||||
if( (*it).shareflags != current_flags )
|
||||
{
|
||||
(*it).shareflags = current_flags ;
|
||||
rsFiles->updateShareFlags(*it) ; // modifies the flags
|
||||
|
@ -298,7 +299,7 @@ void ShareManager::dropEvent(QDropEvent *event)
|
|||
sdi.filename = localpath.toUtf8().constData();
|
||||
sdi.virtualname.clear();
|
||||
|
||||
sdi.shareflags = 0;
|
||||
sdi.shareflags.clear() ;
|
||||
|
||||
/* add new share */
|
||||
rsFiles->addSharedDirectory(sdi);
|
||||
|
|
|
@ -59,7 +59,7 @@ private slots:
|
|||
void showShareDialog();
|
||||
void editShareDirectory();
|
||||
void removeShareDirectory();
|
||||
void updateFlags(bool);
|
||||
void updateFlags();
|
||||
|
||||
private:
|
||||
static ShareManager *_instance;
|
||||
|
|
|
@ -463,11 +463,7 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
|
|||
const DirStub& dirStub = *cit;
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (remote)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = remote?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
|
||||
|
||||
// do not recursive copy sub dirs.
|
||||
if (!rsFiles->RequestDirDetails(dirStub.ref, details, flags) || details.type != DIR_TYPE_FILE)
|
||||
|
|
|
@ -945,7 +945,7 @@ void TransfersDialog::insertTransfers()
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((fileInfo.transfer_info_flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) {
|
||||
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) {
|
||||
// if file transfer is a cache file index file, don't show it
|
||||
DLListModel->removeRow(row);
|
||||
rowCount = DLListModel->rowCount();
|
||||
|
@ -971,7 +971,7 @@ void TransfersDialog::insertTransfers()
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((fileInfo.transfer_info_flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) {
|
||||
if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) {
|
||||
//if file transfer is a cache file index file, don't show it
|
||||
continue;
|
||||
}
|
||||
|
@ -998,7 +998,7 @@ void TransfersDialog::insertTransfers()
|
|||
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
|
||||
continue;
|
||||
|
||||
if((info.transfer_info_flags & RS_FILE_HINTS_CACHE) && showCacheTransfers)
|
||||
if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && showCacheTransfers)
|
||||
continue ;
|
||||
|
||||
std::list<TransferInfo>::iterator pit;
|
||||
|
|
|
@ -30,7 +30,7 @@ QString GroupFlagsWidget::_tooltips_off[4] = {
|
|||
QObject::tr("")
|
||||
};
|
||||
|
||||
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,uint32_t flags)
|
||||
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
|
||||
: QWidget(parent)
|
||||
{
|
||||
_layout = new QHBoxLayout(this) ;
|
||||
|
@ -79,9 +79,9 @@ void GroupFlagsWidget::updated()
|
|||
emit flagsChanged(flags()) ;
|
||||
}
|
||||
|
||||
uint32_t GroupFlagsWidget::flags() const
|
||||
FileStorageFlags GroupFlagsWidget::flags() const
|
||||
{
|
||||
uint32_t flags = 0x0 ;
|
||||
FileStorageFlags flags ;
|
||||
|
||||
for(int i=0;i<4;++i)
|
||||
if(_buttons[i]->isChecked()) flags |= _flags[i] ;
|
||||
|
|
|
@ -3,16 +3,17 @@
|
|||
#include <stdint.h>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
#include <retroshare/rsflags.h>
|
||||
|
||||
class GroupFlagsWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GroupFlagsWidget(QWidget *parent,uint32_t flags) ;
|
||||
GroupFlagsWidget(QWidget *parent,FileStorageFlags flags) ;
|
||||
virtual ~GroupFlagsWidget() ;
|
||||
|
||||
uint32_t flags() const ;
|
||||
FileStorageFlags flags() const ;
|
||||
|
||||
public slots:
|
||||
void updated() ;
|
||||
|
@ -24,7 +25,7 @@ class GroupFlagsWidget: public QWidget
|
|||
void update_OB_button(bool) ;
|
||||
|
||||
signals:
|
||||
void flagsChanged(uint32_t) const ;
|
||||
void flagsChanged(FileStorageFlags) const ;
|
||||
|
||||
private:
|
||||
void update_button_state(bool b,int id) ;
|
||||
|
@ -33,7 +34,7 @@ class GroupFlagsWidget: public QWidget
|
|||
|
||||
QLayout *_layout ;
|
||||
QIcon *_icons[6] ;
|
||||
uint32_t _flags[4] ;
|
||||
FileStorageFlags _flags[4] ;
|
||||
|
||||
static QString _tooltips_on[4] ;
|
||||
static QString _tooltips_off[4] ;
|
||||
|
|
|
@ -217,7 +217,7 @@ void RsCollectionDialog::download()
|
|||
if(!QDir(QApplication::applicationDirPath()).mkpath(cleanPath))
|
||||
QMessageBox::warning(NULL,QObject::tr("Unable to make path"),QObject::tr("Unable to make path:")+"<br> "+cleanPath) ;
|
||||
|
||||
rsFiles->FileRequest(dlinfo.name.toUtf8().constData(), dlinfo.hash.toUtf8().constData(), dlinfo.size, cleanPath.toUtf8().constData(), RS_FILE_HINTS_NETWORK_WIDE, std::list<std::string>());
|
||||
rsFiles->FileRequest(dlinfo.name.toUtf8().constData(), dlinfo.hash.toUtf8().constData(), dlinfo.size, cleanPath.toUtf8().constData(), RS_FILE_REQ_ANONYMOUS_ROUTING, std::list<std::string>());
|
||||
}
|
||||
else
|
||||
std::cerr<<"Skipping file : " << dlinfo.name.toStdString() << std::endl;
|
||||
|
|
|
@ -110,7 +110,7 @@ void RsCollectionFile::recursAddElements(QDomDocument& doc,const DirDetails& det
|
|||
continue;
|
||||
|
||||
DirDetails subDirDetails;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN | DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!rsFiles->RequestDirDetails(it->ref, subDirDetails, flags))
|
||||
continue;
|
||||
|
|
|
@ -100,7 +100,7 @@ AttachFileItem::AttachFileItem(const QString& path)
|
|||
mType = AFI_TYPE_ATTACH;
|
||||
|
||||
/* ask for Files to hash/prepare it for us */
|
||||
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path.toUtf8().constData(), AFI_DEFAULT_PERIOD, 0)))
|
||||
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path.toUtf8().constData(), AFI_DEFAULT_PERIOD, TransferRequestFlags(0u))))
|
||||
{
|
||||
mMode = AFI_STATE_ERROR;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void AttachFileItem::Setup()
|
|||
if (mMode == AFI_STATE_REMOTE)
|
||||
{
|
||||
FileInfo fi;
|
||||
uint32_t hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY;
|
||||
FileSearchFlags hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY;
|
||||
|
||||
/* look up path */
|
||||
if (rsFiles->FileDetails(mFileHash, hintflags, fi))
|
||||
|
@ -194,7 +194,7 @@ void AttachFileItem::updateItemStatic()
|
|||
if (mPath == "")
|
||||
{
|
||||
FileInfo fi;
|
||||
uint32_t hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL
|
||||
FileSearchFlags hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL
|
||||
| RS_FILE_HINTS_SPEC_ONLY;
|
||||
|
||||
/* look up path */
|
||||
|
@ -350,7 +350,7 @@ void AttachFileItem::updateItem()
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t hintflags = 0;
|
||||
FileSearchFlags hintflags(0u);
|
||||
switch(mMode)
|
||||
{
|
||||
case AFI_STATE_REMOTE:
|
||||
|
|
|
@ -182,7 +182,7 @@ void SubFileItem::updateItemStatic()
|
|||
if (mPath == "")
|
||||
{
|
||||
FileInfo fi;
|
||||
uint32_t hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE;
|
||||
FileSearchFlags hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE;
|
||||
|
||||
/* look up path */
|
||||
if (!rsFiles->FileDetails(mFileHash, hintflags, fi))
|
||||
|
@ -364,7 +364,7 @@ void SubFileItem::updateItem()
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32_t hintflags = 0;
|
||||
FileSearchFlags hintflags(0u) ;
|
||||
switch(mMode)
|
||||
{
|
||||
case SFI_STATE_REMOTE:
|
||||
|
@ -544,7 +544,7 @@ void SubFileItem::cancel()
|
|||
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
|
||||
{
|
||||
hide();
|
||||
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA);
|
||||
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
|
||||
mPath = "";
|
||||
}
|
||||
else
|
||||
|
@ -559,7 +559,7 @@ void SubFileItem::cancel()
|
|||
void SubFileItem::play()
|
||||
{
|
||||
FileInfo info;
|
||||
uint32_t flags = RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_NETWORK_WIDE;
|
||||
FileSearchFlags flags = RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_NETWORK_WIDE;
|
||||
|
||||
|
||||
if (!rsFiles->FileDetails( mFileHash, flags, info))
|
||||
|
@ -612,7 +612,7 @@ void SubFileItem::download()
|
|||
if (mSrcId != "")
|
||||
sources.push_back(mSrcId);
|
||||
|
||||
rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", RS_FILE_HINTS_NETWORK_WIDE, sources);
|
||||
rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", RS_FILE_REQ_ANONYMOUS_ROUTING, sources);
|
||||
|
||||
downloadButton->setEnabled(false);
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ void MessageWidget::getcurrentrecommended()
|
|||
const FileInfo& fi(it->second) ;
|
||||
std::cout << "Requesting file " << fi.fname << ", size=" << fi.size << ", hash=" << fi.hash << std::endl ;
|
||||
|
||||
if (rsFiles->FileRequest(fi.fname, fi.hash, fi.size, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds) == false) {
|
||||
if (rsFiles->FileRequest(fi.fname, fi.hash, fi.size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds) == false) {
|
||||
QMessageBox mb(QObject::tr("File Request canceled"), QObject::tr("The following has not been added to your download list, because you already have it:\n ") + QString::fromUtf8(fi.fname.c_str()), QMessageBox::Critical, QMessageBox::Ok, 0, 0);
|
||||
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
|
||||
mb.exec();
|
||||
|
@ -347,7 +347,7 @@ void MessageWidget::getallrecommended()
|
|||
std::cerr << "MessageWidget::getallrecommended() Calling File Request" << std::endl;
|
||||
std::list<std::string> srcIds;
|
||||
srcIds.push_back(msgInfo.srcId);
|
||||
rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds);
|
||||
rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue