summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2016-09-07 16:03:51 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2016-09-07 16:03:51 (GMT)
commit7aaf8b4b99a7b39214b12ad4cacbf8ae058bc73d (patch)
tree41fff96fb8d7dc30bcbf022d8fb0f2a84f45007c
parent6e2654585568ec9528008022d83669996b6676c2 (diff)
port away from kDebug()
-rw-r--r--CMakeLists.txt2
-rw-r--r--caff.cpp5
-rw-r--r--core/KGpgGroupNode.cpp5
-rw-r--r--core/convert.cpp5
-rw-r--r--gpgproc.cpp7
-rw-r--r--keysmanager.cpp9
-rw-r--r--kgpg_debug.cpp22
-rw-r--r--kgpg_debug.h27
-rw-r--r--kgpgoptions.cpp7
-rw-r--r--model/kgpgsearchresultmodel.cpp5
-rw-r--r--transactions/kgpggeneraterevoke.cpp5
-rw-r--r--transactions/kgpgimport.cpp9
-rw-r--r--transactions/kgpgtextorfiletransaction.cpp5
-rw-r--r--transactions/kgpgtransaction.cpp9
-rw-r--r--transactions/kgpgtransactionprivate.cpp17
15 files changed, 101 insertions, 38 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index afe3397..e7fa693 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,6 +141,7 @@ set(kgpg_SRCS ${core_SRCS} ${kgpg_editor_SRCS} ${kgpg_model_SRCS} ${kgpg_transac
kgpgoptions.cpp
keysmanager.cpp
kgpg.cpp
+ kgpg_debug.cpp
main.cpp
kgpgkeygenerate.cpp
kgpginterface.cpp
@@ -189,6 +190,7 @@ set(kgpg_HDRS
kgpgoptions.h
kgpgrevokewidget.h
kgpgtextinterface.h
+ kgpg_debug.h
klinebufferedprocess.h
newkey.h
selectexpirydate.h
diff --git a/caff.cpp b/caff.cpp
index 717d7ab..bd23a73 100644
--- a/caff.cpp
+++ b/caff.cpp
@@ -25,7 +25,8 @@
#include "transactions/kgpgsignuid.h"
#include "gpgproc.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
#include <KMessageBox>
@@ -144,7 +145,7 @@ KGpgCaffPrivate::abortOperation(int result)
{
Q_Q(KGpgCaff);
- kDebug(2100) << "transaction" << sender() << "failed, result" << result;
+ qCDebug(KGPG_LOG_GENERAL) << "transaction" << sender() << "failed, result" << result;
m_tempdir.reset();
emit q->aborted();
diff --git a/core/KGpgGroupNode.cpp b/core/KGpgGroupNode.cpp
index 82e0f20..535d307 100644
--- a/core/KGpgGroupNode.cpp
+++ b/core/KGpgGroupNode.cpp
@@ -22,7 +22,8 @@
#include "KGpgRootNode.h"
#include "kgpgsettings.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
#include <QFile>
@@ -185,7 +186,7 @@ KGpgGroupNode::rename(const QString &newName)
return;
if (index < 0) {
- kDebug(2100) << "Group " << d->m_name << " not renamed, group does not exist";
+ qCDebug(KGPG_LOG_GENERAL) << "Group " << d->m_name << " not renamed, group does not exist";
return;
}
diff --git a/core/convert.cpp b/core/convert.cpp
index 7e7a459..4efbe7c 100644
--- a/core/convert.cpp
+++ b/core/convert.cpp
@@ -21,7 +21,8 @@
#include "convert.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <gpgme.h>
#include "kgpgsettings.h"
@@ -218,7 +219,7 @@ KgpgSubKeyType toSubType(const QString& capString, bool upper)
case '?': // unknown to GnuPG
continue;
default:
- kDebug(2100) << "unknown capability letter" << ch
+ qCDebug(KGPG_LOG_GENERAL) << "unknown capability letter" << ch
<< "in cap string" << capString;
}
}
diff --git a/gpgproc.cpp b/gpgproc.cpp
index 7ee2683..2944592 100644
--- a/gpgproc.cpp
+++ b/gpgproc.cpp
@@ -15,7 +15,8 @@
#include "kgpgsettings.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KProcess>
#include <KStandardDirs>
@@ -115,12 +116,12 @@ getGpgProcessHome(const QString &binary)
void GnupgBinary::setBinary(const QString &executable)
{
- kDebug(2100) << "checking version of GnuPG executable" << executable;
+ qCDebug(KGPG_LOG_GENERAL) << "checking version of GnuPG executable" << executable;
// must be set first as gpgVersionString() uses GPGProc to parse the output
m_binary = executable;
const QString verstr = GPGProc::gpgVersionString(executable);
m_version = GPGProc::gpgVersion(verstr);
- kDebug(2100) << "version is" << verstr << m_version;
+ qCDebug(KGPG_LOG_GENERAL) << "version is" << verstr << m_version;
m_useDebugLevel = (m_version > 0x20000);
diff --git a/keysmanager.cpp b/keysmanager.cpp
index 23e1c89..c09c119 100644
--- a/keysmanager.cpp
+++ b/keysmanager.cpp
@@ -61,7 +61,8 @@
#include <akonadi/contact/contacteditordialog.h>
#include <akonadi/contact/contactsearchjob.h>
#include <KActionCollection>
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
#include <KMessageBox>
#include <KMimeTypeTrader>
@@ -1126,7 +1127,7 @@ void KeysManager::checkList()
changeMessage(i18n("Group member"));
break;
default:
- kDebug(2100) << "Oops, unmatched type value" << exportList.at(0)->getType();
+ qCDebug(KGPG_LOG_GENERAL) << "Oops, unmatched type value" << exportList.at(0)->getType();
}
}
@@ -1678,7 +1679,7 @@ void KeysManager::keyproperties()
break;
}
default:
- kDebug(2100) << "Oops, called with invalid item type" << cur->getType();
+ qCDebug(KGPG_LOG_GENERAL) << "Oops, called with invalid item type" << cur->getType();
return;
}
@@ -2308,7 +2309,7 @@ void KeysManager::slotEditDone(int exitcode)
void KeysManager::doPrint(const QString &txt)
{
QPrinter prt;
- //kDebug(2100) << "Printing..." ;
+ //qCDebug(KGPG_LOG_GENERAL) << "Printing..." ;
QPointer<QPrintDialog> printDialog = new QPrintDialog(&prt, this);
if (printDialog->exec() == QDialog::Accepted) {
QPainter painter(&prt);
diff --git a/kgpg_debug.cpp b/kgpg_debug.cpp
new file mode 100644
index 0000000..7eb6caf
--- /dev/null
+++ b/kgpg_debug.cpp
@@ -0,0 +1,22 @@
+/* This file is part of the KDE project
+ Copyright (C) 2015 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+
+#include "kgpg_debug.h"
+Q_LOGGING_CATEGORY(KGPG_LOG_GENERAL, "log_kgpg")
+Q_LOGGING_CATEGORY(KGPG_LOG_TRANSACTIONS, "log_kgpg")
diff --git a/kgpg_debug.h b/kgpg_debug.h
new file mode 100644
index 0000000..9ed7d78
--- /dev/null
+++ b/kgpg_debug.h
@@ -0,0 +1,27 @@
+/* This file is part of the KDE project
+ Copyright (C) 2015 Laurent Montel <montel@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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 KGPG_DEBUG_H
+#define KGPG_DEBUG_H
+
+#include <QLoggingCategory>
+Q_DECLARE_LOGGING_CATEGORY(KGPG_LOG_GENERAL)
+Q_DECLARE_LOGGING_CATEGORY(KGPG_LOG_TRANSACTIONS)
+
+#endif
diff --git a/kgpgoptions.cpp b/kgpgoptions.cpp
index 3ad8b9a..41ff7ac 100644
--- a/kgpgoptions.cpp
+++ b/kgpgoptions.cpp
@@ -24,7 +24,8 @@
#include <KConfig>
#include <KConfigGroup>
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KDesktopFile>
#include <KFontChooser>
#include <KLocalizedString>
@@ -333,7 +334,7 @@ void kgpgOptions::updateWidgets()
if (!serverList.isEmpty())
m_serverModel->setDefault(keyServer);
- kDebug(2100) << "Finishing options";
+ qCDebug(KGPG_LOG_GENERAL) << "Finishing options";
}
void kgpgOptions::updateWidgetsDefault()
@@ -351,7 +352,7 @@ void kgpgOptions::updateWidgetsDefault()
m_page3->kcfg_EmailSorting->setCurrentIndex(KGpgSettings::EnumEmailSorting::Alphabetical);
- kDebug(2100) << "Finishing default options" ;
+ qCDebug(KGPG_LOG_GENERAL) << "Finishing default options" ;
}
void kgpgOptions::updateSettings()
diff --git a/model/kgpgsearchresultmodel.cpp b/model/kgpgsearchresultmodel.cpp
index 0bce3e6..a85272d 100644
--- a/model/kgpgsearchresultmodel.cpp
+++ b/model/kgpgsearchresultmodel.cpp
@@ -14,7 +14,8 @@
#include "kgpgsearchresultmodel.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
#include <QDateTime>
@@ -473,7 +474,7 @@ KGpgSearchResultBackingModel::slotAddKey(const QStringList &lines)
} else if (line.startsWith(QLatin1String("uat:"))) {
nkey->m_uatCount++;
} else {
- kDebug(2100) << "ignored search result line" << line;
+ qCDebug(KGPG_LOG_GENERAL) << "ignored search result line" << line;
}
}
diff --git a/transactions/kgpggeneraterevoke.cpp b/transactions/kgpggeneraterevoke.cpp
index 2725979..5408e1a 100644
--- a/transactions/kgpggeneraterevoke.cpp
+++ b/transactions/kgpggeneraterevoke.cpp
@@ -13,7 +13,8 @@
#include "kgpggeneraterevoke.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
#include <QFile>
@@ -68,7 +69,7 @@ KGpgGenerateRevoke::nextLine(const QString &line)
m_description.clear();
} else if (line.contains(QLatin1String( "GET_" ))) {
setSuccess(TS_MSG_SEQUENCE);
- kDebug(2100) << line;
+ qCDebug(KGPG_LOG_GENERAL) << line;
return true;
}
diff --git a/transactions/kgpgimport.cpp b/transactions/kgpgimport.cpp
index 2ebe056..7725af0 100644
--- a/transactions/kgpgimport.cpp
+++ b/transactions/kgpgimport.cpp
@@ -16,7 +16,8 @@
#include "model/kgpgitemmodel.h"
#include "core/KGpgKeyNode.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
KGpgImport::KGpgImport(QObject *parent, const QString &text)
@@ -68,14 +69,14 @@ KGpgImport::getImportedIds(const QStringList &log, const int reason)
int space = tmpstr.indexOf(QLatin1Char( ' ' ));
if (space <= 0) {
- kDebug(2100) << __LINE__ << "invalid format:" << str;
+ qCDebug(KGPG_LOG_GENERAL) << __LINE__ << "invalid format:" << str;
continue;
}
bool ok;
unsigned char code = tmpstr.left(space).toUInt(&ok);
if (!ok) {
- kDebug(2100) << __LINE__ << "invalid format:" << str << space << tmpstr.left(space - 1);
+ qCDebug(KGPG_LOG_GENERAL) << __LINE__ << "invalid format:" << str << space << tmpstr.left(space - 1);
continue;
}
@@ -209,7 +210,7 @@ KGpgImport::getDetailedImportMessage(const QStringList &log, const KGpgItemModel
QStringList rc(keyresult.mid(19).split(QLatin1Char( ' ' )));
if (rc.count() < 2) {
- kDebug(2100) << "unexpected syntax:" << keyresult;
+ qCDebug(KGPG_LOG_GENERAL) << "unexpected syntax:" << keyresult;
continue;
}
diff --git a/transactions/kgpgtextorfiletransaction.cpp b/transactions/kgpgtextorfiletransaction.cpp
index d43edff..28e0dec 100644
--- a/transactions/kgpgtextorfiletransaction.cpp
+++ b/transactions/kgpgtextorfiletransaction.cpp
@@ -15,7 +15,8 @@
#include "gpgproc.h"
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KIO/Job>
#include <QRegExp>
@@ -67,7 +68,7 @@ KGpgTextOrFileTransaction::setText(const QString &text)
if (text.mid(begin, charset.length()) == charset) {
QString cs = text.mid(begin + charset.length(), nextlf - begin - charset.length());
if (!getProcess()->setCodec(cs.toAscii()))
- kDebug(2100) << "unsupported charset found in header" << cs;
+ qCDebug(KGPG_LOG_GENERAL) << "unsupported charset found in header" << cs;
break;
}
begin = nextlf + 1;
diff --git a/transactions/kgpgtransaction.cpp b/transactions/kgpgtransaction.cpp
index 0495ce5..149a329 100644
--- a/transactions/kgpgtransaction.cpp
+++ b/transactions/kgpgtransaction.cpp
@@ -23,7 +23,8 @@
#include <QWidget>
#include <KConfigGroup>
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KNewPasswordDialog>
#include <KLocalizedString>
#include <KPasswordDialog>
@@ -53,7 +54,7 @@ KGpgTransaction::start()
if (d->m_inputTransaction != Q_NULLPTR)
d->m_inputTransaction->start();
#ifdef KGPG_DEBUG_TRANSACTIONS
- kDebug(2100) << this << d->m_process->program();
+ qCDebug(KGPG_LOG_TRANSACTIONS) << this << d->m_process->program();
#endif /* KGPG_DEBUG_TRANSACTIONS */
d->m_process->start();
emit infoProgress(0, 1);
@@ -101,7 +102,7 @@ void
KGpgTransaction::setSuccess(const int v)
{
#ifdef KGPG_DEBUG_TRANSACTIONS
- kDebug(2100) << "old" << d->m_success << "new" << v;
+ qCDebug(KGPG_LOG_TRANSACTIONS) << "old" << d->m_success << "new" << v;
#endif /* KGPG_DEBUG_TRANSACTIONS */
d->m_success = v;
}
@@ -158,7 +159,7 @@ KGpgTransaction::waitForInputTransaction()
void
KGpgTransaction::unexpectedLine(const QString &line)
{
- kDebug(2100) << this << "unexpected input line" << line << "for command" << d->m_process->program();
+ qCDebug(KGPG_LOG_GENERAL) << this << "unexpected input line" << line << "for command" << d->m_process->program();
}
bool
diff --git a/transactions/kgpgtransactionprivate.cpp b/transactions/kgpgtransactionprivate.cpp
index c5bb366..252f7d3 100644
--- a/transactions/kgpgtransactionprivate.cpp
+++ b/transactions/kgpgtransactionprivate.cpp
@@ -15,7 +15,8 @@
#include <QWeakPointer>
#include <QWidget>
-#include <KDebug>
+#include <QDebug>
+#include "kgpg_debug.h"
#include <KLocalizedString>
#include <KIO/RenameDialog>
@@ -66,7 +67,7 @@ KGpgTransactionPrivate::slotReadReady()
if (m_quitTries)
m_quitLines << line;
#ifdef KGPG_DEBUG_TRANSACTIONS
- kDebug(2100) << m_parent << line;
+ qCDebug(KGPG_LOG_TRANSACTIONS) << m_parent << line;
#endif /* KGPG_DEBUG_TRANSACTIONS */
static const QString getBool = QLatin1String("[GNUPG:] GET_BOOL ");
@@ -224,13 +225,13 @@ KGpgTransactionPrivate::sendQuit(void)
#ifdef KGPG_DEBUG_TRANSACTIONS
if (m_quitTries == 0)
- kDebug(2100) << "sending quit";
+ qCDebug(KGPG_LOG_TRANSACTIONS) << "sending quit";
#endif /* KGPG_DEBUG_TRANSACTIONS */
if (m_quitTries++ >= 3) {
- kDebug(2100) << "tried" << m_quitTries << "times to quit the GnuPG session";
- kDebug(2100) << "last input was" << m_quitLines;
- kDebug(2100) << "please file a bug report at https://bugs.kde.org";
+ qCDebug(KGPG_LOG_GENERAL) << "tried" << m_quitTries << "times to quit the GnuPG session";
+ qCDebug(KGPG_LOG_GENERAL) << "last input was" << m_quitLines;
+ qCDebug(KGPG_LOG_GENERAL) << "please file a bug report at https://bugs.kde.org";
m_process->closeWriteChannel();
m_success = KGpgTransaction::TS_MSG_SEQUENCE;
}
@@ -285,7 +286,7 @@ KGpgTransactionPrivate::write(const QByteArray &a)
{
m_process->write(a);
#ifdef KGPG_DEBUG_TRANSACTIONS
- kDebug(2100) << m_parent << a;
+ qCDebug(KGPG_LOG_TRANSACTIONS) << m_parent << a;
#endif /* KGPG_DEBUG_TRANSACTIONS */
}
@@ -311,6 +312,6 @@ KGpgTransactionPrivate::processDone()
emit m_parent->infoProgress(100, 100);
emit m_parent->done(m_success);
#ifdef KGPG_DEBUG_TRANSACTIONS
- kDebug(2100) << this << "result:" << m_success;
+ qCDebug(KGPG_LOG_TRANSACTIONS) << this << "result:" << m_success;
#endif /* KGPG_DEBUG_TRANSACTIONS */
}