mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 21:04:32 -05:00
small fixes in files context menus
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2162 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
153413c94d
commit
e0113efb30
@ -1239,7 +1239,6 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
||||
std::cerr << "FileIndexStore::RequestDirDetails() name: " << file->name << std::endl;
|
||||
#endif
|
||||
details.ref = file;
|
||||
details.name = file->name;
|
||||
details.hash = file->hash;
|
||||
details.age = time(NULL) - file->modtime;
|
||||
details.flags = 0;//file->pop;
|
||||
@ -1248,7 +1247,17 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
||||
details.parent = file->parent ;
|
||||
|
||||
details.prow = (file->parent==NULL)?0:file->parent->row ;
|
||||
details.path = (file->parent==NULL)?"":file->parent->path;
|
||||
|
||||
if(details.type == DIR_TYPE_DIR)
|
||||
{
|
||||
details.name = file->name;
|
||||
details.path = dir->path;
|
||||
}
|
||||
else
|
||||
{
|
||||
details.name = file->name;
|
||||
details.path = (file->parent==NULL)?"":file->parent->path;
|
||||
}
|
||||
|
||||
/* find peer id */
|
||||
FileEntry *f ;
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <algorithm>
|
||||
#include "util/misc.h"
|
||||
|
||||
#define RDM_DEBUG
|
||||
/*****
|
||||
* #define RDM_DEBUG
|
||||
****/
|
||||
@ -940,40 +939,38 @@ void RemoteDirModel::getFileInfoFromIndexList(const QModelIndexList& list, std::
|
||||
std::set<std::string> already_in ;
|
||||
|
||||
for(QModelIndexList::const_iterator it(list.begin()); it != list.end(); ++it)
|
||||
{
|
||||
void *ref = it -> internalPointer();
|
||||
if(it->column()==0)
|
||||
{
|
||||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
{
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
continue; /* don't recommend remote stuff */
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||
continue;
|
||||
|
||||
if(details.type == DIR_TYPE_PERSON)
|
||||
continue ;
|
||||
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "::::::::::::FileRecommend:::: " << std::endl;
|
||||
std::cerr << "Name: " << details.name << std::endl;
|
||||
std::cerr << "Hash: " << details.hash << std::endl;
|
||||
std::cerr << "Size: " << details.count << std::endl;
|
||||
std::cerr << "Path: " << details.path << std::endl;
|
||||
std::cerr << "::::::::::::FileRecommend:::: " << std::endl;
|
||||
std::cerr << "Name: " << details.name << std::endl;
|
||||
std::cerr << "Hash: " << details.hash << std::endl;
|
||||
std::cerr << "Size: " << details.count << std::endl;
|
||||
std::cerr << "Path: " << details.path << std::endl;
|
||||
#endif
|
||||
|
||||
if(already_in.find(details.hash) == already_in.end())
|
||||
{
|
||||
file_details.push_back(details) ;
|
||||
already_in.insert(details.hash) ;
|
||||
if(already_in.find(details.hash+details.name) == already_in.end())
|
||||
{
|
||||
file_details.push_back(details) ;
|
||||
already_in.insert(details.hash+details.name) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "::::::::::::Done FileRecommend" << std::endl;
|
||||
#endif
|
||||
@ -1083,7 +1080,9 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
|
||||
if (openFolder) {
|
||||
std::list<std::string>::iterator dit;
|
||||
for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++) {
|
||||
for (dit = dirs_to_open.begin(); dit != dirs_to_open.end(); dit++)
|
||||
{
|
||||
std::cerr << "Opennign this folder: " << (*dit).c_str() << std::endl ;
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile((*dit).c_str()));
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ const QString Image_AddNewAssotiationForFile = ":/images/kcmsystem24.png";
|
||||
|
||||
/** Constructor */
|
||||
SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
: RsAutoUpdatePage(1000,parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -168,10 +168,6 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||
|
||||
ui.remoteDirTreeView->setColumnHidden(2,true) ;
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
timer->start(1000);
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
@ -571,8 +567,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
//if (localModel->isDir( midx ) )
|
||||
// return;
|
||||
|
||||
currentFile = localModel->data(midx,
|
||||
RemoteDirModel::FileNameRole).toString();
|
||||
currentFile = localModel->data(midx, RemoteDirModel::FileNameRole).toString();
|
||||
|
||||
QMenu contextMnu2( this );
|
||||
//
|
||||
@ -618,17 +613,24 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
|
||||
for(it = peers.begin(); it != peers.end(); it++)
|
||||
{
|
||||
std::string name = rsPeers->getPeerName(*it);
|
||||
RsPeerDetails details ;
|
||||
if(!rsPeers->getPeerDetails(*it,details))
|
||||
continue ;
|
||||
|
||||
std::string name = details.name ;
|
||||
std::string location = details.location ;
|
||||
|
||||
std::string nn = name + " (" + location +")" ;
|
||||
/* parents are
|
||||
* recMenu
|
||||
* msgMenu
|
||||
*/
|
||||
|
||||
RsAction *qaf1 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( name ), recMenu, *it );
|
||||
RsAction *qaf1 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), recMenu, *it );
|
||||
connect( qaf1 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesTo( std::string ) ) );
|
||||
recMenu->addAction(qaf1);
|
||||
|
||||
RsAction *qaf2 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( name ), msgMenu, *it );
|
||||
RsAction *qaf2 = new RsAction( QIcon(IMAGE_FRIEND), QString::fromStdString( nn ), msgMenu, *it );
|
||||
connect( qaf2 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesToMsg( std::string ) ) );
|
||||
msgMenu->addAction(qaf2);
|
||||
|
||||
@ -659,20 +661,29 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
|
||||
|
||||
|
||||
contextMnu2.addAction( menuAction );
|
||||
contextMnu2.addAction( openfileAct);
|
||||
contextMnu2.addAction( openfolderAct);
|
||||
contextMnu2.addSeparator();
|
||||
contextMnu2.addAction( copylinklocalAct);
|
||||
contextMnu2.addAction( sendlinkAct);
|
||||
contextMnu2.addAction( sendhtmllinkAct);
|
||||
contextMnu2.addSeparator();
|
||||
contextMnu2.addAction( sendlinkCloudAct);
|
||||
contextMnu2.addAction( addlinkCloudAct);
|
||||
contextMnu2.addSeparator();
|
||||
contextMnu2.addMenu( recMenu);
|
||||
contextMnu2.addMenu( msgMenu);
|
||||
if(localModel->isDir( midx ) )
|
||||
contextMnu2.addAction( openfolderAct);
|
||||
else
|
||||
{
|
||||
contextMnu2.addAction( menuAction );
|
||||
contextMnu2.addAction( openfileAct);
|
||||
}
|
||||
|
||||
contextMnu2.addSeparator();
|
||||
|
||||
if(!localModel->isDir( midx ) )
|
||||
{
|
||||
contextMnu2.addAction( copylinklocalAct);
|
||||
contextMnu2.addAction( sendlinkAct);
|
||||
contextMnu2.addAction( sendhtmllinkAct);
|
||||
contextMnu2.addSeparator();
|
||||
contextMnu2.addAction( sendlinkCloudAct);
|
||||
contextMnu2.addAction( addlinkCloudAct);
|
||||
contextMnu2.addSeparator();
|
||||
|
||||
contextMnu2.addMenu( recMenu);
|
||||
contextMnu2.addMenu( msgMenu);
|
||||
}
|
||||
|
||||
QMouseEvent *mevent2 = new QMouseEvent( QEvent::MouseButtonPress, point,
|
||||
Qt::RightButton, Qt::RightButton,
|
||||
|
@ -27,13 +27,13 @@
|
||||
|
||||
//#include <config/rsharesettings.h>
|
||||
|
||||
#include "mainpage.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_SharedFilesDialog.h"
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
#include "gui/RemoteDirModel.h"
|
||||
|
||||
class SharedFilesDialog : public MainPage
|
||||
class SharedFilesDialog : public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -42,6 +42,7 @@ public:
|
||||
SharedFilesDialog(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
virtual void updatePage() { checkUpdate() ; }
|
||||
|
||||
|
||||
private slots:
|
||||
|
Loading…
Reference in New Issue
Block a user