mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added possibility to remove extra shared file
This commit is contained in:
parent
1383846364
commit
7ab7c7db93
@ -37,8 +37,8 @@
|
|||||||
#define P3FILELISTS_ERROR() std::cerr << "***ERROR***" << " : FILE_LISTS : " << __FUNCTION__ << " : "
|
#define P3FILELISTS_ERROR() std::cerr << "***ERROR***" << " : FILE_LISTS : " << __FUNCTION__ << " : "
|
||||||
|
|
||||||
//#define DEBUG_P3FILELISTS 1
|
//#define DEBUG_P3FILELISTS 1
|
||||||
#define DEBUG_CONTENT_FILTERING 1
|
//#define DEBUG_CONTENT_FILTERING 1
|
||||||
#define DEBUG_FILE_HIERARCHY 1
|
//#define DEBUG_FILE_HIERARCHY 1
|
||||||
|
|
||||||
static const uint32_t P3FILELISTS_UPDATE_FLAG_NOTHING_CHANGED = 0x0000 ;
|
static const uint32_t P3FILELISTS_UPDATE_FLAG_NOTHING_CHANGED = 0x0000 ;
|
||||||
static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_MAP_CHANGED = 0x0001 ;
|
static const uint32_t P3FILELISTS_UPDATE_FLAG_REMOTE_MAP_CHANGED = 0x0001 ;
|
||||||
@ -960,6 +960,14 @@ int p3FileDatabase::getSharedDirStatistics(const RsPeerId& pid,SharedDirStats& s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void p3FileDatabase::removeExtraFile(const RsFileHash& hash)
|
||||||
|
{
|
||||||
|
RS_STACK_MUTEX(mFLSMtx) ;
|
||||||
|
|
||||||
|
mExtraFiles->removeExtraFile(hash);
|
||||||
|
mLastExtraFilesCacheUpdate = 0 ; // forced cache reload
|
||||||
|
}
|
||||||
|
|
||||||
void p3FileDatabase::getExtraFilesDirDetails(void *ref,DirectoryStorage::EntryIndex e,DirDetails& d) const
|
void p3FileDatabase::getExtraFilesDirDetails(void *ref,DirectoryStorage::EntryIndex e,DirDetails& d) const
|
||||||
{
|
{
|
||||||
// update the cache of extra files if last requested too long ago
|
// update the cache of extra files if last requested too long ago
|
||||||
@ -1001,7 +1009,7 @@ void p3FileDatabase::getExtraFilesDirDetails(void *ref,DirectoryStorage::EntryIn
|
|||||||
else // extra file. Just query the corresponding data from ftExtra
|
else // extra file. Just query the corresponding data from ftExtra
|
||||||
{
|
{
|
||||||
d.prow = 1;//fi-1 ;
|
d.prow = 1;//fi-1 ;
|
||||||
d.type = DIR_TYPE_FILE;
|
d.type = DIR_TYPE_EXTRA_FILE;
|
||||||
|
|
||||||
FileInfo& f(mExtraFilesCache[(int)e-1]) ;
|
FileInfo& f(mExtraFilesCache[(int)e-1]) ;
|
||||||
|
|
||||||
@ -1068,7 +1076,7 @@ int p3FileDatabase::RequestDirDetails(void *ref, DirDetails& d, FileSearchFlags
|
|||||||
{
|
{
|
||||||
convertEntryIndexToPointer<sizeof(void*)>(0,1,p); // local shared files from extra list
|
convertEntryIndexToPointer<sizeof(void*)>(0,1,p); // local shared files from extra list
|
||||||
DirStub stub;
|
DirStub stub;
|
||||||
stub.type = DIR_TYPE_PERSON;
|
stub.type = DIR_TYPE_PERSON; // not totally exact, but used as a trick.
|
||||||
stub.name = "Temporary shared files";
|
stub.name = "Temporary shared files";
|
||||||
stub.ref = p;
|
stub.ref = p;
|
||||||
|
|
||||||
@ -1179,7 +1187,7 @@ int p3FileDatabase::RequestDirDetails(const RsPeerId &/*uid*/, const std::string
|
|||||||
// NOT_IMPLEMENTED();
|
// NOT_IMPLEMENTED();
|
||||||
// return 0;
|
// return 0;
|
||||||
//}
|
//}
|
||||||
uint32_t p3FileDatabase::getType(void *ref) const
|
uint32_t p3FileDatabase::getType(void *ref,FileSearchFlags flags) const
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mFLSMtx) ;
|
RS_STACK_MUTEX(mFLSMtx) ;
|
||||||
|
|
||||||
@ -1194,13 +1202,26 @@ uint32_t p3FileDatabase::getType(void *ref) const
|
|||||||
if(e == 0)
|
if(e == 0)
|
||||||
return DIR_TYPE_PERSON ;
|
return DIR_TYPE_PERSON ;
|
||||||
|
|
||||||
|
if(flags & RS_FILE_HINTS_LOCAL)
|
||||||
|
{
|
||||||
if(fi == 0 && mLocalSharedDirs != NULL)
|
if(fi == 0 && mLocalSharedDirs != NULL)
|
||||||
return mLocalSharedDirs->getEntryType(e) ;
|
return mLocalSharedDirs->getEntryType(e) ;
|
||||||
else if(fi-1 < mRemoteDirectories.size() && mRemoteDirectories[fi-1]!=NULL)
|
|
||||||
return mRemoteDirectories[fi-1]->getEntryType(e) ;
|
if(fi == 1)
|
||||||
else
|
return DIR_TYPE_EXTRA_FILE;
|
||||||
|
|
||||||
|
P3FILELISTS_ERROR() << " Cannot determine type of entry " << ref << std::endl;
|
||||||
return DIR_TYPE_ROOT ;// some failure case. Should not happen
|
return DIR_TYPE_ROOT ;// some failure case. Should not happen
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(fi-1 < mRemoteDirectories.size() && mRemoteDirectories[fi-1]!=NULL)
|
||||||
|
return mRemoteDirectories[fi-1]->getEntryType(e) ;
|
||||||
|
|
||||||
|
P3FILELISTS_ERROR() << " Cannot determine type of entry " << ref << std::endl;
|
||||||
|
return DIR_TYPE_ROOT ;// some failure case. Should not happen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed
|
void p3FileDatabase::forceDirectoryCheck() // Force re-sweep the directories and see what's changed
|
||||||
{
|
{
|
||||||
|
@ -109,6 +109,9 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
|||||||
virtual int SearchKeywords(const std::list<std::string>& keywords, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
virtual int SearchKeywords(const std::list<std::string>& keywords, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) ;
|
||||||
virtual int SearchBoolExp(RsRegularExpression::Expression *exp, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
virtual int SearchBoolExp(RsRegularExpression::Expression *exp, std::list<DirDetails>& results,FileSearchFlags flags,const RsPeerId& peer_id) const ;
|
||||||
|
|
||||||
|
// Extra file list
|
||||||
|
virtual void removeExtraFile(const RsFileHash& hash);
|
||||||
|
|
||||||
// Interface for browsing dir hierarchy
|
// Interface for browsing dir hierarchy
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -121,7 +124,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
|
|||||||
|
|
||||||
void requestDirUpdate(void *ref) ; // triggers an update. Used when browsing.
|
void requestDirUpdate(void *ref) ; // triggers an update. Used when browsing.
|
||||||
int RequestDirDetails(void *, DirDetails&, FileSearchFlags) const ;
|
int RequestDirDetails(void *, DirDetails&, FileSearchFlags) const ;
|
||||||
uint32_t getType(void *) const ;
|
uint32_t getType(void *, FileSearchFlags flags) const ;
|
||||||
|
|
||||||
// proxy method used by the web UI. Dont't delete!
|
// proxy method used by the web UI. Dont't delete!
|
||||||
int RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details)const;
|
int RequestDirDetails(const RsPeerId& uid, const std::string& path, DirDetails &details)const;
|
||||||
|
@ -166,11 +166,9 @@ bool ftExtraList::addExtraFile(std::string path, const RsFileHash& hash,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ftExtraList::removeExtraFile(const RsFileHash& hash, TransferRequestFlags flags)
|
bool ftExtraList::removeExtraFile(const RsFileHash& hash)
|
||||||
{
|
{
|
||||||
/* remove unused parameter warnings */
|
/* remove unused parameter warnings */
|
||||||
(void) flags;
|
|
||||||
|
|
||||||
#ifdef DEBUG_ELIST
|
#ifdef DEBUG_ELIST
|
||||||
std::cerr << "ftExtraList::removeExtraFile()";
|
std::cerr << "ftExtraList::removeExtraFile()";
|
||||||
std::cerr << " hash: " << hash;
|
std::cerr << " hash: " << hash;
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
bool addExtraFile(std::string path, const RsFileHash &hash,
|
bool addExtraFile(std::string path, const RsFileHash &hash,
|
||||||
uint64_t size, uint32_t period, TransferRequestFlags flags);
|
uint64_t size, uint32_t period, TransferRequestFlags flags);
|
||||||
|
|
||||||
bool removeExtraFile(const RsFileHash& hash, TransferRequestFlags flags);
|
bool removeExtraFile(const RsFileHash& hash);
|
||||||
bool moveExtraFile(std::string fname, const RsFileHash& hash, uint64_t size,
|
bool moveExtraFile(std::string fname, const RsFileHash& hash, uint64_t size,
|
||||||
std::string destpath);
|
std::string destpath);
|
||||||
|
|
||||||
|
@ -677,9 +677,10 @@ bool ftServer::ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t
|
|||||||
return mFtExtra->addExtraFile(fname, hash, size, period, flags);
|
return mFtExtra->addExtraFile(fname, hash, size, period, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ftServer::ExtraFileRemove(const RsFileHash& hash, TransferRequestFlags flags)
|
bool ftServer::ExtraFileRemove(const RsFileHash& hash)
|
||||||
{
|
{
|
||||||
return mFtExtra->removeExtraFile(hash, flags);
|
mFileDatabase->removeExtraFile(hash);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ftServer::ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags)
|
bool ftServer::ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags)
|
||||||
@ -714,9 +715,9 @@ 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,flags) ;
|
||||||
}
|
}
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/******************** Search Interface *************************/
|
/******************** Search Interface *************************/
|
||||||
|
@ -180,7 +180,7 @@ public:
|
|||||||
* Extra List Access
|
* Extra List Access
|
||||||
***/
|
***/
|
||||||
virtual bool ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t size, uint32_t period, TransferRequestFlags flags);
|
virtual bool ExtraFileAdd(std::string fname, const RsFileHash& hash, uint64_t size, uint32_t period, TransferRequestFlags flags);
|
||||||
virtual bool ExtraFileRemove(const RsFileHash& hash, TransferRequestFlags flags);
|
virtual bool ExtraFileRemove(const RsFileHash& hash);
|
||||||
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags);
|
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags);
|
||||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
|
||||||
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath);
|
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath);
|
||||||
|
@ -409,7 +409,7 @@ public:
|
|||||||
* Extra List Access
|
* Extra List Access
|
||||||
***/
|
***/
|
||||||
//virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferRequestFlags flags) = 0;
|
//virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferRequestFlags flags) = 0;
|
||||||
virtual bool ExtraFileRemove(const RsFileHash& hash, TransferRequestFlags flags) = 0;
|
virtual bool ExtraFileRemove(const RsFileHash& hash) = 0;
|
||||||
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags) = 0;
|
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags) = 0;
|
||||||
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
|
||||||
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath) = 0;
|
virtual bool ExtraFileMove(std::string fname, const RsFileHash& hash, uint64_t size, std::string destpath) = 0;
|
||||||
|
@ -160,7 +160,7 @@ struct PeerBandwidthLimits : RsSerializable
|
|||||||
#define DIR_TYPE_PERSON 0x02
|
#define DIR_TYPE_PERSON 0x02
|
||||||
#define DIR_TYPE_DIR 0x04
|
#define DIR_TYPE_DIR 0x04
|
||||||
#define DIR_TYPE_FILE 0x08
|
#define DIR_TYPE_FILE 0x08
|
||||||
#define DIR_TYPE_EXTRA 0x10
|
#define DIR_TYPE_EXTRA_FILE 0x10
|
||||||
|
|
||||||
/* flags for Directry request -
|
/* flags for Directry request -
|
||||||
* two types;
|
* two types;
|
||||||
|
@ -1291,9 +1291,9 @@ bool p3GxsChannels::ExtraFileHash(const std::string& path)
|
|||||||
|
|
||||||
bool p3GxsChannels::ExtraFileRemove(const RsFileHash &hash)
|
bool p3GxsChannels::ExtraFileRemove(const RsFileHash &hash)
|
||||||
{
|
{
|
||||||
TransferRequestFlags tflags = RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA;
|
//TransferRequestFlags tflags = RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA;
|
||||||
RsFileHash fh = RsFileHash(hash);
|
RsFileHash fh = RsFileHash(hash);
|
||||||
return rsFiles->ExtraFileRemove(fh, tflags);
|
return rsFiles->ExtraFileRemove(fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
#define IMAGE_COLLOPEN ":/images/library.png"
|
#define IMAGE_COLLOPEN ":/images/library.png"
|
||||||
#define IMAGE_EDITSHARE ":/images/edit_16.png"
|
#define IMAGE_EDITSHARE ":/images/edit_16.png"
|
||||||
#define IMAGE_MYFILES ":/icons/svg/folders1.svg"
|
#define IMAGE_MYFILES ":/icons/svg/folders1.svg"
|
||||||
|
#define IMAGE_REMOVE ":/images/deletemail24.png"
|
||||||
|
|
||||||
/*define viewType_CB value */
|
/*define viewType_CB value */
|
||||||
#define VIEW_TYPE_TREE 0
|
#define VIEW_TYPE_TREE 0
|
||||||
@ -229,6 +230,9 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
|
|||||||
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
|
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
|
||||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||||
|
|
||||||
|
removeExtraFileAct = new QAction(QIcon(IMAGE_REMOVE), tr( "Stop sharing this file" ), this );
|
||||||
|
connect( removeExtraFileAct , SIGNAL( triggered() ), this, SLOT( removeExtraFile() ) );
|
||||||
|
|
||||||
collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this) ;
|
collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this) ;
|
||||||
connect(collCreateAct,SIGNAL(triggered()),this,SLOT(collCreate())) ;
|
connect(collCreateAct,SIGNAL(triggered()),this,SLOT(collCreate())) ;
|
||||||
collModifAct= new QAction(QIcon(IMAGE_COLLMODIF), tr("Modify Collection..."), this) ;
|
collModifAct= new QAction(QIcon(IMAGE_COLLMODIF), tr("Modify Collection..."), this) ;
|
||||||
@ -1093,7 +1097,7 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||||||
|
|
||||||
currentFile = model->data(midx, RetroshareDirModel::FileNameRole).toString() ;
|
currentFile = model->data(midx, RetroshareDirModel::FileNameRole).toString() ;
|
||||||
int type = model->getType(midx) ;
|
int type = model->getType(midx) ;
|
||||||
if (type != DIR_TYPE_DIR && type != DIR_TYPE_FILE) return;
|
if (type != DIR_TYPE_DIR && type != DIR_TYPE_FILE && type != DIR_TYPE_EXTRA_FILE) return;
|
||||||
|
|
||||||
QMenu contextMnu(this) ;
|
QMenu contextMnu(this) ;
|
||||||
|
|
||||||
@ -1129,10 +1133,21 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||||||
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to..."), this, SLOT(recommendFilesToMsg())) ;
|
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to..."), this, SLOT(recommendFilesToMsg())) ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DIR_TYPE_EXTRA_FILE:
|
||||||
|
contextMnu.addAction(openfileAct) ;
|
||||||
|
contextMnu.addSeparator() ;//------------------------------------
|
||||||
|
contextMnu.addAction(copylinkAct) ;
|
||||||
|
contextMnu.addAction(sendlinkAct) ;
|
||||||
|
contextMnu.addAction(removeExtraFileAct) ;
|
||||||
|
|
||||||
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(type != DIR_TYPE_EXTRA_FILE)
|
||||||
|
{
|
||||||
GxsChannelDialog *channelDialog = dynamic_cast<GxsChannelDialog*>(MainWindow::getPage(MainWindow::Channels));
|
GxsChannelDialog *channelDialog = dynamic_cast<GxsChannelDialog*>(MainWindow::getPage(MainWindow::Channels));
|
||||||
QMenu shareChannelMenu(tr("Share on channel...")) ; // added here because the shareChannelMenu QMenu object is deleted afterwards
|
QMenu shareChannelMenu(tr("Share on channel...")) ; // added here because the shareChannelMenu QMenu object is deleted afterwards
|
||||||
|
|
||||||
@ -1180,6 +1195,7 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||||||
|
|
||||||
contextMnu.addMenu(&shareForumMenu) ;
|
contextMnu.addMenu(&shareForumMenu) ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos()) ;
|
contextMnu.exec(QCursor::pos()) ;
|
||||||
}
|
}
|
||||||
@ -1564,6 +1580,20 @@ void SharedFilesDialog::FilterItems()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SharedFilesDialog::removeExtraFile()
|
||||||
|
{
|
||||||
|
std::list<DirDetails> files_info ;
|
||||||
|
|
||||||
|
model->getFileInfoFromIndexList(getSelected(),files_info);
|
||||||
|
|
||||||
|
for(auto it(files_info.begin());it!=files_info.end();++it)
|
||||||
|
{
|
||||||
|
std::cerr << "removing file " << (*it).name << ", hash = " << (*it).hash << std::endl;
|
||||||
|
|
||||||
|
rsFiles->ExtraFileRemove((*it).hash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEPRECATED_CODE
|
#ifdef DEPRECATED_CODE
|
||||||
bool SharedFilesDialog::flat_FilterItem(const QModelIndex &index, const QString &text, int /*level*/)
|
bool SharedFilesDialog::flat_FilterItem(const QModelIndex &index, const QString &text, int /*level*/)
|
||||||
{
|
{
|
||||||
|
@ -66,6 +66,7 @@ private slots:
|
|||||||
void copyLink();
|
void copyLink();
|
||||||
void copyLinkhtml();
|
void copyLinkhtml();
|
||||||
void sendLinkTo();
|
void sendLinkTo();
|
||||||
|
void removeExtraFile();
|
||||||
|
|
||||||
void collCreate();
|
void collCreate();
|
||||||
void collModif();
|
void collModif();
|
||||||
@ -122,6 +123,7 @@ protected:
|
|||||||
QAction* sendlinkAct;
|
QAction* sendlinkAct;
|
||||||
QAction* sendchatlinkAct;
|
QAction* sendchatlinkAct;
|
||||||
QAction* copylinkhtmlAct;
|
QAction* copylinkhtmlAct;
|
||||||
|
QAction* removeExtraFileAct;
|
||||||
|
|
||||||
QAction *collCreateAct;
|
QAction *collCreateAct;
|
||||||
QAction *collModifAct;
|
QAction *collModifAct;
|
||||||
|
@ -162,7 +162,7 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (details.type == DIR_TYPE_FILE)
|
if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE)
|
||||||
{
|
{
|
||||||
#ifdef RDM_DEBUG
|
#ifdef RDM_DEBUG
|
||||||
std::cerr << "lookup FILE -> false";
|
std::cerr << "lookup FILE -> false";
|
||||||
@ -220,7 +220,7 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (details.type == DIR_TYPE_FILE)
|
if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE)
|
||||||
{
|
{
|
||||||
#ifdef RDM_DEBUG
|
#ifdef RDM_DEBUG
|
||||||
std::cerr << "lookup FILE: 0";
|
std::cerr << "lookup FILE: 0";
|
||||||
@ -425,7 +425,7 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
|
|||||||
else
|
else
|
||||||
return QIcon(categoryIcon);
|
return QIcon(categoryIcon);
|
||||||
}
|
}
|
||||||
else if (details.type == DIR_TYPE_FILE) /* File */
|
else if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) /* File */
|
||||||
{
|
{
|
||||||
// extensions predefined
|
// extensions predefined
|
||||||
if(details.hash.isNull())
|
if(details.hash.isNull())
|
||||||
@ -506,7 +506,7 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
|
|||||||
return QString() ;
|
return QString() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (details.type == DIR_TYPE_FILE) /* File */
|
else if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) /* File */
|
||||||
{
|
{
|
||||||
switch(coln)
|
switch(coln)
|
||||||
{
|
{
|
||||||
@ -598,7 +598,7 @@ QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
|
|||||||
|
|
||||||
QVariant FlatStyle_RDM::displayRole(const DirDetails& details,int coln) const
|
QVariant FlatStyle_RDM::displayRole(const DirDetails& details,int coln) const
|
||||||
{
|
{
|
||||||
if (details.type == DIR_TYPE_FILE) /* File */
|
if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) /* File */
|
||||||
switch(coln)
|
switch(coln)
|
||||||
{
|
{
|
||||||
case COLUMN_NAME: return QString::fromUtf8(details.name.c_str());
|
case COLUMN_NAME: return QString::fromUtf8(details.name.c_str());
|
||||||
@ -654,7 +654,7 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (details.type == DIR_TYPE_FILE) /* File */
|
else if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) /* File */
|
||||||
{
|
{
|
||||||
switch(coln)
|
switch(coln)
|
||||||
{
|
{
|
||||||
@ -707,7 +707,7 @@ QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
|
|||||||
* Dir : name, (0) count, (0) path, (0) ts
|
* Dir : name, (0) count, (0) path, (0) ts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (details.type == DIR_TYPE_FILE) /* File */
|
if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) /* File */
|
||||||
{
|
{
|
||||||
switch(coln)
|
switch(coln)
|
||||||
{
|
{
|
||||||
@ -769,7 +769,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
|||||||
|
|
||||||
if (role == Qt::TextColorRole)
|
if (role == Qt::TextColorRole)
|
||||||
{
|
{
|
||||||
if(details.type == DIR_TYPE_FILE && details.hash.isNull())
|
if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull())
|
||||||
return QVariant(QColor(Qt::green)) ;
|
return QVariant(QColor(Qt::green)) ;
|
||||||
else if(ageIndicator != IND_ALWAYS && details.max_mtime + ageIndicator < time(NULL))
|
else if(ageIndicator != IND_ALWAYS && details.max_mtime + ageIndicator < time(NULL))
|
||||||
return QVariant(QColor(Qt::gray)) ;
|
return QVariant(QColor(Qt::gray)) ;
|
||||||
@ -1083,6 +1083,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
|
|||||||
case DIR_TYPE_PERSON: return isNewerThanEpoque(details.max_mtime)? (Qt::ItemIsEnabled):(Qt::NoItemFlags) ;
|
case DIR_TYPE_PERSON: return isNewerThanEpoque(details.max_mtime)? (Qt::ItemIsEnabled):(Qt::NoItemFlags) ;
|
||||||
case DIR_TYPE_DIR: return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
case DIR_TYPE_DIR: return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
||||||
case DIR_TYPE_FILE: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled;
|
case DIR_TYPE_FILE: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled;
|
||||||
|
case DIR_TYPE_EXTRA_FILE: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Qt::ItemIsSelectable;
|
return Qt::ItemIsSelectable;
|
||||||
@ -1158,9 +1159,9 @@ void FlatStyle_RDM::postMods()
|
|||||||
|
|
||||||
bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d) const
|
bool RetroshareDirModel::requestDirDetails(void *ref, bool remote,DirDetails& d) const
|
||||||
{
|
{
|
||||||
//#ifdef RDM_DEBUG
|
#ifdef RDM_DEBUG
|
||||||
std::cerr << "RequestDirDetails:: ref = " << ref << ", remote=" << remote << std::endl;
|
std::cerr << "RequestDirDetails:: ref = " << ref << ", remote=" << remote << std::endl;
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
// We look in cache and re-use the last result if the reference and remote are the same.
|
// We look in cache and re-use the last result if the reference and remote are the same.
|
||||||
|
|
||||||
@ -1400,7 +1401,7 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
|
|||||||
|
|
||||||
QDir dir(QString::fromUtf8((*it).path.c_str()));
|
QDir dir(QString::fromUtf8((*it).path.c_str()));
|
||||||
QString dest;
|
QString dest;
|
||||||
if ((*it).type & DIR_TYPE_FILE) {
|
if ((*it).type & DIR_TYPE_FILE || (*it).type & DIR_TYPE_EXTRA_FILE) {
|
||||||
dest = dir.absoluteFilePath(QString::fromUtf8(it->name.c_str()));
|
dest = dir.absoluteFilePath(QString::fromUtf8(it->name.c_str()));
|
||||||
} else if ((*it).type & DIR_TYPE_DIR) {
|
} else if ((*it).type & DIR_TYPE_DIR) {
|
||||||
dest = dir.absolutePath();
|
dest = dir.absolutePath();
|
||||||
@ -1509,7 +1510,7 @@ void RetroshareDirModel::filterItems(const std::list<std::string>& keywords,uint
|
|||||||
mFilteredPointers.insert(p) ;
|
mFilteredPointers.insert(p) ;
|
||||||
++found ;
|
++found ;
|
||||||
|
|
||||||
while(det.type == DIR_TYPE_FILE || det.type == DIR_TYPE_DIR)
|
while(det.type == DIR_TYPE_FILE || det.type == DIR_TYPE_EXTRA_FILE || det.type == DIR_TYPE_DIR)
|
||||||
{
|
{
|
||||||
p = det.parent ;
|
p = det.parent ;
|
||||||
rsFiles->RequestDirDetails( p, det, flags);
|
rsFiles->RequestDirDetails( p, det, flags);
|
||||||
@ -1555,7 +1556,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
|
|||||||
std::cerr << "Path: " << details.path << std::endl;
|
std::cerr << "Path: " << details.path << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (details.type != DIR_TYPE_FILE)
|
if (details.type != DIR_TYPE_FILE && details.type != DIR_TYPE_EXTRA_FILE)
|
||||||
{
|
{
|
||||||
#ifdef RDM_DEBUG
|
#ifdef RDM_DEBUG
|
||||||
std::cerr << "RetroshareDirModel::mimeData() Not File" << std::endl;
|
std::cerr << "RetroshareDirModel::mimeData() Not File" << std::endl;
|
||||||
|
@ -561,7 +561,7 @@ void SubFileItem::cancel()
|
|||||||
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
|
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
|
rsFiles->ExtraFileRemove(FileHash());//, RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
|
||||||
mPath = "";
|
mPath = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user