From d0b1e34a6fc01dcda5fabcbcbc1bd3e4303b3ba6 Mon Sep 17 00:00:00 2001 From: Peter Morgan Date: Tue, 5 Oct 2010 03:56:33 +0100 Subject: [PATCH] Removed message box and status message instead --- sqlitebrowser/sqlitebrowser/createtableform.cpp | 14 ++++++++++---- sqlitebrowser/sqlitebrowser/createtableform.h | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/sqlitebrowser/sqlitebrowser/createtableform.cpp b/sqlitebrowser/sqlitebrowser/createtableform.cpp index c9971b86..06c47708 100644 --- a/sqlitebrowser/sqlitebrowser/createtableform.cpp +++ b/sqlitebrowser/sqlitebrowser/createtableform.cpp @@ -50,18 +50,20 @@ void createTableForm::confirmCreate() QString tabname = tablenameLineEdit->text(); if (tabname.isEmpty()) { ok = false; - QMessageBox::information( this, applicationName, "Please select a name for the table" ); + statusBar->showMessage("Please enter a name for the table", 4000); + tablenameLineEdit->setFocus(); return; } if (tabname.contains(" ")>0) { ok = false; - QMessageBox::warning( this, applicationName, "Spaces are not allowed in the table name" ); + statusBar->showMessage("Spaces are not allowed in the table name", 4000); + tablenameLineEdit->setFocus(); return; } if (treeWidget->invisibleRootItem()->childCount() == 0) { ok = false; - QMessageBox::information( this, applicationName, "No fields defined" ); + statusBar->showMessage("No fields defined", 4000); return; } @@ -87,12 +89,16 @@ void createTableForm::confirmCreate() } if (ok){ + //QString esc("\""); + // #TODO The colnames need to be escaped eg create table 'group' createStatement = "CREATE TABLE "; + //createStatement.append(esc).append(tabname).append(esc); createStatement.append(tabname); createStatement.append(" ("); for(int i = 0; i < treeWidget->invisibleRootItem()->childCount(); i++){ QTreeWidgetItem *item = treeWidget->invisibleRootItem()->child(i); - createStatement.append(item->text(0)); + //createStatement.append(esc).append(item->text(0)).append(esc); + createStatement.append( item->text(0) ); createStatement.append(" "); createStatement.append(item->text(1)); if(i < treeWidget->invisibleRootItem()->childCount() -1){ diff --git a/sqlitebrowser/sqlitebrowser/createtableform.h b/sqlitebrowser/sqlitebrowser/createtableform.h index d2c8202d..43017d38 100644 --- a/sqlitebrowser/sqlitebrowser/createtableform.h +++ b/sqlitebrowser/sqlitebrowser/createtableform.h @@ -15,7 +15,7 @@ #include #include -#include +//#include #include #include @@ -33,8 +33,10 @@ #include #include #include -#include +//#include +#include #include + #include "sqlitedb.h" QT_BEGIN_NAMESPACE @@ -61,6 +63,8 @@ public: QPushButton *buttonCreate; QPushButton *buttonCancel; + QStatusBar *statusBar; + void setupUi(QDialog *createTableForm) { if (createTableForm->objectName().isEmpty()){ @@ -72,13 +76,14 @@ public: //** Main Layout mainVBoxLayout = new QVBoxLayout(createTableForm); - mainVBoxLayout->setSpacing(6); - mainVBoxLayout->setContentsMargins(11, 11, 11, 11); + mainVBoxLayout->setSpacing(10); + mainVBoxLayout->setContentsMargins(0, 0, 0, 0); mainVBoxLayout->setObjectName(QString::fromUtf8("vboxLayout")); //**** Top Table Box **** topTableLayout = new QHBoxLayout(); - topTableLayout->setSpacing(6); + topTableLayout->setSpacing(10); + topTableLayout->setContentsMargins(10,10,10,10); //topTableLayout->setObjectName(QString::fromUtf8("hboxLayout")); textLabel1 = new QLabel(createTableForm); //textLabel1->setObjectName(QString::fromUtf8("textLabel1")); @@ -150,6 +155,8 @@ public: bottomButtonLayout->addWidget(buttonCreate); mainVBoxLayout->addLayout(bottomButtonLayout); + statusBar = new QStatusBar(); + mainVBoxLayout->addWidget(statusBar); //** Setup retranslateUi(createTableForm);