2014-11-13 01:04:59 +02:00
|
|
|
/*
|
|
|
|
Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
|
|
|
|
Copyright (c) 2002-2003 Daniel Molkentin <molkentin@kde.org>
|
|
|
|
Copyright (c) 2006 Matthias Kretz <kretz@kde.org>
|
|
|
|
|
|
|
|
This file is part of the KDE project
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License version 2, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
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 KCMODULELOADER_H
|
|
|
|
#define KCMODULELOADER_H
|
|
|
|
|
|
|
|
#include <kcmodule.h>
|
|
|
|
#include <kcmoduleinfo.h>
|
|
|
|
|
2017-08-04 09:17:49 +00:00
|
|
|
#include <QWidget>
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @short Loads a KControl Module.
|
|
|
|
*
|
|
|
|
* KCModuleLoader tries in several ways
|
|
|
|
* to locate and load a KCModule. If loading fails a
|
|
|
|
* zero pointer is returned. \n
|
|
|
|
* It is very unlikely KCModuleLoader is what you want
|
|
|
|
* and @ref KCModuleProxy suits your needs.
|
|
|
|
*
|
|
|
|
* @author Matthias Hoelzer-Kluepfel <mhk@kde.org>
|
|
|
|
* @author Frans Englich <frans.englich@telia.com>
|
|
|
|
* @internal
|
|
|
|
**/
|
|
|
|
namespace KCModuleLoader
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determines the way errors are reported
|
|
|
|
*/
|
|
|
|
enum ErrorReporting {
|
2023-07-30 09:44:43 +03:00
|
|
|
/**
|
|
|
|
* no error reporting is done
|
|
|
|
*/
|
|
|
|
None = 0,
|
|
|
|
/**
|
|
|
|
* the error report is shown instead of the
|
|
|
|
* KCModule that should have been loaded
|
|
|
|
*/
|
|
|
|
Inline = 1,
|
|
|
|
/**
|
|
|
|
* shows a dialog with the error report
|
|
|
|
*/
|
|
|
|
Dialog = 2,
|
|
|
|
/**
|
|
|
|
* does both Inline and Dialog
|
|
|
|
*/
|
|
|
|
Both = 3
|
2014-11-13 01:04:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads a @ref KCModule. If loading fails a zero pointer is returned.
|
|
|
|
* @param module what module to load
|
|
|
|
* @param report see ErrorReporting
|
|
|
|
*
|
|
|
|
* @return a pointer to the loaded @ref KCModule
|
|
|
|
*/
|
2023-07-30 09:44:43 +03:00
|
|
|
KCMUTILS_EXPORT KCModule* loadModule(const KCModuleInfo &module, ErrorReporting report,
|
|
|
|
QWidget *parent = nullptr, const QStringList &args = QStringList());
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Loads a @ref KCModule. If loading fails a zero pointer is returned.
|
|
|
|
*
|
|
|
|
* @param module what module to load
|
|
|
|
* @param report see ErrorReporting
|
|
|
|
*
|
|
|
|
* @return a pointer to the loaded @ref KCModule
|
|
|
|
*/
|
2023-07-30 09:44:43 +03:00
|
|
|
KCMUTILS_EXPORT KCModule* loadModule(const QString &module, ErrorReporting report,
|
|
|
|
QWidget *parent = nullptr, const QStringList &args = QStringList());
|
2014-11-13 01:04:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a KCModule containing the messages @p report and @p text.
|
|
|
|
*
|
|
|
|
* @param report the type of error reporting, see ErrorReporting
|
|
|
|
* @param text the main message
|
|
|
|
* @param details any additional details
|
|
|
|
*
|
|
|
|
* @internal
|
|
|
|
*/
|
2023-07-30 09:44:43 +03:00
|
|
|
KCMUTILS_EXPORT KCModule* reportError(ErrorReporting report, const QString &text,
|
|
|
|
const QString &details, QWidget *parent);
|
2014-11-13 01:04:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // KCMODULELOADER_H
|