mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-09 23:22:48 -04: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
4 changed files with 76 additions and 56 deletions
|
@ -1239,7 +1239,6 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
||||||
std::cerr << "FileIndexStore::RequestDirDetails() name: " << file->name << std::endl;
|
std::cerr << "FileIndexStore::RequestDirDetails() name: " << file->name << std::endl;
|
||||||
#endif
|
#endif
|
||||||
details.ref = file;
|
details.ref = file;
|
||||||
details.name = file->name;
|
|
||||||
details.hash = file->hash;
|
details.hash = file->hash;
|
||||||
details.age = time(NULL) - file->modtime;
|
details.age = time(NULL) - file->modtime;
|
||||||
details.flags = 0;//file->pop;
|
details.flags = 0;//file->pop;
|
||||||
|
@ -1248,7 +1247,17 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
|
||||||
details.parent = file->parent ;
|
details.parent = file->parent ;
|
||||||
|
|
||||||
details.prow = (file->parent==NULL)?0:file->parent->row ;
|
details.prow = (file->parent==NULL)?0:file->parent->row ;
|
||||||
|
|
||||||
|
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;
|
details.path = (file->parent==NULL)?"":file->parent->path;
|
||||||
|
}
|
||||||
|
|
||||||
/* find peer id */
|
/* find peer id */
|
||||||
FileEntry *f ;
|
FileEntry *f ;
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
||||||
#define RDM_DEBUG
|
|
||||||
/*****
|
/*****
|
||||||
* #define RDM_DEBUG
|
* #define RDM_DEBUG
|
||||||
****/
|
****/
|
||||||
|
@ -940,25 +939,23 @@ void RemoteDirModel::getFileInfoFromIndexList(const QModelIndexList& list, std::
|
||||||
std::set<std::string> already_in ;
|
std::set<std::string> already_in ;
|
||||||
|
|
||||||
for(QModelIndexList::const_iterator it(list.begin()); it != list.end(); ++it)
|
for(QModelIndexList::const_iterator it(list.begin()); it != list.end(); ++it)
|
||||||
|
if(it->column()==0)
|
||||||
{
|
{
|
||||||
void *ref = it -> internalPointer();
|
void *ref = it -> internalPointer();
|
||||||
|
|
||||||
DirDetails details;
|
DirDetails details;
|
||||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||||
|
|
||||||
if (RemoteMode)
|
if (RemoteMode)
|
||||||
{
|
|
||||||
flags |= DIR_FLAGS_REMOTE;
|
flags |= DIR_FLAGS_REMOTE;
|
||||||
continue; /* don't recommend remote stuff */
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
flags |= DIR_FLAGS_LOCAL;
|
flags |= DIR_FLAGS_LOCAL;
|
||||||
}
|
|
||||||
|
|
||||||
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
if (!rsFiles->RequestDirDetails(ref, details, flags))
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
if(details.type == DIR_TYPE_PERSON)
|
||||||
|
continue ;
|
||||||
|
|
||||||
#ifdef RDM_DEBUG
|
#ifdef RDM_DEBUG
|
||||||
std::cerr << "::::::::::::FileRecommend:::: " << std::endl;
|
std::cerr << "::::::::::::FileRecommend:::: " << std::endl;
|
||||||
|
@ -968,10 +965,10 @@ void RemoteDirModel::getFileInfoFromIndexList(const QModelIndexList& list, std::
|
||||||
std::cerr << "Path: " << details.path << std::endl;
|
std::cerr << "Path: " << details.path << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(already_in.find(details.hash) == already_in.end())
|
if(already_in.find(details.hash+details.name) == already_in.end())
|
||||||
{
|
{
|
||||||
file_details.push_back(details) ;
|
file_details.push_back(details) ;
|
||||||
already_in.insert(details.hash) ;
|
already_in.insert(details.hash+details.name) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef RDM_DEBUG
|
#ifdef RDM_DEBUG
|
||||||
|
@ -1083,7 +1080,9 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||||
|
|
||||||
if (openFolder) {
|
if (openFolder) {
|
||||||
std::list<std::string>::iterator dit;
|
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()));
|
QDesktopServices::openUrl(QUrl::fromLocalFile((*dit).c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ const QString Image_AddNewAssotiationForFile = ":/images/kcmsystem24.png";
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||||
: MainPage(parent)
|
: RsAutoUpdatePage(1000,parent)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
@ -168,10 +168,6 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
||||||
|
|
||||||
ui.remoteDirTreeView->setColumnHidden(2,true) ;
|
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 */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
|
@ -571,8 +567,7 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||||
//if (localModel->isDir( midx ) )
|
//if (localModel->isDir( midx ) )
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
currentFile = localModel->data(midx,
|
currentFile = localModel->data(midx, RemoteDirModel::FileNameRole).toString();
|
||||||
RemoteDirModel::FileNameRole).toString();
|
|
||||||
|
|
||||||
QMenu contextMnu2( this );
|
QMenu contextMnu2( this );
|
||||||
//
|
//
|
||||||
|
@ -618,17 +613,24 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||||
|
|
||||||
for(it = peers.begin(); it != peers.end(); it++)
|
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
|
/* parents are
|
||||||
* recMenu
|
* recMenu
|
||||||
* msgMenu
|
* 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 ) ) );
|
connect( qaf1 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesTo( std::string ) ) );
|
||||||
recMenu->addAction(qaf1);
|
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 ) ) );
|
connect( qaf2 , SIGNAL( triggeredId( std::string ) ), this, SLOT( recommendFilesToMsg( std::string ) ) );
|
||||||
msgMenu->addAction(qaf2);
|
msgMenu->addAction(qaf2);
|
||||||
|
|
||||||
|
@ -659,10 +661,18 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||||
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
|
connect(openfolderAct, SIGNAL(triggered()), this, SLOT(openfolder()));
|
||||||
|
|
||||||
|
|
||||||
|
if(localModel->isDir( midx ) )
|
||||||
|
contextMnu2.addAction( openfolderAct);
|
||||||
|
else
|
||||||
|
{
|
||||||
contextMnu2.addAction( menuAction );
|
contextMnu2.addAction( menuAction );
|
||||||
contextMnu2.addAction( openfileAct);
|
contextMnu2.addAction( openfileAct);
|
||||||
contextMnu2.addAction( openfolderAct);
|
}
|
||||||
|
|
||||||
contextMnu2.addSeparator();
|
contextMnu2.addSeparator();
|
||||||
|
|
||||||
|
if(!localModel->isDir( midx ) )
|
||||||
|
{
|
||||||
contextMnu2.addAction( copylinklocalAct);
|
contextMnu2.addAction( copylinklocalAct);
|
||||||
contextMnu2.addAction( sendlinkAct);
|
contextMnu2.addAction( sendlinkAct);
|
||||||
contextMnu2.addAction( sendhtmllinkAct);
|
contextMnu2.addAction( sendhtmllinkAct);
|
||||||
|
@ -670,9 +680,10 @@ void SharedFilesDialog::sharedDirTreeWidgetContextMenu( QPoint point )
|
||||||
contextMnu2.addAction( sendlinkCloudAct);
|
contextMnu2.addAction( sendlinkCloudAct);
|
||||||
contextMnu2.addAction( addlinkCloudAct);
|
contextMnu2.addAction( addlinkCloudAct);
|
||||||
contextMnu2.addSeparator();
|
contextMnu2.addSeparator();
|
||||||
|
|
||||||
contextMnu2.addMenu( recMenu);
|
contextMnu2.addMenu( recMenu);
|
||||||
contextMnu2.addMenu( msgMenu);
|
contextMnu2.addMenu( msgMenu);
|
||||||
|
}
|
||||||
|
|
||||||
QMouseEvent *mevent2 = new QMouseEvent( QEvent::MouseButtonPress, point,
|
QMouseEvent *mevent2 = new QMouseEvent( QEvent::MouseButtonPress, point,
|
||||||
Qt::RightButton, Qt::RightButton,
|
Qt::RightButton, Qt::RightButton,
|
||||||
|
|
|
@ -27,13 +27,13 @@
|
||||||
|
|
||||||
//#include <config/rsharesettings.h>
|
//#include <config/rsharesettings.h>
|
||||||
|
|
||||||
#include "mainpage.h"
|
#include "RsAutoUpdatePage.h"
|
||||||
#include "ui_SharedFilesDialog.h"
|
#include "ui_SharedFilesDialog.h"
|
||||||
|
|
||||||
#include "rsiface/rstypes.h"
|
#include "rsiface/rstypes.h"
|
||||||
#include "gui/RemoteDirModel.h"
|
#include "gui/RemoteDirModel.h"
|
||||||
|
|
||||||
class SharedFilesDialog : public MainPage
|
class SharedFilesDialog : public RsAutoUpdatePage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public:
|
||||||
SharedFilesDialog(QWidget *parent = 0);
|
SharedFilesDialog(QWidget *parent = 0);
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
|
|
||||||
|
virtual void updatePage() { checkUpdate() ; }
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue