change 'Connect' button to 'Listen' when appropriate
authorChristian Pulvermacher <christian@hazel.(none)>
Sun, 24 Oct 2010 13:36:28 +0000 (15:36 +0200)
committerChristian Pulvermacher <christian@hazel.(none)>
Sun, 24 Oct 2010 13:36:28 +0000 (15:36 +0200)
src/connectdialog.cpp
src/connectdialog.h

index 65efcb8..ec515d5 100644 (file)
@@ -78,7 +78,7 @@ ConnectDialog::ConnectDialog(QWidget *parent):
        hostnameUpdated(hosts.lineEdit()->text()); //get saved quality for last host, or 2
 #endif
 
-       QPushButton *done = new QPushButton(tr("Connect"));
+       done = new QPushButton(tr("Connect"));
        done->setMaximumWidth(110);
        connect(done, SIGNAL(clicked()),
                this, SLOT(accept()));
@@ -95,7 +95,10 @@ void ConnectDialog::indexChanged(int index) {
                return;
 
        //disallow editing for special entries (icon set)
-       hosts.setEditable(hosts.itemIcon(index).isNull());
+       const bool normal_entry = hosts.itemIcon(index).isNull();
+       hosts.setEditable(normal_entry);
+
+       done->setText(normal_entry ? tr("Connect") : tr("Listen"));
 }
 
 
index 8593a8d..d73c684 100644 (file)
@@ -38,6 +38,7 @@ private slots:
 private:
        QHBoxLayout layout;
        QStringList hostnames_sorted;
+       QPushButton *done;
        QComboBox hosts;
        QMaemo5ListPickSelector *quality_selector;
 };