From 48e591141be2e7390e0d64507fc41422a24e0b05 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 30 Jul 2023 09:44:43 +0300 Subject: [PATCH] kutils: format and indent Signed-off-by: Ivailo Monev --- kutils/kcmodulecontainer.cpp | 179 +++++++++--------- kutils/kcmoduleinfo.cpp | 122 +++++++------ kutils/kcmoduleinfo.h | 164 +++++++++-------- kutils/kcmoduleloader.cpp | 121 +++++++------ kutils/kcmoduleloader.h | 47 +++-- kutils/kcmoduleproxy.cpp | 290 ++++++++++++++++-------------- kutils/kcmoduleproxy.h | 287 ++++++++++++++--------------- kutils/kcmoduleproxy_p.h | 75 ++++---- kutils/kcmultidialog.h | 45 +++-- kutils/ksettingswidgetadaptor.cpp | 2 +- 10 files changed, 670 insertions(+), 662 deletions(-) diff --git a/kutils/kcmodulecontainer.cpp b/kutils/kcmodulecontainer.cpp index 9e22d379..ca43474c 100644 --- a/kutils/kcmodulecontainer.cpp +++ b/kutils/kcmodulecontainer.cpp @@ -42,155 +42,146 @@ /***********************************************************************/ class KCModuleContainer::KCModuleContainerPrivate { - public: - KCModuleContainerPrivate( const QStringList& mods ) - : modules( mods ) - , tabWidget( 0 ) - , topLayout( 0 ) - {} - - QStringList modules; - KTabWidget *tabWidget; - KCModule::Buttons buttons; - QVBoxLayout *topLayout; - +public: + KCModuleContainerPrivate(const QStringList &mods) + : modules(mods), + tabWidget(nullptr), + topLayout(nullptr) + { + } + QStringList modules; + KTabWidget *tabWidget; + KCModule::Buttons buttons; + QVBoxLayout *topLayout; }; /***********************************************************************/ - // 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 // KComponentData objects when needed. /***********************************************************************/ -KCModuleContainer::KCModuleContainer( QWidget* parent, const QString& mods ) +KCModuleContainer::KCModuleContainer(QWidget *parent, const QString &mods) : KCModule( KGlobal::mainComponent(), parent ), - d(new KCModuleContainerPrivate( QString(mods).remove( ' ' ).split( ',', QString::SkipEmptyParts ) )) + d(new KCModuleContainerPrivate(QString(mods).remove(' ').split(',', QString::SkipEmptyParts))) { - init(); + init(); } -KCModuleContainer::KCModuleContainer( QWidget* parent, const QStringList& mods ) - : KCModule( KGlobal::mainComponent(), parent ), - d( new KCModuleContainerPrivate( mods ) ) +KCModuleContainer::KCModuleContainer(QWidget *parent, const QStringList &mods) + : KCModule( KGlobal::mainComponent(), parent), + d(new KCModuleContainerPrivate(mods)) { - init(); + init(); } void KCModuleContainer::init() { - d->topLayout = new QVBoxLayout( this ); - d->topLayout->setMargin( 0 ); - d->topLayout->setObjectName( "topLayout" ); - d->tabWidget = new KTabWidget(this); - d->tabWidget->setObjectName( "tabWidget"); - connect( d->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabSwitched(int))); - d->topLayout->addWidget( d->tabWidget ); + d->topLayout = new QVBoxLayout(this); + d->topLayout->setMargin(0); + d->topLayout->setObjectName("topLayout"); + d->tabWidget = new KTabWidget(this); + d->tabWidget->setObjectName("tabWidget"); + connect(d->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabSwitched(int))); + d->topLayout->addWidget(d->tabWidget); - if ( !d->modules.isEmpty() ) - { - /* Add our modules */ - foreach (const QString it, d->modules ) - addModule( it ); - } + if (!d->modules.isEmpty()) { + /* Add our modules */ + foreach (const QString it, d->modules) { + addModule(it); + } + } } -void KCModuleContainer::addModule( const QString& module ) +void KCModuleContainer::addModule(const QString &module) { - /* In case it doesn't exist we just silently drop it. - * This allows people to easily extend containers. - * For example, KCM monitor gamma can be in kdegraphics. - */ - KService::Ptr service = KService::serviceByDesktopName( module ); - if ( !service ) - { - kDebug(713) << "KCModuleContainer: module '" << - module << "' was not found and thus not loaded"; - return; - } + /* In case it doesn't exist we just silently drop it. + * This allows people to easily extend containers. + * For example, KCM monitor gamma can be in kdegraphics. + */ + KService::Ptr service = KService::serviceByDesktopName(module); + if (!service) { + kDebug(713) << "KCModuleContainer: module '" + << module << "' was not found and thus not loaded"; + return; + } - if ( service->noDisplay() ) - return; + if (service->noDisplay()) { + return; + } - KCModuleProxy* proxy = new KCModuleProxy( service, d->tabWidget ); - allModules.append( proxy ); + KCModuleProxy* proxy = new KCModuleProxy(service, d->tabWidget); + allModules.append(proxy); - proxy->setObjectName( module.toLatin1() ); + proxy->setObjectName(module.toLatin1()); - d->tabWidget->addTab( proxy, KIcon( proxy->moduleInfo().icon() ), - /* Qt eats ampersands for dinner. But not this time. */ - proxy->moduleInfo().moduleName().replace( '&', "&&" )); + d->tabWidget->addTab( + proxy, KIcon(proxy->moduleInfo().icon()), + /* 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()); - connect( proxy, SIGNAL(changed(KCModuleProxy*)), SLOT(moduleChanged(KCModuleProxy*))); + connect(proxy, SIGNAL(changed(KCModuleProxy*)), SLOT(moduleChanged(KCModuleProxy*))); - /* Collect our buttons - we go for the common deliminator */ - setButtons( buttons() | proxy->realModule()->buttons() ); + /* Collect our buttons - we go for the common deliminator */ + setButtons(buttons() | proxy->realModule()->buttons()); } void KCModuleContainer::tabSwitched(int index) { - KCModuleProxy* mod = static_cast(d->tabWidget->widget(index)); - setQuickHelp( mod->quickHelp() ); - setAboutData( mod->aboutData() ); + KCModuleProxy* mod = static_cast(d->tabWidget->widget(index)); + setQuickHelp(mod->quickHelp()); + setAboutData(mod->aboutData()); } void KCModuleContainer::save() { - ModuleList list = changedModules; - ModuleList::iterator it; - for ( it = list.begin() ; it !=list.end() ; ++it ) - { - (*it)->save(); - } + ModuleList list = changedModules; + ModuleList::iterator it; + for ( it = list.begin() ; it !=list.end() ; ++it ) { + (*it)->save(); + } - emit changed( false ); + emit changed( false ); } void KCModuleContainer::load() { - ModuleList list = allModules; - ModuleList::iterator it; - for ( it = list.begin() ; it !=list.end() ; ++it ) - { - (*it)->load(); - } + ModuleList list = allModules; + ModuleList::iterator it; + for ( it = list.begin() ; it !=list.end() ; ++it ) { + (*it)->load(); + } - emit changed( false ); + emit changed( false ); } void KCModuleContainer::defaults() { - ModuleList list = allModules; - ModuleList::iterator it; - for ( it = list.begin() ; it !=list.end() ; ++it ) - { - (*it)->defaults(); - } + ModuleList list = allModules; + ModuleList::iterator it; + for (it = list.begin() ; it !=list.end() ; ++it) { + (*it)->defaults(); + } - emit changed( true ); + emit changed( true ); } - -void KCModuleContainer::moduleChanged(KCModuleProxy * proxy) +void KCModuleContainer::moduleChanged(KCModuleProxy *proxy) { - changedModules.append( proxy ); - if( changedModules.isEmpty() ) - return; + changedModules.append(proxy); + if (changedModules.isEmpty()) { + return; + } - emit changed(true); + emit changed(true); } KCModuleContainer::~KCModuleContainer() { - delete d; + delete d; } - -/***********************************************************************/ - - - - diff --git a/kutils/kcmoduleinfo.cpp b/kutils/kcmoduleinfo.cpp index 8d613097..a17d733b 100644 --- a/kutils/kcmoduleinfo.cpp +++ b/kutils/kcmoduleinfo.cpp @@ -33,14 +33,19 @@ class KCModuleInfo::Private { - public: +public: Private(); - Private( KService::Ptr ); + Private(KService::Ptr s); QStringList keywords; - QString name, icon, lib, fileName, doc, comment; - bool allLoaded; - int weight; + QString name; + QString icon; + QString lib; + QString fileName; + QString doc; + QString comment; + bool allLoaded; + int weight; KService::Ptr service; @@ -55,131 +60,130 @@ KCModuleInfo::Private::Private() { } -KCModuleInfo::Private::Private( KService::Ptr s ) - : allLoaded( false ) - , service( s ) +KCModuleInfo::Private::Private(KService::Ptr s) + : allLoaded(false), + service(s) { - if ( !service ) - { - kDebug(712) << "Could not find the service."; - return; - } + if (!service) { + kDebug(712) << "Could not find the service."; + return; + } - // set the modules simple attributes - name = service->name(); - comment = service->comment(); - icon = service->icon(); - fileName = service->entryPath(); - lib = service->library(); - keywords = service->keywords(); + // set the modules simple attributes + name = service->name(); + comment = service->comment(); + icon = service->icon(); + fileName = service->entryPath(); + lib = service->library(); + keywords = service->keywords(); } 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; } -KCModuleInfo &KCModuleInfo::operator=( const KCModuleInfo &rhs ) +KCModuleInfo &KCModuleInfo::operator=(const KCModuleInfo &rhs) { *d = *(rhs.d); return *this; } -bool KCModuleInfo::operator==( const KCModuleInfo & rhs ) const +bool KCModuleInfo::operator==(const KCModuleInfo &rhs) const { - return ( ( d->name == rhs.d->name ) && ( d->lib == rhs.d->lib ) && ( d->fileName == rhs.d->fileName ) ); + return ((d->name == rhs.d->name) && (d->lib == rhs.d->lib) && (d->fileName == rhs.d->fileName)); } -bool KCModuleInfo::operator!=( const KCModuleInfo & rhs ) const +bool KCModuleInfo::operator!=(const KCModuleInfo &rhs) const { - return ! operator==( rhs ); + return !operator==(rhs); } KCModuleInfo::~KCModuleInfo() { - delete d; + delete d; } void KCModuleInfo::Private::loadAll() { - allLoaded = true; + allLoaded = true; - if( !service ) /* We have a bogus service. All get functions will return empty/zero values */ - return; + if (!service) { + /* We have a bogus service. All get functions will return empty/zero values */ + return; + } - // get the documentation path - doc = service->property( "X-DocPath", QVariant::String ).toString(); + // get the documentation path + doc = service->property("X-DocPath", QVariant::String).toString(); - // read weight - QVariant tmp = service->property( "X-KDE-Weight", QVariant::Int ); - weight = tmp.isValid() ? tmp.toInt() : 100; + // read weight + QVariant tmp = service->property("X-KDE-Weight", QVariant::Int); + weight = tmp.isValid() ? tmp.toInt() : 100; } QString KCModuleInfo::fileName() const { - return d->fileName; + return d->fileName; } QStringList KCModuleInfo::keywords() const { - return d->keywords; + return d->keywords; } QString KCModuleInfo::moduleName() const { - return d->name; + return d->name; } KService::Ptr KCModuleInfo::service() const { - return d->service; + return d->service; } QString KCModuleInfo::comment() const { - return d->comment; + return d->comment; } QString KCModuleInfo::icon() const { - return d->icon; + return d->icon; } QString KCModuleInfo::library() const { - return d->lib; + return d->lib; } QString KCModuleInfo::docPath() const { - if (!d->allLoaded) - d->loadAll(); - - return d->doc; + if (!d->allLoaded) { + d->loadAll(); + } + return d->doc; } int KCModuleInfo::weight() const { - if (!d->allLoaded) - d->loadAll(); - - return d->weight; + if (!d->allLoaded) { + d->loadAll(); + } + return d->weight; } - -// vim: ts=2 sw=2 et diff --git a/kutils/kcmoduleinfo.h b/kutils/kcmoduleinfo.h index 5ad953bd..bb4981b5 100644 --- a/kutils/kcmoduleinfo.h +++ b/kutils/kcmoduleinfo.h @@ -44,114 +44,110 @@ * @author Daniel Molkentin * */ -class KCMUTILS_EXPORT KCModuleInfo // krazy:exclude=dpointer (implicitly shared) +class KCMUTILS_EXPORT KCModuleInfo { - public: + /** + * Constructs a KCModuleInfo. + * @note a KCModuleInfo object will have to be manually deleted, it is not + * done automatically for you. + * @param desktopFile the desktop file representing the module, or + * the name of the module. + */ + KCModuleInfo(const QString &desktopFile); - /** - * Constructs a KCModuleInfo. - * @note a KCModuleInfo object will have to be manually deleted, it is not - * done automatically for you. - * @param desktopFile the desktop file representing the module, or - * the name of the module. - */ - KCModuleInfo(const QString& desktopFile); - - /** - * Same as above but takes a KService::Ptr as argument. - * - * @note @p moduleInfo must be a valid pointer. - * - * @param moduleInfo specifies the module - */ - KCModuleInfo( KService::Ptr moduleInfo ); + /** + * Same as above but takes a KService::Ptr as argument. + * + * @note @p moduleInfo must be a valid pointer. + * + * @param moduleInfo specifies the module + */ + KCModuleInfo(KService::Ptr moduleInfo); - /** - * Same as above but takes a KCModuleInfo as argument. - * - * @param rhs specifies the module - */ - KCModuleInfo( const KCModuleInfo &rhs ); + /** + * Same as above but takes a KCModuleInfo as argument. + * + * @param rhs specifies the module + */ + KCModuleInfo(const KCModuleInfo &rhs); - /** - * Same as above but creates an empty KCModuleInfo. - * You should not normally call this. - */ - KCModuleInfo(); + /** + * Same as above but creates an empty KCModuleInfo. + * You should not normally call this. + */ + KCModuleInfo(); - /** - * Assignment operator - */ - KCModuleInfo &operator=( const KCModuleInfo &rhs ); + /** + * Assignment operator + */ + KCModuleInfo &operator=(const KCModuleInfo &rhs); /** * Returns true if @p rhs describes the same KCModule as this object. */ - bool operator==( const KCModuleInfo &rhs ) const; + bool operator==(const KCModuleInfo &rhs) const; - /** - * @return true if @p rhs is not equal itself - */ - bool operator!=( const KCModuleInfo &rhs ) const; + /** + * @return true if @p rhs is not equal itself + */ + bool operator!=(const KCModuleInfo &rhs) const; - /** - * Default destructor. - */ - ~KCModuleInfo(); + /** + * Default destructor. + */ + ~KCModuleInfo(); - /** - * @return the filename of the .desktop file that describes the KCM - */ - QString fileName() const; + /** + * @return the filename of the .desktop file that describes the KCM + */ + QString fileName() const; - /** - * @return the keywords associated with this KCM. - */ - QStringList keywords() const; + /** + * @return the keywords associated with this KCM. + */ + QStringList keywords() const; - /** - * @return the module\'s (translated) name - */ - QString moduleName() const; + /** + * @return the module\'s (translated) name + */ + QString moduleName() const; - /** - * @return a KSharedPtr to KService created from the modules .desktop file - */ - KService::Ptr service() const; + /** + * @return a KSharedPtr to KService created from the modules .desktop file + */ + KService::Ptr service() const; - /** - * @return the module's (translated) comment field - */ - QString comment() const; + /** + * @return the module's (translated) comment field + */ + QString comment() const; - /** - * @return the module's icon name - */ - QString icon() const; + /** + * @return the module's icon name + */ + QString icon() const; - /** - * @return the path of the module's documentation - */ - QString docPath() const; + /** + * @return the path of the module's documentation + */ + QString docPath() const; - /** - * @return the library name - */ - QString library() const; + /** + * @return the library name + */ + QString library() const; - /** - * @return the weight of the module which determines the order of the pages in - * the KCMultiDialog. It's set by the X-KDE-Weight field. - */ - int weight() const; + /** + * @return the weight of the module which determines the order of the pages in + * the KCMultiDialog. It's set by the X-KDE-Weight field. + */ + int weight() const; private: - class Private; - Private * d; + class Private; + Private *d; }; #endif // KCMODULEINFO_H - -// vim: ts=2 sw=2 et diff --git a/kutils/kcmoduleloader.cpp b/kutils/kcmoduleloader.cpp index a378aa7b..33072ef7 100644 --- a/kutils/kcmoduleloader.cpp +++ b/kutils/kcmoduleloader.cpp @@ -41,44 +41,60 @@ using namespace KCModuleLoader; class KCMError : public KCModule { public: - KCMError( const QString& msg, const QString& details, QWidget* parent ) - : KCModule( KGlobal::mainComponent(), parent ) - { - QVBoxLayout* topLayout = new QVBoxLayout( this ); - QLabel *lab = new QLabel( msg, this ); - lab->setWordWrap(true); - topLayout->addWidget( lab ); - lab = new QLabel(details, this ); - lab->setWordWrap(true); - topLayout->addWidget( lab ); - } + KCMError(const QString &msg, const QString &details, QWidget *parent) + : KCModule(KGlobal::mainComponent(), parent) + { + QVBoxLayout* topLayout = new QVBoxLayout(this); + QLabel *lab = new QLabel(msg, this); + lab->setWordWrap(true); + topLayout->addWidget(lab); + lab = new QLabel(details, this); + lab->setWordWrap(true); + topLayout->addWidget(lab); + } }; /***************************************************************/ -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: - * We just have to load the library and get the module - * from the factory. - */ + /* + * Simple libraries as modules are the easiest case: + * We just have to load the library and get the module + * from the factory. + */ - if ( !mod.service() ) - return reportError( report, - i18n("The module %1 could not be found.", - mod.moduleName() ), i18n("

The diagnosis is:
The desktop file %1 could not be found.

", mod.fileName()), parent ); - if( mod.service()->noDisplay() ) - return reportError( report, i18n( "The module %1 is disabled.", mod.moduleName() ), - i18n( "

Either the hardware/software the module configures is not available or the module has been disabled by the administrator.

" ), - parent ); + if (!mod.service()) { + return reportError( + report, + i18n( + "The module %1 could not be found.", + mod.moduleName() + ), + i18n( + "

The diagnosis is:
The desktop file %1 could not be found.

", mod.fileName() + ), + parent + ); + } + if (mod.service()->noDisplay()) { + return reportError( + report, + i18n("The module %1 is disabled.", mod.moduleName()), + i18n( + "

Either the hardware/software the module configures is not available or the module has been disabled by the administrator.

" + ), + parent + ); + } - if (!mod.library().isEmpty()) - { + if (!mod.library().isEmpty()) { QString error; QVariantList args2; foreach (const QString &arg, args) { @@ -89,31 +105,36 @@ KCModule* KCModuleLoader::loadModule(const KCModuleInfo& mod, ErrorReporting rep return module; } return reportError(report, error, QString(), parent); - } + } - /* - * Ok, we could not load the library. - * Try to run it as an executable. - * This must not be done when calling from kcmshell, or you'll - * have infinite recursion - * (startService calls kcmshell which calls modloader which calls startService...) - * - */ - return reportError( report, - i18n("The module %1 is not a valid configuration module.", mod.moduleName() ), - i18n("The diagnosis is:
The desktop file %1 does not specify a library.
", mod.fileName()), parent ); + /* + * Ok, we could not load the library. + * Try to run it as an executable. + * This must not be done when calling from kcmshell, or you'll + * have infinite recursion + * (startService calls kcmshell which calls modloader which calls startService...) + * + */ + return reportError( + report, + i18n("The module %1 is not a valid configuration module.", mod.moduleName()), + i18n("The diagnosis is:
The desktop file %1 does not specify a library.
", mod.fileName()), + parent + ); } -KCModule* KCModuleLoader::reportError( ErrorReporting report, const QString & text, - const QString &details, QWidget * parent ) +KCModule* KCModuleLoader::reportError(ErrorReporting report, const QString &text, + const QString &details, QWidget *parent) { QString realDetails = details; if (realDetails.isNull()) { - realDetails = i18n("

Possible reasons:

  • An error occurred during your last " - "KDE upgrade leaving an orphaned control module
  • You have old third party " - "modules lying around.

Check these points carefully and try to remove " - "the module mentioned in the error message. If this fails, consider contacting " - "your distributor or packager.

"); + realDetails = i18n( + "

Possible reasons:

  • An error occurred during your last " + "KDE upgrade leaving an orphaned control module
  • You have old third party " + "modules lying around.

Check these points carefully and try to remove " + "the module mentioned in the error message. If this fails, consider contacting " + "your distributor or packager.

" + ); } if (report & KCModuleLoader::Dialog) { KMessageBox::detailedError(parent, text, realDetails); @@ -121,7 +142,5 @@ KCModule* KCModuleLoader::reportError( ErrorReporting report, const QString & te if (report & KCModuleLoader::Inline) { return new KCMError(text, realDetails, parent); } - return 0; + return nullptr; } - -// vim: ts=4 diff --git a/kutils/kcmoduleloader.h b/kutils/kcmoduleloader.h index 1b492496..dba67095 100644 --- a/kutils/kcmoduleloader.h +++ b/kutils/kcmoduleloader.h @@ -46,23 +46,23 @@ namespace KCModuleLoader * Determines the way errors are reported */ enum ErrorReporting { - /** - * 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 + /** + * 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 }; /** @@ -72,8 +72,8 @@ namespace KCModuleLoader * * @return a pointer to the loaded @ref KCModule */ - KCMUTILS_EXPORT KCModule *loadModule(const KCModuleInfo &module, ErrorReporting - report, QWidget * parent = 0, const QStringList& args = QStringList() ); + KCMUTILS_EXPORT KCModule* loadModule(const KCModuleInfo &module, ErrorReporting report, + QWidget *parent = nullptr, const QStringList &args = QStringList()); /** * Loads a @ref KCModule. If loading fails a zero pointer is returned. @@ -83,8 +83,8 @@ namespace KCModuleLoader * * @return a pointer to the loaded @ref KCModule */ - KCMUTILS_EXPORT KCModule *loadModule( const QString &module, ErrorReporting report, - QWidget *parent = 0, const QStringList& args = QStringList() ); + KCMUTILS_EXPORT KCModule* loadModule(const QString &module, ErrorReporting report, + QWidget *parent = nullptr, const QStringList &args = QStringList()); /** * Returns a KCModule containing the messages @p report and @p text. @@ -95,9 +95,8 @@ namespace KCModuleLoader * * @internal */ - KCMUTILS_EXPORT KCModule* reportError( ErrorReporting report, const QString & text, - const QString &details, QWidget * parent ); + KCMUTILS_EXPORT KCModule* reportError(ErrorReporting report, const QString &text, + const QString &details, QWidget *parent); } -// vim: ts=2 sw=2 et #endif // KCMODULELOADER_H diff --git a/kutils/kcmoduleproxy.cpp b/kutils/kcmoduleproxy.cpp index 94f1677a..c64a088f 100644 --- a/kutils/kcmoduleproxy.cpp +++ b/kutils/kcmoduleproxy.cpp @@ -44,123 +44,136 @@ TODO: - Two Layout problems in runAsRoot: - * lblBusy doesn't show - * d->kcm/d->rootInfo doesn't get it right when the user - presses cancel in the kdesudo dialog + * lblBusy doesn't show + * d->kcm/d->rootInfo doesn't get it right when the user presses cancel in the kdesudo dialog - 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. - Prettify: set icon in KCMultiDialog. - */ +*/ /***************************************************************/ KCModule* KCModuleProxy::realModule() const { Q_D(const KCModuleProxy); - /* - * Note, don't call any function that calls realModule() since - * that leads to an infinite loop. - */ + /* + * Note, don't call any function that calls realModule() since + * that leads to an infinite loop. + */ - /* Already loaded */ - if( !d->kcm ) - { - QApplication::setOverrideCursor( Qt::WaitCursor ); - const_cast(d)->loadModule(); - QApplication::restoreOverrideCursor(); - } - return d->kcm; + /* Already loaded */ + if (!d->kcm) { + QApplication::setOverrideCursor(Qt::WaitCursor); + const_cast(d)->loadModule(); + QApplication::restoreOverrideCursor(); + } + return d->kcm; } void KCModuleProxyPrivate::loadModule() { - if( !topLayout ) - { - topLayout = new QVBoxLayout( parent ); - topLayout->setMargin( 0 ); + if (!topLayout) { + topLayout = new QVBoxLayout(parent); + topLayout->setMargin(0); - QString name = modInfo.library(); - name.replace("-", "_"); //hyphen is not allowed in dbus, only [A-Z][a-z][0-9]_ - dbusPath = QLatin1String("/internal/KSettingsWidget/") + name; - dbusService = QLatin1String("org.kde.internal.KSettingsWidget_") + name; - } + QString name = modInfo.library(); + name.replace("-", "_"); //hyphen is not allowed in dbus, only [A-Z][a-z][0-9]_ + dbusPath = QLatin1String("/internal/KSettingsWidget/") + name; + dbusService = QLatin1String("org.kde.internal.KSettingsWidget_") + name; + } - if( QDBusConnection::sessionBus().registerService( dbusService ) || bogusOccupier ) - { /* We got the name we requested, because no one was before us, - * 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(); + if (QDBusConnection::sessionBus().registerService(dbusService) || bogusOccupier) { + /* We got the name we requested, because no one was before us, + * 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(); - kcm = KCModuleLoader::loadModule( modInfo, KCModuleLoader::Inline, parent, args ); + kcm = KCModuleLoader::loadModule(modInfo, KCModuleLoader::Inline, parent, args); QObject::connect(kcm, SIGNAL(changed(bool)), parent, SLOT(_k_moduleChanged(bool))); QObject::connect(kcm, SIGNAL(destroyed()), parent, SLOT(_k_moduleDestroyed())); - QObject::connect( kcm, SIGNAL(quickHelpChanged()), parent, SIGNAL(quickHelpChanged()) ); - parent->setWhatsThis( kcm->quickHelp() ); + QObject::connect(kcm, SIGNAL(quickHelpChanged()), parent, SIGNAL(quickHelpChanged())); + parent->setWhatsThis(kcm->quickHelp()); - if ( kcm->layout() ) { - kcm->layout()->setMargin( 0 ); - } - topLayout->addWidget( kcm ); - if( !modInfo.library().isEmpty() ) - QDBusConnection::sessionBus().registerObject(dbusPath, new KSettingsWidgetAdaptor(parent), QDBusConnection::ExportAllSlots); + if (kcm->layout()) { + kcm->layout()->setMargin(0); + } + topLayout->addWidget( kcm ); + if (!modInfo.library().isEmpty()) { + QDBusConnection::sessionBus().registerObject( + dbusPath, new KSettingsWidgetAdaptor(parent), QDBusConnection::ExportAllSlots + ); + } - if ( !rootInfo && /* If it's not already done */ - kcm->useRootOnlyMessage() && /* kcm wants root message */ - !KUser().isSuperUser() ) /* Not necessary if we're root */ - { - /*rootInfo = new QLabel( parent ); - topLayout->insertWidget( 0, rootInfo ); - - QPalette palette = rootInfo->palette(); - KStatefulBrush stbrush(KColorScheme::Window, KColorScheme::NeutralBackground); - qDebug() << stbrush.brush(rootInfo); - palette.setBrush(QPalette::Window, stbrush.brush(rootInfo)); - rootInfo->setPalette(palette); - rootInfo->setAutoFillBackground(true); + if (!rootInfo && /* If it's not already done */ + kcm->useRootOnlyMessage() && /* kcm wants root message */ + !KUser().isSuperUser() ) /* Not necessary if we're root */ + { +#if 0 + rootInfo = new QLabel(parent); + topLayout->insertWidget(0, rootInfo); - const QString message = kcm->rootOnlyMessage(); - if( message.isEmpty() ) - rootInfo->setText( i18n( - "Changes in this section require root access.
" - "On applying your changes you will have to supply your root " - "password." ) ); - else - rootInfo->setText(message); + QPalette palette = rootInfo->palette(); + KStatefulBrush stbrush(KColorScheme::Window, KColorScheme::NeutralBackground); + qDebug() << stbrush.brush(rootInfo); + palette.setBrush(QPalette::Window, stbrush.brush(rootInfo)); + rootInfo->setPalette(palette); + rootInfo->setAutoFillBackground(true); - rootInfo->setWhatsThis( i18n( - "This section requires special permissions, probably " - "for system-wide changes; therefore, it is " - "required that you provide the root password to be " - "able to change the module's properties. If " - "you cannot provide the password, the changes of the " - "module cannot be saved " ) );*/ - } - } - else - { - kDebug(711) << "Module already loaded, loading KCMError"; + const QString message = kcm->rootOnlyMessage(); + if (message.isEmpty() ) + rootInfo->setText( + i18n( + "Changes in this section require root access.
" + "On applying your changes you will have to supply your root " + "password." ) + ); + } else { + rootInfo->setText(message); + } - /* Figure out the name of where the module is already loaded */ - QDBusInterface proxy( dbusService, dbusPath, "org.kde.internal.KSettingsWidget" ); - QDBusReply reply = proxy.call("applicationName"); + rootInfo->setWhatsThis( + i18n( + "This section requires special permissions, probably " + "for system-wide changes; therefore, it is " + "required that you provide the root password to be " + "able to change the module's properties. If " + "you cannot provide the password, the changes of the " + "module cannot be saved " + ) + ); +#endif + } + } else { + kDebug(711) << "Module already loaded, loading KCMError"; - if( reply.isValid() ) - { - QObject::connect( QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), - parent, SLOT(_k_ownerChanged(QString,QString,QString))); - kcm = KCModuleLoader::reportError( KCModuleLoader::Inline, - i18nc( "Argument is application name", "This configuration section is " - "already opened in %1" , reply.value() ), " ", parent ); - topLayout->addWidget( kcm ); - } - else - { - kDebug(711) << "Calling KCModuleProxy's DBus interface for fetching the name failed."; - bogusOccupier = true; - loadModule(); - } - } + /* Figure out the name of where the module is already loaded */ + QDBusInterface proxy(dbusService, dbusPath, "org.kde.internal.KSettingsWidget"); + QDBusReply reply = proxy.call("applicationName"); + + if (reply.isValid()) { + QObject::connect( + QDBusConnection::sessionBus().interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)), + parent, SLOT(_k_ownerChanged(QString,QString,QString)) + ); + kcm = KCModuleLoader::reportError( + KCModuleLoader::Inline, + i18nc( + "Argument is application name", "This configuration section is " + "already opened in %1", reply.value() + ), + " ", + parent + ); + topLayout->addWidget(kcm); + } else { + kDebug(711) << "Calling KCModuleProxy's DBus interface for fetching the name failed."; + bogusOccupier = true; + loadModule(); + } + } } void KCModuleProxyPrivate::_k_ownerChanged(const QString &service, const QString &oldOwner, const QString &) @@ -169,7 +182,7 @@ void KCModuleProxyPrivate::_k_ownerChanged(const QString &service, const QString // Violence: Get rid of KCMError & CO, so that // realModule() attempts to reload the module delete kcm; - kcm = 0; + kcm = nullptr; Q_Q(KCModuleProxy); q->realModule(); @@ -178,33 +191,32 @@ void KCModuleProxyPrivate::_k_ownerChanged(const QString &service, const QString } } -void KCModuleProxy::showEvent( QShowEvent * ev ) +void KCModuleProxy::showEvent(QShowEvent *ev) { Q_D(KCModuleProxy); - ( void )realModule(); + (void)realModule(); - /* We have no kcm, if we're in root mode */ - if( d->kcm ) { - d->kcm->showEvent(ev); + /* We have no kcm, if we're in root mode */ + if( d->kcm ) { + d->kcm->showEvent(ev); } - QWidget::showEvent( ev ); + QWidget::showEvent(ev); } KCModuleProxy::~KCModuleProxy() { - deleteClient(); - - delete d_ptr; + deleteClient(); + delete d_ptr; } void KCModuleProxy::deleteClient() { Q_D(KCModuleProxy); delete d->kcm; - d->kcm = 0; + d->kcm = nullptr; if (qApp) { qApp->syncX(); @@ -213,7 +225,7 @@ void KCModuleProxy::deleteClient() void KCModuleProxyPrivate::_k_moduleChanged(bool c) { - if(changed == c) { + if (changed == c) { return; } @@ -225,112 +237,114 @@ void KCModuleProxyPrivate::_k_moduleChanged(bool c) void KCModuleProxyPrivate::_k_moduleDestroyed() { - kcm = 0; + kcm = nullptr; } -KCModuleProxy::KCModuleProxy( const KService::Ptr& service, QWidget * parent, - const QStringList& args ) - : QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(service), args)) +KCModuleProxy::KCModuleProxy(const KService::Ptr &service, QWidget *parent, + const QStringList &args) + : QWidget(parent), + d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(service), args)) { d_ptr->q_ptr = this; } -KCModuleProxy::KCModuleProxy( const KCModuleInfo& info, QWidget * parent, - const QStringList& args ) - : QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, info, args)) +KCModuleProxy::KCModuleProxy(const KCModuleInfo &info, QWidget *parent, + const QStringList &args) + : QWidget(parent), + d_ptr(new KCModuleProxyPrivate(this, info, args)) { d_ptr->q_ptr = this; } -KCModuleProxy::KCModuleProxy( const QString& serviceName, QWidget * parent, - const QStringList& args ) - : QWidget(parent), d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(serviceName), args)) +KCModuleProxy::KCModuleProxy(const QString &serviceName, QWidget *parent, + const QStringList &args) + : QWidget(parent), + d_ptr(new KCModuleProxyPrivate(this, KCModuleInfo(serviceName), args)) { d_ptr->q_ptr = this; } - void KCModuleProxy::load() { Q_D(KCModuleProxy); - if( realModule() ) - { - d->kcm->load(); + if (realModule()) { + d->kcm->load(); d->_k_moduleChanged(false); - } + } } void KCModuleProxy::save() { Q_D(KCModuleProxy); - if( d->changed && realModule() ) - { - d->kcm->save(); + if (d->changed && realModule()) { + d->kcm->save(); d->_k_moduleChanged(false); - } + } } void KCModuleProxy::defaults() { Q_D(KCModuleProxy); - if( realModule() ) - d->kcm->defaults(); + if (realModule()) { + d->kcm->defaults(); + } } QString KCModuleProxy::quickHelp() const { - return realModule() ? realModule()->quickHelp() : QString(); + return realModule() ? realModule()->quickHelp() : QString(); } -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 { - if( realModule() ) - return realModule()->buttons(); - return KCModule::Buttons( KCModule::Help | KCModule::Default | KCModule::Apply ); + if (realModule()) { + return realModule()->buttons(); + } + return KCModule::Buttons(KCModule::Help | KCModule::Default | KCModule::Apply); } QString KCModuleProxy::rootOnlyMessage() const { - return realModule() ? realModule()->rootOnlyMessage() : QString(); + return realModule() ? realModule()->rootOnlyMessage() : QString(); } bool KCModuleProxy::useRootOnlyMessage() const { - return realModule() ? realModule()->useRootOnlyMessage() : true; + return realModule() ? realModule()->useRootOnlyMessage() : true; } KComponentData KCModuleProxy::componentData() const { - return realModule() ? realModule()->componentData() : KComponentData(); + return realModule() ? realModule()->componentData() : KComponentData(); } bool KCModuleProxy::changed() const { Q_D(const KCModuleProxy); - return d->changed; + return d->changed; } KCModuleInfo KCModuleProxy::moduleInfo() const { Q_D(const KCModuleProxy); - return d->modInfo; + return d->modInfo; } QString KCModuleProxy::dbusService() const { Q_D(const KCModuleProxy); - return d->dbusService; + return d->dbusService; } QString KCModuleProxy::dbusPath() const { Q_D(const KCModuleProxy); - return d->dbusPath; + return d->dbusPath; } //X void KCModuleProxy::emitQuickHelpChanged() @@ -340,5 +354,3 @@ QString KCModuleProxy::dbusPath() const /***************************************************************/ #include "moc_kcmoduleproxy.cpp" - -// vim: ts=4 diff --git a/kutils/kcmoduleproxy.h b/kutils/kcmoduleproxy.h index c208bda3..d2b913df 100644 --- a/kutils/kcmoduleproxy.h +++ b/kutils/kcmoduleproxy.h @@ -63,184 +63,173 @@ class KCModuleProxyPrivate; */ class KCMUTILS_EXPORT KCModuleProxy : public QWidget { -Q_DECLARE_PRIVATE(KCModuleProxy) -Q_OBJECT + Q_DECLARE_PRIVATE(KCModuleProxy) + Q_OBJECT public: - /** - * Constructs a KCModuleProxy from a KCModuleInfo class. - * - * @param info The KCModuleInfo to construct the module from. - * @param parent the parent QWidget. - * @param args This is used in the implementation and is internal. - * Use the default. - */ - explicit KCModuleProxy( const KCModuleInfo& info, QWidget* parent = 0, - const QStringList& args = QStringList() ); + /** + * Constructs a KCModuleProxy from a KCModuleInfo class. + * + * @param info The KCModuleInfo to construct the module from. + * @param parent the parent QWidget. + * @param args This is used in the implementation and is internal. Use the default. + */ + explicit KCModuleProxy(const KCModuleInfo &info, QWidget *parent = nullptr, + const QStringList &args = QStringList()); - /** - * Constructs a KCModuleProxy from a module's service name, which is - * equivalent to the desktop file for the kcm without the ".desktop" part. - * Otherwise equal to the one above. - * - * @param serviceName The module's service name to construct from. - * @param parent the parent QWidget. - * @param args This is used in the implementation and is internal. - * Use the default. - */ - explicit KCModuleProxy( const QString& serviceName, QWidget* parent = 0, - const QStringList& args = QStringList() ); + /** + * Constructs a KCModuleProxy from a module's service name, which is + * equivalent to the desktop file for the kcm without the ".desktop" part. + * Otherwise equal to the one above. + * + * @param serviceName The module's service name to construct from. + * @param parent the parent QWidget. + * @param args This is used in the implementation and is internal. Use the default. + */ + explicit KCModuleProxy(const QString &serviceName, QWidget *parent = nullptr, + const QStringList &args = QStringList()); - /** - * Constructs a KCModuleProxy from KService. Otherwise equal to the one above. - * - * @param service The KService to construct from. - * @param parent the parent QWidget. - * @param args This is used in the implementation and is internal. - * Use the default. - */ - explicit KCModuleProxy( const KService::Ptr& service, QWidget* parent = 0, - const QStringList& args = QStringList() ); + /** + * Constructs a KCModuleProxy from KService. Otherwise equal to the one above. + * + * @param service The KService to construct from. + * @param parent the parent QWidget. + * @param args This is used in the implementation and is internal. Use the default. + */ + explicit KCModuleProxy(const KService::Ptr &service, QWidget *parent = nullptr, + const QStringList &args = QStringList()); - /** - * Default destructor - */ - ~KCModuleProxy(); + /** + * Default destructor + */ + ~KCModuleProxy(); - /** - * Calling it will cause the contained module to - * run its load() routine. - */ - void load(); + /** + * Calling it will cause the contained module to run its load() routine. + */ + void load(); - /** - * Calling it will cause the contained module to - * run its save() routine. - * - * If the module was not modified, it will not be asked - * to save. - */ - void save(); + /** + * Calling it will cause the contained module to run its save() routine. + * + * If the module was not modified, it will not be asked to save. + */ + void save(); - /** - * @return the module's quickHelp(); - */ - QString quickHelp() const; + /** + * @return the module's quickHelp(); + */ + QString quickHelp() const; - /** - * @return the module's aboutData() - */ - const KAboutData * aboutData() const; + /** + * @return the module's aboutData() + */ + const KAboutData* aboutData() const; - /** - * @return what buttons the module - * needs - */ - KCModule::Buttons buttons() const; + /** + * @return what buttons the module + * needs + */ + KCModule::Buttons buttons() const; - /** - * @return The module's custom root - * message, if it has one - * @deprecated - */ - QString rootOnlyMessage() const; - //KDE4 remove. There's a limit for convenience functions, - // this one's available via realModule()-> + /** + * @return The module's custom root message, if it has one + * @deprecated + */ + QString rootOnlyMessage() const; + //KDE4 remove. There's a limit for convenience functions, + // this one's available via realModule()-> - /** - * @return If the module is a root module. - * @deprecated - */ - bool useRootOnlyMessage() const; - //KDE4 remove. There's a limit for convenience functions, - // this one's available via realModule()-> + /** + * @return If the module is a root module. + * @deprecated + */ + bool useRootOnlyMessage() const; + //KDE4 remove. There's a limit for convenience functions, + // this one's available via realModule()-> - /** - * Returns the embedded KCModule's KComponentData. - * @return The module's KComponentData. - * @deprecated - */ - KComponentData componentData() const; - //KDE4 remove. There's a limit for convenience functions, - // this one's available via realModule() + /** + * Returns the embedded KCModule's KComponentData. + * @return The module's KComponentData. + * @deprecated + */ + KComponentData componentData() const; + //KDE4 remove. There's a limit for convenience functions, + // this one's available via realModule() - /** - * @return true if the module is modified - * and needs to be saved. - */ - bool changed() const; + /** + * @return true if the module is modified + * and needs to be saved. + */ + bool changed() const; - /** - * Access to the actual module. However, if the module is - * running in root mode, see rootMode(), this function returns - * a NULL pointer, since the module is in another process. It may also - * return NULL if anything goes wrong. - * - * @return the encapsulated module. - */ - KCModule* realModule() const; + /** + * Access to the actual module. However, if the module is + * running in root mode, see rootMode(), this function returns + * a NULL pointer, since the module is in another process. It may also + * return NULL if anything goes wrong. + * + * @return the encapsulated module. + */ + KCModule* realModule() const; - /** - * @return a KCModuleInfo for the encapsulated - * module - */ - KCModuleInfo moduleInfo() const; + /** + * @return a KCModuleInfo for the encapsulated module + */ + KCModuleInfo moduleInfo() const; - /** - * Returns the DBUS Service name - */ - QString dbusService() const; + /** + * Returns the DBUS Service name + */ + QString dbusService() const; /** * Returns the DBUS Path */ - QString dbusPath() const; + QString dbusPath() const; public Q_SLOTS: + /** + * Calling it will cause the contained module to + * load its default values. + */ + void defaults(); - /** - * Calling it will cause the contained module to - * load its default values. - */ - void defaults(); - - /** - * Calling this, results in deleting the contained - * module, and unregistering from DCOP. A similar result is achieved - * by deleting the KCModuleProxy itself. - */ - void deleteClient(); + /** + * Calling this, results in deleting the contained + * module, and unregistering from DCOP. A similar result is achieved + * by deleting the KCModuleProxy itself. + */ + void deleteClient(); Q_SIGNALS: + /* + * This signal is emitted when the contained module is changed. + */ + void changed(bool state); - /* - * This signal is emitted when the contained module is changed. - */ - void changed( bool state ); + /** + * This is emitted in the same situations as in the one above. Practical + * when several KCModuleProxys are loaded. + */ + void changed(KCModuleProxy *mod); - /** - * This is emitted in the same situations as in the one above. Practical - * when several KCModuleProxys are loaded. - */ - void changed( KCModuleProxy* mod ); + /** + * When a module running with root privileges and exits, returns to normal mode, the + * childClosed() signal is emitted. + */ + void childClosed(); - /** - * When a module running with root privileges and exits, returns to normal mode, the - * childClosed() signal is emitted. - */ - void childClosed(); - - /* - * This signal is relayed from the encapsulated module, and - * is equivalent to the module's own quickHelpChanged() signal. - */ - void quickHelpChanged(); + /* + * This signal is relayed from the encapsulated module, and + * is equivalent to the module's own quickHelpChanged() signal. + */ + void quickHelpChanged(); protected: - - /** - * Reimplemented for internal purposes. Makes sure the encapsulated - * module is loaded before the show event is taken care of. - */ - void showEvent( QShowEvent * ); + /** + * Reimplemented for internal purposes. Makes sure the encapsulated + * module is loaded before the show event is taken care of. + */ + void showEvent(QShowEvent *); protected: KCModuleProxyPrivate *const d_ptr; diff --git a/kutils/kcmoduleproxy_p.h b/kutils/kcmoduleproxy_p.h index f2fa4424..72c8d03b 100644 --- a/kutils/kcmoduleproxy_p.h +++ b/kutils/kcmoduleproxy_p.h @@ -28,50 +28,49 @@ class KCModuleProxyPrivate { Q_DECLARE_PUBLIC(KCModuleProxy) - protected: - KCModuleProxyPrivate(KCModuleProxy *_parent, const KCModuleInfo &info, const QStringList &_args) - : args(_args), kcm(0), topLayout(0), rootInfo(0), modInfo(info), - changed(false), bogusOccupier(false), parent(_parent) - { - } +protected: + KCModuleProxyPrivate(KCModuleProxy *_parent, const KCModuleInfo &info, const QStringList &_args) + : args(_args), kcm(0), topLayout(0), rootInfo(0), modInfo(info), + changed(false), bogusOccupier(false), parent(_parent) + { + } - ~KCModuleProxyPrivate() - { - delete rootInfo; // Delete before embedWidget! - delete kcm; - } + ~KCModuleProxyPrivate() + { + delete rootInfo; // Delete before embedWidget! + delete kcm; + } - void loadModule(); + void loadModule(); - /** - * Makes sure the proper variables is set and signals are emitted. - */ - void _k_moduleChanged(bool); + /** + * Makes sure the proper variables is set and signals are emitted. + */ + void _k_moduleChanged(bool); - /** - * Zeroes d->kcm - */ - void _k_moduleDestroyed(); + /** + * Zeroes d->kcm + */ + void _k_moduleDestroyed(); - /** - * Gets called by DCOP when an application closes. - * Is used to (try to) reload a KCM which previously - * was loaded. - */ - void _k_ownerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); + /** + * Gets called by DCOP when an application closes. + * Is used to (try to) reload a KCM which previously + * was loaded. + */ + void _k_ownerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); - QStringList args; - KCModule *kcm; - QVBoxLayout *topLayout; /* Contains QScrollView view, and root stuff */ - QLabel *rootInfo; - QString dbusService; - QString dbusPath; - KCModuleInfo modInfo; - bool changed; - bool bogusOccupier; - KCModuleProxy *parent; - KCModuleProxy *q_ptr; + QStringList args; + KCModule *kcm; + QVBoxLayout *topLayout; /* Contains QScrollView view, and root stuff */ + QLabel *rootInfo; + QString dbusService; + QString dbusPath; + KCModuleInfo modInfo; + bool changed; + bool bogusOccupier; + KCModuleProxy *parent; + KCModuleProxy *q_ptr; }; #endif // KCMUTILS_KCMODULEPROXY_P_H -// vim: sw=4 sts=4 et tw=100 diff --git a/kutils/kcmultidialog.h b/kutils/kcmultidialog.h index bd6a7e43..28a04391 100644 --- a/kutils/kcmultidialog.h +++ b/kutils/kcmultidialog.h @@ -36,22 +36,22 @@ class KCMultiDialogPrivate; */ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog { - Q_OBJECT + Q_OBJECT Q_DECLARE_PRIVATE(KCMultiDialog) - public: +public: /** * Constructs a new KCMultiDialog * * @param parent The parent widget **/ - KCMultiDialog( QWidget *parent = 0 ); + KCMultiDialog(QWidget *parent = nullptr); /** * Destructor **/ - virtual ~KCMultiDialog(); + virtual ~KCMultiDialog(); /** * Add a module. @@ -66,8 +66,7 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog * * @returns The @see KPageWidgetItem associated with the new dialog page. **/ - KPageWidgetItem* addModule( const QString& module, const QStringList& - args = QStringList() ); + KPageWidgetItem* addModule(const QString &module, const QStringList &args = QStringList()); /** * Add a module. @@ -80,12 +79,12 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog * to the list of modules the dialog will show. * * @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 **/ - KPageWidgetItem* addModule( const KCModuleInfo& moduleinfo, KPageWidgetItem *parent = 0, - const QStringList& args = QStringList() ); + KPageWidgetItem* addModule(const KCModuleInfo &moduleinfo, KPageWidgetItem *parent = nullptr, + const QStringList &args = QStringList()); /** * Removes all modules from the dialog. @@ -97,7 +96,7 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog */ void setButtons(ButtonCodes buttonMask); - Q_SIGNALS: +Q_SIGNALS: /** * Emitted after all KCModules have been told to save their configuration. * @@ -121,16 +120,16 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog * @param componentName The name of the instance that needs to reload its * configuration. */ - void configCommitted( const QByteArray & componentName ); + void configCommitted(const QByteArray &componentName); - protected: - /** - * This constructor can be used by subclasses to provide a custom KPageWidget. - */ - KCMultiDialog(KPageWidget *pageWidget, QWidget *parent, Qt::WindowFlags flags = 0); - KCMultiDialog(KCMultiDialogPrivate &dd, KPageWidget *pageWidget, QWidget *parent, Qt::WindowFlags flags = 0); +protected: + /** + * This constructor can be used by subclasses to provide a custom KPageWidget. + */ + KCMultiDialog(KPageWidget *pageWidget, QWidget *parent, Qt::WindowFlags flags = 0); + KCMultiDialog(KCMultiDialogPrivate &dd, KPageWidget *pageWidget, QWidget *parent, Qt::WindowFlags flags = 0); - protected Q_SLOTS: +protected Q_SLOTS: /** * This slot is called when the user presses the "Default" Button. * You can reimplement it if needed. @@ -175,11 +174,11 @@ class KCMUTILS_EXPORT KCMultiDialog : public KPageDialog **/ void slotHelpClicked(); - private: - Q_PRIVATE_SLOT(d_func(), void _k_slotCurrentPageChanged(KPageWidgetItem *, KPageWidgetItem *)) - Q_PRIVATE_SLOT(d_func(), void _k_clientChanged()) - Q_PRIVATE_SLOT(d_func(), void _k_dialogClosed()) - Q_PRIVATE_SLOT(d_func(), void _k_updateHeader(bool use, const QString &message)) +private: + Q_PRIVATE_SLOT(d_func(), void _k_slotCurrentPageChanged(KPageWidgetItem *, KPageWidgetItem *)) + Q_PRIVATE_SLOT(d_func(), void _k_clientChanged()) + Q_PRIVATE_SLOT(d_func(), void _k_dialogClosed()) + Q_PRIVATE_SLOT(d_func(), void _k_updateHeader(bool use, const QString &message)) }; #endif diff --git a/kutils/ksettingswidgetadaptor.cpp b/kutils/ksettingswidgetadaptor.cpp index 1d3ba9ed..0640098e 100644 --- a/kutils/ksettingswidgetadaptor.cpp +++ b/kutils/ksettingswidgetadaptor.cpp @@ -28,7 +28,7 @@ KSettingsWidgetAdaptor::KSettingsWidgetAdaptor(QObject *parent) QString KSettingsWidgetAdaptor::applicationName() { - return KGlobal::caption(); + return KGlobal::caption(); } #include "moc_ksettingswidgetadaptor.cpp"