make dashboard happy
[kdenetwork.git] / krdc / hostpreferences.h
blobb4b95ff6c2c67a9d2eec9a1d1ec2e204d13a53c4
1 /*
2 Copyright (C) 2003 Tim Jansen <tim@tjansen.de>
3 Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
4 */
5 /***************************************************************************
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
14 #ifndef HOSTPREFERENCES_H
15 #define HOSTPREFERENCES_H
17 #include <QString>
18 #include <QStringList>
19 #include <QList>
20 #include <ksharedconfig.h>
22 #include "smartptr.h"
24 class HostPreferences;
25 class KConfig;
27 class HostPref {
28 protected:
29 friend class HostPreferences;
30 QString m_host;
31 QString m_type;
32 KSharedConfigPtr m_config;
34 HostPref(KSharedConfigPtr conf, const QString &host, const QString &type);
36 virtual void load() = 0;
37 virtual void setDefaults() = 0;
38 virtual void save() = 0;
39 virtual void remove() = 0;
40 public:
41 virtual ~HostPref();
43 virtual QString prefDescription() const = 0;
44 QString host() const;
45 QString type() const;
46 QString prefix() const;
47 static QString prefix(const QString &host, const QString &type);
50 typedef SmartPtr<HostPref> HostPrefPtr;
51 typedef QList<HostPrefPtr> HostPrefPtrList;
53 class HostPreferences {
54 public:
55 static HostPreferences *instance();
56 ~HostPreferences();
58 HostPrefPtr getHostPref(const QString &host, const QString &type);
59 HostPrefPtr createHostPref(const QString &host, const QString &type);
60 HostPrefPtrList getAllHostPrefs();
61 HostPrefPtr vncDefaults();
62 HostPrefPtr rdpDefaults();
63 void removeHostPref(HostPref *hostPref);
65 void setShowBrowsingPanel( bool b );
66 void setServerCompletions( const QStringList &list );
67 void setServerHistory( const QStringList &list );
69 bool showBrowsingPanel();
70 QStringList serverCompletions();
71 QStringList serverHistory();
73 void sync();
75 private:
76 HostPreferences();
78 KSharedConfigPtr m_config;
79 static HostPreferences *m_instance;
83 #endif