author | paule <paule> | 2007-01-28 09:02:01 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-28 09:02:01 (UTC) |
commit | 67b8a6e01fd3e47227f8bafa21077506fa55568c (patch) (unidiff) | |
tree | db7b7eedaad723d47211f58b9ce20d601f08cf4b | |
parent | 99a72804434360cfef9d807c26fa0b02e5aa28cd (diff) | |
download | opie-67b8a6e01fd3e47227f8bafa21077506fa55568c.zip opie-67b8a6e01fd3e47227f8bafa21077506fa55568c.tar.gz opie-67b8a6e01fd3e47227f8bafa21077506fa55568c.tar.bz2 |
Don't allow creating remote layouts with a blank name; remove old commented out code
-rw-r--r-- | noncore/tools/remote/configtab.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/noncore/tools/remote/configtab.cpp b/noncore/tools/remote/configtab.cpp index ebfba2e..af2b5ff 100644 --- a/noncore/tools/remote/configtab.cpp +++ b/noncore/tools/remote/configtab.cpp | |||
@@ -81,66 +81,57 @@ void ConfigTab::setConfig(Config *newCfg) | |||
81 | cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text()); | 81 | cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text()); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | objList = channelGroupConf->children(); | 86 | objList = channelGroupConf->children(); |
87 | for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) | 87 | for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) |
88 | { | 88 | { |
89 | if(obj->inherits("QPushButton")) | 89 | if(obj->inherits("QPushButton")) |
90 | { | 90 | { |
91 | if(!cfg->hasKey((QString)obj->name()+"Label")) | 91 | if(!cfg->hasKey((QString)obj->name()+"Label")) |
92 | { | 92 | { |
93 | cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text()); | 93 | cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text()); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
97 | cfg->write(); | 97 | cfg->write(); |
98 | 98 | ||
99 | cfg->setGroup("Remotes"); | 99 | cfg->setGroup("Remotes"); |
100 | 100 | ||
101 | QString curr_remote = topGroupConf->getRemotesText(); | 101 | QString curr_remote = topGroupConf->getRemotesText(); |
102 | if(curr_remote != "") | 102 | if(curr_remote != "") |
103 | remoteSelected(curr_remote); | 103 | remoteSelected(curr_remote); |
104 | } | 104 | } |
105 | /* | ||
106 | void ConfigTab::savePressed() | ||
107 | { | ||
108 | cfg->setGroup(remotes->currentText()); | ||
109 | ButtonDialog *bd = new ButtonDialog(this, "BD", true, 0); | ||
110 | if( bd->exec() == 1) | ||
111 | { | ||
112 | printf("%s\n", bd->getList().join(" ").latin1()); | ||
113 | } | ||
114 | } | ||
115 | */ | ||
116 | 105 | ||
117 | void ConfigTab::newPressed() | 106 | void ConfigTab::newPressed() |
118 | { | 107 | { |
119 | QStringList list; | 108 | QStringList list; |
120 | QString newname = topGroupConf->getRemotesText(); | 109 | QString newname = topGroupConf->getRemotesText(); |
121 | if(newname=="Remotes") | 110 | if(newname.stripWhiteSpace()=="") |
122 | QMessageBox::warning(this, tr("Error"), tr("The name 'Remotes' is not allowed"), QMessageBox::Ok, QMessageBox::NoButton); | 111 | QMessageBox::warning(this, tr("Error"), tr("Please enter a name\nfirst"), QMessageBox::Ok, QMessageBox::NoButton); |
112 | else if(newname=="Remotes") | ||
113 | QMessageBox::warning(this, tr("Error"), tr("The name 'Remotes' is\nnot allowed"), QMessageBox::Ok, QMessageBox::NoButton); | ||
123 | else { | 114 | else { |
124 | cfg->setGroup("Remotes"); | 115 | cfg->setGroup("Remotes"); |
125 | list=cfg->readListEntry("remoteList", ','); | 116 | list=cfg->readListEntry("remoteList", ','); |
126 | if(list.findIndex(newname) == -1) { | 117 | if(list.findIndex(newname) == -1) { |
127 | list+=newname; | 118 | list+=newname; |
128 | cfg->writeEntry("remoteList", list, ','); | 119 | cfg->writeEntry("remoteList", list, ','); |
129 | cfg->setGroup(newname); | 120 | cfg->setGroup(newname); |
130 | topGroupConf->updateRemotes(QStringList(newname) ); | 121 | topGroupConf->updateRemotes(QStringList(newname) ); |
131 | cfg->write(); | 122 | cfg->write(); |
132 | emit remotesChanged(); | 123 | emit remotesChanged(); |
133 | remoteSelected(newname); | 124 | remoteSelected(newname); |
134 | } | 125 | } |
135 | else { | 126 | else { |
136 | QMessageBox::warning(this, tr("Already exists"), tr("A layout named %1\nalready exists").arg(newname), QMessageBox::Ok, QMessageBox::NoButton); | 127 | QMessageBox::warning(this, tr("Already exists"), tr("A layout named %1\nalready exists").arg(newname), QMessageBox::Ok, QMessageBox::NoButton); |
137 | // Re-select existing layout | 128 | // Re-select existing layout |
138 | remoteSelected(newname); | 129 | remoteSelected(newname); |
139 | } | 130 | } |
140 | } | 131 | } |
141 | } | 132 | } |
142 | 133 | ||
143 | void ConfigTab::remoteSelected(const QString &string) | 134 | void ConfigTab::remoteSelected(const QString &string) |
144 | { | 135 | { |
145 | cfg->setGroup(string); | 136 | cfg->setGroup(string); |
146 | const QObject *obj; | 137 | const QObject *obj; |