merge in my changes from soc-krdc branch
[kdenetwork.git] / krdc / hostpreferences.h
blob4cb2448889865d10a57099a98870687d1651cba2
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
18 #include <QStringList>
19 #include <QList>
20 #include <ksharedconfig.h>
22 #include "smartptr.h"
24 class HostPreferences;
26 class HostPref {
27 protected:
28 friend class HostPreferences;
29 QString m_host;
30 QString m_type;
31 KSharedConfigPtr m_config;
33 HostPref(KSharedConfigPtr conf, const QString &host, const QString &type);
35 virtual void load() = 0;
36 virtual void setDefaults() = 0;
37 virtual void save() = 0;
38 virtual void remove() = 0;
39 public:
40 virtual ~HostPref();
42 virtual QString prefDescription() const = 0;
43 QString host() const;
44 QString type() const;
45 QString prefix() const;
46 static QString prefix(const QString &host, const QString &type);
49 typedef SmartPtr<HostPref> HostPrefPtr;
50 typedef QList<HostPrefPtr> HostPrefPtrList;
52 class HostPreferences {
53 public:
54 static HostPreferences *instance();
55 ~HostPreferences();
57 HostPrefPtr getHostPref(const QString &host, const QString &type);
58 HostPrefPtr createHostPref(const QString &host, const QString &type);
59 HostPrefPtrList getAllHostPrefs();
60 HostPrefPtr vncDefaults();
61 HostPrefPtr rdpDefaults();
62 void removeHostPref(HostPref *hostPref);
64 void setShowBrowsingPanel( bool b );
65 void setServerCompletions( const QStringList &list );
66 void setServerHistory( const QStringList &list );
68 bool showBrowsingPanel();
69 QStringList serverCompletions();
70 QStringList serverHistory();
72 void sync();
74 private:
75 HostPreferences();
77 KSharedConfigPtr m_config;
78 static HostPreferences *m_instance;
82 #endif