Merge pull request #793 from PhenomRetroShare/Fix_FriendListExport

Fix FriendList Import/Export filename and error message.
This commit is contained in:
csoler 2017-05-02 10:14:12 +02:00 committed by GitHub
commit c481186d95

View File

@ -1816,25 +1816,26 @@ void FriendList::importFriendlistClicked()
*/
bool FriendList::importExportFriendlistFileDialog(QString &fileName, bool import)
{
if(!misc::getSaveFileName(this,
RshareSettings::LASTDIR_CERT,
(import ? tr("Select file for importing your friendlist from") :
tr("Select a file for exporting your friendlist to")),
tr("XML File (*.xml);;All Files (*)"),
fileName,
NULL,
(import ? QFileDialog::DontConfirmOverwrite : (QFileDialog::Options)0)
)) {
// show error to user
QMessageBox mbox;
mbox.setIcon(QMessageBox::Warning);
mbox.setText(tr("Error"));
mbox.setInformativeText(tr("Failed to get a file!"));
mbox.setStandardButtons(QMessageBox::Ok);
mbox.exec();
return false;
bool res = true;
if (import) {
res = misc::getOpenFileName(this, RshareSettings::LASTDIR_CERT
, tr("Select file for importing your friendlist from")
, tr("XML File (*.xml);;All Files (*)")
, fileName
, QFileDialog::DontConfirmOverwrite
);
} else {
res = misc::getSaveFileName(this, RshareSettings::LASTDIR_CERT
, tr("Select a file for exporting your friendlist to")
, tr("XML File (*.xml);;All Files (*)")
, fileName, NULL
, (QFileDialog::Options)0
);
}
return true;
if ( res && !fileName.endsWith(".xml",Qt::CaseInsensitive) )
fileName = fileName.append(".xml");
return res;
}
/**