1/*
2 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
3 Copyright (c) 2000 Matthias Elter <elter@kde.org>
4 Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
5 Copyright (c) 2003,2006 Matthias Kretz <kretz@kde.org>
6
7 This file is part of the KDE project
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License version 2, as published by the Free Software Foundation.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22*/
23
24#ifndef KCMODULEINFO_H
25#define KCMODULEINFO_H
26
27#include <kcmutils_export.h>
28#include <kservice.h>
29
30class QString;
31class QStringList;
32
33/**
34 * A class that provides information about a KCModule
35 *
36 * KCModuleInfo provides various technical information, such as icon, library
37 * etc. about a KCModule.n
38 * @note Any values set with the set* functions is not
39 * written back with KCModuleInfo it only reads value from the desktop file.
40 *
41 * @internal
42 * @author Matthias Hoelzer-Kluepfel <mhk@kde.org>
43 * @author Matthias Elter <elter@kde.org>
44 * @author Daniel Molkentin <molkentin@kde.org>
45 *
46 */
47class KCMUTILS_EXPORT KCModuleInfo // krazy:exclude=dpointer (implicitly shared)
48{
49
50public:
51
52 /**
53 * Constructs a KCModuleInfo.
54 * @note a KCModuleInfo object will have to be manually deleted, it is not
55 * done automatically for you.
56 * @param desktopFile the desktop file representing the module, or
57 * the name of the module.
58 */
59 KCModuleInfo(const QString& desktopFile);
60
61 /**
62 * Same as above but takes a KService::Ptr as argument.
63 *
64 * @note @p moduleInfo must be a valid pointer.
65 *
66 * @param moduleInfo specifies the module
67 */
68 KCModuleInfo( KService::Ptr moduleInfo );
69
70
71 /**
72 * Same as above but takes a KCModuleInfo as argument.
73 *
74 * @param rhs specifies the module
75 */
76 KCModuleInfo( const KCModuleInfo &rhs );
77
78 /**
79 * Same as above but creates an empty KCModuleInfo.
80 * You should not normally call this.
81 */
82 KCModuleInfo();
83
84 /**
85 * Assignment operator
86 */
87 KCModuleInfo &operator=( const KCModuleInfo &rhs );
88
89 /**
90 * Returns true if @p rhs describes the same KCModule as this object.
91 */
92 bool operator==( const KCModuleInfo &rhs ) const;
93
94 /**
95 * @return true if @p rhs is not equal itself
96 */
97 bool operator!=( const KCModuleInfo &rhs ) const;
98
99 /**
100 * Default destructor.
101 */
102 ~KCModuleInfo();
103
104 /**
105 * @return the filename of the .desktop file that describes the KCM
106 */
107 QString fileName() const;
108
109 /**
110 * @return the keywords associated with this KCM.
111 */
112 QStringList keywords() const;
113
114 /**
115 * @return the module\'s (translated) name
116 */
117 QString moduleName() const;
118
119 /**
120 * @return a KSharedPtr to KService created from the modules .desktop file
121 */
122 KService::Ptr service() const;
123
124 /**
125 * @return the module's (translated) comment field
126 */
127 QString comment() const;
128
129 /**
130 * @return the module's icon name
131 */
132 QString icon() const;
133
134 /**
135 * @return the path of the module's documentation
136 */
137 QString docPath() const;
138
139 /**
140 * @return the library name
141 */
142 QString library() const;
143
144 /**
145 * @return a handle (the contents of the X-KDE-FactoryName field if it exists,
146 * else the same as the library name)
147 */
148 QString handle() const;
149
150 /**
151 * @return the weight of the module which determines the order of the pages in
152 * the KCMultiDialog. It's set by the X-KDE-Weight field.
153 */
154 int weight() const;
155
156private:
157 class Private;
158 Private * d;
159};
160
161#endif // KCMODULEINFO_H
162
163// vim: ts=2 sw=2 et
164