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

#include <kuniqueapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <klocale.h>
#include <dcopclient.h>
#include "%{APPNAMELC}.h"

static const char description[] =
    I18N_NOOP("A TDE KPart Application");

static const char version[] = "0.1";

static KCmdLineOptions options[] =
{
    KCmdLineLastOption
};

int main (int argc, char *argv[])
{
	KLocale::setMainCatalogue("tdelibs");
	TDEAboutData aboutdata("%{APPNAMELC}", I18N_NOOP("TDE"),
				version, description,
				TDEAboutData::License_GPL, "(C) %{YEAR}, %{AUTHOR}");
	aboutdata.addAuthor("%{AUTHOR}",I18N_NOOP("Developer"),"%{EMAIL}");

	TDECmdLineArgs::init( argc, argv, &aboutdata );
	TDECmdLineArgs::addCmdLineOptions( options );
	KUniqueApplication::addCmdLineOptions();

	if (!KUniqueApplication::start())
	{
		kdDebug() << "%{APPNAMELC} is already running!" << endl;
		return (0);
	}

	KUniqueApplication app;
	kdDebug() << "starting %{APPNAMELC} " << endl;
	// This app is started automatically, no need for session management
	app.disableSessionManagement();
	%{APPNAME} *service = new %{APPNAME};
	kdDebug() << "starting %{APPNAMELC} " << endl;
	return app.exec();

}