Commit 8399f223 authored by Michal Humpula's avatar Michal Humpula

migrate from KDebug to QLoggingCategory (kate)

REVIEW: 114490
parent 701f8a34
......@@ -33,7 +33,7 @@
#include <KCmdLineArgs>
#include <KConfig>
#include <KTipDialog>
#include <kdebug.h>
#include "katedebug.h"
#include <KMessageBox>
#include <KLocale>
#include <KGlobal>
......@@ -50,6 +50,8 @@
KateApp *KateApp::s_self = 0;
Q_LOGGING_CATEGORY(LOG_KATE, "kate")
KateApp::KateApp(const QCommandLineParser &args)
: m_shouldExit(false)
, m_args (args)
......@@ -123,7 +125,7 @@ QString KateApp::kateVersion (bool fullVersion)
void KateApp::initKate ()
{
kDebug() << "Setting KATE_PID: '" << getpid() << "'";
qCDebug(LOG_KATE) << "Setting KATE_PID: '" << getpid() << "'";
::setenv( "KATE_PID", QString("%1").arg(getpid()).toLatin1().constData(), 1 );
// handle restore different
......@@ -137,7 +139,7 @@ void KateApp::initKate ()
// we can exit here if session chooser decides
if (!startupKate ())
{
kDebug() << "startupKate returned false";
qCDebug(LOG_KATE) << "startupKate returned false";
m_shouldExit = true;
return ;
}
......@@ -190,7 +192,7 @@ bool KateApp::startupKate ()
// let the user choose session if possible
if (!sessionManager()->chooseSession ())
{
kDebug() << "chooseSession returned false, exiting";
qCDebug(LOG_KATE) << "chooseSession returned false, exiting";
// we will exit kate now, notify the rest of the world we are done
#ifdef Q_WS_X11
KStartupInfo::appStarted (startupId());
......@@ -291,7 +293,7 @@ bool KateApp::startupKate ()
activeMainWindow()->setAutoSaveSettings();
kDebug() << "KateApplication::init finished successful";
qCDebug(LOG_KATE) << "KateApplication::init finished successful";
return true;
}
......
......@@ -24,7 +24,7 @@
#include "katemainwindow.h"
#include "kateappadaptor.moc"
#include <kdebug.h>
#include "katedebug.h"
#include <kwindowsystem.h>
KateAppAdaptor::KateAppAdaptor (KateApp *app)
......@@ -55,7 +55,7 @@ bool KateAppAdaptor::openUrl (QString url, QString encoding)
bool KateAppAdaptor::openUrl (QString url, QString encoding, bool isTempFile)
{
kDebug () << "openURL";
qCDebug(LOG_KATE) << "openURL";
return m_app->openUrl (url, encoding, isTempFile);
}
......@@ -70,7 +70,7 @@ QString KateAppAdaptor::tokenOpenUrl (QString url, QString encoding)
QString KateAppAdaptor::tokenOpenUrl (QString url, QString encoding, bool isTempFile)
{
kDebug () << "openURL";
qCDebug(LOG_KATE) << "openURL";
KTextEditor::Document *doc=m_app->openDocUrl (url, encoding, isTempFile);
if (!doc) return QString("ERROR");
return QString("%1").arg((qptrdiff)doc);
......
......@@ -32,7 +32,7 @@
#include <KTextEditor/ConfigPage>
#include <kdebug.h>
#include "katedebug.h"
#include <KGlobal>
#include <KIconLoader>
#include <KLocale>
......@@ -274,7 +274,7 @@ void KateConfigDialog::slotCurrentPageChanged( KPageWidgetItem *current, KPageWi
PluginPageListItem *info=m_pluginPages[current];
if (!info) return;
if (info->pluginPage) return;
kDebug()<<"creating config page";
qCDebug(LOG_KATE)<<"creating config page";
info->pluginPage=info->configPageInterface->configPage(info->idInPlugin,info->pageParent);
info->pluginPage->show();
connect( info->pluginPage, SIGNAL(changed()), this, SLOT(slotChanged()) );
......@@ -293,7 +293,7 @@ void KateConfigDialog::removePluginPage (Kate::Plugin *plugin)
remove.append(it.key());
}
kDebug()<<remove.count();
qCDebug(LOG_KATE)<<remove.count();
while (!remove.isEmpty()) {
KPageWidgetItem *wItem=remove.takeLast();
PluginPageListItem *pItem=m_pluginPages.take(wItem);
......
......@@ -26,7 +26,7 @@
#include "katemainwindow.h"
#include "kateviewmanager.h"
#include <kdebug.h>
#include "katedebug.h"
KateContainer::KateContainer(KateApp* parent)
: QObject(parent)
......@@ -44,7 +44,7 @@ QWidget* KateContainer::getViewBarParent(KTextEditor::View *view,KTextEditor::Vi
if (position==KTextEditor::ViewBarContainer::BottomBar) {
KateMainWindow* mainWindow=qobject_cast<KateMainWindow*>(view->window());
if (!mainWindow) {
kDebug()<<"returning hardcoded 0, views window is not a KateMainWindow";
qCDebug(LOG_KATE)<<"returning hardcoded 0, views window is not a KateMainWindow";
return 0;
}
//Toplevel is a KateMainWindow
......@@ -52,7 +52,7 @@ QWidget* KateContainer::getViewBarParent(KTextEditor::View *view,KTextEditor::Vi
} else if (position==KTextEditor::ViewBarContainer::TopBar) {
KateMainWindow* mainWindow=qobject_cast<KateMainWindow*>(view->window());
if (!mainWindow) {
kDebug()<<"returning hardcoded 0, views window is not a KateMainWindow";
qCDebug(LOG_KATE)<<"returning hardcoded 0, views window is not a KateMainWindow";
return 0;
}
//Toplevel is a KateMainWindow
......@@ -64,7 +64,7 @@ QWidget* KateContainer::getViewBarParent(KTextEditor::View *view,KTextEditor::Vi
void KateContainer::addViewBarToLayout(KTextEditor::View *view,QWidget *bar, KTextEditor::ViewBarContainer::Position position) {
KateMainWindow* mainWindow=qobject_cast<KateMainWindow*>(view->window());
if (!mainWindow) {
kDebug()<<"main window is not a katemainwindow";
qCDebug(LOG_KATE)<<"main window is not a katemainwindow";
return;
}
......@@ -79,7 +79,7 @@ void KateContainer::addViewBarToLayout(KTextEditor::View *view,QWidget *bar, KTe
void KateContainer::showViewBarForView(KTextEditor::View *view, KTextEditor::ViewBarContainer::Position position) {
KateMainWindow* mainWindow=qobject_cast<KateMainWindow*>(view->window());
if (!mainWindow) {
kDebug()<<"main window is not a katemainwindow";
qCDebug(LOG_KATE)<<"main window is not a katemainwindow";
return;
}
......@@ -93,7 +93,7 @@ void KateContainer::showViewBarForView(KTextEditor::View *view, KTextEditor::Vie
void KateContainer::hideViewBarForView(KTextEditor::View *view, KTextEditor::ViewBarContainer::Position position) {
KateMainWindow* mainWindow=qobject_cast<KateMainWindow*>(view->window());
if (!mainWindow) {
kDebug()<<"main window is not a katemainwindow";
qCDebug(LOG_KATE)<<"main window is not a katemainwindow";
return;
}
......@@ -107,7 +107,7 @@ void KateContainer::hideViewBarForView(KTextEditor::View *view, KTextEditor::Vie
void KateContainer::deleteViewBarForView(KTextEditor::View *view, KTextEditor::ViewBarContainer::Position position) {
KateMainWindow* mainWindow=qobject_cast<KateMainWindow*>(view->window());
if (!mainWindow) {
kDebug()<<"main window is not a katemainwindow";
qCDebug(LOG_KATE)<<"main window is not a katemainwindow";
return;
}
......
/* This file is part of the KDE project
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KATE_DEBUG_H
#define KATE_DEBUG_H
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(LOG_KATE)
#endif /* KATE_DEBUG_H */
......@@ -34,7 +34,7 @@
#include <KParts/Factory>
#include <KLocale>
#include <kdebug.h>
#include "katedebug.h"
#include <KConfig>
#include <KLibLoader>
#include <KCodecs>
......@@ -75,7 +75,7 @@ KateDocManager::KateDocManager (QObject *parent)
if (iface != NULL) {
iface->setContainer( new KateContainer(KateApp::self()) );
} else {
kDebug()<<"Editor does not support the container interface";
qCDebug(LOG_KATE)<<"Editor does not support the container interface";
}
// read in editor config
......@@ -131,7 +131,7 @@ void KateDocManager::setSuppressOpeningErrorDialogs (bool suppress)
KTextEditor::Document *KateDocManager::createDoc (const KateDocumentInfo& docInfo)
{
kDebug()<<"createDoc"<<endl;
qCDebug(LOG_KATE)<<"createDoc"<<endl;
KTextEditor::Document *doc = (KTextEditor::Document *) m_editor->createDocument(this);
......@@ -165,7 +165,7 @@ KTextEditor::Document *KateDocManager::createDoc (const KateDocumentInfo& docInf
void KateDocManager::deleteDoc (KTextEditor::Document *doc)
{
KateApp::self()->emitDocumentClosed(QString("%1").arg((qptrdiff)doc));
kDebug()<<"deleting document with name:"<<doc->documentName();
qCDebug(LOG_KATE)<<"deleting document with name:"<<doc->documentName();
// document will be deleted, soon
emit m_documentManager->documentWillBeDeleted (doc);
......@@ -248,7 +248,7 @@ KTextEditor::Document *KateDocManager::openUrl (const QUrl& url, const QString &
if ( fi.exists() )
{
m_tempFiles[ doc] = qMakePair(u, fi.lastModified());
kDebug(13001) << "temporary file will be deleted after use unless modified: " << u.url();
qCDebug(LOG_KATE) << "temporary file will be deleted after use unless modified: " << u.url();
}
}
}
......@@ -311,13 +311,13 @@ bool KateDocManager::closeDocuments(const QList<KTextEditor::Document *> &docume
i18n("Delete File?") ) == KMessageBox::Yes )
{
KIO::del( m_tempFiles[ doc ].first, KIO::HideProgressInfo );
kDebug(13001) << "Deleted temporary file " << m_tempFiles[ doc ].first;
qCDebug(LOG_KATE) << "Deleted temporary file " << m_tempFiles[ doc ].first;
m_tempFiles.remove( doc );
}
else
{
m_tempFiles.remove(doc);
kDebug(13001) << "The supposedly temporary file " << m_tempFiles[ doc ].first.url() << " have been modified since loaded, and has not been deleted.";
qCDebug(LOG_KATE) << "The supposedly temporary file " << m_tempFiles[ doc ].first.url() << " have been modified since loaded, and has not been deleted.";
}
}
......
......@@ -26,7 +26,6 @@
#include <KCmdLineArgs>
#include <KAboutData>
#include <KStartupInfo>
#include <kdebug.h>
#include <QTextCodec>
#include <QByteArray>
......@@ -38,6 +37,7 @@
#include <QDBusReply>
#include <QVariant>
#include <QCommandLineParser>
#include <QLoggingCategory>
#include <iostream>
......@@ -76,6 +76,8 @@ class KateWaiter : public QObject {
extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
{
QLoggingCategory::setFilterRules(QStringLiteral("kate = true"));
/**
* construct about data for Kate
*/
......
......@@ -39,7 +39,7 @@
#include <KAboutApplicationDialog>
#include <KAction>
#include <kdebug.h>
#include "katedebug.h"
#include <KEditToolBar>
#include <KGlobal>
#include <KShortcutsDialog>
......@@ -173,7 +173,7 @@ KateMainWindow::KateMainWindow (KConfig *sconfig, const QString &sgroup)
setXMLFile( "kateui.rc" );
createShellGUI ( true );
//kDebug() << "****************************************************************************" << sconfig;
//qCDebug(LOG_KATE) << "****************************************************************************" << sconfig;
// register mainwindow in app
KateApp::self()->addMainWindow (this);
......@@ -673,11 +673,11 @@ void KateMainWindow::editKeys()
foreach(KXMLGUIClient *client, clients) {
// FIXME there appear to be invalid clients after session switching
// kDebug(13001)<<"adding client to shortcut editor";
// kDebug(13001)<<client;
// kDebug(13001)<<client->actionCollection();
// kDebug(13001)<<client->componentData().aboutData();
// kDebug(13001)<<client->componentData().aboutData()->programName();
// qCDebug(LOG_KATE)<<"adding client to shortcut editor";
// qCDebug(LOG_KATE)<<client;
// qCDebug(LOG_KATE)<<client->actionCollection();
// qCDebug(LOG_KATE)<<client->componentData().aboutData();
// qCDebug(LOG_KATE)<<client->componentData().aboutData()->programName();
dlg.addCollection ( client->actionCollection(), client->componentName() );
}
dlg.configure();
......@@ -685,13 +685,13 @@ void KateMainWindow::editKeys()
QList<KTextEditor::Document*> l = KateDocManager::self()->documentList();
for (int i = 0;i < l.count();i++)
{
// kDebug(13001)<<"reloading Keysettings for document "<<i;
// qCDebug(LOG_KATE)<<"reloading Keysettings for document "<<i;
l.at(i)->reloadXML();
QList<KTextEditor::View *> l1 = l.at(i)->views ();
for (int i1 = 0;i1 < l1.count();i1++)
{
l1.at(i1)->reloadXML();
// kDebug(13001)<<"reloading Keysettings for view "<<i<<"/"<<i1;
// qCDebug(LOG_KATE)<<"reloading Keysettings for view "<<i<<"/"<<i1;
}
}
}
......@@ -749,7 +749,7 @@ void KateMainWindow::mSlotFixOpenWithMenu()
// get a list of appropriate services.
QMimeDatabase db;
QMimeType mime = db.mimeTypeForName( activeView->document()->mimeType() );
//kDebug(13001) << "mime type: " << mime.name();
//qCDebug(LOG_KATE) << "mime type: " << mime.name();
QAction *a = 0;
KService::List offers = KMimeTypeTrader::self()->query(mime.name(), "Application");
......@@ -954,7 +954,7 @@ void KateMainWindow::restoreWindowConfig(const KConfigGroup &config)
void KateMainWindow::slotUpdateBottomViewBar()
{
//kDebug()<<"slotUpdateHorizontalViewBar()"<<endl;
//qCDebug(LOG_KATE)<<"slotUpdateHorizontalViewBar()"<<endl;
KTextEditor::View *view=m_viewManager->activeView();
BarState bs=m_bottomViewBarMapping[view];
if (bs.bar() && bs.state()) {
......@@ -964,7 +964,7 @@ void KateMainWindow::slotUpdateBottomViewBar()
} else {
QWidget *wid=m_bottomContainerStack->currentWidget();
if (wid) wid->hide();
//kDebug()<<wid<<"hiding container"<<endl;
//qCDebug(LOG_KATE)<<wid<<"hiding container"<<endl;
m_bottomViewBarContainer->hide();
}
}
......@@ -972,7 +972,7 @@ void KateMainWindow::slotUpdateBottomViewBar()
void KateMainWindow::slotUpdateTopViewBar()
{
//kDebug()<<"slotUpdateHorizontalViewBar()"<<endl;
//qCDebug(LOG_KATE)<<"slotUpdateHorizontalViewBar()"<<endl;
KTextEditor::View *view=m_viewManager->activeView();
BarState bs=m_topViewBarMapping[view];
if (bs.bar() && bs.state()) {
......@@ -982,7 +982,7 @@ void KateMainWindow::slotUpdateTopViewBar()
} else {
QWidget *wid=m_topContainerStack->currentWidget();
if (wid) wid->hide();
//kDebug()<<wid<<"hiding container"<<endl;
//qCDebug(LOG_KATE)<<wid<<"hiding container"<<endl;
m_topViewBarContainer->hide();
}
}
......
......@@ -29,7 +29,7 @@
#include <kactionmenu.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kdebug.h>
#include "katedebug.h"
#include <kglobal.h>
#include <kglobalsettings.h>
#include <khbox.h>
......@@ -478,7 +478,7 @@ namespace KateMDI
KMultiTabBarTab *bt = dynamic_cast<KMultiTabBarTab*>(obj);
if (bt)
{
//kDebug() << "Request for popup";
//qCDebug(LOG_KATE) << "Request for popup";
m_popupButton = bt->id();
......
......@@ -30,7 +30,7 @@
#include <KServiceTypeTrader>
#include <KConfigGroup>
#include <kdebug.h>
#include "katedebug.h"
#include <QFile>
QString KatePluginInfo::saveName() const
......
......@@ -29,7 +29,7 @@
#include <KVBox>
#include <KIconLoader>
#include <KMessageBox>
#include <kdebug.h>
#include "katedebug.h"
#include <KEncodingFileDialog>
#include <klocalizedstring.h>
......
......@@ -29,7 +29,7 @@
#include <KStandardDirs>
#include <KLocale>
#include <kdebug.h>
#include "katedebug.h"
#include <KDirWatch>
#include <KInputDialog>
#include <KIconLoader>
......@@ -90,7 +90,7 @@ void KateSession::init ()
}
if (!m_sessionFileRel.isEmpty() && !KGlobal::dirs()->exists(sessionFile ()))
kDebug() << "Warning, session file not found: " << m_sessionFileRel;
qCDebug(LOG_KATE) << "Warning, session file not found: " << m_sessionFileRel;
}
KateSession::~KateSession ()
......@@ -217,7 +217,7 @@ KateSessionManager::KateSessionManager (QObject *parent)
, m_sessionsDir (KStandardDirs::locateLocal( "data", "kate/sessions"))
, m_activeSession (new KateSession (this, QString()))
{
kDebug() << "LOCAL SESSION DIR: " << m_sessionsDir;
qCDebug(LOG_KATE) << "LOCAL SESSION DIR: " << m_sessionsDir;
// create dir if needed
KGlobal::dirs()->makeDir (m_sessionsDir);
......@@ -254,7 +254,7 @@ void KateSessionManager::updateSessionList ()
}
m_sessionList.append (KateSession::Ptr(session));
//kDebug () << "FOUND SESSION: " << session->sessionName() << " FILE: " << session->sessionFile() << " dir[i];" << dir[i];
//qCDebug(LOG_KATE) << "FOUND SESSION: " << session->sessionName() << " FILE: " << session->sessionFile() << " dir[i];" << dir[i];
}
qSort(m_sessionList.begin(), m_sessionList.end(), katesessions_compare_sessions_ptr);
......@@ -672,12 +672,12 @@ KateSessionChooser::KateSessionChooser (QWidget *parent, const QString &lastSess
connect(a, SIGNAL(triggered()), this, SLOT(slotCopySession()));
const KateSessionList &slist (KateSessionManager::self()->sessionList());
kDebug()<<"Last session is:"<<lastSession;
qCDebug(LOG_KATE)<<"Last session is:"<<lastSession;
for (int i = 0; i < slist.count(); ++i)
{
KateSessionChooserItem *item = new KateSessionChooserItem (m_sessions, slist[i]);
kDebug()<<"Session added to chooser:"<<slist[i]->sessionName()<<"........"<<slist[i]->sessionFileRelative();
qCDebug(LOG_KATE)<<"Session added to chooser:"<<slist[i]->sessionName()<<"........"<<slist[i]->sessionFileRelative();
if (slist[i]->sessionFileRelative() == lastSession)
m_sessions->setCurrentItem (item);
}
......
......@@ -36,7 +36,7 @@
#include <KAction>
#include <KActionCollection>
#include <KCmdLineArgs>
#include <kdebug.h>
#include "katedebug.h"
#include <KEncodingFileDialog>
#include <KIconLoader>
#include <KGlobal>
......
......@@ -31,7 +31,7 @@
#include <KLocale>
#include <KSqueezedTextLabel>
#include <KConfig>
#include <kdebug.h>
#include "katedebug.h"
#include <KStringHandler>
#include <KVBox>
#include <klocalizedstring.h>
......@@ -210,7 +210,7 @@ void KateViewSpace::setActive( bool active, bool )
void KateViewSpace::saveConfig ( KConfigBase* config, int myIndex , const QString& viewConfGrp)
{
// kDebug()<<"KateViewSpace::saveConfig("<<myIndex<<", "<<viewConfGrp<<") - currentView: "<<currentView()<<")";
// qCDebug(LOG_KATE)<<"KateViewSpace::saveConfig("<<myIndex<<", "<<viewConfGrp<<") - currentView: "<<currentView()<<")";
QString groupname = QString(viewConfGrp + "-ViewSpace %1").arg( myIndex );
KConfigGroup group (config, groupname);
......
......@@ -26,7 +26,6 @@
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <kglobal.h>
#include <qdir.h>
......@@ -142,7 +141,6 @@ namespace Kate
QString XMLGUIClient::localXmlDataFile(const QString &componentName, const QString &filename)
{
QString result = KStandardDirs::locateLocal( "data", "kate/plugins/" + componentName + QDir::separator() + filename);
kDebug(13000) << "File for shortcut storage" << result;
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment