summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/remote/configtab.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/noncore/tools/remote/configtab.cpp b/noncore/tools/remote/configtab.cpp
index 17cdc6a..ebfba2e 100644
--- a/noncore/tools/remote/configtab.cpp
+++ b/noncore/tools/remote/configtab.cpp
@@ -99,2 +99,6 @@ void ConfigTab::setConfig(Config *newCfg)
cfg->setGroup("Remotes");
+
+ QString curr_remote = topGroupConf->getRemotesText();
+ if(curr_remote != "")
+ remoteSelected(curr_remote);
}
@@ -115,11 +119,23 @@ 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);
+ else {
cfg->setGroup("Remotes");
list=cfg->readListEntry("remoteList", ',');
- list+=topGroupConf->getRemotesText();
+ if(list.findIndex(newname) == -1) {
+ list+=newname;
cfg->writeEntry("remoteList", list, ',');
- cfg->setGroup(topGroupConf->getRemotesText());
- topGroupConf->updateRemotes(QStringList(topGroupConf->getRemotesText()) );
+ cfg->setGroup(newname);
+ topGroupConf->updateRemotes(QStringList(newname) );
cfg->write();
emit remotesChanged();
- remoteSelected(topGroupConf->getRemotesText());
+ 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);
+ }
+ }
}
@@ -209,8 +225,9 @@ void ConfigTab::buttonPressed()
- ButtonDialog *bd = new ButtonDialog(((QPushButton *)button)->text(), this, "BD", true, 0);
+ QString action = cfg->readEntry(string);
+
+ ButtonDialog *bd = new ButtonDialog(((QPushButton *)button)->text(), action, this, "BD", true, 0);
if( bd->exec() == 1)
{
- cfg->writeEntry(string, bd->getList().join(" ").latin1());
+ cfg->writeEntry(string, bd->getAction().latin1());
cfg->writeEntry(string+"Label", bd->getLabel().latin1());
- }
cfg->write();
@@ -218 +235,4 @@ void ConfigTab::buttonPressed()
}
+
+ delete bd;
+}