mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kutils: format and indent
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
833951fbc3
commit
48e591141b
10 changed files with 670 additions and 662 deletions
|
@ -44,22 +44,20 @@ class KCModuleContainer::KCModuleContainerPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KCModuleContainerPrivate(const QStringList &mods)
|
KCModuleContainerPrivate(const QStringList &mods)
|
||||||
: modules( mods )
|
: modules(mods),
|
||||||
, tabWidget( 0 )
|
tabWidget(nullptr),
|
||||||
, topLayout( 0 )
|
topLayout(nullptr)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QStringList modules;
|
QStringList modules;
|
||||||
KTabWidget *tabWidget;
|
KTabWidget *tabWidget;
|
||||||
KCModule::Buttons buttons;
|
KCModule::Buttons buttons;
|
||||||
QVBoxLayout *topLayout;
|
QVBoxLayout *topLayout;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// The KCModuleContainer is only a wrapper around real KCModules. Therefore it doesn't need a
|
// The KCModuleContainer is only a wrapper around real KCModules. Therefore it doesn't need a
|
||||||
// special KComponentData and can just use the global instance. The contained KCModules create their own
|
// special KComponentData and can just use the global instance. The contained KCModules create their own
|
||||||
// KComponentData objects when needed.
|
// KComponentData objects when needed.
|
||||||
|
@ -88,13 +86,13 @@ void KCModuleContainer::init()
|
||||||
connect(d->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabSwitched(int)));
|
connect(d->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabSwitched(int)));
|
||||||
d->topLayout->addWidget(d->tabWidget);
|
d->topLayout->addWidget(d->tabWidget);
|
||||||
|
|
||||||
if ( !d->modules.isEmpty() )
|
if (!d->modules.isEmpty()) {
|
||||||
{
|
|
||||||
/* Add our modules */
|
/* Add our modules */
|
||||||
foreach (const QString it, d->modules )
|
foreach (const QString it, d->modules) {
|
||||||
addModule(it);
|
addModule(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KCModuleContainer::addModule(const QString &module)
|
void KCModuleContainer::addModule(const QString &module)
|
||||||
{
|
{
|
||||||
|
@ -103,24 +101,26 @@ void KCModuleContainer::addModule( const QString& module )
|
||||||
* For example, KCM monitor gamma can be in kdegraphics.
|
* For example, KCM monitor gamma can be in kdegraphics.
|
||||||
*/
|
*/
|
||||||
KService::Ptr service = KService::serviceByDesktopName(module);
|
KService::Ptr service = KService::serviceByDesktopName(module);
|
||||||
if ( !service )
|
if (!service) {
|
||||||
{
|
kDebug(713) << "KCModuleContainer: module '"
|
||||||
kDebug(713) << "KCModuleContainer: module '" <<
|
<< module << "' was not found and thus not loaded";
|
||||||
module << "' was not found and thus not loaded";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( service->noDisplay() )
|
if (service->noDisplay()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
KCModuleProxy* proxy = new KCModuleProxy(service, d->tabWidget);
|
KCModuleProxy* proxy = new KCModuleProxy(service, d->tabWidget);
|
||||||
allModules.append(proxy);
|
allModules.append(proxy);
|
||||||
|
|
||||||
proxy->setObjectName(module.toLatin1());
|
proxy->setObjectName(module.toLatin1());
|
||||||
|
|
||||||
d->tabWidget->addTab( proxy, KIcon( proxy->moduleInfo().icon() ),
|
d->tabWidget->addTab(
|
||||||
/* Qt eats ampersands for dinner. But not this time. */
|
proxy, KIcon(proxy->moduleInfo().icon()),
|
||||||
proxy->moduleInfo().moduleName().replace( '&', "&&" ));
|
/* Katie eats ampersands for dinner. But not this time. */
|
||||||
|
proxy->moduleInfo().moduleName().replace('&', "&&")
|
||||||
|
);
|
||||||
|
|
||||||
d->tabWidget->setTabToolTip(d->tabWidget->indexOf(proxy), proxy->moduleInfo().comment());
|
d->tabWidget->setTabToolTip(d->tabWidget->indexOf(proxy), proxy->moduleInfo().comment());
|
||||||
|
|
||||||
|
@ -141,8 +141,7 @@ void KCModuleContainer::save()
|
||||||
{
|
{
|
||||||
ModuleList list = changedModules;
|
ModuleList list = changedModules;
|
||||||
ModuleList::iterator it;
|
ModuleList::iterator it;
|
||||||
for ( it = list.begin() ; it !=list.end() ; ++it )
|
for ( it = list.begin() ; it !=list.end() ; ++it ) {
|
||||||
{
|
|
||||||
(*it)->save();
|
(*it)->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +153,7 @@ void KCModuleContainer::load()
|
||||||
{
|
{
|
||||||
ModuleList list = allModules;
|
ModuleList list = allModules;
|
||||||
ModuleList::iterator it;
|
ModuleList::iterator it;
|
||||||
for ( it = list.begin() ; it !=list.end() ; ++it )
|
for ( it = list.begin() ; it !=list.end() ; ++it ) {
|
||||||
{
|
|
||||||
(*it)->load();
|
(*it)->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,20 +164,19 @@ void KCModuleContainer::defaults()
|
||||||
{
|
{
|
||||||
ModuleList list = allModules;
|
ModuleList list = allModules;
|
||||||
ModuleList::iterator it;
|
ModuleList::iterator it;
|
||||||
for ( it = list.begin() ; it !=list.end() ; ++it )
|
for (it = list.begin() ; it !=list.end() ; ++it) {
|
||||||
{
|
|
||||||
(*it)->defaults();
|
(*it)->defaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit changed( true );
|
emit changed( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KCModuleContainer::moduleChanged(KCModuleProxy *proxy)
|
void KCModuleContainer::moduleChanged(KCModuleProxy *proxy)
|
||||||
{
|
{
|
||||||
changedModules.append(proxy);
|
changedModules.append(proxy);
|
||||||
if( changedModules.isEmpty() )
|
if (changedModules.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
emit changed(true);
|
emit changed(true);
|
||||||
}
|
}
|
||||||
|
@ -188,9 +185,3 @@ KCModuleContainer::~KCModuleContainer()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,15 @@ class KCModuleInfo::Private
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private();
|
Private();
|
||||||
Private( KService::Ptr );
|
Private(KService::Ptr s);
|
||||||
|
|
||||||
QStringList keywords;
|
QStringList keywords;
|
||||||
QString name, icon, lib, fileName, doc, comment;
|
QString name;
|
||||||
|
QString icon;
|
||||||
|
QString lib;
|
||||||
|
QString fileName;
|
||||||
|
QString doc;
|
||||||
|
QString comment;
|
||||||
bool allLoaded;
|
bool allLoaded;
|
||||||
int weight;
|
int weight;
|
||||||
|
|
||||||
|
@ -56,11 +61,10 @@ KCModuleInfo::Private::Private()
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleInfo::Private::Private(KService::Ptr s)
|
KCModuleInfo::Private::Private(KService::Ptr s)
|
||||||
: allLoaded( false )
|
: allLoaded(false),
|
||||||
, service( s )
|
service(s)
|
||||||
{
|
|
||||||
if ( !service )
|
|
||||||
{
|
{
|
||||||
|
if (!service) {
|
||||||
kDebug(712) << "Could not find the service.";
|
kDebug(712) << "Could not find the service.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,23 +79,23 @@ KCModuleInfo::Private::Private( KService::Ptr s )
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleInfo::KCModuleInfo()
|
KCModuleInfo::KCModuleInfo()
|
||||||
|
: d(new Private())
|
||||||
{
|
{
|
||||||
d = new Private;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleInfo::KCModuleInfo(const QString &desktopFile)
|
KCModuleInfo::KCModuleInfo(const QString &desktopFile)
|
||||||
|
: d(new Private(KService::serviceByStorageId(desktopFile)))
|
||||||
{
|
{
|
||||||
d = new Private( KService::serviceByStorageId(desktopFile) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleInfo::KCModuleInfo(KService::Ptr moduleInfo)
|
KCModuleInfo::KCModuleInfo(KService::Ptr moduleInfo)
|
||||||
|
: d(new Private(moduleInfo))
|
||||||
{
|
{
|
||||||
d = new Private( moduleInfo );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleInfo::KCModuleInfo(const KCModuleInfo &rhs)
|
KCModuleInfo::KCModuleInfo(const KCModuleInfo &rhs)
|
||||||
|
: d(new Private())
|
||||||
{
|
{
|
||||||
d = new Private;
|
|
||||||
(*this) = rhs;
|
(*this) = rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +124,10 @@ void KCModuleInfo::Private::loadAll()
|
||||||
{
|
{
|
||||||
allLoaded = true;
|
allLoaded = true;
|
||||||
|
|
||||||
if( !service ) /* We have a bogus service. All get functions will return empty/zero values */
|
if (!service) {
|
||||||
|
/* We have a bogus service. All get functions will return empty/zero values */
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get the documentation path
|
// get the documentation path
|
||||||
doc = service->property("X-DocPath", QVariant::String).toString();
|
doc = service->property("X-DocPath", QVariant::String).toString();
|
||||||
|
@ -168,18 +174,16 @@ QString KCModuleInfo::library() const
|
||||||
|
|
||||||
QString KCModuleInfo::docPath() const
|
QString KCModuleInfo::docPath() const
|
||||||
{
|
{
|
||||||
if (!d->allLoaded)
|
if (!d->allLoaded) {
|
||||||
d->loadAll();
|
d->loadAll();
|
||||||
|
}
|
||||||
return d->doc;
|
return d->doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int KCModuleInfo::weight() const
|
int KCModuleInfo::weight() const
|
||||||
{
|
{
|
||||||
if (!d->allLoaded)
|
if (!d->allLoaded) {
|
||||||
d->loadAll();
|
d->loadAll();
|
||||||
|
}
|
||||||
return d->weight;
|
return d->weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: ts=2 sw=2 et
|
|
||||||
|
|
|
@ -44,11 +44,9 @@
|
||||||
* @author Daniel Molkentin <molkentin@kde.org>
|
* @author Daniel Molkentin <molkentin@kde.org>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class KCMUTILS_EXPORT KCModuleInfo // krazy:exclude=dpointer (implicitly shared)
|
class KCMUTILS_EXPORT KCModuleInfo
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a KCModuleInfo.
|
* Constructs a KCModuleInfo.
|
||||||
* @note a KCModuleInfo object will have to be manually deleted, it is not
|
* @note a KCModuleInfo object will have to be manually deleted, it is not
|
||||||
|
@ -153,5 +151,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KCMODULEINFO_H
|
#endif // KCMODULEINFO_H
|
||||||
|
|
||||||
// vim: ts=2 sw=2 et
|
|
||||||
|
|
|
@ -55,12 +55,14 @@ public:
|
||||||
};
|
};
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
KCModule *KCModuleLoader::loadModule(const QString &module, ErrorReporting report, QWidget *parent, const QStringList &args)
|
KCModule *KCModuleLoader::loadModule(const QString &module, ErrorReporting report,
|
||||||
|
QWidget *parent, const QStringList &args)
|
||||||
{
|
{
|
||||||
return loadModule(KCModuleInfo(module), report, parent, args);
|
return loadModule(KCModuleInfo(module), report, parent, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModule* KCModuleLoader::loadModule(const KCModuleInfo& mod, ErrorReporting report, QWidget* parent, const QStringList& args )
|
KCModule* KCModuleLoader::loadModule(const KCModuleInfo &mod, ErrorReporting report,
|
||||||
|
QWidget *parent, const QStringList &args)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Simple libraries as modules are the easiest case:
|
* Simple libraries as modules are the easiest case:
|
||||||
|
@ -68,17 +70,31 @@ KCModule* KCModuleLoader::loadModule(const KCModuleInfo& mod, ErrorReporting rep
|
||||||
* from the factory.
|
* from the factory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( !mod.service() )
|
if (!mod.service()) {
|
||||||
return reportError( report,
|
return reportError(
|
||||||
i18n("The module %1 could not be found.",
|
report,
|
||||||
mod.moduleName() ), i18n("<qt><p>The diagnosis is:<br />The desktop file %1 could not be found.</p></qt>", mod.fileName()), parent );
|
i18n(
|
||||||
if( mod.service()->noDisplay() )
|
"The module %1 could not be found.",
|
||||||
return reportError( report, i18n( "The module %1 is disabled.", mod.moduleName() ),
|
mod.moduleName()
|
||||||
i18n( "<qt><p>Either the hardware/software the module configures is not available or the module has been disabled by the administrator.</p></qt>" ),
|
),
|
||||||
parent );
|
i18n(
|
||||||
|
"<qt><p>The diagnosis is:<br />The desktop file %1 could not be found.</p></qt>", mod.fileName()
|
||||||
|
),
|
||||||
|
parent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (mod.service()->noDisplay()) {
|
||||||
|
return reportError(
|
||||||
|
report,
|
||||||
|
i18n("The module %1 is disabled.", mod.moduleName()),
|
||||||
|
i18n(
|
||||||
|
"<qt><p>Either the hardware/software the module configures is not available or the module has been disabled by the administrator.</p></qt>"
|
||||||
|
),
|
||||||
|
parent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!mod.library().isEmpty())
|
if (!mod.library().isEmpty()) {
|
||||||
{
|
|
||||||
QString error;
|
QString error;
|
||||||
QVariantList args2;
|
QVariantList args2;
|
||||||
foreach (const QString &arg, args) {
|
foreach (const QString &arg, args) {
|
||||||
|
@ -99,9 +115,12 @@ KCModule* KCModuleLoader::loadModule(const KCModuleInfo& mod, ErrorReporting rep
|
||||||
* (startService calls kcmshell which calls modloader which calls startService...)
|
* (startService calls kcmshell which calls modloader which calls startService...)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
return reportError( report,
|
return reportError(
|
||||||
|
report,
|
||||||
i18n("The module %1 is not a valid configuration module.", mod.moduleName()),
|
i18n("The module %1 is not a valid configuration module.", mod.moduleName()),
|
||||||
i18n("<qt>The diagnosis is:<br />The desktop file %1 does not specify a library.</qt>", mod.fileName()), parent );
|
i18n("<qt>The diagnosis is:<br />The desktop file %1 does not specify a library.</qt>", mod.fileName()),
|
||||||
|
parent
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModule* KCModuleLoader::reportError(ErrorReporting report, const QString &text,
|
KCModule* KCModuleLoader::reportError(ErrorReporting report, const QString &text,
|
||||||
|
@ -109,11 +128,13 @@ KCModule* KCModuleLoader::reportError( ErrorReporting report, const QString & te
|
||||||
{
|
{
|
||||||
QString realDetails = details;
|
QString realDetails = details;
|
||||||
if (realDetails.isNull()) {
|
if (realDetails.isNull()) {
|
||||||
realDetails = i18n("<qt><p>Possible reasons:<ul><li>An error occurred during your last "
|
realDetails = i18n(
|
||||||
|
"<qt><p>Possible reasons:<ul><li>An error occurred during your last "
|
||||||
"KDE upgrade leaving an orphaned control module</li><li>You have old third party "
|
"KDE upgrade leaving an orphaned control module</li><li>You have old third party "
|
||||||
"modules lying around.</li></ul></p><p>Check these points carefully and try to remove "
|
"modules lying around.</li></ul></p><p>Check these points carefully and try to remove "
|
||||||
"the module mentioned in the error message. If this fails, consider contacting "
|
"the module mentioned in the error message. If this fails, consider contacting "
|
||||||
"your distributor or packager.</p></qt>");
|
"your distributor or packager.</p></qt>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (report & KCModuleLoader::Dialog) {
|
if (report & KCModuleLoader::Dialog) {
|
||||||
KMessageBox::detailedError(parent, text, realDetails);
|
KMessageBox::detailedError(parent, text, realDetails);
|
||||||
|
@ -121,7 +142,5 @@ KCModule* KCModuleLoader::reportError( ErrorReporting report, const QString & te
|
||||||
if (report & KCModuleLoader::Inline) {
|
if (report & KCModuleLoader::Inline) {
|
||||||
return new KCMError(text, realDetails, parent);
|
return new KCMError(text, realDetails, parent);
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: ts=4
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace KCModuleLoader
|
||||||
enum ErrorReporting {
|
enum ErrorReporting {
|
||||||
/**
|
/**
|
||||||
* no error reporting is done
|
* no error reporting is done
|
||||||
* */
|
*/
|
||||||
None = 0,
|
None = 0,
|
||||||
/**
|
/**
|
||||||
* the error report is shown instead of the
|
* the error report is shown instead of the
|
||||||
|
@ -72,8 +72,8 @@ namespace KCModuleLoader
|
||||||
*
|
*
|
||||||
* @return a pointer to the loaded @ref KCModule
|
* @return a pointer to the loaded @ref KCModule
|
||||||
*/
|
*/
|
||||||
KCMUTILS_EXPORT KCModule *loadModule(const KCModuleInfo &module, ErrorReporting
|
KCMUTILS_EXPORT KCModule* loadModule(const KCModuleInfo &module, ErrorReporting report,
|
||||||
report, QWidget * parent = 0, const QStringList& args = QStringList() );
|
QWidget *parent = nullptr, const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a @ref KCModule. If loading fails a zero pointer is returned.
|
* Loads a @ref KCModule. If loading fails a zero pointer is returned.
|
||||||
|
@ -84,7 +84,7 @@ namespace KCModuleLoader
|
||||||
* @return a pointer to the loaded @ref KCModule
|
* @return a pointer to the loaded @ref KCModule
|
||||||
*/
|
*/
|
||||||
KCMUTILS_EXPORT KCModule* loadModule(const QString &module, ErrorReporting report,
|
KCMUTILS_EXPORT KCModule* loadModule(const QString &module, ErrorReporting report,
|
||||||
QWidget *parent = 0, const QStringList& args = QStringList() );
|
QWidget *parent = nullptr, const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a KCModule containing the messages @p report and @p text.
|
* Returns a KCModule containing the messages @p report and @p text.
|
||||||
|
@ -99,5 +99,4 @@ namespace KCModuleLoader
|
||||||
const QString &details, QWidget *parent);
|
const QString &details, QWidget *parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: ts=2 sw=2 et
|
|
||||||
#endif // KCMODULELOADER_H
|
#endif // KCMODULELOADER_H
|
||||||
|
|
|
@ -45,8 +45,7 @@
|
||||||
|
|
||||||
- Two Layout problems in runAsRoot:
|
- Two Layout problems in runAsRoot:
|
||||||
* lblBusy doesn't show
|
* lblBusy doesn't show
|
||||||
* d->kcm/d->rootInfo doesn't get it right when the user
|
* d->kcm/d->rootInfo doesn't get it right when the user presses cancel in the kdesudo dialog
|
||||||
presses cancel in the kdesudo dialog
|
|
||||||
|
|
||||||
- Resizing horizontally is contrained; minimum size is set somewhere.
|
- Resizing horizontally is contrained; minimum size is set somewhere.
|
||||||
It appears to be somehow derived from the module's size.
|
It appears to be somehow derived from the module's size.
|
||||||
|
@ -64,8 +63,7 @@ KCModule* KCModuleProxy::realModule() const
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Already loaded */
|
/* Already loaded */
|
||||||
if( !d->kcm )
|
if (!d->kcm) {
|
||||||
{
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
const_cast<KCModuleProxyPrivate*>(d)->loadModule();
|
const_cast<KCModuleProxyPrivate*>(d)->loadModule();
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
@ -75,8 +73,7 @@ KCModule* KCModuleProxy::realModule() const
|
||||||
|
|
||||||
void KCModuleProxyPrivate::loadModule()
|
void KCModuleProxyPrivate::loadModule()
|
||||||
{
|
{
|
||||||
if( !topLayout )
|
if (!topLayout) {
|
||||||
{
|
|
||||||
topLayout = new QVBoxLayout(parent);
|
topLayout = new QVBoxLayout(parent);
|
||||||
topLayout->setMargin(0);
|
topLayout->setMargin(0);
|
||||||
|
|
||||||
|
@ -86,10 +83,12 @@ void KCModuleProxyPrivate::loadModule()
|
||||||
dbusService = QLatin1String("org.kde.internal.KSettingsWidget_") + name;
|
dbusService = QLatin1String("org.kde.internal.KSettingsWidget_") + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( QDBusConnection::sessionBus().registerService( dbusService ) || bogusOccupier )
|
if (QDBusConnection::sessionBus().registerService(dbusService) || bogusOccupier) {
|
||||||
{ /* We got the name we requested, because no one was before us,
|
/* We got the name we requested, because no one was before us,
|
||||||
* or, it was an random application which had picked that name */
|
* or, it was an random application which had picked that name
|
||||||
kDebug(711) << "Module not already loaded, loading module " << modInfo.moduleName() << " from library " << modInfo.library();
|
*/
|
||||||
|
kDebug(711) << "Module not already loaded, loading module " << modInfo.moduleName()
|
||||||
|
<< " from library " << modInfo.library();
|
||||||
|
|
||||||
kcm = KCModuleLoader::loadModule(modInfo, KCModuleLoader::Inline, parent, args);
|
kcm = KCModuleLoader::loadModule(modInfo, KCModuleLoader::Inline, parent, args);
|
||||||
|
|
||||||
|
@ -102,14 +101,18 @@ void KCModuleProxyPrivate::loadModule()
|
||||||
kcm->layout()->setMargin(0);
|
kcm->layout()->setMargin(0);
|
||||||
}
|
}
|
||||||
topLayout->addWidget( kcm );
|
topLayout->addWidget( kcm );
|
||||||
if( !modInfo.library().isEmpty() )
|
if (!modInfo.library().isEmpty()) {
|
||||||
QDBusConnection::sessionBus().registerObject(dbusPath, new KSettingsWidgetAdaptor(parent), QDBusConnection::ExportAllSlots);
|
QDBusConnection::sessionBus().registerObject(
|
||||||
|
dbusPath, new KSettingsWidgetAdaptor(parent), QDBusConnection::ExportAllSlots
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!rootInfo && /* If it's not already done */
|
if (!rootInfo && /* If it's not already done */
|
||||||
kcm->useRootOnlyMessage() && /* kcm wants root message */
|
kcm->useRootOnlyMessage() && /* kcm wants root message */
|
||||||
!KUser().isSuperUser() ) /* Not necessary if we're root */
|
!KUser().isSuperUser() ) /* Not necessary if we're root */
|
||||||
{
|
{
|
||||||
/*rootInfo = new QLabel( parent );
|
#if 0
|
||||||
|
rootInfo = new QLabel(parent);
|
||||||
topLayout->insertWidget(0, rootInfo);
|
topLayout->insertWidget(0, rootInfo);
|
||||||
|
|
||||||
QPalette palette = rootInfo->palette();
|
QPalette palette = rootInfo->palette();
|
||||||
|
@ -121,41 +124,51 @@ void KCModuleProxyPrivate::loadModule()
|
||||||
|
|
||||||
const QString message = kcm->rootOnlyMessage();
|
const QString message = kcm->rootOnlyMessage();
|
||||||
if (message.isEmpty() )
|
if (message.isEmpty() )
|
||||||
rootInfo->setText( i18n(
|
rootInfo->setText(
|
||||||
|
i18n(
|
||||||
"<b>Changes in this section require root access.</b><br />"
|
"<b>Changes in this section require root access.</b><br />"
|
||||||
"On applying your changes you will have to supply your root "
|
"On applying your changes you will have to supply your root "
|
||||||
"password." ) );
|
"password." )
|
||||||
else
|
);
|
||||||
|
} else {
|
||||||
rootInfo->setText(message);
|
rootInfo->setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
rootInfo->setWhatsThis( i18n(
|
rootInfo->setWhatsThis(
|
||||||
|
i18n(
|
||||||
"This section requires special permissions, probably "
|
"This section requires special permissions, probably "
|
||||||
"for system-wide changes; therefore, it is "
|
"for system-wide changes; therefore, it is "
|
||||||
"required that you provide the root password to be "
|
"required that you provide the root password to be "
|
||||||
"able to change the module's properties. If "
|
"able to change the module's properties. If "
|
||||||
"you cannot provide the password, the changes of the "
|
"you cannot provide the password, the changes of the "
|
||||||
"module cannot be saved " ) );*/
|
"module cannot be saved "
|
||||||
|
)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
kDebug(711) << "Module already loaded, loading KCMError";
|
kDebug(711) << "Module already loaded, loading KCMError";
|
||||||
|
|
||||||
/* Figure out the name of where the module is already loaded */
|
/* Figure out the name of where the module is already loaded */
|
||||||
QDBusInterface proxy(dbusService, dbusPath, "org.kde.internal.KSettingsWidget");
|
QDBusInterface proxy(dbusService, dbusPath, "org.kde.internal.KSettingsWidget");
|
||||||
QDBusReply<QString> reply = proxy.call("applicationName");
|
QDBusReply<QString> reply = proxy.call("applicationName");
|
||||||
|
|
||||||
if( reply.isValid() )
|
if (reply.isValid()) {
|
||||||
{
|
QObject::connect(
|
||||||
QObject::connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
|
QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
|
||||||
parent, SLOT(_k_ownerChanged(QString,QString,QString)));
|
parent, SLOT(_k_ownerChanged(QString,QString,QString))
|
||||||
kcm = KCModuleLoader::reportError( KCModuleLoader::Inline,
|
);
|
||||||
i18nc( "Argument is application name", "This configuration section is "
|
kcm = KCModuleLoader::reportError(
|
||||||
"already opened in %1" , reply.value() ), " ", parent );
|
KCModuleLoader::Inline,
|
||||||
|
i18nc(
|
||||||
|
"Argument is application name", "This configuration section is "
|
||||||
|
"already opened in %1", reply.value()
|
||||||
|
),
|
||||||
|
" ",
|
||||||
|
parent
|
||||||
|
);
|
||||||
topLayout->addWidget(kcm);
|
topLayout->addWidget(kcm);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
kDebug(711) << "Calling KCModuleProxy's DBus interface for fetching the name failed.";
|
kDebug(711) << "Calling KCModuleProxy's DBus interface for fetching the name failed.";
|
||||||
bogusOccupier = true;
|
bogusOccupier = true;
|
||||||
loadModule();
|
loadModule();
|
||||||
|
@ -169,7 +182,7 @@ void KCModuleProxyPrivate::_k_ownerChanged(const QString &service, const QString
|
||||||
// Violence: Get rid of KCMError & CO, so that
|
// Violence: Get rid of KCMError & CO, so that
|
||||||
// realModule() attempts to reload the module
|
// realModule() attempts to reload the module
|
||||||
delete kcm;
|
delete kcm;
|
||||||
kcm = 0;
|
kcm = nullptr;
|
||||||
Q_Q(KCModuleProxy);
|
Q_Q(KCModuleProxy);
|
||||||
q->realModule();
|
q->realModule();
|
||||||
|
|
||||||
|
@ -196,7 +209,6 @@ void KCModuleProxy::showEvent( QShowEvent * ev )
|
||||||
KCModuleProxy::~KCModuleProxy()
|
KCModuleProxy::~KCModuleProxy()
|
||||||
{
|
{
|
||||||
deleteClient();
|
deleteClient();
|
||||||
|
|
||||||
delete d_ptr;
|
delete d_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +216,7 @@ void KCModuleProxy::deleteClient()
|
||||||
{
|
{
|
||||||
Q_D(KCModuleProxy);
|
Q_D(KCModuleProxy);
|
||||||
delete d->kcm;
|
delete d->kcm;
|
||||||
d->kcm = 0;
|
d->kcm = nullptr;
|
||||||
|
|
||||||
if (qApp) {
|
if (qApp) {
|
||||||
qApp->syncX();
|
qApp->syncX();
|
||||||
|
@ -225,36 +237,37 @@ void KCModuleProxyPrivate::_k_moduleChanged(bool c)
|
||||||
|
|
||||||
void KCModuleProxyPrivate::_k_moduleDestroyed()
|
void KCModuleProxyPrivate::_k_moduleDestroyed()
|
||||||
{
|
{
|
||||||
kcm = 0;
|
kcm = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleProxy::KCModuleProxy(const KService::Ptr &service, QWidget *parent,
|
KCModuleProxy::KCModuleProxy(const KService::Ptr &service, QWidget *parent,
|
||||||
const QStringList &args)
|
const QStringList &args)
|
||||||
: QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(service), args))
|
: QWidget(parent),
|
||||||
|
d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(service), args))
|
||||||
{
|
{
|
||||||
d_ptr->q_ptr = this;
|
d_ptr->q_ptr = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleProxy::KCModuleProxy(const KCModuleInfo &info, QWidget *parent,
|
KCModuleProxy::KCModuleProxy(const KCModuleInfo &info, QWidget *parent,
|
||||||
const QStringList &args)
|
const QStringList &args)
|
||||||
: QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, info, args))
|
: QWidget(parent),
|
||||||
|
d_ptr(new KCModuleProxyPrivate(this, info, args))
|
||||||
{
|
{
|
||||||
d_ptr->q_ptr = this;
|
d_ptr->q_ptr = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModuleProxy::KCModuleProxy(const QString &serviceName, QWidget *parent,
|
KCModuleProxy::KCModuleProxy(const QString &serviceName, QWidget *parent,
|
||||||
const QStringList &args)
|
const QStringList &args)
|
||||||
: QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(serviceName), args))
|
: QWidget(parent),
|
||||||
|
d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(serviceName), args))
|
||||||
{
|
{
|
||||||
d_ptr->q_ptr = this;
|
d_ptr->q_ptr = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KCModuleProxy::load()
|
void KCModuleProxy::load()
|
||||||
{
|
{
|
||||||
Q_D(KCModuleProxy);
|
Q_D(KCModuleProxy);
|
||||||
if( realModule() )
|
if (realModule()) {
|
||||||
{
|
|
||||||
d->kcm->load();
|
d->kcm->load();
|
||||||
d->_k_moduleChanged(false);
|
d->_k_moduleChanged(false);
|
||||||
}
|
}
|
||||||
|
@ -263,8 +276,7 @@ void KCModuleProxy::load()
|
||||||
void KCModuleProxy::save()
|
void KCModuleProxy::save()
|
||||||
{
|
{
|
||||||
Q_D(KCModuleProxy);
|
Q_D(KCModuleProxy);
|
||||||
if( d->changed && realModule() )
|
if (d->changed && realModule()) {
|
||||||
{
|
|
||||||
d->kcm->save();
|
d->kcm->save();
|
||||||
d->_k_moduleChanged(false);
|
d->_k_moduleChanged(false);
|
||||||
}
|
}
|
||||||
|
@ -273,9 +285,10 @@ void KCModuleProxy::save()
|
||||||
void KCModuleProxy::defaults()
|
void KCModuleProxy::defaults()
|
||||||
{
|
{
|
||||||
Q_D(KCModuleProxy);
|
Q_D(KCModuleProxy);
|
||||||
if( realModule() )
|
if (realModule()) {
|
||||||
d->kcm->defaults();
|
d->kcm->defaults();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString KCModuleProxy::quickHelp() const
|
QString KCModuleProxy::quickHelp() const
|
||||||
{
|
{
|
||||||
|
@ -284,13 +297,14 @@ QString KCModuleProxy::quickHelp() const
|
||||||
|
|
||||||
const KAboutData* KCModuleProxy::aboutData() const
|
const KAboutData* KCModuleProxy::aboutData() const
|
||||||
{
|
{
|
||||||
return realModule() ? realModule()->aboutData() : 0;
|
return realModule() ? realModule()->aboutData() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
KCModule::Buttons KCModuleProxy::buttons() const
|
KCModule::Buttons KCModuleProxy::buttons() const
|
||||||
{
|
{
|
||||||
if( realModule() )
|
if (realModule()) {
|
||||||
return realModule()->buttons();
|
return realModule()->buttons();
|
||||||
|
}
|
||||||
return KCModule::Buttons(KCModule::Help | KCModule::Default | KCModule::Apply);
|
return KCModule::Buttons(KCModule::Help | KCModule::Default | KCModule::Apply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,5 +354,3 @@ QString KCModuleProxy::dbusPath() const
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
#include "moc_kcmoduleproxy.cpp"
|
#include "moc_kcmoduleproxy.cpp"
|
||||||
|
|
||||||
// vim: ts=4
|
|
||||||
|
|
|
@ -71,10 +71,9 @@ public:
|
||||||
*
|
*
|
||||||
* @param info The KCModuleInfo to construct the module from.
|
* @param info The KCModuleInfo to construct the module from.
|
||||||
* @param parent the parent QWidget.
|
* @param parent the parent QWidget.
|
||||||
* @param args This is used in the implementation and is internal.
|
* @param args This is used in the implementation and is internal. Use the default.
|
||||||
* Use the default.
|
|
||||||
*/
|
*/
|
||||||
explicit KCModuleProxy( const KCModuleInfo& info, QWidget* parent = 0,
|
explicit KCModuleProxy(const KCModuleInfo &info, QWidget *parent = nullptr,
|
||||||
const QStringList &args = QStringList());
|
const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,10 +83,9 @@ public:
|
||||||
*
|
*
|
||||||
* @param serviceName The module's service name to construct from.
|
* @param serviceName The module's service name to construct from.
|
||||||
* @param parent the parent QWidget.
|
* @param parent the parent QWidget.
|
||||||
* @param args This is used in the implementation and is internal.
|
* @param args This is used in the implementation and is internal. Use the default.
|
||||||
* Use the default.
|
|
||||||
*/
|
*/
|
||||||
explicit KCModuleProxy( const QString& serviceName, QWidget* parent = 0,
|
explicit KCModuleProxy(const QString &serviceName, QWidget *parent = nullptr,
|
||||||
const QStringList &args = QStringList());
|
const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,10 +93,9 @@ public:
|
||||||
*
|
*
|
||||||
* @param service The KService to construct from.
|
* @param service The KService to construct from.
|
||||||
* @param parent the parent QWidget.
|
* @param parent the parent QWidget.
|
||||||
* @param args This is used in the implementation and is internal.
|
* @param args This is used in the implementation and is internal. Use the default.
|
||||||
* Use the default.
|
|
||||||
*/
|
*/
|
||||||
explicit KCModuleProxy( const KService::Ptr& service, QWidget* parent = 0,
|
explicit KCModuleProxy(const KService::Ptr &service, QWidget *parent = nullptr,
|
||||||
const QStringList &args = QStringList());
|
const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,17 +104,14 @@ public:
|
||||||
~KCModuleProxy();
|
~KCModuleProxy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calling it will cause the contained module to
|
* Calling it will cause the contained module to run its load() routine.
|
||||||
* run its load() routine.
|
|
||||||
*/
|
*/
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calling it will cause the contained module to
|
* Calling it will cause the contained module to run its save() routine.
|
||||||
* run its save() routine.
|
|
||||||
*
|
*
|
||||||
* If the module was not modified, it will not be asked
|
* If the module was not modified, it will not be asked to save.
|
||||||
* to save.
|
|
||||||
*/
|
*/
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
@ -138,8 +132,7 @@ public:
|
||||||
KCModule::Buttons buttons() const;
|
KCModule::Buttons buttons() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The module's custom root
|
* @return The module's custom root message, if it has one
|
||||||
* message, if it has one
|
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
QString rootOnlyMessage() const;
|
QString rootOnlyMessage() const;
|
||||||
|
@ -180,8 +173,7 @@ public:
|
||||||
KCModule* realModule() const;
|
KCModule* realModule() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a KCModuleInfo for the encapsulated
|
* @return a KCModuleInfo for the encapsulated module
|
||||||
* module
|
|
||||||
*/
|
*/
|
||||||
KCModuleInfo moduleInfo() const;
|
KCModuleInfo moduleInfo() const;
|
||||||
|
|
||||||
|
@ -195,7 +187,6 @@ public:
|
||||||
QString dbusPath() const;
|
QString dbusPath() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calling it will cause the contained module to
|
* Calling it will cause the contained module to
|
||||||
* load its default values.
|
* load its default values.
|
||||||
|
@ -210,7 +201,6 @@ public Q_SLOTS:
|
||||||
void deleteClient();
|
void deleteClient();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This signal is emitted when the contained module is changed.
|
* This signal is emitted when the contained module is changed.
|
||||||
*/
|
*/
|
||||||
|
@ -235,7 +225,6 @@ Q_SIGNALS:
|
||||||
void quickHelpChanged();
|
void quickHelpChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplemented for internal purposes. Makes sure the encapsulated
|
* Reimplemented for internal purposes. Makes sure the encapsulated
|
||||||
* module is loaded before the show event is taken care of.
|
* module is loaded before the show event is taken care of.
|
||||||
|
|
|
@ -74,4 +74,3 @@ class KCModuleProxyPrivate
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KCMUTILS_KCMODULEPROXY_P_H
|
#endif // KCMUTILS_KCMODULEPROXY_P_H
|
||||||
// vim: sw=4 sts=4 et tw=100
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog
|
||||||
*
|
*
|
||||||
* @param parent The parent widget
|
* @param parent The parent widget
|
||||||
**/
|
**/
|
||||||
KCMultiDialog( QWidget *parent = 0 );
|
KCMultiDialog(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,8 +66,7 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog
|
||||||
*
|
*
|
||||||
* @returns The @see KPageWidgetItem associated with the new dialog page.
|
* @returns The @see KPageWidgetItem associated with the new dialog page.
|
||||||
**/
|
**/
|
||||||
KPageWidgetItem* addModule( const QString& module, const QStringList&
|
KPageWidgetItem* addModule(const QString &module, const QStringList &args = QStringList());
|
||||||
args = QStringList() );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a module.
|
* Add a module.
|
||||||
|
@ -80,11 +79,11 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog
|
||||||
* to the list of modules the dialog will show.
|
* to the list of modules the dialog will show.
|
||||||
*
|
*
|
||||||
* @param parent The @see KPageWidgetItem that should appear as parents
|
* @param parent The @see KPageWidgetItem that should appear as parents
|
||||||
* in the tree view or a 0 pointer if there is no parent.
|
* in the tree view or a null pointer if there is no parent.
|
||||||
*
|
*
|
||||||
* @param args The arguments that should be given to the KCModule when it is created
|
* @param args The arguments that should be given to the KCModule when it is created
|
||||||
**/
|
**/
|
||||||
KPageWidgetItem* addModule( const KCModuleInfo& moduleinfo, KPageWidgetItem *parent = 0,
|
KPageWidgetItem* addModule(const KCModuleInfo &moduleinfo, KPageWidgetItem *parent = nullptr,
|
||||||
const QStringList &args = QStringList());
|
const QStringList &args = QStringList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue