Pre-select current file in save as dialog.

This commit is contained in:
Florian Geyer 2011-12-26 20:08:26 +01:00
parent 4d8e9561a7
commit d2712b2a95

View File

@ -158,11 +158,13 @@ void DatabaseManager::saveDatabase(Database* db)
void DatabaseManager::saveDatabaseAs(Database* db)
{
DatabaseManagerStruct& dbStruct = m_dbList[db];
QString oldFileName = QString();
if (dbStruct.file)
oldFileName = dbStruct.fileName;
QString fileName = fileDialog()->getSaveFileName(m_window, tr("Save database as"),
QString(), tr("KeePass 2 Database").append(" (*.kdbx)"));
oldFileName, tr("KeePass 2 Database").append(" (*.kdbx)"));
if (!fileName.isEmpty()) {
DatabaseManagerStruct& dbStruct = m_dbList[db];
delete dbStruct.file;
QScopedPointer<QFile> file(new QFile(fileName));
// TODO error handling