kuserprofile.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __kuserprofile_h__
00021 #define __kuserprofile_h__
00022
00023 #include <qmap.h>
00024 #include <qstring.h>
00025 #include <qptrlist.h>
00026 #include <qvaluelist.h>
00027
00028 #include <kservice.h>
00029
00040 class KIO_EXPORT KServiceOffer
00041 {
00042 public:
00046 KServiceOffer();
00047
00052 KServiceOffer( const KServiceOffer& );
00053
00062 KServiceOffer( KService::Ptr _service,
00063 int _pref, bool _default );
00064
00069 bool operator< ( const KServiceOffer& ) const;
00075 bool allowAsDefault() const { return m_bAllowAsDefault; }
00081 int preference() const { return m_iPreference; }
00087 KService::Ptr service() const { return m_pService; }
00093 bool isValid() const { return m_iPreference >= 0; }
00094
00095 private:
00096 int m_iPreference;
00097 bool m_bAllowAsDefault;
00098 KService::Ptr m_pService;
00099 private:
00100 class KServiceOfferPrivate;
00101 };
00102
00117 class KIO_EXPORT KServiceTypeProfile
00118 {
00119 public:
00120 typedef QValueList<KServiceOffer> OfferList;
00121
00122 ~KServiceTypeProfile();
00123
00131 int preference( const QString& _service ) const;
00132
00139 bool allowAsDefault( const QString& _service ) const;
00140
00146 OfferList offers() const;
00147
00157 static KService::Ptr preferredService( const QString & serviceType, const QString & genericServiceType );
00158
00167 static KServiceTypeProfile* serviceTypeProfile( const QString& servicetype, const QString & genericServiceType = QString::null );
00168
00188 static OfferList offers( const QString& servicetype, const QString& genericServiceType = QString::null );
00189
00194 static const QPtrList<KServiceTypeProfile>& serviceTypeProfiles() { return *s_lstProfiles; }
00195
00199 static void clear();
00200
00207 static void setConfigurationMode() { s_configurationMode = true; }
00211 static bool configurationMode() { return s_configurationMode; }
00212
00213 protected:
00222 KServiceTypeProfile( const QString& serviceType,
00223 const QString& genericServiceType = QString::null );
00224
00233 void addService( const QString& _service, int _preference = 1, bool _allow_as_default = true );
00234
00235 private:
00239 struct Service
00240 {
00244 int m_iPreference;
00248 bool m_bAllowAsDefault;
00249 };
00250
00254 QMap<QString,Service> m_mapServices;
00255
00259 QString m_strServiceType;
00260
00264 QString m_strGenericServiceType;
00265
00266 static void initStatic();
00267 static QPtrList<KServiceTypeProfile>* s_lstProfiles;
00268 static bool s_configurationMode;
00269 private:
00270 class KServiceTypeProfilePrivate* d;
00271 };
00272
00273 #endif
|