1/*
2 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
3 Copyright (c) 2002-2003 Daniel Molkentin <molkentin@kde.org>
4 Copyright (c) 2006 Matthias Kretz <kretz@kde.org>
5
6 This file is part of the KDE project
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License version 2, as published by the Free Software Foundation.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22#ifndef KCMODULELOADER_H
23#define KCMODULELOADER_H
24
25#include <kcmodule.h>
26#include <kcmoduleinfo.h>
27
28class QWidget;
29
30/**
31 * @short Loads a KControl Module.
32 *
33 * KCModuleLoader tries in several ways
34 * to locate and load a KCModule. If loading fails a
35 * zero pointer is returned. \n
36 * It is very unlikely KCModuleLoader is what you want
37 * and @ref KCModuleProxy suits your needs.
38 *
39 * @author Matthias Hoelzer-Kluepfel <mhk@kde.org>
40 * @author Frans Englich <frans.englich@telia.com>
41 * @internal
42**/
43namespace KCModuleLoader
44{
45 /**
46 * Determines the way errors are reported
47 */
48 enum ErrorReporting {
49 /**
50 * no error reporting is done
51 * */
52 None = 0,
53 /**
54 * the error report is shown instead of the
55 * KCModule that should have * been loaded
56 */
57 Inline = 1,
58 /**
59 * shows a dialog with the error report
60 */
61 Dialog = 2,
62 /**
63 * does both Inline and Dialog
64 */
65 Both = 3
66 };
67
68 /**
69 * Loads a @ref KCModule. If loading fails a zero pointer is returned.
70 * @param module what module to load
71 * @param report see ErrorReporting
72 *
73 * @return a pointer to the loaded @ref KCModule
74 */
75 KCMUTILS_EXPORT KCModule *loadModule(const KCModuleInfo &module, ErrorReporting
76 report, QWidget * parent = 0, const QStringList& args = QStringList() );
77
78 /**
79 * Loads a @ref KCModule. If loading fails a zero pointer is returned.
80 *
81 * @param module what module to load
82 * @param report see ErrorReporting
83 *
84 * @return a pointer to the loaded @ref KCModule
85 */
86 KCMUTILS_EXPORT KCModule *loadModule( const QString &module, ErrorReporting report,
87 QWidget *parent = 0, const QStringList& args = QStringList() );
88
89 /**
90 * Unloads the module's library
91 * @param mod What module to unload for
92 */
93 KCMUTILS_EXPORT void unloadModule(const KCModuleInfo &mod);
94
95 /**
96 * Display a message box explaining an error occurred and possible
97 * reasons to why.
98 *
99 * @deprecated Use a constructor with ErrorReporting set to Dialog to show a
100 * message box like this function did.
101 */
102#ifndef KDE_NO_DEPRECATED
103 KCMUTILS_EXPORT KDE_DEPRECATED void showLastLoaderError(QWidget *parent);
104#endif
105
106 /**
107 * Returns a KCModule containing the messages @p report and @p text.
108 *
109 * @param report the type of error reporting, see ErrorReporting
110 * @param text the main message
111 * @param details any additional details
112 *
113 * @internal
114 */
115 KCMUTILS_EXPORT KCModule* reportError( ErrorReporting report, const QString & text,
116 const QString &details, QWidget * parent );
117
118}
119
120// vim: ts=2 sw=2 et
121#endif // KCMODULELOADER_H
122