summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-28 06:41:22 (UTC)
committer paule <paule>2007-01-28 06:41:22 (UTC)
commitb17ca0982b26c0f18ccd3113906206f8fb49df2a (patch) (unidiff)
treec6e98cc4bdab06ed9b1c198badc185abbfe58088
parentec2309cb69365847762db542c41951629cd06cbe (diff)
downloadopie-b17ca0982b26c0f18ccd3113906206f8fb49df2a.zip
opie-b17ca0982b26c0f18ccd3113906206f8fb49df2a.tar.gz
opie-b17ca0982b26c0f18ccd3113906206f8fb49df2a.tar.bz2
Load in current button action on opening
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/buttondialog.cpp45
-rw-r--r--noncore/tools/remote/buttondialog.h6
2 files changed, 34 insertions, 17 deletions
diff --git a/noncore/tools/remote/buttondialog.cpp b/noncore/tools/remote/buttondialog.cpp
index 56738d1..7d03f27 100644
--- a/noncore/tools/remote/buttondialog.cpp
+++ b/noncore/tools/remote/buttondialog.cpp
@@ -18,3 +18,4 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18
19ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name, bool modal, WFlags f):QDialog(parent, name, modal, f) 19ButtonDialog::ButtonDialog(QString buttonName, QString action, QWidget *parent, const char*name, bool modal, WFlags f)
20: QDialog(parent, name, modal, f)
20{ 21{
@@ -45,3 +46,2 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name,
45 hlayout1->addSpacing(5); 46 hlayout1->addSpacing(5);
46 remote->insertItem("Remote ");
47 remote->insertStringList(lh->getRemotes()); 47 remote->insertStringList(lh->getRemotes());
@@ -56,4 +56,2 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name,
56 hlayout2->addSpacing(5); 56 hlayout2->addSpacing(5);
57 button->insertItem("Button ");
58 connect(button, SIGNAL(activated(const QString&)), this, SLOT(buttonSelected(const QString&)) );
59 57
@@ -67,2 +65,28 @@ ButtonDialog::ButtonDialog(QString buttonName, QWidget *parent, const char*name,
67 hlayout3->addSpacing(5); 65 hlayout3->addSpacing(5);
66
67 QStringList actionArgs = QStringList::split(' ', action);
68 if(actionArgs.count() > 1) {
69 // Remote
70 for(int i=0;i<remote->count();i++) {
71 if(remote->text(i) == actionArgs[1]) {
72 remote->setCurrentItem(i);
73 break;
74 }
75 }
76 }
77 // Populate the list of buttons
78 remoteSelected(remote->currentText());
79
80 if(actionArgs.count() > 2) {
81 // Button
82 for(int i=0;i<button->count();i++) {
83 if(button->text(i) == actionArgs[2]) {
84 button->setCurrentItem(i);
85 break;
86 }
87 }
88 }
89 else {
90 button->setCurrentItem(-1);
91 }
68} 92}
@@ -76,15 +100,10 @@ void ButtonDialog::remoteSelected(const QString &string)
76{ 100{
101 button->clear();
77 button->insertStringList(lh->getButtons(string.latin1()) ); 102 button->insertStringList(lh->getButtons(string.latin1()) );
78 list="SEND_ONCE";
79 list+=string;
80}
81
82void ButtonDialog::buttonSelected(const QString &string)
83{
84 list+=string;
85} 103}
86 104
87QStringList ButtonDialog::getList() 105QString ButtonDialog::getAction()
88{ 106{
89 return list; 107 QString action("SEND_ONCE " + remote->currentText() + " " + button->currentText());
108 return action;
90} 109}
diff --git a/noncore/tools/remote/buttondialog.h b/noncore/tools/remote/buttondialog.h
index cc697b5..f66903f 100644
--- a/noncore/tools/remote/buttondialog.h
+++ b/noncore/tools/remote/buttondialog.h
@@ -39,5 +39,5 @@ class ButtonDialog : public QDialog
39public: 39public:
40 ButtonDialog(QString buttonName, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0); 40 ButtonDialog(QString buttonName, QString action, QWidget *parent=0, const char*name=0, bool modal=FALSE, WFlags f=0);
41 ~ButtonDialog(); 41 ~ButtonDialog();
42 QStringList getList(); 42 QString getAction();
43 QString getLabel(); 43 QString getLabel();
@@ -45,3 +45,2 @@ public slots:
45 void remoteSelected(const QString &string); 45 void remoteSelected(const QString &string);
46 void buttonSelected(const QString &string);
47private: 46private:
@@ -49,3 +48,2 @@ private:
49 QComboBox *button; 48 QComboBox *button;
50 QStringList list;
51 QLineEdit *label; 49 QLineEdit *label;