]> Shamusworld >> Repos - schematic/commitdiff
Added error messages to SQL Connection dialog.
authorShamus Hammons <jlhamm@acm.org>
Wed, 3 Oct 2012 15:18:48 +0000 (10:18 -0500)
committerShamus Hammons <jlhamm@acm.org>
Wed, 3 Oct 2012 15:18:48 +0000 (10:18 -0500)
src/mainwin.cpp
src/sqlsettingsdialog.cpp
src/sqlsettingsdialog.h

index c360a4eaa7a89ad6186716904f5022180a71a781..d4531034c95712f6423f5906bcfcd90de5a00b0b 100644 (file)
@@ -135,12 +135,14 @@ db.setPassword("xcdr");
                db.setPassword(dbPassword);
                ok = db.open();
 
-//printf("Error: %s\n", db.lastError().databaseText().toAscii().data());
-//printf("Error: %s\n", db.lastError().driverText().toAscii().data());
-
                // If unsuccessful, run the SQL settings/test dialog
                if (!ok)
                {
+//printf("Error: %s\n", db.lastError().databaseText().toAscii().data());
+//printf("Error: %s\n", db.lastError().driverText().toAscii().data());
+                       sqlSettings.error1->setText(db.lastError().databaseText());
+                       sqlSettings.error2->setText(db.lastError().driverText());
+
                        if (sqlSettings.exec())
                        {
                                // User thinks this will work (hit OK button), so prime the variables
index 0decb0346675fe3e6e9e25b11600ef5cb873fdd8..6a9eecadf6b50a7eba75292d4c0cafcb20f73522 100644 (file)
@@ -19,12 +19,16 @@ SQLSettingsDialog::SQLSettingsDialog(QWidget * parent/*= 0*/): QDialog(parent),
        edit2(new QLineEdit()),
        edit3(new QLineEdit()),
        edit4(new QLineEdit()),
-       edit5(new QLineEdit())
+       edit5(new QLineEdit()),
+       error1(new QLabel()),
+       error2(new QLabel())
 {
        connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
        connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
 
        edit5->setEchoMode(QLineEdit::Password);
+       error1->setWordWrap(true);
+       error2->setWordWrap(true);
 
        QFormLayout * formLayout = new QFormLayout;
        formLayout->addRow(tr("&Database Driver:"), edit1);
@@ -35,6 +39,8 @@ SQLSettingsDialog::SQLSettingsDialog(QWidget * parent/*= 0*/): QDialog(parent),
 
        QVBoxLayout * mainLayout = new QVBoxLayout;
        mainLayout->addLayout(formLayout);
+       mainLayout->addWidget(error1);
+       mainLayout->addWidget(error2);
        mainLayout->addWidget(buttonBox);
        setLayout(mainLayout);
 
index e72a1ee6101a27215f05cac8db63d21f62c99c22..bb4e46d113a678e327ca26c3d9ee2f4f7b00af16 100644 (file)
@@ -22,6 +22,8 @@ class SQLSettingsDialog: public QDialog
                QLineEdit * edit3;
                QLineEdit * edit4;
                QLineEdit * edit5;
+               QLabel * error1;
+               QLabel * error2;
 };
 
 #endif // __SQLSETTINGSDIALOG_H__