1 | /* This file is part of the KDE project |
2 | Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 | Copyright 2007 David Faure <faure@kde.org> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef __kservicetypeprofile_h__ |
22 | #define __kservicetypeprofile_h__ |
23 | |
24 | #include <QtCore/QMap> // KDE5: remove |
25 | #include <QtCore/QString> |
26 | #include <QtCore/QList> |
27 | |
28 | #include <kservicetypetrader.h> |
29 | |
30 | |
31 | /** |
32 | * KServiceTypeProfile represents the user's preferences for services |
33 | * of a service type. |
34 | * It consists of a list of services (service offers) for the service type |
35 | * that is sorted by the user's preference. |
36 | * KServiceTypeTrader uses KServiceTypeProfile to |
37 | * get results sorted according to the user's preference. |
38 | * |
39 | * @see KService |
40 | * @see KServiceType |
41 | * @see KServiceTypeTrader |
42 | * @short Represents the user's preferences for services of a service type |
43 | */ |
44 | namespace KServiceTypeProfile |
45 | { |
46 | /** |
47 | * Write the complete profile for a given servicetype. |
48 | * Do not use this for mimetypes. |
49 | * @param serviceType The name of the servicetype. |
50 | * @param services Ordered list of services, from the preferred one to the least preferred one. |
51 | * @param disabledServices List of services which are normally associated with this serviceType, |
52 | * but which should be disabled, i.e. trader queries will not return them. |
53 | */ |
54 | KDECORE_EXPORT void writeServiceTypeProfile( const QString& serviceType, |
55 | const KService::List& services, |
56 | const KService::List& disabledServices = KService::List() ); |
57 | |
58 | |
59 | /** |
60 | * Delete the complete profile for a given servicetype, reverting to the default |
61 | * preference order (the one specified by InitialPreference in the .desktop files). |
62 | * |
63 | * Do not use this for mimetypes. |
64 | * @param serviceType The name of the servicetype. |
65 | */ |
66 | KDECORE_EXPORT void deleteServiceTypeProfile( const QString& serviceType ); |
67 | |
68 | /** |
69 | * This method activates a special mode of KServiceTypeProfile, in which all/all |
70 | * and all/allfiles are excluded from the results of the queries. |
71 | * It is meant for the configuration module _only_. |
72 | * @internal |
73 | */ |
74 | KDECORE_EXPORT void setConfigurationMode(); |
75 | /** |
76 | * @internal |
77 | */ |
78 | KDECORE_EXPORT bool configurationMode(); |
79 | |
80 | /** |
81 | * @internal, for KServiceTypeTrader |
82 | */ |
83 | KDECORE_EXPORT bool hasProfile( const QString& serviceType ); |
84 | |
85 | /** |
86 | * Clear all cached information |
87 | * @internal, for KServiceTypeFactory |
88 | */ |
89 | void clearCache(); |
90 | |
91 | } |
92 | |
93 | #endif |
94 | |