summaryrefslogtreecommitdiffstats
path: root/kdelirc/kdelirc/mode.cpp
blob: cd0dc4cd3fea5893c8025fd61e78d4f087698a42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Gav Wood <gav@kde.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//

#include <kconfig.h>

#include "modes.h"
#include "mode.h"

Mode::Mode() : theName(TQString())
{
}

Mode::Mode(const TQString &remote, const TQString &name, const TQString &iconFile)
{
	theRemote = remote;
	theName = name;
	theIconFile = iconFile;
}

Mode::~Mode()
{
}

const Mode &Mode::loadFromConfig(KConfig &theConfig, int index)
{
	TQString Prefix = "Mode" + TQString().setNum(index);
	theName = theConfig.readEntry(Prefix + "Name");
	theRemote = theConfig.readEntry(Prefix + "Remote");
	theIconFile = theConfig.readEntry(Prefix + "IconFile");
	if(theIconFile.isEmpty()) theIconFile = TQString();
	return *this;
}

void Mode::saveToConfig(KConfig &theConfig, int index)
{
	TQString Prefix = "Mode" + TQString().setNum(index);
	theConfig.writeEntry(Prefix + "Name", theName);
	theConfig.writeEntry(Prefix + "Remote", theRemote);
	theConfig.writeEntry(Prefix + "IconFile", theIconFile);
}