diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2013-05-17 12:45:40 -0500 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2013-05-17 12:45:40 -0500 |
commit | 359294c33620c8328d61f67635046d7cc060530c (patch) | |
tree | f2ac08fdad8860f7bc1ac76203e31013a799fda7 /tdelirc/tdelirc/iractions.cpp | |
parent | 7be7990fc5770d2cbcd937772e8239167b5900c6 (diff) | |
download | tdeutils-359294c33620c8328d61f67635046d7cc060530c.tar.gz tdeutils-359294c33620c8328d61f67635046d7cc060530c.zip |
Rename kdessh -> tdessh and kdelirc -> tdelirc.
Diffstat (limited to 'tdelirc/tdelirc/iractions.cpp')
-rw-r--r-- | tdelirc/tdelirc/iractions.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tdelirc/tdelirc/iractions.cpp b/tdelirc/tdelirc/iractions.cpp new file mode 100644 index 0000000..85d144e --- /dev/null +++ b/tdelirc/tdelirc/iractions.cpp @@ -0,0 +1,90 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <tdeconfig.h> +#include <kdebug.h> + +#include "iractions.h" +#include "iraction.h" + +void IRActions::loadFromConfig(TDEConfig &theConfig) +{ + clear(); + int numBindings = theConfig.readNumEntry("Bindings"); + for(int i = 0; i < numBindings; i++) + addAction(IRAction().loadFromConfig(theConfig, i)); +} + +void IRActions::purgeAllBindings(TDEConfig &theConfig) +{ + int numBindings = theConfig.readNumEntry("Bindings"); + for(int i = 0; i < numBindings; i++) + { TQString Binding = "Binding" + TQString().setNum(i); + int numArguments = theConfig.readNumEntry(Binding + "Arguments"); + for(int j = 0; j < numArguments; j++) + { theConfig.deleteEntry(Binding + "Argument" + TQString().setNum(j)); + theConfig.deleteEntry(Binding + "ArgumentType" + TQString().setNum(j)); + } + theConfig.deleteEntry(Binding + "Arguments"); theConfig.deleteEntry(Binding + "Program"); + theConfig.deleteEntry(Binding + "Object"); theConfig.deleteEntry(Binding + "Method"); + theConfig.deleteEntry(Binding + "Remote"); theConfig.deleteEntry(Binding + "Button"); + theConfig.deleteEntry(Binding + "Repeat"); theConfig.deleteEntry(Binding + "Mode"); + } +} + +void IRActions::saveToConfig(TDEConfig &theConfig) +{ + int index = 0; + purgeAllBindings(theConfig); + for(iterator i = begin(); i != end(); ++i,index++) + (*i).saveToConfig(theConfig, index); + theConfig.writeEntry("Bindings", index); +} + +IRAIt IRActions::addAction(const IRAction &theAction) +{ + return append(theAction); +} + +IRAItList IRActions::findByButton(const TQString &remote, const TQString &button) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == remote && (*i).button() == button) + ret += i; + return ret; +} + +void IRActions::renameMode(const Mode &mode, const TQString &to) +{ + for(iterator i = begin(); i != end(); ++i) + { if((*i).remote() == mode.remote() && (*i).mode() == mode.name()) (*i).setMode(to); + if((*i).isModeChange() && (*i).modeChange() == mode.name()) (*i).setModeChange(to); + } +} + +IRAItList IRActions::findByMode(const Mode &mode) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == mode.remote() && (*i).mode() == mode.name()) ret += i; + return ret; +} + +IRAItList IRActions::findByModeButton(const Mode &mode, const TQString &button) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == mode.remote() && (*i).mode() == mode.name() && (*i).button() == button) + ret += i; + return ret; +} |