Improve File Dialog

* QFileDialog returns UNIX paths, even on Windows. This patch converts what QFileDialog returns to the native path format.

* Improve const correctness

* Avoid imposing file extension on Linux

* This patch improves things like unneeded passes by values, missing const qualifiers, ugly copies because of variable reuse and consistency in variable names.
This commit is contained in:
Gianluca Recchia
2019-08-24 17:53:11 +02:00
committed by Jonathan White
parent c12fd369d9
commit fccbb98b8e
6 changed files with 70 additions and 159 deletions

View File

@@ -1656,13 +1656,8 @@ bool DatabaseWidget::saveAs()
oldFilePath = QDir::toNativeSeparators(config()->get("LastDir", QDir::homePath()).toString() + "/"
+ tr("Passwords").append(".kdbx"));
}
QString newFilePath = fileDialog()->getSaveFileName(this,
tr("Save database as"),
oldFilePath,
tr("KeePass 2 Database").append(" (*.kdbx)"),
nullptr,
nullptr,
"kdbx");
const QString newFilePath = fileDialog()->getSaveFileName(
this, tr("Save database as"), oldFilePath, tr("KeePass 2 Database").append(" (*.kdbx)"), nullptr, nullptr);
if (!newFilePath.isEmpty()) {
// Ensure we don't recurse back into this function