Small fix to log window item clicking.
[jenirok] / src / gui / buttonselector.cpp
index 6ba49da..14534ef 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <QtGui/QStandardItem>
+#include <QtCore/QDebug>
 #include "buttonselector.h"
 
 ButtonSelector::ButtonSelector(QString const& text, QWidget* parent):
@@ -24,6 +25,7 @@ QMaemo5ValueButton(text, parent), selector_(0), model_(0)
 {
     setValueLayout(QMaemo5ValueButton::ValueBesideText);
     selector_ = new QMaemo5ListPickSelector(this);
+    connect(selector_, SIGNAL(selected(QString const&)), this, SLOT(onSelected(QString const&)));
     model_ = new QStandardItemModel(0, 1);
     selector_->setModel(model_);
     setPickSelector(selector_);
@@ -46,6 +48,7 @@ void ButtonSelector::addItem(QString const& text, QVariant const& value)
     {
         selector_->setCurrentIndex(0);
     }
+
 }
 
 void ButtonSelector::clear()
@@ -114,7 +117,7 @@ QVariant ButtonSelector::value() const
 bool ButtonSelector::changeItem(unsigned int index,
                                 QString const& text)
 {
-    changeItem(index, text, QVariant(text));
+    return changeItem(index, text, QVariant(text));
 }
 
 bool ButtonSelector::changeItem(unsigned int index,
@@ -138,3 +141,8 @@ bool ButtonSelector::removeItem(unsigned int index)
 {
     return model_->removeRow(index);
 }
+
+void ButtonSelector::onSelected(QString const& text)
+{
+    emit selected(currentIndex(), text, value());
+}