create collection dialog filename as dir name

This commit is contained in:
RetroPooh 2017-11-14 19:52:48 +03:00
parent 8368a764fc
commit 1f207ba05c
4 changed files with 14 additions and 6 deletions

View File

@ -1066,8 +1066,17 @@ void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndex
getDirDetailsFromSelect(list, dirVec);
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
RsCollection(dirVec,f).openNewColl(parent);
QString dir_name;
if(!RemoteMode)
{
if(dirVec.size())
{
const DirDetails& details = dirVec[0];
dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
}
}
RsCollection(dirVec,f).openNewColl(parent,dir_name);
}
void RetroshareDirModel::downloadSelected(const QModelIndexList &list,bool interactive)

View File

@ -413,9 +413,8 @@ bool RsCollection::save(QWidget *parent) const
}
bool RsCollection::openNewColl(QWidget *parent)
bool RsCollection::openNewColl(QWidget *parent, QString fileName)
{
QString fileName;
if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE
, QApplication::translate("RsCollectionFile", "Create collection file")
, QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")"

View File

@ -82,7 +82,7 @@ public:
bool save(const QString& fileName) const ;
// Open new collection
bool openNewColl(QWidget *parent);
bool openNewColl(QWidget *parent, QString fileName = "");
// Open existing collection
bool openColl(const QString& fileName, bool readOnly = false, bool showError = true);

View File

@ -363,7 +363,7 @@ bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type
, QString &file, QString *selectedFilter
, QFileDialog::Options options)
{
QString lastDir = Settings->getLastDir(type);
QString lastDir = Settings->getLastDir(type) + "/" + file;
file = QFileDialog::getSaveFileName(parent, caption, lastDir, filter, selectedFilter, QFileDialog::DontUseNativeDialog | options);