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