Enabled the RetroShare icon of the collection file dialogs.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5493 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-08-31 14:07:15 +00:00
parent 1723bc1cde
commit fb71387a47
6 changed files with 12 additions and 11 deletions

View File

@ -879,7 +879,7 @@ bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,uint32_
return rsFiles->RequestDirDetails(ref, details, flags) ; return rsFiles->RequestDirDetails(ref, details, flags) ;
} }
void RetroshareDirModel::createCollectionFile(const QModelIndexList &list) void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndexList &list)
{ {
if(RemoteMode) if(RemoteMode)
{ {
@ -890,7 +890,7 @@ void RetroshareDirModel::createCollectionFile(const QModelIndexList &list)
std::vector <DirDetails> dirVec; std::vector <DirDetails> dirVec;
getDirDetailsFromSelect(list, dirVec); getDirDetailsFromSelect(list, dirVec);
RsCollectionFile(dirVec).save(); RsCollectionFile(dirVec).save(parent);
} }
void RetroshareDirModel::downloadSelected(const QModelIndexList &list) void RetroshareDirModel::downloadSelected(const QModelIndexList &list)

View File

@ -55,7 +55,7 @@ class RetroshareDirModel : public QAbstractItemModel
/* Callback from GUI */ /* Callback from GUI */
void downloadSelected(const QModelIndexList &list); void downloadSelected(const QModelIndexList &list);
void createCollectionFile(const QModelIndexList &list); void createCollectionFile(QWidget *parent, const QModelIndexList &list);
void getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec); void getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec);

View File

@ -433,7 +433,7 @@ void SharedFilesDialog::createCollectionFile()
std::cerr << "Creating a collection file!" << std::endl; std::cerr << "Creating a collection file!" << std::endl;
QModelIndexList lst = getLocalSelected(); QModelIndexList lst = getLocalSelected();
localModel->createCollectionFile(lst); localModel->createCollectionFile(this, lst);
} }
void SharedFilesDialog::downloadRemoteSelected() void SharedFilesDialog::downloadRemoteSelected()
{ {

View File

@ -1666,7 +1666,7 @@ QString TransfersDialog::getSources(int row, QStandardItemModel *model)
void TransfersDialog::openCollection() void TransfersDialog::openCollection()
{ {
RsCollectionFile Collection; RsCollectionFile Collection;
if (Collection.load()) { if (Collection.load(this)) {
Collection.downloadFiles(); Collection.downloadFiles();
} }
} }

View File

@ -166,10 +166,10 @@ bool RsCollectionFile::load(const QString& filename, bool showError /* = true*/)
return ok; return ok;
} }
bool RsCollectionFile::load() bool RsCollectionFile::load(QWidget *parent)
{ {
QString filename; QString filename;
if (!misc::getOpenFileName(NULL, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", filename)) if (!misc::getOpenFileName(parent, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", filename))
return false; return false;
std::cerr << "Got file name: " << filename.toStdString() << std::endl; std::cerr << "Got file name: " << filename.toStdString() << std::endl;
@ -197,10 +197,10 @@ bool RsCollectionFile::save(const QString& filename) const
return true; return true;
} }
bool RsCollectionFile::save() const bool RsCollectionFile::save(QWidget *parent) const
{ {
QString filename; QString filename;
if(!misc::getSaveFileName(NULL, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Create collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", filename)) if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Create collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", filename))
return false; return false;
if (!filename.endsWith("." + RsCollectionFile::ExtensionString)) if (!filename.endsWith("." + RsCollectionFile::ExtensionString))

View File

@ -34,6 +34,7 @@
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
class QDomElement ; class QDomElement ;
class QWidget;
class RsCollectionFile class RsCollectionFile
{ {
@ -46,11 +47,11 @@ class RsCollectionFile
RsCollectionFile(const std::vector<DirDetails>& file_entries) ; RsCollectionFile(const std::vector<DirDetails>& file_entries) ;
// Loads file from disk. // Loads file from disk.
bool load(); bool load(QWidget *parent);
bool load(const QString& filename, bool showError = true); bool load(const QString& filename, bool showError = true);
// Save to disk // Save to disk
bool save() const ; bool save(QWidget *parent) const ;
bool save(const QString& filename) const ; bool save(const QString& filename) const ;
// Download the content. // Download the content.