VacuumDialog: Fix dialog after savepoint change

Call saveAll() in the VacuumDialog to make sure to release all savepoints.

Also cancel the dialog when no object was select but the OK button
clicked. This avoids an unnecessary DB reload in the main window.
This commit is contained in:
Martin Kleusberg
2013-05-23 18:09:09 +02:00
parent 7f03e01a86
commit 6de8425985
2 changed files with 4 additions and 5 deletions

View File

@@ -38,12 +38,12 @@ VacuumDialog::~VacuumDialog()
void VacuumDialog::accept()
{
if(ui->treeSelectedObjects->selectedItems().count() == 0)
QDialog::accept();
return QDialog::reject();
QApplication::setOverrideCursor(Qt::WaitCursor);
// Commit all changes first
db->save();
db->saveAll();
// All items selected?
if(ui->treeSelectedObjects->selectedItems().count() == ui->treeSelectedObjects->topLevelItemCount())
@@ -57,7 +57,6 @@ void VacuumDialog::accept()
db->executeSQL(QString("VACUUM `%1`;").arg(item->text(0)), false);
}
db->setDirty(false);
QApplication::restoreOverrideCursor();
QDialog::accept();
}

View File

@@ -12,11 +12,11 @@ class DBBrowserDB;
class VacuumDialog : public QDialog
{
Q_OBJECT
public:
explicit VacuumDialog(DBBrowserDB* _db, QWidget* parent = 0);
~VacuumDialog();
private:
Ui::VacuumDialog* ui;
DBBrowserDB* db;