summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-28 09:02:01 (UTC)
committer paule <paule>2007-01-28 09:02:01 (UTC)
commit67b8a6e01fd3e47227f8bafa21077506fa55568c (patch) (side-by-side diff)
treedb7b7eedaad723d47211f58b9ce20d601f08cf4b
parent99a72804434360cfef9d807c26fa0b02e5aa28cd (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/remote/configtab.cpp17
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)
cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
}
}
}
objList = channelGroupConf->children();
for(obj = ((QObjectList *)objList)->first(); obj != 0; obj=((QObjectList *)objList)->next())
{
if(obj->inherits("QPushButton"))
{
if(!cfg->hasKey((QString)obj->name()+"Label"))
{
cfg->writeEntry((QString)obj->name()+"Label", ((QPushButton *)obj)->text());
}
}
}
cfg->write();
cfg->setGroup("Remotes");
QString curr_remote = topGroupConf->getRemotesText();
if(curr_remote != "")
remoteSelected(curr_remote);
}
-/*
-void ConfigTab::savePressed()
-{
- cfg->setGroup(remotes->currentText());
- ButtonDialog *bd = new ButtonDialog(this, "BD", true, 0);
- if( bd->exec() == 1)
- {
- printf("%s\n", bd->getList().join(" ").latin1());
- }
-}
-*/
void ConfigTab::newPressed()
{
QStringList list;
QString newname = topGroupConf->getRemotesText();
- if(newname=="Remotes")
- QMessageBox::warning(this, tr("Error"), tr("The name 'Remotes' is not allowed"), QMessageBox::Ok, QMessageBox::NoButton);
+ if(newname.stripWhiteSpace()=="")
+ QMessageBox::warning(this, tr("Error"), tr("Please enter a name\nfirst"), QMessageBox::Ok, QMessageBox::NoButton);
+ else if(newname=="Remotes")
+ QMessageBox::warning(this, tr("Error"), tr("The name 'Remotes' is\nnot allowed"), QMessageBox::Ok, QMessageBox::NoButton);
else {
cfg->setGroup("Remotes");
list=cfg->readListEntry("remoteList", ',');
if(list.findIndex(newname) == -1) {
list+=newname;
cfg->writeEntry("remoteList", list, ',');
cfg->setGroup(newname);
topGroupConf->updateRemotes(QStringList(newname) );
cfg->write();
emit remotesChanged();
remoteSelected(newname);
}
else {
QMessageBox::warning(this, tr("Already exists"), tr("A layout named %1\nalready exists").arg(newname), QMessageBox::Ok, QMessageBox::NoButton);
// Re-select existing layout
remoteSelected(newname);
}
}
}
void ConfigTab::remoteSelected(const QString &string)
{
cfg->setGroup(string);
const QObject *obj;