mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed open folder in shared files in portable version.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3834 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7bcebc8e2b
commit
f0f3dc413a
@ -766,7 +766,7 @@ Qt::ItemFlags RemoteDirModel::flags( const QModelIndex & index ) const
|
||||
// //rsFiles -> RequestDirectories(id, path, 1);
|
||||
//}
|
||||
|
||||
void RemoteDirModel::downloadSelected(QModelIndexList list)
|
||||
void RemoteDirModel::downloadSelected(const QModelIndexList &list)
|
||||
{
|
||||
if (!RemoteMode)
|
||||
{
|
||||
@ -846,12 +846,12 @@ void RemoteDirModel::downloadDirectory(const DirDetails & dirDetails, int prefix
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteDirModel::getDirDetailsFromSelect (QModelIndexList list, std::vector <DirDetails>& dirVec)
|
||||
void RemoteDirModel::getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec)
|
||||
{
|
||||
dirVec.clear();
|
||||
|
||||
/* Fire off requests */
|
||||
QModelIndexList::iterator it;
|
||||
QModelIndexList::const_iterator it;
|
||||
for(it = list.begin(); it != list.end(); it++)
|
||||
{
|
||||
if(it->column()==1)
|
||||
@ -945,7 +945,7 @@ void RemoteDirModel::getFileInfoFromIndexList(const QModelIndexList& list, std::
|
||||
* OLD RECOMMEND SYSTEM - DISABLED
|
||||
******/
|
||||
|
||||
void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
void RemoteDirModel::openSelected(const QModelIndexList &qmil)
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "RemoteDirModel::openSelected()" << std::endl;
|
||||
@ -968,37 +968,28 @@ void RemoteDirModel::openSelected(QModelIndexList qmil, bool openFolder)
|
||||
{
|
||||
if ((*it).type & DIR_TYPE_PERSON) continue;
|
||||
|
||||
std::string fullpath, name;
|
||||
rsFiles->ConvertSharedFilePath((*it).path, fullpath);
|
||||
int len = fullpath.length();
|
||||
if (len && (fullpath[len - 1] != '/')) fullpath += '/';
|
||||
std::string path, name;
|
||||
rsFiles->ConvertSharedFilePath((*it).path, path);
|
||||
|
||||
QDir dir(QString::fromUtf8(path.c_str()));
|
||||
QString dest;
|
||||
if ((*it).type & DIR_TYPE_FILE) {
|
||||
name = fullpath + (*it).name;
|
||||
dest = dir.absoluteFilePath(QString::fromUtf8(it->name.c_str()));
|
||||
} else if ((*it).type & DIR_TYPE_DIR) {
|
||||
name = fullpath;
|
||||
dest = dir.absolutePath();
|
||||
}
|
||||
|
||||
std::cerr << "Opennign this file: " << name << std::endl ;
|
||||
std::cerr << "Opening this file: " << dest.toStdString() << std::endl ;
|
||||
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(name.c_str(),name.length())));
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(dest));
|
||||
}
|
||||
|
||||
// if (openFolder) {
|
||||
// std::list<std::string>::iterator 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(QString::fromUtf8((*dit).c_str())));
|
||||
// }
|
||||
// }
|
||||
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "::::::::::::Done RemoteDirModel::openSelected()" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void RemoteDirModel::getFilePaths(QModelIndexList list, std::list<std::string> &fullpaths)
|
||||
void RemoteDirModel::getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths)
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "RemoteDirModel::getFilePaths()" << std::endl;
|
||||
@ -1011,7 +1002,7 @@ void RemoteDirModel::getFilePaths(QModelIndexList list, std::list<std::string> &
|
||||
return;
|
||||
}
|
||||
/* translate */
|
||||
QModelIndexList::iterator it;
|
||||
QModelIndexList::const_iterator it;
|
||||
for(it = list.begin(); it != list.end(); it++)
|
||||
{
|
||||
void *ref = it -> internalPointer();
|
||||
|
@ -63,18 +63,18 @@ class RemoteDirModel : public QAbstractItemModel
|
||||
void postMods();
|
||||
|
||||
/* Callback from GUI */
|
||||
void downloadSelected(QModelIndexList list);
|
||||
void downloadSelected(const QModelIndexList &list);
|
||||
|
||||
void getDirDetailsFromSelect (QModelIndexList list, std::vector <DirDetails>& dirVec);
|
||||
void getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec);
|
||||
|
||||
int getType ( const QModelIndex & index ) const ;
|
||||
//void openFile(QModelIndex fileIndex, const QString command);
|
||||
|
||||
void getFileInfoFromIndexList(const QModelIndexList& list, std::list<DirDetails>& files_info) ;
|
||||
|
||||
void openSelected(QModelIndexList list, bool openFolder);
|
||||
void openSelected(const QModelIndexList &list);
|
||||
|
||||
void getFilePaths(QModelIndexList list, std::list<std::string> &fullpaths);
|
||||
void getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths);
|
||||
|
||||
void changeAgeIndicator(uint32_t indicator) { ageIndicator = indicator; }
|
||||
|
||||
|
@ -601,7 +601,7 @@ void SharedFilesDialog::openfile()
|
||||
std::cerr << "SharedFilesDialog::openfile" << std::endl;
|
||||
|
||||
QModelIndexList qmil = getLocalSelected();
|
||||
localModel->openSelected(qmil, false);
|
||||
localModel->openSelected(qmil);
|
||||
}
|
||||
|
||||
|
||||
@ -610,7 +610,7 @@ void SharedFilesDialog::openfolder()
|
||||
std::cerr << "SharedFilesDialog::openfolder" << std::endl;
|
||||
|
||||
QModelIndexList qmil = getLocalSelected();
|
||||
localModel->openSelected(qmil, true);
|
||||
localModel->openSelected(qmil);
|
||||
}
|
||||
|
||||
void SharedFilesDialog::preModDirectories(bool update_local)
|
||||
|
Loading…
Reference in New Issue
Block a user