summaryrefslogtreecommitdiffstats
path: root/languages/cpp/app_templates/dcopservice/dcopservice.cpp
blob: a23da01b5a60ff84bac63eab6255241922c3475f (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
%{CPP_TEMPLATE}

#include "%{APPNAMELC}.h"
#include <kdebug.h>
#include <kapplication.h>

%{APPNAME}::%{APPNAME}() : DCOPObject("serviceInterface")
{
	kdDebug() << "Starting new service... " << endl;
	m_List = QStringList();
}

%{APPNAME}::~%{APPNAME}()
{
	kdDebug() << "Going away... " << endl;
}

QString %{APPNAME}::string(int idx)
{
	return *m_List.at(idx);
}

QStringList %{APPNAME}::list()
{
	return m_List;
}

void %{APPNAME}::add(QString arg)
{
	kdDebug() << "Adding " << arg << " to the list" << endl;
	m_List << arg;
}

bool %{APPNAME}::remove(QString arg)
{
	QStringList::Iterator it = m_List.find(arg);
	if (it != m_List.end())
	{
		m_List.remove(it);
	}
	else
		return false;
	return true;
}

bool %{APPNAME}::exit()
{
	kapp->quit();
}