Public feed #599953

Something

public text v1 · immutable
Raw Edit
·published 2007-07-02 15:10 UTC
rendered paste body
Index: kdecore/kernel/kcomponentdata.cpp
===================================================================
--- kdecore/kernel/kcomponentdata.cpp   (revision 681384)
+++ kdecore/kernel/kcomponentdata.cpp   (working copy)
@@ -64,7 +64,7 @@
     return d == rhs.d;
 }

-KComponentData::KComponentData(const QByteArray &name)
+KComponentData::KComponentData(const QByteArray &name, MainComponentRegistration registerAsMain)
     : d(new KComponentDataPrivate)
 {
     Q_ASSERT(!name.isEmpty());
@@ -72,7 +72,7 @@
     d->name = name;
     d->aboutData = new KAboutData(name, "", 0);

-    if (name != "kdeinit4") {
+    if (registerAsMain == RegisterAsMainComponent) {
         KGlobal::newComponentData(*this);
     }
 }
Index: kdecore/kernel/kcomponentdata.h
===================================================================
--- kdecore/kernel/kcomponentdata.h     (revision 681384)
+++ kdecore/kernel/kcomponentdata.h     (working copy)
@@ -85,12 +85,17 @@
      */
     bool operator!=(const KComponentData &rhs) const { return !operator==(rhs); }

+    enum MainComponentRegistration {
+        RegisterAsMainComponent,
+        SkipMainComponentRegistration
+    };
+
     /**
      * Constructor.
      *
      * @param componentName the name of the component.
      */
-    explicit KComponentData(const QByteArray &componentName);
+    explicit KComponentData(const QByteArray &componentName, MainComponentRegistration = RegisterAsMainComponent);

     /**
      * Constructor.
Index: kinit/kinit.cpp
===================================================================
--- kinit/kinit.cpp     (revision 681384)
+++ kinit/kinit.cpp     (working copy)
@@ -1673,7 +1673,7 @@
       setsid();

    /** Create our instance **/
-   s_instance = new KComponentData("kdeinit4"); // "kdeinit4" is special cased in KComponentData to not register with KGlobal
+   s_instance = new KComponentData("kdeinit4", KComponentData::SkipMainComponentRegistration);

    /** Prepare to change process name **/
    proctitle_init(argc, argv, envp);
Index: kinit/kinit_win.cpp
===================================================================
--- kinit/kinit_win.cpp (revision 681384)
+++ kinit/kinit_win.cpp (working copy)
@@ -284,7 +284,7 @@
     /** Make process group leader (for shutting down children later) **/

     /** Create our instance **/
-    s_instance = new KComponentData("kdeinit4"); // "kdeinit4" is special cased in KComponentData to not register with KGlobal
+    s_instance = new KComponentData("kdeinit4", KComponentData::SkipMainComponentRegistration);

     if (launch_dbus && !processList.hasProcessInList("dbus-daemon"))
     {