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
|
/***************************************************************************
*
* knetworkmanager-connection_setting.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_H
#define KNETWORKMANAGER_CONNECTION_SETTING_H
#include <tqmap.h>
#include <tqobject.h>
#include <tqdbusdata.h>
namespace ConnectionSettings
{
/*
Annotation: hopefully we can convert these to
TQMap<TQString, TQVariant> when switching to TQt4
*/
typedef TQMap<TQString, TQT_DBusData> SettingsMap;
class Connection;
// the base class for all settings
class ConnectionSetting : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
ConnectionSetting(Connection* conn, TQString type, const char* name = 0, bool enabled = true);
ConnectionSetting(const ConnectionSetting&);
// serialize the setting to a map
virtual SettingsMap toMap() const = 0;
// serialize the secrets to a map
virtual SettingsMap toSecretsMap(bool withSettings = true) const;
// initialize setting from a settingsmap
virtual void fromMap(const SettingsMap&) = 0;
// set secrtes from a secretsmap
virtual bool fromSecretsMap(const SettingsMap&);
// return whether this setting should be used or not
virtual bool getEnabled(void) const;
// return whether this setting is valid or not
virtual bool isValid() const = 0;
// return the settings type
TQString getType(void) const;
// return the connection this setting belongs to
Connection* getConnection(void) const;
// return whether the setting has secrets or not
virtual bool hasSecrets(void) const;
signals:
void validityChanged();
protected:
void emitValidityChanged();
// parent-connection
Connection* _conn;
private:
TQString _type;
bool _enabled;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_H */
|