mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Delete the DeleteIndexForm
Delete the DeleteIndexForm as it is no longer needed. Since the last commit an index can be deleted directly via the popup menu.
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
#include "DeleteIndexForm.h"
|
||||
#include <QMessageBox>
|
||||
/*
|
||||
* Constructs a deleteIndexForm as a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'.
|
||||
*
|
||||
* The dialog will by default be modeless, unless you set 'modal' to
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
deleteIndexForm::deleteIndexForm(QWidget* parent, Qt::WindowFlags fl)
|
||||
: QDialog(parent, fl)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
deleteIndexForm::~deleteIndexForm()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the strings of the subwidgets using the current
|
||||
* language.
|
||||
*/
|
||||
void deleteIndexForm::languageChange()
|
||||
{
|
||||
retranslateUi(this);
|
||||
}
|
||||
|
||||
void deleteIndexForm::confirmDelete()
|
||||
{
|
||||
QString msg = "Are you sure you want to delete index ";
|
||||
msg.append(comboOptions->currentText());
|
||||
msg.append("?");
|
||||
|
||||
if (QMessageBox::warning( this, QApplication::applicationName(),
|
||||
msg,
|
||||
QMessageBox::Yes | QMessageBox::Default,
|
||||
QMessageBox::No | QMessageBox::Escape )
|
||||
== QMessageBox::Yes ){
|
||||
option = comboOptions->currentText();
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
void deleteIndexForm::populateOptions(QStringList entries)
|
||||
{
|
||||
comboOptions->clear();
|
||||
comboOptions->addItems(entries);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
#ifndef DELETEINDEXFORM_H
|
||||
#define DELETEINDEXFORM_H
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
class Ui_deleteIndexForm
|
||||
{
|
||||
public:
|
||||
QVBoxLayout *vboxLayout;
|
||||
QHBoxLayout *hboxLayout;
|
||||
QLabel *textLabel2;
|
||||
QComboBox *comboOptions;
|
||||
QSpacerItem *spacer13;
|
||||
QHBoxLayout *hboxLayout1;
|
||||
QSpacerItem *spacer11;
|
||||
QPushButton *buttonDelete;
|
||||
QPushButton *buttonCancel;
|
||||
|
||||
void setupUi(QDialog *deleteIndexForm)
|
||||
{
|
||||
if (deleteIndexForm->objectName().isEmpty())
|
||||
deleteIndexForm->setObjectName(QString::fromUtf8("deleteIndexForm"));
|
||||
deleteIndexForm->resize(236, 137);
|
||||
vboxLayout = new QVBoxLayout(deleteIndexForm);
|
||||
vboxLayout->setSpacing(6);
|
||||
vboxLayout->setContentsMargins(11, 11, 11, 11);
|
||||
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
|
||||
hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->setSpacing(6);
|
||||
hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
|
||||
textLabel2 = new QLabel(deleteIndexForm);
|
||||
textLabel2->setObjectName(QString::fromUtf8("textLabel2"));
|
||||
textLabel2->setWordWrap(false);
|
||||
|
||||
hboxLayout->addWidget(textLabel2);
|
||||
|
||||
comboOptions = new QComboBox(deleteIndexForm);
|
||||
comboOptions->setObjectName(QString::fromUtf8("comboOptions"));
|
||||
|
||||
hboxLayout->addWidget(comboOptions);
|
||||
|
||||
|
||||
vboxLayout->addLayout(hboxLayout);
|
||||
|
||||
spacer13 = new QSpacerItem(20, 41, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
vboxLayout->addItem(spacer13);
|
||||
|
||||
hboxLayout1 = new QHBoxLayout();
|
||||
hboxLayout1->setSpacing(6);
|
||||
hboxLayout1->setObjectName(QString::fromUtf8("hboxLayout1"));
|
||||
spacer11 = new QSpacerItem(31, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
|
||||
hboxLayout1->addItem(spacer11);
|
||||
|
||||
buttonDelete = new QPushButton(deleteIndexForm);
|
||||
buttonDelete->setObjectName(QString::fromUtf8("buttonDelete"));
|
||||
|
||||
hboxLayout1->addWidget(buttonDelete);
|
||||
|
||||
buttonCancel = new QPushButton(deleteIndexForm);
|
||||
buttonCancel->setObjectName(QString::fromUtf8("buttonCancel"));
|
||||
buttonCancel->setDefault(true);
|
||||
|
||||
hboxLayout1->addWidget(buttonCancel);
|
||||
|
||||
|
||||
vboxLayout->addLayout(hboxLayout1);
|
||||
|
||||
|
||||
retranslateUi(deleteIndexForm);
|
||||
QObject::connect(buttonDelete, SIGNAL(clicked()), deleteIndexForm, SLOT(confirmDelete()));
|
||||
QObject::connect(buttonCancel, SIGNAL(clicked()), deleteIndexForm, SLOT(reject()));
|
||||
|
||||
QMetaObject::connectSlotsByName(deleteIndexForm);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QDialog *deleteIndexForm)
|
||||
{
|
||||
deleteIndexForm->setWindowTitle(QApplication::translate("deleteIndexForm", "Delete Index", 0, QApplication::UnicodeUTF8));
|
||||
textLabel2->setText(QApplication::translate("deleteIndexForm", "Index name:", 0, QApplication::UnicodeUTF8));
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
comboOptions->setProperty("toolTip", QVariant(QApplication::translate("deleteIndexForm", "Choose the index to delete", 0, QApplication::UnicodeUTF8)));
|
||||
#endif // QT_NO_TOOLTIP
|
||||
#ifndef QT_NO_WHATSTHIS
|
||||
comboOptions->setProperty("whatsThis", QVariant(QApplication::translate("deleteIndexForm", "Use this control to select the name of the index to be deleted", 0, QApplication::UnicodeUTF8)));
|
||||
#endif // QT_NO_WHATSTHIS
|
||||
buttonDelete->setText(QApplication::translate("deleteIndexForm", "Delete", 0, QApplication::UnicodeUTF8));
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
buttonDelete->setProperty("toolTip", QVariant(QApplication::translate("deleteIndexForm", "Delete the selected index", 0, QApplication::UnicodeUTF8)));
|
||||
#endif // QT_NO_TOOLTIP
|
||||
buttonCancel->setText(QApplication::translate("deleteIndexForm", "Cancel", 0, QApplication::UnicodeUTF8));
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
buttonCancel->setProperty("toolTip", QVariant(QApplication::translate("deleteIndexForm", "Cancel and close dialog box", 0, QApplication::UnicodeUTF8)));
|
||||
#endif // QT_NO_TOOLTIP
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class deleteIndexForm: public Ui_deleteIndexForm {};
|
||||
} // namespace Ui
|
||||
|
||||
class deleteIndexForm : public QDialog, public Ui::deleteIndexForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
deleteIndexForm(QWidget* parent = 0, Qt::WindowFlags fl = Qt::Window);
|
||||
~deleteIndexForm();
|
||||
|
||||
QString option;
|
||||
|
||||
public slots:
|
||||
virtual void confirmDelete();
|
||||
virtual void populateOptions( QStringList entries );
|
||||
|
||||
protected slots:
|
||||
virtual void languageChange();
|
||||
|
||||
};
|
||||
|
||||
#endif // DELETEINDEXFORM_H
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <QDragEnterEvent>
|
||||
#include <QScrollBar>
|
||||
#include "CreateIndexForm.h"
|
||||
#include "DeleteIndexForm.h"
|
||||
#include "DialogAbout.h"
|
||||
#include "EditTableForm.h"
|
||||
#include "EditFieldForm.h"
|
||||
@@ -640,31 +639,6 @@ void MainWindow::editTable()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::deleteIndex()
|
||||
{
|
||||
if (!db.isOpen()){
|
||||
QMessageBox::information( this, QApplication::applicationName(), "There is no database opened." );
|
||||
return;
|
||||
}
|
||||
deleteIndexForm dialog(this);
|
||||
dialog.populateOptions(db.getIndexNames());
|
||||
if(dialog.exec())
|
||||
{
|
||||
QString statement = "DROP INDEX ";
|
||||
statement.append(dialog.option);
|
||||
statement.append(";");
|
||||
if (!db.executeSQL( statement)){
|
||||
QString error = "Error: could not delete the index. Message from database engine: ";
|
||||
error.append(db.lastErrorMessage);
|
||||
QMessageBox::warning( this, QApplication::applicationName(), error );
|
||||
} else {
|
||||
populateStructure();
|
||||
resetBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::copy()
|
||||
{
|
||||
QWidget * t = ui->dataTable->cellWidget(ui->dataTable->currentRow(), ui->dataTable->currentColumn());
|
||||
@@ -1083,13 +1057,15 @@ void MainWindow::on_tree_selection_changed()
|
||||
return;
|
||||
|
||||
// Change the text of the actions
|
||||
ui->editDeleteObjectAction->setText(tr("Delete Table"));
|
||||
ui->editDeleteObjectAction->setIcon(QIcon(QString(":icons/%1_delete").arg(ui->dbTreeWidget->currentItem()->text(1))));
|
||||
if(ui->dbTreeWidget->currentItem()->text(1) == "view")
|
||||
ui->editDeleteObjectAction->setText(tr("Delete View"));
|
||||
else if(ui->dbTreeWidget->currentItem()->text(1) == "trigger")
|
||||
ui->editDeleteObjectAction->setText(tr("Delete Trigger"));
|
||||
else if(ui->dbTreeWidget->currentItem()->text(1) == "index")
|
||||
ui->editDeleteObjectAction->setText(tr("Delete Index"));
|
||||
else
|
||||
ui->editDeleteObjectAction->setText(tr("Delete Table"));
|
||||
|
||||
// Activate actions
|
||||
if(ui->dbTreeWidget->currentItem()->text(1) == "table")
|
||||
@@ -1217,7 +1193,6 @@ void MainWindow::activateFields(bool enable)
|
||||
ui->fileImportCSVAction->setEnabled(enable);
|
||||
ui->editCreateTableAction->setEnabled(enable);
|
||||
ui->editCreateIndexAction->setEnabled(enable);
|
||||
ui->editDeleteIndexAction->setEnabled(enable);
|
||||
ui->buttonNext->setEnabled(enable);
|
||||
ui->buttonPrevious->setEnabled(enable);
|
||||
ui->executeQueryButton->setEnabled(enable);
|
||||
|
||||
@@ -94,7 +94,6 @@ public slots:
|
||||
virtual void compact();
|
||||
virtual void deleteObject();
|
||||
virtual void editTable();
|
||||
virtual void deleteIndex();
|
||||
virtual void copy();
|
||||
virtual void paste();
|
||||
virtual void helpWhatsThis();
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>763</width>
|
||||
<width>354</width>
|
||||
<height>653</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -972,11 +972,11 @@
|
||||
<string>&Edit</string>
|
||||
</property>
|
||||
<addaction name="editCreateTableAction"/>
|
||||
<addaction name="editDeleteObjectAction"/>
|
||||
<addaction name="editModifyTableAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="editDeleteObjectAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="editCreateIndexAction"/>
|
||||
<addaction name="editDeleteIndexAction"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="viewMenu">
|
||||
<property name="title">
|
||||
@@ -1252,21 +1252,6 @@
|
||||
<string>Open the Create Index wizard, where it is possible to define a new index on an existing database table.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="editDeleteIndexAction">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
<normaloff>:/icons/index_delete</normaloff>:/icons/index_delete</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete Index</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Open the Delete Index wizard, where you can select a database index to be dropped.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="viewPreferencesAction">
|
||||
<property name="icon">
|
||||
<iconset resource="icons/icons.qrc">
|
||||
@@ -1822,22 +1807,6 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>editDeleteIndexAction</sender>
|
||||
<signal>activated()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>deleteIndex()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
<y>299</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>editCreateIndexAction</sender>
|
||||
<signal>activated()</signal>
|
||||
|
||||
@@ -16,7 +16,6 @@ HEADERS += \
|
||||
sqlite_source/sqlite3.h \
|
||||
SQLLogDock.h \
|
||||
CreateIndexForm.h \
|
||||
DeleteIndexForm.h \
|
||||
DialogAbout.h \
|
||||
EditFieldForm.h \
|
||||
EditForm.h \
|
||||
@@ -35,7 +34,6 @@ SOURCES += \
|
||||
SQLLogDock.cpp \
|
||||
main.cpp \
|
||||
CreateIndexForm.cpp \
|
||||
DeleteIndexForm.cpp \
|
||||
DialogAbout.cpp \
|
||||
EditFieldForm.cpp \
|
||||
EditForm.cpp \
|
||||
|
||||
Reference in New Issue
Block a user