kdelirc
mode.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <kconfig.h>
00015
00016 #include "modes.h"
00017 #include "mode.h"
00018
00019 Mode::Mode() : theName(QString::null)
00020 {
00021 }
00022
00023 Mode::Mode(const QString &remote, const QString &name, const QString &iconFile)
00024 {
00025 theRemote = remote;
00026 theName = name;
00027 theIconFile = iconFile;
00028 }
00029
00030 Mode::~Mode()
00031 {
00032 }
00033
00034 const Mode &Mode::loadFromConfig(KConfig &theConfig, int index)
00035 {
00036 QString Prefix = "Mode" + QString().setNum(index);
00037 theName = theConfig.readEntry(Prefix + "Name",QString());
00038 theRemote = theConfig.readEntry(Prefix + "Remote",QString());
00039 theIconFile = theConfig.readEntry(Prefix + "IconFile",QString());
00040 if(theIconFile.isEmpty()) theIconFile = QString();
00041 return *this;
00042 }
00043
00044 void Mode::saveToConfig(KConfig &theConfig, int index)
00045 {
00046 QString Prefix = "Mode" + QString().setNum(index);
00047 theConfig.writeEntry(Prefix + "Name", theName);
00048 theConfig.writeEntry(Prefix + "Remote", theRemote);
00049 theConfig.writeEntry(Prefix + "IconFile", theIconFile);
00050 }
00051