diff options
| author | 2015-04-19 22:30:43 -0400 | |
|---|---|---|
| committer | 2015-04-19 22:30:43 -0400 | |
| commit | 094918f048c81474b22f9ba2940c96dc4033d753 (patch) | |
| tree | 2b89c77ad7dc9c55e9ba383f23f9f25b82df358e /SQLiteStudio3/guiSQLiteStudio/dialogs | |
| parent | 640fff60ceecde402131937dddb3458f7a003e9c (diff) | |
| parent | a308f430f694423064ebc86fd0506c8c6fdb3d93 (diff) | |
Merge tag 'upstream/3.0.5'
Upstream version 3.0.5
# gpg: Signature made Sun 19 Apr 2015 10:30:41 PM EDT using RSA key ID EBE9BD91
# gpg: Good signature from "Unit 193 <unit193@gmail.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.org>"
# gpg: aka "Unit 193 <unit193@ubuntu.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.com>"
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/dialogs')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/dialogs/dbdialog.cpp | 22 | ||||
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.cpp | 13 | ||||
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.h | 2 |
3 files changed, 26 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; } diff --git a/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.cpp b/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.cpp index ca3fd31..7861ff0 100644 --- a/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.cpp @@ -51,7 +51,9 @@ void PopulateDialog::init() pluginTitles << plugin->getTitle(); widgetCover = new WidgetCover(this); + widgetCover->initWithInterruptContainer(tr("Abort")); widgetCover->setVisible(false); + connect(widgetCover, SIGNAL(cancelClicked()), POPULATE_MANAGER, SLOT(interrupt())); ui->scrollArea->setAutoFillBackground(false); ui->scrollArea->viewport()->setAutoFillBackground(false); @@ -71,6 +73,7 @@ void PopulateDialog::init() connect(ui->databaseCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(refreshTables())); connect(ui->tableCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(refreshColumns())); connect(POPULATE_MANAGER, SIGNAL(populatingFinished()), widgetCover, SLOT(hide())); + connect(POPULATE_MANAGER, SIGNAL(finishedStep(int)), widgetCover, SLOT(setProgress(int))); connect(POPULATE_MANAGER, SIGNAL(populatingSuccessful()), this, SLOT(finished())); } @@ -317,10 +320,20 @@ void PopulateDialog::accept() QString table = ui->tableCombo->currentText(); qint64 rows = ui->rowsSpin->value(); + started = true; + widgetCover->displayProgress(rows, "%v / %m"); widgetCover->show(); POPULATE_MANAGER->populate(db, table, engines, rows); } +void PopulateDialog::reject() +{ + if (started) + POPULATE_MANAGER->interrupt(); + + QDialog::reject(); +} + PopulateDialog::ColumnEntry::ColumnEntry(QCheckBox* check, QComboBox* combo, QToolButton* button) : check(check), combo(combo), button(button) { diff --git a/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.h b/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.h index 0ecc318..948d6ce 100644 --- a/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.h +++ b/SQLiteStudio3/guiSQLiteStudio/dialogs/populatedialog.h @@ -58,6 +58,7 @@ class GUI_API_EXPORT PopulateDialog : public QDialog QSignalMapper* buttonMapper = nullptr; QHash<int,bool> columnsValid; WidgetCover* widgetCover = nullptr; + bool started = false; private slots: void refreshTables(); @@ -71,6 +72,7 @@ class GUI_API_EXPORT PopulateDialog : public QDialog public: void accept(); + void reject(); }; #endif // POPULATEDIALOG_H |
