diff options
| author | 2015-04-19 22:30:21 -0400 | |
|---|---|---|
| committer | 2015-04-19 22:30:21 -0400 | |
| commit | a308f430f694423064ebc86fd0506c8c6fdb3d93 (patch) | |
| tree | ceacd24fecf92f40980f8d8f3fd169e317c886af /SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp | |
| parent | a5b034d4a9c44f9bc1e83b01de82530f8fc63013 (diff) | |
Imported Upstream version 3.0.5upstream/3.0.5
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp b/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp index 05d50af..ac7cd8a 100644 --- a/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp @@ -455,10 +455,6 @@ bool DbDialog::testDatabase() if (url.scheme().isEmpty()) url.setScheme("file"); - bool existed = false; - if (url.isLocalFile() && QFile::exists(path)) - existed = QFile::exists(path); - QHash<QString, QVariant> options = collectOptions(); DbPlugin* plugin = dbPlugins[ui->typeCombo->currentText()]; Db* testDb = plugin->getInstance("", path, options); @@ -466,15 +462,14 @@ bool DbDialog::testDatabase() bool res = false; if (testDb) { - res = true; + if (testDb->openForProbing()) + { + res = !testDb->getEncoding().isEmpty(); + testDb->closeQuiet(); + } delete testDb; } - if (!existed) - { - QFile file(path); - file.remove(); - } return res; } @@ -605,7 +600,12 @@ void DbDialog::browseClicked() { if (customBrowseHandler) { - customBrowseHandler(ui->fileEdit->text()); + QString newUrl = customBrowseHandler(ui->fileEdit->text()); + if (!newUrl.isNull()) + { + ui->fileEdit->setText(newUrl); + updateState(); + } return; } |
