Removed message box and status message instead

This commit is contained in:
Peter Morgan
2010-10-05 03:56:33 +01:00
parent a6ea30d015
commit d0b1e34a6f
2 changed files with 22 additions and 9 deletions
@@ -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){
+12 -5
View File
@@ -15,7 +15,7 @@
#include <QtCore/QVariant>
#include <QtGui/QGroupBox>
#include <Qt3Support/Q3Header>
//#include <Qt3Support/Q3Header>
#include <QtGui/QTreeWidget>
#include <QtGui/QTreeWidgetItem>
@@ -33,8 +33,10 @@
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QSpacerItem>
//#include <QtGui/QSpacerItem>
#include <QtGui/QStatusBar>
#include <QtGui/QVBoxLayout>
#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);