summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorsenator <senator>2008-03-24 13:33:35 +0000
committersenator <senator>2008-03-24 13:33:35 +0000
commit917aea688614bd29568f7eb37efe8cbd2620b25c (patch)
tree568937b1a05890f5780500e5ae0696bd55cb1809 /client
parent2e87c4608a9fb888fd7669756d8cb457ac305f71 (diff)
Fixed isValid for combobox and radiobuttons
Diffstat (limited to 'client')
-rw-r--r--client/builder.cc5
-rw-r--r--client/macro.cc5
-rw-r--r--client/widgets/combobox.cc7
-rw-r--r--client/widgets/combobox.h1
-rw-r--r--client/widgets/radiobuttons.cc14
-rw-r--r--client/widgets/radiobuttons.h1
6 files changed, 25 insertions, 8 deletions
diff --git a/client/builder.cc b/client/builder.cc
index 29f58d0..b5a9928 100644
--- a/client/builder.cc
+++ b/client/builder.cc
@@ -130,9 +130,6 @@ bool Builder::doCommit()
while (i != widgets.end()) {
Widget* w = *i;
if(!w->isValid()) faulty++; // Regexp check, returns valid if entry passed
-
- // All selectable entries return "none" if nothing is selected
- //if(w->getValue() == "none") faulty++; // Faulty+1 if error detected
i++;
}
@@ -198,7 +195,7 @@ void Builder::commit()
void Builder::reset()
{
- int ret = QMessageBox::warning(NULL, tr("Reset"),
+ QMessageBox::warning(NULL, tr("Reset"),
tr("Du har valgt at nulstille de indtastede data.\n"
"Er du sikker?"),
QMessageBox::Yes | QMessageBox::Cancel);
diff --git a/client/macro.cc b/client/macro.cc
index 5e3b83d..3beb93d 100644
--- a/client/macro.cc
+++ b/client/macro.cc
@@ -67,10 +67,11 @@ void create_macro(QString name)
}
// Initiate the macro builder with the xml document
- Builder *builder = new Builder(&xml_doc);
+ new Builder(&xml_doc);
+ //Builder *builder = new Builder(&xml_doc);
}
-bool MyEventHandler::eventFilter( QObject *o, QEvent *e )
+bool MyEventHandler::eventFilter( QObject *, QEvent *e )
{
if ( e->type() == MY_EVENT_ID ) {
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index e60ea8e..29bf253 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -63,9 +63,14 @@ ComboBox::ComboBox(QDomNode node)
if(default_found == 0) setCurrentIndex(-1); // -1 is default for none selected
}
+bool ComboBox::isValid()
+{
+ return currentIndex() != -1;
+}
+
QString ComboBox::getValue()
{
- QString value = "none";
+ QString value;
if(currentIndex() != -1) value = itemData(currentIndex()).toString();
return value;
}
diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h
index f6baa67..a7f16c8 100644
--- a/client/widgets/combobox.h
+++ b/client/widgets/combobox.h
@@ -38,6 +38,7 @@ public:
ComboBox(QDomNode);
public slots:
+ bool isValid();
QString getValue();
private:
diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc
index dc79831..ccc5506 100644
--- a/client/widgets/radiobuttons.cc
+++ b/client/widgets/radiobuttons.cc
@@ -75,10 +75,22 @@ RadioButtons::RadioButtons(QDomNode node)
}
+bool RadioButtons::isValid()
+{
+ QVector< RadioButton* >::iterator i;
+ for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
+ RadioButton *widget = *i;
+ if(widget->isChecked()) {
+ return true;
+ }
+ }
+ return false;
+}
+
QString RadioButtons::getValue()
{
QVector< RadioButton* >::iterator i;
- QString value = "none";
+ QString value;
for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
RadioButton *widget = *i;
if(widget->isChecked()) {
diff --git a/client/widgets/radiobuttons.h b/client/widgets/radiobuttons.h
index 34e90ce..f84555f 100644
--- a/client/widgets/radiobuttons.h
+++ b/client/widgets/radiobuttons.h
@@ -41,6 +41,7 @@ public:
RadioButtons(QDomNode);
public slots:
+ bool isValid();
QString getValue();
private: