[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: =?utf-8?q?=5Bkdepimlibs=5D_akonadi=3A_Use_the_process_name_inste?=
From: Thomas McGuire <mcguire () kde ! org>
Date: 2011-02-26 8:49:43
Message-ID: 20110226084943.C1145A60A9 () git ! kde ! org
[Download RAW message or body]
Git commit e10204095e42d56882e4d8bf3807f08cca06c59b by Thomas McGuire.
Committed on 26/02/2011 at 09:47.
Pushed by tmcguire into branch 'master'.
Use the process name instead of the identifier as the debug area name.
M +11 -0 akonadi/resourcebase.cpp
M +5 -0 akonadi/resourcebase.h
http://commits.kde.org/kdepimlibs/e10204095e42d56882e4d8bf3807f08cca06c59b
diff --git a/akonadi/resourcebase.cpp b/akonadi/resourcebase.cpp
index ed01574..083d99b 100644
--- a/akonadi/resourcebase.cpp
+++ b/akonadi/resourcebase.cpp
@@ -45,6 +45,7 @@
#include <kaboutdata.h>
#include <kcmdlineargs.h>
+#include <kcomponentdata.h>
#include <kdebug.h>
#include <klocale.h>
@@ -972,5 +973,15 @@ void ResourceBase::setAutomaticProgressReporting( bool enabled )
d->mAutomaticProgressReporting = enabled;
}
+void ResourceBase::initComponentData()
+{
+ // This will set the component name of the main component to the process name, which
+ // is used in kDebug() output. Without this call, the debug area would be the resource
+ // identifier, e.g. akonadi_imap_resource_42, akonadi_imap_resource_231 and so on, therefore
+ // creating too many debug areas in kdebugdialog. With this, the area name is just
+ // akonadi_imap_resource.
+ KComponentData dummy( KCmdLineArgs::appName().toUtf8() );
+}
+
#include "resourcebase.moc"
#include "moc_resourcebase.cpp"
diff --git a/akonadi/resourcebase.h b/akonadi/resourcebase.h
index 0df1fd9..162c5ef 100644
--- a/akonadi/resourcebase.h
+++ b/akonadi/resourcebase.h
@@ -176,6 +176,10 @@ class AKONADI_EXPORT ResourceBase : public AgentBase
static int init( int argc, char **argv )
{
const QString id = parseArguments( argc, argv );
+
+ // Needs to be called before the first kDebug(), but after parseArguments().
+ initComponentData();
+
KApplication app;
T* r = new T( id );
@@ -580,6 +584,7 @@ class AKONADI_EXPORT ResourceBase : public AgentBase
private:
static QString parseArguments( int, char** );
static int init( ResourceBase *r );
+ static void initComponentData();
// dbus resource interface
friend class ::Akonadi__ResourceAdaptor;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic