kuserprofile.h
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kuserprofile_h__
#define __kuserprofile_h__
#include <qmap.h>
#include <qstring.h>
#include <qptrlist.h>
#include <qvaluelist.h>
#include <kservice.h>
class KIO_EXPORT KServiceOffer
{
public:
KServiceOffer();
KServiceOffer( const KServiceOffer& );
KServiceOffer( KService::Ptr _service,
int _pref, bool _default );
bool operator< ( const KServiceOffer& ) const;
bool allowAsDefault() const { return m_bAllowAsDefault; }
int preference() const { return m_iPreference; }
KService::Ptr service() const { return m_pService; }
bool isValid() const { return m_iPreference >= 0; }
private:
int m_iPreference;
bool m_bAllowAsDefault;
KService::Ptr m_pService;
private:
class KServiceOfferPrivate;
};
class KIO_EXPORT KServiceTypeProfile
{
public:
typedef QValueList<KServiceOffer> OfferList;
~KServiceTypeProfile();
int preference( const QString& _service ) const;
bool allowAsDefault( const QString& _service ) const;
OfferList offers() const;
static KService::Ptr preferredService( const QString & serviceType, const QString & genericServiceType );
static KServiceTypeProfile* serviceTypeProfile( const QString& servicetype, const QString & genericServiceType = QString::null );
static OfferList offers( const QString& servicetype, const QString& genericServiceType = QString::null );
static const QPtrList<KServiceTypeProfile>& serviceTypeProfiles() { return *s_lstProfiles; }
static void clear();
static void setConfigurationMode() { s_configurationMode = true; }
static void unsetConfigurationMode() { s_configurationMode = false; }
static bool configurationMode() { return s_configurationMode; }
protected:
KServiceTypeProfile( const QString& serviceType,
const QString& genericServiceType = QString::null );
void addService( const QString& _service, int _preference = 1, bool _allow_as_default = true );
private:
struct Service
{
int m_iPreference;
bool m_bAllowAsDefault;
};
QMap<QString,Service> m_mapServices;
QString m_strServiceType;
QString m_strGenericServiceType;
static void initStatic();
static QPtrList<KServiceTypeProfile>* s_lstProfiles;
static bool s_configurationMode;
private:
class KServiceTypeProfilePrivate* d;
};
#endif
KServiceTypeProfile::serviceTypeProfiles
static const QPtrList< KServiceTypeProfile > & serviceTypeProfiles()
Returns a list of all KServiceTypeProfiles.
Definition: kuserprofile.h:194
KServiceOffer::service
KService::Ptr service() const
The service which this offer is about.
Definition: kuserprofile.h:87
KServiceTypeProfile
KServiceTypeProfile represents the user's preferences for services of a service type.
Definition: kuserprofile.h:117
KServiceTypeProfile::unsetConfigurationMode
static void unsetConfigurationMode()
This method deactivates the special mode above of KServiceTypeProfile It is meant for the configurati...
Definition: kuserprofile.h:215
KServiceOffer
This class holds the user-specific preferences of a service (whether it can be a default offer or not...
Definition: kuserprofile.h:40
KServiceOffer::preference
int preference() const
The bigger this number is, the better is this service.
Definition: kuserprofile.h:81
KServiceOffer::isValid
bool isValid() const
Check whether the entry is valid.
Definition: kuserprofile.h:93
KServiceOffer::allowAsDefault
bool allowAsDefault() const
Is it allowed to use this service for default actions (e.g.
Definition: kuserprofile.h:75
KServiceTypeProfile::setConfigurationMode
static void setConfigurationMode()
This method activates a special mode of KServiceTypeProfile, in which all/all and all/allfiles are ex...
Definition: kuserprofile.h:207

KDE Home | KDE Accessibility Home | Description of Access Keys