summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-31 09:12:36 (UTC)
committer paule <paule>2007-01-31 09:12:36 (UTC)
commite9c5c237e27d908c890779215b19c22a3706b614 (patch) (unidiff)
tree246a2447df7b7a1e4236d8dd8bd589041734a6a9
parent3a2db1ba1395a6d33de421ed5f3b04df53ced5bc (diff)
downloadopie-e9c5c237e27d908c890779215b19c22a3706b614.zip
opie-e9c5c237e27d908c890779215b19c22a3706b614.tar.gz
opie-e9c5c237e27d908c890779215b19c22a3706b614.tar.bz2
Don't allow configuring buttons with no remote layout selected
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/configtab.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/noncore/tools/remote/configtab.cpp b/noncore/tools/remote/configtab.cpp
index af2b5ff..7951772 100644
--- a/noncore/tools/remote/configtab.cpp
+++ b/noncore/tools/remote/configtab.cpp
@@ -166,64 +166,72 @@ void ConfigTab::remoteSelected(const QString &string)
166 else 166 else
167 { 167 {
168 cfg->setGroup("Default"); 168 cfg->setGroup("Default");
169 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 169 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
170 cfg->setGroup(string); 170 cfg->setGroup(string);
171 } 171 }
172 } 172 }
173 } 173 }
174 174
175 objList = vcrGroupConf->children(); 175 objList = vcrGroupConf->children();
176 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) 176 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
177 { 177 {
178 if(obj->inherits("QPushButton")) 178 if(obj->inherits("QPushButton"))
179 { 179 {
180 if(cfg->hasKey((QString)obj->name()+"Label")) 180 if(cfg->hasKey((QString)obj->name()+"Label"))
181 { 181 {
182 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 182 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
183 } 183 }
184 else 184 else
185 { 185 {
186 cfg->setGroup("Default"); 186 cfg->setGroup("Default");
187 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 187 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
188 cfg->setGroup(string); 188 cfg->setGroup(string);
189 } 189 }
190 } 190 }
191 } 191 }
192 192
193 objList = channelGroupConf->children(); 193 objList = channelGroupConf->children();
194 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next()) 194 for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
195 { 195 {
196 if(obj->inherits("QPushButton")) 196 if(obj->inherits("QPushButton"))
197 { 197 {
198 if(cfg->hasKey((QString)obj->name()+"Label")) 198 if(cfg->hasKey((QString)obj->name()+"Label"))
199 { 199 {
200 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 200 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
201 } 201 }
202 else 202 else
203 { 203 {
204 cfg->setGroup("Default"); 204 cfg->setGroup("Default");
205 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") ); 205 ((QPushButton *)obj)->setText(cfg->readEntry((QString)obj->name()+"Label") );
206 cfg->setGroup(string); 206 cfg->setGroup(string);
207 } 207 }
208 } 208 }
209 } 209 }
210} 210}
211 211
212void ConfigTab::buttonPressed() 212void ConfigTab::buttonPressed()
213{ 213{
214 QString curr_remote = topGroupConf->getRemotesText();
215 if(curr_remote != "")
216 cfg->setGroup(curr_remote);
217 else {
218 QMessageBox::warning(this, tr("Error"), tr("Please select or create\na remote layout"), QMessageBox::Ok, QMessageBox::NoButton);
219 return;
220 }
221
214 const QObject *button = sender(); 222 const QObject *button = sender();
215 QString string = button->name(); 223 QString string = button->name();
216 224
217 QString action = cfg->readEntry(string); 225 QString action = cfg->readEntry(string);
218 226
219 ButtonDialog *bd = new ButtonDialog(((QPushButton *)button)->text(), action, this, "BD", true, 0); 227 ButtonDialog *bd = new ButtonDialog(((QPushButton *)button)->text(), action, this, "BD", true, 0);
220 if( bd->exec() == 1) 228 if( bd->exec() == 1)
221 { 229 {
222 cfg->writeEntry(string, bd->getAction().latin1()); 230 cfg->writeEntry(string, bd->getAction().latin1());
223 cfg->writeEntry(string+"Label", bd->getLabel().latin1()); 231 cfg->writeEntry(string+"Label", bd->getLabel().latin1());
224 cfg->write(); 232 cfg->write();
225 ((QPushButton *)button)->setText(bd->getLabel()); 233 ((QPushButton *)button)->setText(bd->getLabel());
226 } 234 }
227 235
228 delete bd; 236 delete bd;
229} 237}