[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [khelpcenter] /: Autogenerate debug category + create categories file
From:       Laurent Montel <null () kde ! org>
Date:       2018-08-29 7:03:55
Message-ID: E1fuuWB-00010Q-KT () code ! kde ! org
[Download RAW message or body]

Git commit 1c1cf47ca33c97248df50c7c637dca47ad80f08a by Laurent Montel.
Committed on 29/08/2018 at 06:40.
Pushed by mlaurent into branch 'master'.

Autogenerate debug category + create categories file

M  +3    -1    CMakeLists.txt
M  +10   -10   docentry.cpp
M  +9    -9    docmetainfo.cpp
M  +3    -3    glossary.cpp
M  +1    -1    grantleeformatter.cpp
M  +17   -17   history.cpp
M  +4    -4    infotree.cpp
D  +0    -24   khc_debug.cpp
D  +0    -36   khc_debug.h
M  +1    -6    khelpcenter.categories
M  +1    -1    mainwindow.cpp
M  +21   -21   navigator.cpp
M  +3    -3    navigatorappgroupitem.cpp
M  +2    -2    navigatorappitem.cpp
M  +2    -2    plugintraverser.cpp
M  +4    -4    scrollkeepertreebuilder.cpp
M  +17   -17   searchengine.cpp
M  +3    -3    searchhandler.cpp
M  +1    -1    searchwidget.cpp
M  +1    -1    tests/CMakeLists.txt
M  +3    -3    toc.cpp

https://commits.kde.org/khelpcenter/1c1cf47ca33c97248df50c7c637dca47ad80f08a

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3799a05..c7e7590 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,7 @@ include(ECMMarkNonGuiExecutable)
 include(ECMOptionalAddSubdirectory)
 include(FeatureSummary)
 include(CheckIncludeFiles)
+include(ECMQtDeclareLoggingCategory)
 
 find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
     DBus
@@ -67,7 +68,6 @@ add_subdirectory( templates )
 ########### next target ###############
 
 set(khelpcenter_KDEINIT_SRCS
-   khc_debug.cpp
    navigator.cpp
    navigatoritem.cpp
    navigatorappitem.cpp
@@ -91,6 +91,7 @@ set(khelpcenter_KDEINIT_SRCS
    scrollkeepertreebuilder.cpp
    bookmarkowner.cpp
    searchhandler.cpp )
+ecm_qt_declare_logging_category(khelpcenter_KDEINIT_SRCS HEADER khc_debug.h \
IDENTIFIER KHC_LOG CATEGORY_NAME org.kde.khelpcenter)  
 kconfig_add_kcfg_files(khelpcenter_KDEINIT_SRCS prefs.kcfgc )
 # kf5_add_app_icon(khelpcenter_KDEINIT_SRCS \
"${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/help-browser.png") @@ -112,5 +113,6 @@ \
install( FILES table-of-contents.xslt glossary.xslt DESTINATION ${DATA_INSTALL_D  \
install( FILES khelpcenterui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/khelpcenter )  \
install( FILES khelpcenter.categories DESTINATION ${KDE_INSTALL_CONFDIR} )  install( \
FILES org.kde.Help.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} ) +install( \
FILES khelpcenter.categories DESTINATION ${KDE_INSTALL_CONFDIR} )  
 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/docentry.cpp b/docentry.cpp
index 92f2bc8..a1e132b 100644
--- a/docentry.cpp
+++ b/docentry.cpp
@@ -326,15 +326,15 @@ bool DocEntry::isSearchable() const
 
 void DocEntry::dump() const
 {
-  khcDebug() << "  <docentry>";
-  khcDebug() << "    <name>" << mName << "</name>";
-  khcDebug() << "    <searchmethod>" << mSearchMethod << "</searchmethod>";
-  khcDebug() << "    <search>" << mSearch << "</search>";
-  khcDebug() << "    <indexer>" << mIndexer << "</indexer>";
-  khcDebug() << "    <indextestfile>" << mIndexTestFile << "</indextestfile>";
-  khcDebug() << "    <icon>" << mIcon << "</icon>";
-  khcDebug() << "    <url>" << mUrl << "</url>";
-  khcDebug() << "    <documenttype>" << mDocumentType << "</documenttype>";
-  khcDebug() << "  </docentry>";
+  qCDebug(KHC_LOG) << "  <docentry>";
+  qCDebug(KHC_LOG) << "    <name>" << mName << "</name>";
+  qCDebug(KHC_LOG) << "    <searchmethod>" << mSearchMethod << "</searchmethod>";
+  qCDebug(KHC_LOG) << "    <search>" << mSearch << "</search>";
+  qCDebug(KHC_LOG) << "    <indexer>" << mIndexer << "</indexer>";
+  qCDebug(KHC_LOG) << "    <indextestfile>" << mIndexTestFile << "</indextestfile>";
+  qCDebug(KHC_LOG) << "    <icon>" << mIcon << "</icon>";
+  qCDebug(KHC_LOG) << "    <url>" << mUrl << "</url>";
+  qCDebug(KHC_LOG) << "    <documenttype>" << mDocumentType << "</documenttype>";
+  qCDebug(KHC_LOG) << "  </docentry>";
 }
 // vim:ts=2:sw=2:et
diff --git a/docmetainfo.cpp b/docmetainfo.cpp
index 666665e..7f9bbb2 100644
--- a/docmetainfo.cpp
+++ b/docmetainfo.cpp
@@ -45,14 +45,14 @@ DocMetaInfo *DocMetaInfo::self()
 
 DocMetaInfo::DocMetaInfo()
 {
-  khcDebug() << "DocMetaInfo()";
+  qCDebug(KHC_LOG) << "DocMetaInfo()";
 
   mRootEntry.setName( i18n("Top-Level Documentation") );
 }
 
 DocMetaInfo::~DocMetaInfo()
 {
-  khcDebug() << "~DocMetaInfo()";
+  qCDebug(KHC_LOG) << "~DocMetaInfo()";
 
   DocEntry::List::ConstIterator it;
   for( it = mDocEntries.constBegin(); it != mDocEntries.constEnd(); ++it )
@@ -135,7 +135,7 @@ QString DocMetaInfo::languageName( const QString &langcode )
 
   QString cfgfile = QStandardPaths::locate( QStandardPaths::GenericDataLocation, \
QStringLiteral( "locale/%1/kf5_entry.desktop" ).arg( langcode ) );  
-  khcDebug() << "-- langcode: " << langcode << " cfgfile: " << cfgfile;
+  qCDebug(KHC_LOG) << "-- langcode: " << langcode << " cfgfile: " << cfgfile;
 
   KConfig _cfg( cfgfile, KConfig::SimpleConfig );
   KConfigGroup cfg(&_cfg, "KCM Locale" );
@@ -160,7 +160,7 @@ void DocMetaInfo::scanMetaInfo( bool force )
   }
   for( it = metaInfos.constBegin(); it != metaInfos.constEnd(); ++it)
   {
-    khcDebug() << "DocMetaInfo::scanMetaInfo(): scanning " << *it;
+    qCDebug(KHC_LOG) << "DocMetaInfo::scanMetaInfo(): scanning " << *it;
     scanMetaInfoDir( *it, &mRootEntry );
   }
 
@@ -237,7 +237,7 @@ void DocMetaInfo::traverseEntry( DocEntry *entry, \
DocEntryTraverser *traverser )  
 void DocMetaInfo::startTraverseEntries( DocEntryTraverser *traverser )
 {
-  khcDebug() << "DocMetaInfo::startTraverseEntries()";
+  qCDebug(KHC_LOG) << "DocMetaInfo::startTraverseEntries()";
   traverser->setNotifyee( this );
   startTraverseEntry( &mRootEntry, traverser );
 }
@@ -247,13 +247,13 @@ void DocMetaInfo::startTraverseEntry( DocEntry *entry,
 {
   if ( !traverser ) 
   {
-    khcWarning() << "DocMetaInfo::startTraverseEntry(): ERROR. No Traverser.";
+    qCWarning(KHC_LOG) << "DocMetaInfo::startTraverseEntry(): ERROR. No Traverser.";
     return;
   }
 
   if ( !entry ) 
   {
-    khcWarning() << "DocMetaInfo::startTraverseEntry(): no entry.";
+    qCWarning(KHC_LOG) << "DocMetaInfo::startTraverseEntry(): no entry.";
     endTraverseEntries( traverser );
     return;
   }
@@ -301,11 +301,11 @@ void DocMetaInfo::endProcess( DocEntry *entry, \
DocEntryTraverser *traverser )  
 void DocMetaInfo::endTraverseEntries( DocEntryTraverser *traverser )
 {
-  khcDebug() << "DocMetaInfo::endTraverseEntries()";
+  qCDebug(KHC_LOG) << "DocMetaInfo::endTraverseEntries()";
 
   if ( !traverser ) 
   {
-    khcDebug() << " no more traversers.";
+    qCDebug(KHC_LOG) << " no more traversers.";
     return;
   }
 
diff --git a/glossary.cpp b/glossary.cpp
index 7653b0c..0bbe946 100644
--- a/glossary.cpp
+++ b/glossary.cpp
@@ -159,7 +159,7 @@ void Glossary::rebuildGlossaryCache()
     meinproc->start();
     if (!meinproc->waitForStarted())
     {
-        khcWarning() << "could not start process" << meinproc->program();
+        qCWarning(KHC_LOG) << "could not start process" << meinproc->program();
         if (mainWindow && !m_alreadyWarned)
         {
             ; // add warning message box with don't display again option
@@ -177,8 +177,8 @@ void Glossary::meinprocFinished( int exitCode, \
QProcess::ExitStatus exitStatus )  
     if (exitStatus != QProcess::NormalExit || exitCode != 0)
     {
-        khcWarning() << "running" << meinproc->program() << "failed with exitCode" \
                << exitCode;
-        khcWarning() << "stderr output:" << meinproc->readAllStandardError();
+        qCWarning(KHC_LOG) << "running" << meinproc->program() << "failed with \
exitCode" << exitCode; +        qCWarning(KHC_LOG) << "stderr output:" << \
meinproc->readAllStandardError();  if (mainWindow && !m_alreadyWarned)
         {
             ; // add warning message box with don't display again option
diff --git a/grantleeformatter.cpp b/grantleeformatter.cpp
index ae12da6..c17a082 100644
--- a/grantleeformatter.cpp
+++ b/grantleeformatter.cpp
@@ -70,7 +70,7 @@ QString GrantleeFormatter::Private::format( Grantlee::Template t, \
Grantlee::Cont  t->render( &stream, ctx );
   if ( t->error() )
   {
-    khcWarning() << "GrantleeFormatter rendering error:" << t->errorString();
+    qCWarning(KHC_LOG) << "GrantleeFormatter rendering error:" << t->errorString();
   }
 
   return result;
diff --git a/history.cpp b/history.cpp
index 2ed35bb..5488bc4 100644
--- a/history.cpp
+++ b/history.cpp
@@ -109,7 +109,7 @@ void History::installMenuBarHook( KXmlGuiWindow *mainWindow )
 
 void History::createEntry()
 {
-  khcDebug() << "History::createEntry()";
+  qCDebug(KHC_LOG) << "History::createEntry()";
 
   // First, remove any forward history
   if (m_entries_current!=m_entries.end())
@@ -141,11 +141,11 @@ void History::updateCurrentEntry( View *view )
   current->view = view;
 
   if ( url.isEmpty() ) {
-    khcDebug() << "History::updateCurrentEntry(): internal url";
+    qCDebug(KHC_LOG) << "History::updateCurrentEntry(): internal url";
     url = view->internalUrl();
   }
 
-  khcDebug() << "History::updateCurrentEntry(): " << view->title()
+  qCDebug(KHC_LOG) << "History::updateCurrentEntry(): " << view->title()
             << " (URL: " << url.url() << ")";
 
   current->url = url;
@@ -162,33 +162,33 @@ void History::updateActions()
 
 void History::back()
 {
-  khcDebug() << "History::back()";
+  qCDebug(KHC_LOG) << "History::back()";
   goHistoryActivated( -1 );
 }
 
 void History::backActivated( QAction *action )
 {
   int id = action->data().toInt();
-  khcDebug() << "History::backActivated(): id = " << id;
+  qCDebug(KHC_LOG) << "History::backActivated(): id = " << id;
   goHistoryActivated( -( id + 1 ) );
 }
 
 void History::forward()
 {
-  khcDebug() << "History::forward()";
+  qCDebug(KHC_LOG) << "History::forward()";
   goHistoryActivated( 1 );
 }
 
 void History::forwardActivated( QAction *action )
 {
   int id = action->data().toInt();
-  khcDebug() << "History::forwardActivated(): id = " << id;
+  qCDebug(KHC_LOG) << "History::forwardActivated(): id = " << id;
   goHistoryActivated( id + 1 );
 }
 
 void History::goHistoryActivated( int steps )
 {
-  khcDebug() << "History::goHistoryActivated(): m_goBuffer = " << m_goBuffer;
+  qCDebug(KHC_LOG) << "History::goHistoryActivated(): m_goBuffer = " << m_goBuffer;
   if ( m_goBuffer )
     return;
   m_goBuffer = steps;
@@ -197,7 +197,7 @@ void History::goHistoryActivated( int steps )
 
 void History::goHistoryDelayed()
 {
-  khcDebug() << "History::goHistoryDelayed(): m_goBuffer = " << m_goBuffer;
+  qCDebug(KHC_LOG) << "History::goHistoryDelayed(): m_goBuffer = " << m_goBuffer;
   if ( !m_goBuffer )
     return;
   int steps = m_goBuffer;
@@ -207,7 +207,7 @@ void History::goHistoryDelayed()
 
 void History::goHistory( int steps )
 {
-  khcDebug() << "History::goHistory(): " << steps;
+  qCDebug(KHC_LOG) << "History::goHistory(): " << steps;
 
   // If current entry is empty remove it.
   Entry *current = *m_entries_current;
@@ -217,25 +217,25 @@ void History::goHistory( int steps )
   
   current = *newPos;
   if ( !current ) {
-    khcWarning() << "No History entry at position " << newPos - m_entries.begin();
+    qCWarning(KHC_LOG) << "No History entry at position " << newPos - \
m_entries.begin();  return;
   }
 
   if ( !current->view ) {
-    khcWarning() << "Empty history entry." ;
+    qCWarning(KHC_LOG) << "Empty history entry." ;
     return;
   }
   
   m_entries_current = newPos;
 
   if ( current->search ) {
-    khcDebug() << "History::goHistory(): search";
+    qCDebug(KHC_LOG) << "History::goHistory(): search";
     current->view->lastSearch();
     return;
   }
 
   if ( current->url.scheme() == QLatin1String("khelpcenter") ) {
-    khcDebug() << "History::goHistory(): internal";
+    qCDebug(KHC_LOG) << "History::goHistory(): internal";
     emit goInternalUrl( current->url );
     return;
   }
@@ -314,10 +314,10 @@ void History::goMenuActivated( QAction* action )
   int index = goMenu->actions().indexOf(action) - m_goMenuIndex + 1;
   if ( index > 0 )
   {
-    khcDebug() << "Item clicked has index " << index;
+    qCDebug(KHC_LOG) << "Item clicked has index " << index;
     // -1 for one step back, 0 for don't move, +1 for one step forward, etc.
     int steps = ( m_goMenuHistoryStartPos+1 ) - index - m_goMenuHistoryCurrentPos; \
                // make a drawing to understand this :-)
-    khcDebug() << "Emit activated with steps = " << steps;
+    qCDebug(KHC_LOG) << "Emit activated with steps = " << steps;
     goHistory( steps );
   }
 }
@@ -378,7 +378,7 @@ bool History::canGoForward() const
 
 void History::dumpHistory() const {
   for(EntryList::const_iterator it = m_entries.constBegin() ; \
                it!=m_entries.constEnd() ; ++it) {
-    khcDebug() << (*it)->title << (*it)->url << \
(it==EntryList::const_iterator(m_entries_current) ? "current" : "" ) ; +    \
qCDebug(KHC_LOG) << (*it)->title << (*it)->url << \
(it==EntryList::const_iterator(m_entries_current) ? "current" : "" ) ;  }
 
 }
diff --git a/infotree.cpp b/infotree.cpp
index 3f5b15a..2ec3aeb 100644
--- a/infotree.cpp
+++ b/infotree.cpp
@@ -54,7 +54,7 @@ InfoCategoryItem::InfoCategoryItem( NavigatorItem *parent, const \
QString &text )  setAutoDeleteDocEntry( true );
   setExpanded( false );
   setIcon( 0, QIcon::fromTheme( "help-contents" ) );
-//  khcDebug() << "Got category: " << text;
+//  qCDebug(KHC_LOG) << "Got category: " << text;
 }
 
 void InfoCategoryItem::itemExpanded( bool open )
@@ -70,7 +70,7 @@ InfoNodeItem::InfoNodeItem( InfoCategoryItem *parent, const QString \
&text )  : NavigatorItem( new DocEntry( text ), parent )
 {
   setAutoDeleteDocEntry( true );
-//  khcDebug() << "Created info node item: " << text;
+//  qCDebug(KHC_LOG) << "Created info node item: " << text;
 }
 
 InfoTree::InfoTree( QObject *parent )
@@ -81,7 +81,7 @@ InfoTree::InfoTree( QObject *parent )
 
 void InfoTree::build( NavigatorItem *parent )
 {
-  khcDebug() << "Populating info tree.";
+  qCDebug(KHC_LOG) << "Populating info tree.";
 
   m_parentItem = parent;
 
@@ -111,7 +111,7 @@ void InfoTree::build( NavigatorItem *parent )
 
 void InfoTree::parseInfoDirFile( const QString &infoDirFileName )
 {
-  khcDebug() << "Parsing info dir file " << infoDirFileName;
+  qCDebug(KHC_LOG) << "Parsing info dir file " << infoDirFileName;
 
   QFile infoDirFile( infoDirFileName );
   if ( !infoDirFile.open( QIODevice::ReadOnly ) )
diff --git a/khc_debug.cpp b/khc_debug.cpp
deleted file mode 100644
index 19c0efc..0000000
--- a/khc_debug.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-  This file is part of the KDE Help Center
-
-  Copyright (c) 2016 Pino Toscano <pino@kde.org>
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-  MA  02110-1301, USA
-*/
-
-#include "khc_debug.h"
-
-Q_LOGGING_CATEGORY( KHC_LOG, "org.kde.khelpcenter", QtWarningMsg )
diff --git a/khc_debug.h b/khc_debug.h
deleted file mode 100644
index a6d43e9..0000000
--- a/khc_debug.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-  This file is part of the KDE Help Center
-
-  Copyright (c) 2016 Pino Toscano <pino@kde.org>
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-  MA  02110-1301, USA
-*/
-
-
-#ifndef KHC_DEBUG_H
-#define KHC_DEBUG_H
-
-#include <QLoggingCategory>
-#include <QDebug>
-
-Q_DECLARE_LOGGING_CATEGORY(KHC_LOG)
-
-#define khcCritical() qCCritical(KHC_LOG)
-#define khcDebug() qCDebug(KHC_LOG)
-#define khcInfo() qCInfo(KHC_LOG)
-#define khcWarning() qCWarning(KHC_LOG)
-
-#endif
diff --git a/khelpcenter.categories b/khelpcenter.categories
index c7e0f28..81d512e 100644
--- a/khelpcenter.categories
+++ b/khelpcenter.categories
@@ -1,6 +1 @@
-org.kde.khelpcenter KHelpCenter (main application)
-org.kde.khelpcenter.xapian.cachereader KHelpCenter (Xapian cache reader)
-org.kde.khelpcenter.xapian.htmltextdump KHelpCenter (Xapian HTML text dump)
-org.kde.khelpcenter.xapian.common KHelpCenter (Xapian common)
-org.kde.khelpcenter.xapian.indexer KHelpCenter (Xapian indexer)
-org.kde.khelpcenter.xapian.search KHelpCenter (Xapian search)
+org.kde.khelpcenter khelpcenter IDENTIFIER [KHC_LOG]
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 66804ff..051fdca 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -330,7 +330,7 @@ void MainWindow::slotOpenURLRequest( const QUrl &url,
                                      const KParts::OpenUrlArguments &args,
                                      const KParts::BrowserArguments &browserArgs )
 {
-  khcDebug() << url.url();
+  qCDebug(KHC_LOG) << url.url();
 
   mNavigator->selectItem( url );
   viewUrl( url, args, browserArgs );
diff --git a/navigator.cpp b/navigator.cpp
index 118eaac..f1695ed 100644
--- a/navigator.cpp
+++ b/navigator.cpp
@@ -169,7 +169,7 @@ void Navigator::insertPlugins()
 
 void Navigator::insertParentAppDocs( const QString &name, NavigatorItem *topItem )
 {
-  khcDebug() << "Requested plugin documents for ID " << name;
+  qCDebug(KHC_LOG) << "Requested plugin documents for ID " << name;
 
   KServiceGroup::Ptr grp = KServiceGroup::childGroup( name );
   if ( !grp )
@@ -188,7 +188,7 @@ void Navigator::insertParentAppDocs( const QString &name, \
NavigatorItem *topItem  
 void Navigator::insertKCMDocs( const QString &name, NavigatorItem *topItem, const \
QString &type )  {
-  khcDebug() << "Requested KCM documents for ID" << name;
+  qCDebug(KHC_LOG) << "Requested KCM documents for ID" << name;
   QString systemsettingskontrolconstraint = "[X-KDE-System-Settings-Parent-Category] \
!= ''";  QString konquerorcontrolconstraint = "[X-KDE-PluginKeyword] == \
                'khtml_general'\
                                      or [X-KDE-PluginKeyword] == 'performance'\
@@ -240,7 +240,7 @@ History                 no X-KDE-PluginKeyword in \
kcmhistory.desktop  
 void Navigator::insertIOSlaveDocs( const QString &name, NavigatorItem *topItem )
 {
-  khcDebug() << "Requested IOSlave documents for ID" << name;
+  qCDebug(KHC_LOG) << "Requested IOSlave documents for ID" << name;
 
   QStringList list = KProtocolInfo::protocols();
   list.sort();
@@ -293,7 +293,7 @@ void Navigator::insertScrollKeeperDocs( NavigatorItem *topItem )
 
 void Navigator::selectItem( const QUrl &url )
 {
-  khcDebug() << "Navigator::selectItem(): " << url.url();
+  qCDebug(KHC_LOG) << "Navigator::selectItem(): " << url.url();
 
   if ( url.url() == "khelpcenter:home" ) {
     clearSelection();
@@ -316,7 +316,7 @@ void Navigator::selectItem( const QUrl &url )
   if ( item && mSelected ) {
     QUrl currentURL ( item->entry()->url() );
     if ( (currentURL == url) || (currentURL == alternativeURL) ) {
-      khcDebug() << "URL already shown.";
+      qCDebug(KHC_LOG) << "URL already shown.";
       return;
     }
   }
@@ -367,7 +367,7 @@ void Navigator::slotItemSelected( QTreeWidgetItem *currentItem )
 
   NavigatorItem *item = static_cast<NavigatorItem *>( currentItem );
 
-  khcDebug() << item->entry()->name();
+  qCDebug(KHC_LOG) << item->entry()->name();
 
   item->setExpanded( !item->isExpanded() );
 
@@ -491,7 +491,7 @@ QString Navigator::createChildrenList( QTreeWidgetItem *child, \
int level )  void Navigator::slotSearch()
 {
   
-  khcDebug() << "Navigator::slotSearch()";
+  qCDebug(KHC_LOG) << "Navigator::slotSearch()";
 
   if ( mIndexingProc ) return;
 
@@ -502,8 +502,8 @@ void Navigator::slotSearch()
   int pages = mSearchWidget->pages();
   QStringList scope = mSearchWidget->scope();
 
-  khcDebug() << "Navigator::slotSearch() words: " << words;
-  khcDebug() << "Navigator::slotSearch() scope: " << scope;
+  qCDebug(KHC_LOG) << "Navigator::slotSearch() words: " << words;
+  qCDebug(KHC_LOG) << "Navigator::slotSearch() scope: " << scope;
 
   if ( words.isEmpty() || scope.isEmpty() ) return;
 
@@ -533,7 +533,7 @@ void Navigator::slotSearchFinished()
   mSearchButton->setEnabled(true);
   QApplication::restoreOverrideCursor();
 
-  khcDebug() << "Search finished.";
+  qCDebug(KHC_LOG) << "Search finished.";
 }
 
 void Navigator::checkSearchButton()
@@ -633,12 +633,12 @@ void Navigator::slotDoIndexWork()
     return slotDoIndexWork();
   }
   if ( !handler->checkPaths( &error ) ) {
-    khcWarning() << "Indexing path error for" << entry->name() << ":" << error;
+    qCWarning(KHC_LOG) << "Indexing path error for" << entry->name() << ":" << \
error;  return slotDoIndexWork();
   }
   QString indexer = handler->indexCommand( entry->identifier() );
   if ( indexer.isEmpty() ) {
-    khcWarning() << "Empty indexer for" << entry->identifier() << \
entry->documentType(); +    qCWarning(KHC_LOG) << "Empty indexer for" << \
entry->identifier() << entry->documentType();  return slotDoIndexWork();
   }
 
@@ -647,10 +647,10 @@ void Navigator::slotDoIndexWork()
   indexer.replace( QLatin1String( "%i" ), entry->identifier() );
   indexer.replace( QLatin1String( "%d" ), indexDir );
   indexer.replace( QLatin1String( "%p" ), entry->url() );
-  khcDebug() << "Indexer:" << indexer;
+  qCDebug(KHC_LOG) << "Indexer:" << indexer;
 
   if ( !QDir().mkpath( indexDir ) ) {
-    khcWarning() << "cannot create the directory:" << indexDir;
+    qCWarning(KHC_LOG) << "cannot create the directory:" << indexDir;
     return slotDoIndexWork();
   }
 
@@ -664,7 +664,7 @@ void Navigator::slotDoIndexWork()
   mIndexingProc->start();
 
   if ( !mIndexingProc->waitForStarted() )  {
-    khcWarning() << "Unable to start command" << indexer;
+    qCWarning(KHC_LOG) << "Unable to start command" << indexer;
     delete mIndexingProc;
     mIndexingProc = nullptr;
     return slotDoIndexWork();
@@ -674,13 +674,13 @@ void Navigator::slotDoIndexWork()
 void Navigator::slotProcessExited( int exitCode, QProcess::ExitStatus exitStatus )
 {
   if ( exitStatus != QProcess::NormalExit ) {
-    khcWarning() << "Process failed";
-    khcWarning() << "stdout output:" << mIndexingProc->readAllStandardOutput();
-    khcWarning() << "stderr output:" << mIndexingProc->readAllStandardError();
+    qCWarning(KHC_LOG) << "Process failed";
+    qCWarning(KHC_LOG) << "stdout output:" << \
mIndexingProc->readAllStandardOutput(); +    qCWarning(KHC_LOG) << "stderr output:" \
<< mIndexingProc->readAllStandardError();  } else if ( exitCode != 0 ) {
-    khcWarning() << "running" << mIndexingProc->program() << "failed with exitCode" \
                << exitCode;
-    khcWarning() << "stdout output:" << mIndexingProc->readAllStandardOutput();
-    khcWarning() << "stderr output:" << mIndexingProc->readAllStandardError();
+    qCWarning(KHC_LOG) << "running" << mIndexingProc->program() << "failed with \
exitCode" << exitCode; +    qCWarning(KHC_LOG) << "stdout output:" << \
mIndexingProc->readAllStandardOutput(); +    qCWarning(KHC_LOG) << "stderr output:" \
<< mIndexingProc->readAllStandardError();  }
   delete mIndexingProc;
   mIndexingProc = nullptr;
diff --git a/navigatorappgroupitem.cpp b/navigatorappgroupitem.cpp
index 59d6524..622f11f 100644
--- a/navigatorappgroupitem.cpp
+++ b/navigatorappgroupitem.cpp
@@ -69,11 +69,11 @@ void NavigatorAppGroupItem::setRelpath( const QString &relpath )
 
 void NavigatorAppGroupItem::itemExpanded(bool open)
 {
-  khcDebug() << "NavigatorAppGroupItem::itemExpanded()";
+  qCDebug(KHC_LOG) << "NavigatorAppGroupItem::itemExpanded()";
 
   if ( open && (childCount() == 0) && !mPopulated )
   {
-     khcDebug() << "  -> populate:" << this << "-" << mRelpath;
+     qCDebug(KHC_LOG) << "  -> populate:" << this << "-" << mRelpath;
      populate();
   }
   NavigatorItem::itemExpanded(open);
@@ -85,7 +85,7 @@ void NavigatorAppGroupItem::populate( bool recursive )
 
   KServiceGroup::Ptr root = KServiceGroup::group(mRelpath);
   if ( !root ) {
-    khcWarning() << "No Service groups for" << mRelpath;
+    qCWarning(KHC_LOG) << "No Service groups for" << mRelpath;
     return;
   }
   KServiceGroup::List list = root->entries();
diff --git a/navigatorappitem.cpp b/navigatorappitem.cpp
index 5f2291e..7ce9f3e 100644
--- a/navigatorappitem.cpp
+++ b/navigatorappitem.cpp
@@ -71,7 +71,7 @@ void NavigatorAppItem::scheduleTOCBuild()
   if ( url.scheme() == QLatin1String( "help" ) ) {
     mToc = new TOC( this );
 
-    khcDebug() << "Trying to build TOC for" << entry()->name();
+    qCDebug(KHC_LOG) << "Trying to build TOC for" << entry()->name();
     mToc->setApplication( url.toString( QUrl::RemoveScheme | QUrl::RemoveFilename | \
QUrl::StripTrailingSlash ) );  QString doc = View::langLookup( url.path() );
     // Enforce the original .docbook version, in case langLookup returns a
@@ -81,7 +81,7 @@ void NavigatorAppItem::scheduleTOCBuild()
       if ( pos >= 0 ) {
         doc.replace( pos, 5, QLatin1String( ".docbook" ) );
       }
-      khcDebug() << "doc =" << doc;
+      qCDebug(KHC_LOG) << "doc =" << doc;
 
       mToc->build( doc );
       // ensure the newly populated item is expanded
diff --git a/plugintraverser.cpp b/plugintraverser.cpp
index ee54211..fab5b60 100644
--- a/plugintraverser.cpp
+++ b/plugintraverser.cpp
@@ -55,7 +55,7 @@ PluginTraverser::PluginTraverser( Navigator *navigator, \
NavigatorItem *parent )  void PluginTraverser::process( DocEntry *entry )
 {
   if ( !mListView && !mParentItem ) {
-    khcWarning() << "ERROR! Neither mListView nor mParentItem is set.";
+    qCWarning(KHC_LOG) << "ERROR! Neither mListView nor mParentItem is set.";
     return;
   }
 
@@ -115,7 +115,7 @@ DocEntryTraverser *PluginTraverser::createChild( DocEntry * \
/*entry*/ )  if ( mCurrentItem ) {
     return new PluginTraverser( mNavigator, mCurrentItem );
   }
-  khcWarning() << "ERROR! mCurrentItem is not set.";
+  qCWarning(KHC_LOG) << "ERROR! mCurrentItem is not set.";
   return nullptr;
 }
 
diff --git a/scrollkeepertreebuilder.cpp b/scrollkeepertreebuilder.cpp
index 1f81745..87eda88 100644
--- a/scrollkeepertreebuilder.cpp
+++ b/scrollkeepertreebuilder.cpp
@@ -49,11 +49,11 @@ void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
 {
   QString lang = QLocale().bcp47Name();
 
-  khcDebug() << "ScrollKeeper language: " << lang;
+  qCDebug(KHC_LOG) << "ScrollKeeper language: " << lang;
 
   const QString exePath = QStandardPaths::findExecutable( QLatin1Literal( \
"scrollkeeper-get-content-list" ) );  if ( exePath.isEmpty() ) {
-    khcDebug() << "scrollkeeper-get-content-list is not available, skipping";
+    qCDebug(KHC_LOG) << "scrollkeeper-get-content-list is not available, skipping";
     return;
   }
 
@@ -64,13 +64,13 @@ void ScrollKeeperTreeBuilder::build( NavigatorItem *parent )
   proc.setOutputChannelMode(KProcess::OnlyStdoutChannel);
   proc.start();
   if ( !proc.waitForFinished() ) {
-    khcWarning() << "Could not execute scrollkeeper-get-content-list";
+    qCWarning(KHC_LOG) << "Could not execute scrollkeeper-get-content-list";
     return;
   }
   mContentsList = proc.readAllStandardOutput().trimmed();
 
   if (!QFile::exists(mContentsList)) {
-    khcWarning() << "Scrollkeeper contents file" << mContentsList
+    qCWarning(KHC_LOG) << "Scrollkeeper contents file" << mContentsList
       << "does not exist.";
     return;
   }
diff --git a/searchengine.cpp b/searchengine.cpp
index 1737391..4d666a1 100644
--- a/searchengine.cpp
+++ b/searchengine.cpp
@@ -16,25 +16,25 @@ SearchTraverser::SearchTraverser( SearchEngine *engine, int level \
) :  mMaxLevel( 999 ), mEngine( engine), mLevel( level ), mResultsPtr( &mResults )
 {
 #if 0
-  khcDebug() << "SearchTraverser():" << mLevel << this;
+  qCDebug(KHC_LOG) << "SearchTraverser():" << mLevel << this;
 #endif
 }
 
 SearchTraverser::~SearchTraverser()
 {
 #if 0
-    khcDebug() << "~SearchTraverser():" << mLevel << this;
+    qCDebug(KHC_LOG) << "~SearchTraverser():" << mLevel << this;
 #endif
 }
 
 void SearchTraverser::process( DocEntry * )
 {
-  khcDebug() << "SearchTraverser::process()";
+  qCDebug(KHC_LOG) << "SearchTraverser::process()";
 }
 
 void SearchTraverser::startProcess( DocEntry *entry )
 {
-//  khcDebug() << "SearchTraverser::startProcess():" << entry->name()
+//  qCDebug(KHC_LOG) << "SearchTraverser::startProcess():" << entry->name()
 //    << "SEARCH:" << entry->search();
 
   if ( !mEngine->canSearch( entry ) || !entry->searchEnabled() ) {
@@ -42,7 +42,7 @@ void SearchTraverser::startProcess( DocEntry *entry )
     return;
   }
 
-//  khcDebug() << "SearchTraverser::startProcess():" << entry->identifier();
+//  qCDebug(KHC_LOG) << "SearchTraverser::startProcess():" << entry->identifier();
 
   SearchHandler *handler = mEngine->handler( entry->documentType() );
 
@@ -63,7 +63,7 @@ void SearchTraverser::startProcess( DocEntry *entry )
   handler->search( entry, mEngine->words(), mEngine->maxResults(),
     mEngine->operation() );
 
-//  khcDebug() << "SearchTraverser::startProcess() done: " << entry->name();
+//  qCDebug(KHC_LOG) << "SearchTraverser::startProcess() done: " << entry->name();
 }
 
 void SearchTraverser::connectHandler( SearchHandler *handler )
@@ -86,7 +86,7 @@ void SearchTraverser::disconnectHandler( SearchHandler *handler )
   QMap<SearchHandler *,int>::Iterator it;
   it = mConnectCount.find( handler );
   if ( it == mConnectCount.end() ) {
-    khcWarning() << "SearchTraverser::disconnectHandler() handler not connected.";
+    qCWarning(KHC_LOG) << "SearchTraverser::disconnectHandler() handler not \
connected.";  } else {
     int count = *it;
     --count;
@@ -102,7 +102,7 @@ void SearchTraverser::disconnectHandler( SearchHandler *handler )
 
 DocEntryTraverser *SearchTraverser::createChild( DocEntry *parentEntry )
 {
-//  khcDebug() << "SearchTraverser::createChild() level " << mLevel;
+//  qCDebug(KHC_LOG) << "SearchTraverser::createChild() level " << mLevel;
 
   if ( mLevel >= mMaxLevel ) {
     ++mLevel;
@@ -117,7 +117,7 @@ DocEntryTraverser *SearchTraverser::createChild( DocEntry \
*parentEntry )  
 DocEntryTraverser *SearchTraverser::parentTraverser()
 {
-//  khcDebug() << "SearchTraverser::parentTraverser(): level: " << mLevel;
+//  qCDebug(KHC_LOG) << "SearchTraverser::parentTraverser(): level: " << mLevel;
 
   if ( mLevel > mMaxLevel ) {
     return this;
@@ -128,7 +128,7 @@ DocEntryTraverser *SearchTraverser::parentTraverser()
 
 void SearchTraverser::deleteTraverser()
 {
-//  khcDebug() << "SearchTraverser::deleteTraverser()";
+//  qCDebug(KHC_LOG) << "SearchTraverser::deleteTraverser()";
 
   if ( mLevel > mMaxLevel ) {
     --mLevel;
@@ -139,7 +139,7 @@ void SearchTraverser::deleteTraverser()
 
 void SearchTraverser::showSearchError( SearchHandler *handler, DocEntry *entry, \
const QString &error )  {
-//  khcDebug() << "SearchTraverser::showSearchError():" << entry->name();
+//  qCDebug(KHC_LOG) << "SearchTraverser::showSearchError():" << entry->name();
 
   mResultsPtr->append( qMakePair( entry, error ) );
 
@@ -152,7 +152,7 @@ void SearchTraverser::showSearchError( SearchHandler *handler, \
DocEntry *entry,  
 void SearchTraverser::showSearchResult( SearchHandler *handler, DocEntry *entry, \
const QString &result )  {
-//  khcDebug() << "SearchTraverser::showSearchResult():" << entry->name();
+//  qCDebug(KHC_LOG) << "SearchTraverser::showSearchResult():" << entry->name();
 
   mResultsPtr->append( qMakePair( entry, result ) );
 
@@ -163,7 +163,7 @@ void SearchTraverser::showSearchResult( SearchHandler *handler, \
DocEntry *entry,  
 void SearchTraverser::finishTraversal()
 {
-//  khcDebug() << "SearchTraverser::finishTraversal()";
+//  qCDebug(KHC_LOG) << "SearchTraverser::finishTraversal()";
 
   mEngine->view()->beginSearchResult();
   mEngine->view()->writeSearchResult( \
mEngine->grantleeFormatter()->formatSearchResults( mWords, mResults ) ); @@ -204,10 \
+204,10 @@ bool SearchEngine::initSearchHandlers()  QStringList::ConstIterator it;
   for( it = resources.constBegin(); it != resources.constEnd(); ++it ) {
     QString filename = *it;
-    khcDebug() << "SearchEngine::initSearchHandlers(): " << filename;
+    qCDebug(KHC_LOG) << "SearchEngine::initSearchHandlers(): " << filename;
     QSharedPointer<SearchHandler> handler( SearchHandler::initFromFile( filename ) \
);  if ( !handler ) {
-      khcWarning() << "Unable to initialize SearchHandler from" << filename;
+      qCWarning(KHC_LOG) << "Unable to initialize SearchHandler from" << filename;
     } else {
       QStringList documentTypes = handler->documentTypes();
       QStringList::ConstIterator it;
@@ -225,7 +225,7 @@ bool SearchEngine::initSearchHandlers()
 
   if ( mHandlers.isEmpty() ) {
     QString txt = i18n("No valid search handler found.");
-    khcWarning() << txt;
+    qCWarning(KHC_LOG) << txt;
 //    KMessageBox::sorry( mView->widget(), txt );
     return false;
   }
@@ -259,7 +259,7 @@ bool SearchEngine::search( const QString & words, const QString & \
method, int ma  mStderr = "<b>" + txt + "</b>\n";
 
   if ( mRootTraverser ) {
-    khcDebug() << "SearchEngine::search(): mRootTraverser not null.";
+    qCDebug(KHC_LOG) << "SearchEngine::search(): mRootTraverser not null.";
     return false;
   }
   mRootTraverser = new SearchTraverser( this, 0 );
diff --git a/searchhandler.cpp b/searchhandler.cpp
index 7d68978..6b19e2d 100644
--- a/searchhandler.cpp
+++ b/searchhandler.cpp
@@ -190,13 +190,13 @@ void ExternalProcessSearchHandler::search( DocEntry *entry, \
const QStringList &w  int maxResults,
   SearchEngine::Operation operation )
 {
-  khcDebug() << entry->identifier();
+  qCDebug(KHC_LOG) << entry->identifier();
 
   if ( !mSearchCommand.isEmpty() ) {
     QString cmdString = SearchEngine::substituteSearchQuery( mSearchCommand,
       entry->identifier(), words, maxResults, operation, mLang, mSearchBinary );
 
-    khcDebug() << "CMD:" << cmdString;
+    qCDebug(KHC_LOG) << "CMD:" << cmdString;
 
     SearchJob *searchJob = new SearchJob(entry);
     connect(searchJob, SIGNAL(searchFinished( SearchJob *, DocEntry *, const QString \
& )), @@ -209,7 +209,7 @@ void ExternalProcessSearchHandler::search( DocEntry *entry, \
const QStringList &w  QString urlString = SearchEngine::substituteSearchQuery( \
                mSearchUrl,
       entry->identifier(), words, maxResults, operation, mLang, mSearchBinary );
 
-    khcDebug() << "URL:" << urlString;
+    qCDebug(KHC_LOG) << "URL:" << urlString;
 
     SearchJob *searchJob = new SearchJob(entry);
     connect(searchJob, SIGNAL(searchFinished( SearchJob *, DocEntry *, const QString \
                & )),
diff --git a/searchwidget.cpp b/searchwidget.cpp
index 7643828..daffc26 100644
--- a/searchwidget.cpp
+++ b/searchwidget.cpp
@@ -322,7 +322,7 @@ void SearchWidget::scopeDoubleClicked( QTreeWidgetItem* item )
 
   QString searchUrl = scopeItem->entry()->search();
 
-  khcDebug() << "DoubleClick: " << searchUrl;
+  qCDebug(KHC_LOG) << "DoubleClick: " << searchUrl;
 
   emit searchResult( searchUrl );
 }
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2bf840e..44b235c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,10 +6,10 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )
 
 set(testmetainfo_SRCS
     testmetainfo.cpp 
-    ${CMAKE_CURRENT_SOURCE_DIR}/../khc_debug.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/../docmetainfo.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/../docentry.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/../docentrytraverser.cpp )
+ecm_qt_declare_logging_category(testmetainfo_SRCS HEADER khc_debug.h IDENTIFIER \
KHC_LOG CATEGORY_NAME org.kde.khelpcenter)  
 kconfig_add_kcfg_files(testmetainfo_SRCS ../prefs.kcfgc)
 
diff --git a/toc.cpp b/toc.cpp
index 929c2d9..647e179 100644
--- a/toc.cpp
+++ b/toc.cpp
@@ -163,7 +163,7 @@ void TOC::buildCache()
     meinproc->setOutputChannelMode(KProcess::OnlyStderrChannel);
     meinproc->start();
     if (!meinproc->waitForStarted()) {
-        khcWarning() << "could not start process" << meinproc->program();
+        qCWarning(KHC_LOG) << "could not start process" << meinproc->program();
         if (mainWindow && !m_alreadyWarned) {
             ; // add warning message box with don't display again option 
               // http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classKDialog.html
 @@ -179,8 +179,8 @@ void TOC::meinprocExited( int exitCode, QProcess::ExitStatus \
                exitStatus)
     KXmlGuiWindow *mainWindow = dynamic_cast<KXmlGuiWindow *>( \
qobject_cast<QApplication*>(qApp)->activeWindow() );  
     if ( exitStatus == QProcess::CrashExit || exitCode != 0 ) {
-        khcWarning() << "running" << meinproc->program() << "failed with exitCode" \
                << exitCode;
-        khcWarning() << "stderr output:" << meinproc->readAllStandardError();
+        qCWarning(KHC_LOG) << "running" << meinproc->program() << "failed with \
exitCode" << exitCode; +        qCWarning(KHC_LOG) << "stderr output:" << \
meinproc->readAllStandardError();  if (mainWindow && !m_alreadyWarned) {
             ; // add warning message box with don't display again option 
               // http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classKDialog.html



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic