Public feed #600508

Mine

public text v1 · immutable
Raw Edit
·published 2007-07-02 22:20 UTC
rendered paste body
Index: kinit/kinit.cpp
===================================================================
--- kinit/kinit.cpp     (revision 682466)
+++ 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", QByteArray(), KComponentData::SkipMainComponentRegistration);

    /** Prepare to change process name **/
    proctitle_init(argc, argv, envp);
Index: kinit/kinit_win.cpp
===================================================================
--- kinit/kinit_win.cpp (revision 682466)
+++ 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", QByteArray(), KComponentData::SkipMainComponentRegistration);

     if (launch_dbus && !processList.hasProcessInList("dbus-daemon"))
     {
Index: kdecore/kernel/kcomponentdata.cpp
===================================================================
--- kdecore/kernel/kcomponentdata.cpp   (revision 682466)
+++ kdecore/kernel/kcomponentdata.cpp   (working copy)
@@ -64,7 +64,7 @@
     return d == rhs.d;
 }

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

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

+    enum MainComponentRegistration {
+        RegisterAsMainComponent,
+        SkipMainComponentRegistration
+    };
+
     /**
      * Constructor.
      *
@@ -92,7 +97,7 @@
      * @param catalogName the name of the translation catalog;
      *                    if left empty @p componentName is used
      */
-    explicit KComponentData(const QByteArray &componentName, const QByteArray &catalogName = QByteArray());
+    explicit KComponentData(const QByteArray &componentName, const QByteArray &catalogName = QByteArray(), MainComponentRegistration = RegisterAsMainComponent);

     /**
      * Constructor.