summaryrefslogtreecommitdiffstats
path: root/korn/dcop_proto.h
blob: cb92b8bf9006a387cdb25ff228a2c6c56d82adee (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Copyright (C) 2005, Mart Kelder (mart.kde@hccnet.nl)
*
* 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 option) 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
*/


#ifndef DCOP_PROTO_H
#define DCOP_PROTO_H

#include "protocol.h"

class AccountInput;
class KConfigGroup;
class KIO_Protocol;
class KMailDrop;
class Protocol;

class QGroupBox;
class QObject;
class QStringList;
class QWidget;

template< class T> class QPtrList;
template< class T> class QPtrVector;
template< class T, class S> class QMap;

#include <qstring.h>

/**
 * This class implements a DCOP-protocol.
 * DCOP can be used to add messages to a box, or delete created dcop-messages.
 * This can be usefull in scripts.
 */
class DCOP_Protocol : public Protocol
{
public:
	/**
	 * Constructor
	 */
	DCOP_Protocol() {}
	/**
	 * Destructor
	 */
	virtual ~DCOP_Protocol() {}

	/**
	 * This function returns a Protocol pointer given a configuration.
	 * This function always returns itselfs, as the configuration never uses another protocol.
	 */
	virtual const Protocol* getProtocol( KConfigGroup* ) const { return this; }
	/**
	 * This function creates the maildrop used to count dcop-messages.
	 * @param config The configuration
	 */
	virtual KMailDrop* createMaildrop( KConfigGroup* config ) const;
	/**
	 * The function converts the information of the configuration file into a mapping.
	 *
	 * @param config The configuration instance to be mapped
	 * @return The keys and values of the configuration in a mapping
	 */
	virtual QMap< QString, QString > * createConfig( KConfigGroup* config, const QString& passwd ) const;
	/**
	 * This return the name of this protocol. It is always "dcop".
	 * @return The name of this protocol: "dcop"
	 */
	virtual QString configName() const { return "dcop"; }

	/**
	 * This function sets into the list the groupboxes.
	 *
	 * @param list A (empty) list, which is filled with the names of group-boxes.
	 */
	virtual void configFillGroupBoxes( QStringList* list ) const;
	/**
	 * This function filles the configuration field of this protocol.
	 * It is used to construct the configuration dialog.
	 *
	 * @param vector A vector with groupboxes.
	 * @param obj The pointer to the configDialog to connect signals to.
	 * @param result A list with AccountInput which is used to reconstruct the configuration.
	 */
	virtual void configFields( QPtrVector< QWidget >* vector, const QObject* obj, QPtrList< AccountInput >* result ) const;
	/**
	 * This function can edit some configuaration option before reading them.
	 */
	virtual void readEntries( QMap< QString, QString >* ) const;
	/**
	 * This function can edit some configuaration option before writing them.
	 */
	virtual void writeEntries( QMap< QString, QString >* ) const;

	//Functions that return a derived class.
	//This way, no explicit cast is needed
	/**
	 * This function returns a cast to a KIO_Protocol. Because this isn't a KIO_Protocol,
	 * it returns 0.
	 *
	 * @return 0
	 */
	virtual const KIO_Protocol* getKIOProtocol() const { return 0; }
};

#endif