From dbf291f74b2186baffea9f3a95fb13804ca948bd Mon Sep 17 00:00:00 2001
From: Darrell Anderson <humanreadable@yahoo.com>
Date: Sat, 7 Sep 2013 18:26:15 -0500
Subject: Add source code module name to stdout/stderr messages to improve
 readability. (cherry picked from commit
 7f26e9d03ba171ef8f4b7e9b6940958f484309a7)

---
 kdecore/kapplication.cpp | 14 +++++-----
 kdecore/kstartupinfo.cpp | 72 ++++++++++++++++++++++++------------------------
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/kdecore/kapplication.cpp b/kdecore/kapplication.cpp
index 79392e933..fa7ad7adb 100644
--- a/kdecore/kapplication.cpp
+++ b/kdecore/kapplication.cpp
@@ -1118,13 +1118,13 @@ KConfig* KApplication::sessionConfig()
 void KApplication::ref()
 {
     d->refCount++;
-    //kdDebug() << "KApplication::ref() : refCount = " << d->refCount << endl;
+    //kdDebug() << "[kdecore-kapplication] KApplication::ref() : refCount = " << d->refCount << endl;
 }
 
 void KApplication::deref()
 {
     d->refCount--;
-    //kdDebug() << "KApplication::deref() : refCount = " << d->refCount << endl;
+    //kdDebug() << "[kdecore-kapplication] KApplication::deref() : refCount = " << d->refCount << endl;
     if ( d->refCount <= 0 )
         quit();
 }
@@ -1957,7 +1957,7 @@ void KApplication::getX11RGBAInformation(Display *dpy) {
 			if ( format->type == PictTypeDirect && format->direct.alphaMask ) {
 				visual = xvi[i].visual;
 				colormap = XCreateColormap( dpy, RootWindow( dpy, screen ), visual, AllocNone );
-				kdDebug() << "found visual with alpha support" << endl;
+				kdDebug() << "[kdecore-kapplication] Found visual with alpha support" << endl;
 				argb_visual = true;
 				break;
 			}
@@ -2240,7 +2240,7 @@ void KApplication::addKipcEventMask(int id)
 {
     if (id >= 32)
     {
-        kdDebug(101) << "Cannot use KIPC event mask for message IDs >= 32\n";
+        kdDebug(101) << "[kdecore-kapplication] Cannot use KIPC event mask for message IDs >= 32\n";
         return;
     }
     kipcEventMask |= (1 << id);
@@ -2250,7 +2250,7 @@ void KApplication::removeKipcEventMask(int id)
 {
     if (id >= 32)
     {
-        kdDebug(101) << "Cannot use KIPC event mask for message IDs >= 32\n";
+        kdDebug(101) << "[kdecore-kapplication] Cannot use KIPC event mask for message IDs >= 32\n";
         return;
     }
     kipcEventMask &= ~(1 << id);
@@ -2745,7 +2745,7 @@ static TQStringList splitEmailAddressList( const TQString & aStr )
         if (commentlevel > 0)
           commentlevel--;
         else {
-          //kdDebug() << "Error in address splitting: Unmatched ')'"
+          //kdDebug() << "[kdecore-kapplication] Error in address splitting: Unmatched ')'"
           //          << endl;
           return list;
         }
@@ -2771,7 +2771,7 @@ static TQStringList splitEmailAddressList( const TQString & aStr )
       list += addr.simplifyWhiteSpace();
   }
   //else
-  //  kdDebug() << "Error in address splitting: "
+  //  kdDebug() << "[kdecore-kapplication] Error in address splitting: "
   //            << "Unexpected end of address list"
   //            << endl;
 
diff --git a/kdecore/kstartupinfo.cpp b/kdecore/kstartupinfo.cpp
index 9108b5cd0..bfb83365e 100644
--- a/kdecore/kstartupinfo.cpp
+++ b/kdecore/kstartupinfo.cpp
@@ -158,7 +158,7 @@ KStartupInfo::~KStartupInfo()
 void KStartupInfo::got_message( const TQString& msg_P )
     {
 // TODO do something with SCREEN= ?
-    kdDebug( 172 ) << "got:" << msg_P << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] got:" << msg_P << endl;
     TQString msg = msg_P.stripWhiteSpace();
     if( msg.startsWith( "new:" )) // must match length below
         got_startup_info( msg.mid( 4 ), false );
@@ -207,7 +207,7 @@ void KStartupInfo::window_added( WId w_P )
     switch( ret )
         {
         case Match:
-            kdDebug( 172 ) << "new window match" << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] new window match" << endl;
           break;
         case NoMatch:
           break; // nothing
@@ -238,7 +238,7 @@ void KStartupInfo::new_startup_info_internal( const KStartupInfoId& id_P,
         { // already reported, update
         d->startups[ id_P ].update( data_P );
         d->startups[ id_P ].age = 0; // CHECKME
-        kdDebug( 172 ) << "updating" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] updating" << endl;
 	if( d->startups[ id_P ].silent() == Data::Yes
 	    && !( d->flags & AnnounceSilenceChanges ))
 	    {
@@ -254,7 +254,7 @@ void KStartupInfo::new_startup_info_internal( const KStartupInfoId& id_P,
         { // already reported, update
         d->silent_startups[ id_P ].update( data_P );
         d->silent_startups[ id_P ].age = 0; // CHECKME
-        kdDebug( 172 ) << "updating silenced" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] updating silenced" << endl;
 	if( d->silent_startups[ id_P ].silent() != Data::Yes )
 	    {
 	    d->startups[ id_P ] = d->silent_startups[ id_P ];
@@ -268,7 +268,7 @@ void KStartupInfo::new_startup_info_internal( const KStartupInfoId& id_P,
     if( d->uninited_startups.contains( id_P ))
         {
         d->uninited_startups[ id_P ].update( data_P );
-        kdDebug( 172 ) << "updating uninited" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] updating uninited" << endl;
         if( !update_P ) // uninited finally got new:
             {
             d->startups[ id_P ] = d->uninited_startups[ id_P ];
@@ -281,18 +281,18 @@ void KStartupInfo::new_startup_info_internal( const KStartupInfoId& id_P,
         }
     if( update_P ) // change: without any new: first
         {
-        kdDebug( 172 ) << "adding uninited" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] adding uninited" << endl;
 	d->uninited_startups.insert( id_P, data_P );
         }
     else if( data_P.silent() != Data::Yes || d->flags & AnnounceSilenceChanges )
 	{
-        kdDebug( 172 ) << "adding" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] adding" << endl;
         d->startups.insert( id_P, data_P );
 	emit gotNewStartup( id_P, data_P );
 	}
     else // new silenced, and silent shouldn't be announced
 	{
-        kdDebug( 172 ) << "adding silent" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] adding silent" << endl;
 	d->silent_startups.insert( id_P, data_P );
 	}
     d->cleanup->start( 1000 ); // 1 sec
@@ -319,18 +319,18 @@ void KStartupInfo::remove_startup_info_internal( const KStartupInfoId& id_P )
         return;
     if( d->startups.contains( id_P ))
         {
-	kdDebug( 172 ) << "removing" << endl;
+	kdDebug( 172 ) << "[kdecore-kstartupinfo] removing" << endl;
 	emit gotRemoveStartup( id_P, d->startups[ id_P ]);
 	d->startups.remove( id_P );
 	}
     else if( d->silent_startups.contains( id_P ))
 	{
-	kdDebug( 172 ) << "removing silent" << endl;
+	kdDebug( 172 ) << "[kdecore-kstartupinfo] removing silent" << endl;
 	d->silent_startups.remove( id_P );
 	}
     else if( d->uninited_startups.contains( id_P ))
 	{
-	kdDebug( 172 ) << "removing uninited" << endl;
+	kdDebug( 172 ) << "[kdecore-kstartupinfo] removing uninited" << endl;
 	d->uninited_startups.remove( id_P );
 	}
     return;
@@ -384,7 +384,7 @@ bool KStartupInfo::sendStartup( const KStartupInfoId& id_P, const KStartupInfoDa
     TQString msg = TQString::fromLatin1( "new: %1 %2" )
         .arg( id_P.to_text()).arg( data_P.to_text());
     msg = check_required_startup_fields( msg, data_P, qt_xscreen());
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
     msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
     return true;
     }
@@ -398,7 +398,7 @@ bool KStartupInfo::sendStartupX( Display* disp_P, const KStartupInfoId& id_P,
         .arg( id_P.to_text()).arg( data_P.to_text());
     msg = check_required_startup_fields( msg, data_P, DefaultScreen( disp_P ));
 #ifdef KSTARTUPINFO_ALL_DEBUG
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
 #endif
     return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
     }
@@ -409,7 +409,7 @@ TQString KStartupInfo::check_required_startup_fields( const TQString& msg, const
     TQString ret = msg;
     if( data_P.name().isEmpty())
         {
-//        kdWarning( 172 ) << "NAME not specified in initial startup message" << endl;
+//        kdWarning( 172 ) << "[kdecore-kstartupinfo] NAME not specified in initial startup message" << endl;
         TQString name = data_P.bin();
         if( name.isEmpty())
             name = "UNKNOWN";
@@ -427,7 +427,7 @@ bool KStartupInfo::sendChange( const KStartupInfoId& id_P, const KStartupInfoDat
     KXMessages msgs;
     TQString msg = TQString::fromLatin1( "change: %1 %2" )
         .arg( id_P.to_text()).arg( data_P.to_text());
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
     msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
     return true;
     }
@@ -440,7 +440,7 @@ bool KStartupInfo::sendChangeX( Display* disp_P, const KStartupInfoId& id_P,
     TQString msg = TQString::fromLatin1( "change: %1 %2" )
         .arg( id_P.to_text()).arg( data_P.to_text());
 #ifdef KSTARTUPINFO_ALL_DEBUG
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
 #endif
     return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
     }
@@ -451,7 +451,7 @@ bool KStartupInfo::sendFinish( const KStartupInfoId& id_P )
         return false;
     KXMessages msgs;
     TQString msg = TQString::fromLatin1( "remove: %1" ).arg( id_P.to_text());
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
     msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
     return true;
     }
@@ -462,7 +462,7 @@ bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P )
         return false;
     TQString msg = TQString::fromLatin1( "remove: %1" ).arg( id_P.to_text());
 #ifdef KSTARTUPINFO_ALL_DEBUG
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
 #endif
     return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
     }
@@ -474,7 +474,7 @@ bool KStartupInfo::sendFinish( const KStartupInfoId& id_P, const KStartupInfoDat
     KXMessages msgs;
     TQString msg = TQString::fromLatin1( "remove: %1 %2" )
         .arg( id_P.to_text()).arg( data_P.to_text());
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
     msgs.broadcastMessage( NET_STARTUP_MSG, msg, -1, false );
     return true;
     }
@@ -487,7 +487,7 @@ bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P,
     TQString msg = TQString::fromLatin1( "remove: %1 %2" )
         .arg( id_P.to_text()).arg( data_P.to_text());
 #ifdef KSTARTUPINFO_ALL_DEBUG
-    kdDebug( 172 ) << "sending " << msg << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] sending " << msg << endl;
 #endif
     return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
     }
@@ -606,13 +606,13 @@ KStartupInfo::startup_t KStartupInfo::check_startup_internal( WId w_P, KStartupI
     //  - No - Is this a NET_WM compliant app ?
     //           - Yes - test for pid match
     //           - No - test for WM_CLASS match
-    kdDebug( 172 ) << "check_startup" << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] check_startup" << endl;
     TQCString id = windowStartupId( w_P );
     if( !id.isNull())
         {
         if( id.isEmpty() || id == "0" ) // means ignore this window
             {
-            kdDebug( 172 ) << "ignore" << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] ignore" << endl;
             return NoMatch;
             }
         return find_id( id, id_O, data_O ) ? Match : NoMatch;
@@ -657,7 +657,7 @@ KStartupInfo::startup_t KStartupInfo::check_startup_internal( WId w_P, KStartupI
         && transient_for != None )
 	return NoMatch;
 #endif
-    kdDebug( 172 ) << "check_startup:cantdetect" << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] check_startup:cantdetect" << endl;
     return CantDetect;
     }
 
@@ -666,7 +666,7 @@ bool KStartupInfo::find_id( const TQCString& id_P, KStartupInfoId* id_O,
     {
     if( d == NULL )
         return false;
-    kdDebug( 172 ) << "find_id:" << id_P << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] find_id:" << id_P << endl;
     KStartupInfoId id;
     id.initId( id_P );
     if( d->startups.contains( id ))
@@ -675,7 +675,7 @@ bool KStartupInfo::find_id( const TQCString& id_P, KStartupInfoId* id_O,
             *id_O = id;
         if( data_O != NULL )
             *data_O = d->startups[ id ];
-        kdDebug( 172 ) << "check_startup_id:match" << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] check_startup_id:match" << endl;
         return true;
         }
     return false;
@@ -686,7 +686,7 @@ bool KStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P,
     {
     if( d == NULL )
         return false;
-    kdDebug( 172 ) << "find_pid:" << pid_P << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] find_pid:" << pid_P << endl;
     for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin();
          it != d->startups.end();
          ++it )
@@ -699,7 +699,7 @@ bool KStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P,
                 *data_O = *it;
             // non-compliant, remove on first match
             remove_startup_info_internal( it.key());
-            kdDebug( 172 ) << "check_startup_pid:match" << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] check_startup_pid:match" << endl;
             return true;
             }
         }
@@ -713,7 +713,7 @@ bool KStartupInfo::find_wclass( TQCString res_name, TQCString res_class,
         return false;
     res_name = res_name.lower();
     res_class = res_class.lower();
-    kdDebug( 172 ) << "find_wclass:" << res_name << ":" << res_class << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] find_wclass:" << res_name << ":" << res_class << endl;
     for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin();
          it != d->startups.end();
          ++it )
@@ -727,7 +727,7 @@ bool KStartupInfo::find_wclass( TQCString res_name, TQCString res_class,
                 *data_O = *it;
             // non-compliant, remove on first match
             remove_startup_info_internal( it.key());
-            kdDebug( 172 ) << "check_startup_wclass:match" << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] check_startup_wclass:match" << endl;
             return true;
             }
         }
@@ -858,7 +858,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
             {
             const KStartupInfoId& key = it.key();
             ++it;
-            kdDebug( 172 ) << "startups entry timeout:" << key.id() << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] startups entry timeout:" << key.id() << endl;
             remove_startup_info_internal( key );
             }
         else
@@ -877,7 +877,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
             {
             const KStartupInfoId& key = it.key();
             ++it;
-            kdDebug( 172 ) << "silent entry timeout:" << key.id() << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] silent entry timeout:" << key.id() << endl;
             remove_startup_info_internal( key );
             }
         else
@@ -896,7 +896,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
             {
             const KStartupInfoId& key = it.key();
             ++it;
-            kdDebug( 172 ) << "uninited entry timeout:" << key.id() << endl;
+            kdDebug( 172 ) << "[kdecore-kstartupinfo] uninited entry timeout:" << key.id() << endl;
             remove_startup_info_internal( key );
             }
         else
@@ -919,7 +919,7 @@ void KStartupInfo::clean_all_noncompliant()
             }
         const KStartupInfoId& key = it.key();
         ++it;
-        kdDebug( 172 ) << "entry cleaning:" << key.id() << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] entry cleaning:" << key.id() << endl;
         remove_startup_info_internal( key );
         }
     }
@@ -936,7 +936,7 @@ TQCString KStartupInfo::createNewStartupId()
 	hostname[sizeof(hostname)-1] = '\0';
     TQCString id = TQString(TQString( "%1;%2;%3;%4_TIME%5" ).arg( hostname ).arg( tm.tv_sec )
         .arg( tm.tv_usec ).arg( getpid()).arg( GET_QT_X_USER_TIME() )).utf8();
-    kdDebug( 172 ) << "creating: " << id << ":" << tqAppName() << endl;
+    kdDebug( 172 ) << "[kdecore-kstartupinfo] creating: " << id << ":" << tqAppName() << endl;
     return id;
     }
 
@@ -978,7 +978,7 @@ void KStartupInfoId::initId( const TQCString& id_P )
         {
         d->id = id_P;
 #ifdef KSTARTUPINFO_ALL_DEBUG
-        kdDebug( 172 ) << "using: " << d->id << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] using: " << d->id << endl;
 #endif
         return;
         }
@@ -987,7 +987,7 @@ void KStartupInfoId::initId( const TQCString& id_P )
         { // already has id
         d->id = startup_env;
 #ifdef KSTARTUPINFO_ALL_DEBUG
-        kdDebug( 172 ) << "reusing: " << d->id << endl;
+        kdDebug( 172 ) << "[kdecore-kstartupinfo] reusing: " << d->id << endl;
 #endif
         return;
         }
-- 
cgit v1.2.3

