summaryrefslogtreecommitdiffstats
path: root/src/kvilib/ext/kvi_dcophelper.h
blob: de605e37083b630c9f0cd246d8180cf6e2bf1ef8 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef _KVI_DCOPHELPER_H_
#define _KVI_DCOPHELPER_H_
//=============================================================================
//
//   File : kvi_dcophelper.h
//   Created on Sat 20 Jan 2007 12:35:21 by Alexander Stillich
//
//   This file is part of the KVIrc IRC client distribution
//   Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net>
//   Copyright (C) 2007 Alexander Stillich <torque at pltn dot org>
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "kvi_settings.h"
#include "kvi_qstring.h"
#include "kvi_qcstring.h"
#include "kvi_valuelist.h"

#ifdef COMPILE_KDE_SUPPORT

typedef KviValueList<KviQCString> KviQCStringList;

class KVILIB_API KviDCOPHelper
{

public:

	// Constructs a DCOP helper object.
	// bStartApp: tries to start application when a dcop call is about to be made and the app is not already running
	// szAppID: application name as seen by DCOP
	KviDCOPHelper(bool bStartApp, const KviQCString &szAppId);
	~KviDCOPHelper();

protected:

	KviQCString 	m_szAppId;
	bool 	m_bStartApp;

protected:

	bool 	ensureAppRunning(const QString &szApp);
	bool 	findRunningApp(const QString &szApp);
	bool 	startApp(const QString &szApp,int iWaitMSecs = 0);
	int 		detectApp(const QString &szApp,bool bStart,int iScoreWhenFound,int iScoreWhenStarted);

	// naming convention: [return value] Ret [argument type(s)] DCOPCall

	bool 	voidRetVoidDCOPCall(const KviQCString &szObj,const KviQCString &szFunc);
	bool 	voidRetIntDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,int iVal);
	bool 	voidRetIntBoolDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,int iVal, bool bVal);
	bool 	voidRetIntIntIntDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,int iVal1, int iVal2, int iVal3);
	bool 	voidRetBoolDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,bool bVal);
	bool 	voidRetStringDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,const QString &szVal);
	bool 	voidRetFloatDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,float fVal);
	bool 	stringRetVoidDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,QString &szRet);
	bool 	stringRetIntDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,QString &szRet,int iVal);
	bool 	intRetVoidDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,int &ret);
	bool 	intRetIntDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,int &ret, int iVal);
	bool 	boolRetVoidDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,bool &ret);

	bool		qvalueListIntRetIntDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,KviValueList<int> &ret, int iVal);
	bool		qcstringListRetIntDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,KviQCStringList &ret, int iVal);
	bool		qcstringListRetVoidDCOPCall(const KviQCString &szObj,const KviQCString &szFunc,KviQCStringList &ret);
};

#endif //COMPILE_KDE_SUPPORT

#endif // _KVI_DCOPHELPER_H_