rewrite plasmoid, de and helper to use pdebug

This commit is contained in:
arcan1s 2014-08-13 07:26:15 +04:00
parent 5c8dca22d0
commit 07e07ee777
6 changed files with 100 additions and 98 deletions

View File

@ -26,6 +26,7 @@
#include <QTextCodec>
#include "netctl.h"
#include "pdebug.h"
#include "taskadds.h"
@ -49,13 +50,13 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
Netctl::~Netctl()
{
if (debug) qDebug() << "[DE]" << "[~Netctl]";
if (debug) qDebug() << PDEBUG;
}
QStringList Netctl::sources() const
{
if (debug) qDebug() << "[DE]" << "[sources]";
if (debug) qDebug() << PDEBUG;
QStringList sources;
sources.append(QString("active"));
@ -75,7 +76,7 @@ QStringList Netctl::sources() const
void Netctl::readConfiguration()
{
if (debug) qDebug() << "[DE]" << "[readConfiguration]";
if (debug) qDebug() << PDEBUG;
// default configuration
QMap<QString, QString> rawConfig;
@ -87,7 +88,7 @@ void Netctl::readConfiguration()
rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto");
QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf");
if (debug) qDebug() << "[DE]" << "[readConfiguration]" << ":" << "Configuration file" << fileName;
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile configFile(fileName);
if (!configFile.open(QIODevice::ReadOnly)) {
configuration = updateConfiguration(rawConfig);
@ -117,7 +118,7 @@ void Netctl::readConfiguration()
QMap<QString, QString> Netctl::updateConfiguration(const QMap<QString, QString> rawConfig)
{
if (debug) qDebug() << "[DE]" << "[updateConfiguration]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> config;
QString key, value;
@ -135,8 +136,7 @@ QMap<QString, QString> Netctl::updateConfiguration(const QMap<QString, QString>
}
for (int i=0; i<config.keys().count(); i++)
if (debug) qDebug() << "[DE]" << "[updateConfiguration]" << ":" <<
config.keys()[i] + QString("=") + config[config.keys()[i]];
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") + config[config.keys()[i]];
return config;
}
@ -144,8 +144,8 @@ QMap<QString, QString> Netctl::updateConfiguration(const QMap<QString, QString>
bool Netctl::sourceRequestEvent(const QString &name)
{
if (debug) qDebug() << "[DE]" << "[sourceRequestEvent]";
if (debug) qDebug() << "[DE]" << "[sourceRequestEvent]" << ":" << "Source name" << name;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source name" << name;
return updateSourceEvent(name);
}
@ -153,7 +153,7 @@ bool Netctl::sourceRequestEvent(const QString &name)
QString Netctl::getCurrentProfile(const QString cmdNetctl, const QString cmdNetctlAuto)
{
if (debug) qDebug() << "[DE]" << "[getCurrentProfile]";
if (debug) qDebug() << PDEBUG;
getNetctlAutoStatus(cmdNetctlAuto);
QString cmd;
@ -161,11 +161,11 @@ QString Netctl::getCurrentProfile(const QString cmdNetctl, const QString cmdNetc
cmd = cmdNetctlAuto;
else
cmd = cmdNetctl;
if (debug) qDebug() << "[DE]" << "[getCurrentProfile]" << ":" << "Cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
TaskResult process = runTask(cmd + QString(" list"));
if (debug) qDebug() << "[DE]" << "[getCurrentProfile]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (process.exitCode != 0)
if (debug) qDebug() << "[DE]" << "[getCurrentProfile]" << ":" << "Error" << process.error;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
currentProfile = QString("");
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
QStringList profileList = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
@ -182,13 +182,13 @@ QString Netctl::getCurrentProfile(const QString cmdNetctl, const QString cmdNetc
QString Netctl::getExtIp(const QString cmd)
{
if (debug) qDebug() << "[DE]" << "[getExtIp]";
if (debug) qDebug() << "[DE]" << "[getExtIp]" << ":" << "Cmd" << cmd;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
TaskResult process = runTask(cmd);
if (debug) qDebug() << "[DE]" << "[getExtIp]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (process.exitCode != 0)
if (debug) qDebug() << "[DE]" << "[getExtIp]" << ":" << "Error" << process.error;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
QString extIp = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
return extIp;
@ -197,7 +197,7 @@ QString Netctl::getExtIp(const QString cmd)
QStringList Netctl::getInterfaceList()
{
if (debug) qDebug() << "[DE]" << "[getInterfaceList]";
if (debug) qDebug() << PDEBUG;
QList<QNetworkInterface> rawList = QNetworkInterface::allInterfaces();
QStringList interfacesList;
@ -210,7 +210,7 @@ QStringList Netctl::getInterfaceList()
QString Netctl::getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol)
{
if (debug) qDebug() << "[DE]" << "[getIntIp]";
if (debug) qDebug() << PDEBUG;
QString intIp = QString("");
if (protocol == QAbstractSocket::IPv4Protocol)
@ -232,12 +232,12 @@ QString Netctl::getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol)
QString Netctl::getNetctlAutoStatus(const QString cmdNetctlAuto)
{
if (debug) qDebug() << "[DE]" << "[getNetctlAutoStatus]";
if (debug) qDebug() << PDEBUG;
TaskResult process = runTask(cmdNetctlAuto + QString(" list"));
if (debug) qDebug() << "[DE]" << "[getNetctlAutoStatus]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (process.exitCode != 0)
if (debug) qDebug() << "[DE]" << "[getNetctlAutoStatus]" << ":" << "Error" << process.error;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
QString status;
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
if (cmdOutput.isEmpty()) {
@ -254,7 +254,7 @@ QString Netctl::getNetctlAutoStatus(const QString cmdNetctlAuto)
QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto)
{
if (debug) qDebug() << "[DE]" << "[getProfileList]";
if (debug) qDebug() << PDEBUG;
getNetctlAutoStatus(cmdNetctlAuto);
QString cmd;
@ -262,11 +262,11 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
cmd = cmdNetctlAuto;
else
cmd = cmdNetctl;
if (debug) qDebug() << "[DE]" << "[getProfileList]" << ":" << "Cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
TaskResult process = runTask(cmd + QString(" list"));
if (debug) qDebug() << "[DE]" << "[getProfileList]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (process.exitCode != 0)
if (debug) qDebug() << "[DE]" << "[getProfileList]" << ":" << "Error" << process.error;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(process.output);
QStringList profileList = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
for (int i=0; i<profileList.count(); i++)
@ -278,7 +278,7 @@ QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNet
QString Netctl::getProfileStringStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
{
if (debug) qDebug() << "[DE]" << "[getProfileStringStatus]";
if (debug) qDebug() << PDEBUG;
getNetctlAutoStatus(cmdNetctlAuto);
QString status = QString("static");
@ -286,9 +286,9 @@ QString Netctl::getProfileStringStatus(const QString cmdNetctl, const QString cm
status = QString("netctl-auto");
else {
TaskResult process = runTask(cmdNetctl + QString(" is-enabled ") + getCurrentProfile(cmdNetctl, cmdNetctlAuto));
if (debug) qDebug() << "[DE]" << "[getProfileStringStatus]" << ":" << "Cmd returns" << process.exitCode;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
if (process.exitCode != 0)
if (debug) qDebug() << "[DE]" << "[getProfileStringStatus]" << ":" << "Error" << process.error;
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
if (process.exitCode == 0)
status = QString("enabled");
}
@ -299,7 +299,7 @@ QString Netctl::getProfileStringStatus(const QString cmdNetctl, const QString cm
QString Netctl::getStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
{
if (debug) qDebug() << "[DE]" << "[getStatus]";
if (debug) qDebug() << PDEBUG;
getNetctlAutoStatus(cmdNetctlAuto);
QString status = QString("false");
@ -313,8 +313,8 @@ QString Netctl::getStatus(const QString cmdNetctl, const QString cmdNetctlAuto)
bool Netctl::updateSourceEvent(const QString &source)
{
if (debug) qDebug() << "[DE]" << "[updateSourceEvent]";
if (debug) qDebug() << "[DE]" << "[updateSourceEvent]" << ":" << "Source name" << source;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;
QString value = QString("N\\A");
if (source == QString("active")) {

1
sources/dataengine/pdebug.h Symbolic link
View File

@ -0,0 +1 @@
../3rdparty/pdebug/pdebug.h

View File

@ -27,6 +27,7 @@
#include "controladaptor.h"
#include "netctladaptor.h"
#include "pdebug.h"
#include "version.h"
@ -44,7 +45,7 @@ NetctlHelper::NetctlHelper(QObject *parent, QMap<QString, QVariant> args)
NetctlHelper::~NetctlHelper()
{
if (debug) qDebug() << "[NetctlHelper]" << "[~NetctlHelper]";
if (debug) qDebug() << PDEBUG;
deleteInterface();
}
@ -52,7 +53,7 @@ NetctlHelper::~NetctlHelper()
QStringList NetctlHelper::printSettings()
{
if (debug) qDebug() << "[NetctlHelper]" << "[printSettings]";
if (debug) qDebug() << PDEBUG;
QStringList settingsList;
for (int i=0; i<configuration.keys().count(); i++)
@ -65,26 +66,26 @@ QStringList NetctlHelper::printSettings()
void NetctlHelper::createInterface()
{
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]";
if (debug) qDebug() << PDEBUG;
QDBusConnection bus = QDBusConnection::systemBus();
if (!bus.registerService(DBUS_HELPER_SERVICE)) {
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << "Could not register service";
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << bus.lastError().message();
if (debug) qDebug() << PDEBUG << ":" << "Could not register service";
if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
return quitHelper();
}
if (!bus.registerObject(DBUS_LIB_PATH,
new NetctlAdaptor(this, debug, configuration),
QDBusConnection::ExportAllContents)) {
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << "Could not register library object";
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << bus.lastError().message();
if (debug) qDebug() << PDEBUG << ":" << "Could not register library object";
if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
return quitHelper();
}
if (!bus.registerObject(DBUS_CTRL_PATH,
new ControlAdaptor(this, debug, configuration),
QDBusConnection::ExportAllContents)) {
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << "Could not register control object";
if (debug) qDebug() << "[NetctlHelper]" << "[createInterface]" << ":" << bus.lastError().message();
if (debug) qDebug() << PDEBUG << ":" << "Could not register control object";
if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
return quitHelper();
}
}
@ -92,7 +93,7 @@ void NetctlHelper::createInterface()
void NetctlHelper::deleteInterface()
{
if (debug) qDebug() << "[NetctlHelper]" << "[deleteInterface]";
if (debug) qDebug() << PDEBUG;
QDBusConnection::systemBus().unregisterObject(DBUS_LIB_PATH);
QDBusConnection::systemBus().unregisterObject(DBUS_CTRL_PATH);
@ -102,7 +103,7 @@ void NetctlHelper::deleteInterface()
QMap<QString, QString> NetctlHelper::getDefault()
{
if (debug) qDebug() << "[NetctlHelper]" << "[getDefault]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> settings;
settings[QString("CLOSE_HELPER")] = QString("false");
@ -130,8 +131,7 @@ QMap<QString, QString> NetctlHelper::getDefault()
settings[QString("WPASUP_PATH")] = QString("/usr/bin/wpa_supplicant");
settings[QString("WPA_DRIVERS")] = QString("nl80211,wext");
for (int i=0; i<settings.keys().count(); i++)
if (debug) qDebug() << "[NetctlHelper]" << "[getDefault]" << ":" <<
settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
return settings;
}
@ -139,7 +139,7 @@ QMap<QString, QString> NetctlHelper::getDefault()
QMap<QString, QString> NetctlHelper::getSettings(const QString file, const QMap<QString, QString> existing)
{
if (debug) qDebug() << "[NetctlHelper]" << "[getSettings]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> settings;
if (existing.isEmpty())
@ -161,8 +161,7 @@ QMap<QString, QString> NetctlHelper::getSettings(const QString file, const QMap<
}
configFile.close();
for (int i=0; i<settings.keys().count(); i++)
if (debug) qDebug() << "[NetctlHelper]" << "[getSettings]" << ":" <<
settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
if (debug) qDebug() << PDEBUG << ":" << settings.keys()[i] + QString("=") + settings[settings.keys()[i]];
return settings;
}
@ -170,7 +169,7 @@ QMap<QString, QString> NetctlHelper::getSettings(const QString file, const QMap<
void NetctlHelper::updateConfiguration()
{
if (debug) qDebug() << "[NetctlHelper]" << "[updateConfiguration]";
if (debug) qDebug() << PDEBUG;
deleteInterface();
configuration = getSettings(QString("/etc/netctlgui-helper.conf"));
@ -182,7 +181,7 @@ void NetctlHelper::updateConfiguration()
void NetctlHelper::quitHelper()
{
if (debug) qDebug() << "[NetctlHelper]" << "[quitHelper]";
if (debug) qDebug() << PDEBUG;
QCoreApplication::instance()->quit();
}

1
sources/helper/src/pdebug.h Symbolic link
View File

@ -0,0 +1 @@
../../3rdparty/pdebug/pdebug.h

View File

@ -30,6 +30,7 @@
#include <QProcessEnvironment>
#include "netctl.h"
#include "pdebug.h"
#include "ui_about.h"
#include "ui_appearance.h"
#include "ui_dataengine.h"
@ -52,7 +53,7 @@ IconLabel::~IconLabel()
void IconLabel::mousePressEvent(QMouseEvent *event)
{
if (debug) qDebug() << "[PLASMOID]" << "[mousePressEvent]";
if (debug) qDebug() << PDEBUG;
if (event->button() == Qt::LeftButton)
widget->showGui();
@ -81,7 +82,7 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
Netctl::~Netctl()
{
if (debug) qDebug() << "[PLASMOID]" << "[~Netctl]";
if (debug) qDebug() << PDEBUG;
// // actions
// delete startProfileMenu;
@ -99,7 +100,7 @@ Netctl::~Netctl()
void Netctl::init()
{
if (debug) qDebug() << "[PLASMOID]" << "[init]";
if (debug) qDebug() << PDEBUG;
info[QString("current")] = QString("N\\A");
info[QString("extip4")] = QString("N\\A");
@ -130,7 +131,7 @@ void Netctl::init()
QString Netctl::parsePattern(const QString rawLine)
{
if (debug) qDebug() << "[PLASMOID]" << "[parsePattern]";
if (debug) qDebug() << PDEBUG;
QString line = rawLine;
for (int i=0; i<info.keys().count(); i++)
@ -145,7 +146,7 @@ QString Netctl::parsePattern(const QString rawLine)
QMap<QString, QString> Netctl::readDataEngineConfiguration()
{
if (debug) qDebug() << "[PLASMOID]" << "[readDataEngineConfiguration]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> rawConfig;
rawConfig[QString("EXTIP4")] = QString("false");
@ -156,7 +157,7 @@ QMap<QString, QString> Netctl::readDataEngineConfiguration()
rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto");
QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf");
if (debug) qDebug() << "[PLASMOID]" << "[readDataEngineConfiguration]" << ":" << "Configuration file" << fileName;
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile configFile(fileName);
if (!configFile.open(QIODevice::ReadOnly))
return updateDataEngineConfiguration(rawConfig);
@ -183,11 +184,11 @@ QMap<QString, QString> Netctl::readDataEngineConfiguration()
void Netctl::writeDataEngineConfiguration(const QMap<QString, QString> settings)
{
if (debug) qDebug() << "[PLASMOID]" << "[writeDataEngineConfiguration]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> config = updateDataEngineConfiguration(settings);
QString fileName = KGlobal::dirs()->locateLocal("config", "netctl.conf");
if (debug) qDebug() << "[PLASMOID]" << "[writeDataEngineConfiguration]" << ":" << "Configuration file" << fileName;
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile configFile(fileName);
if (!configFile.open(QIODevice::WriteOnly)) return;
for (int i=0; i<config.keys().count(); i++) {
@ -200,7 +201,7 @@ void Netctl::writeDataEngineConfiguration(const QMap<QString, QString> settings)
QMap<QString, QString> Netctl::updateDataEngineConfiguration(const QMap<QString, QString> rawConfig)
{
if (debug) qDebug() << "[PLASMOID]" << "[updateDataEngineConfiguration]";
if (debug) qDebug() << PDEBUG;
QMap<QString, QString> config;
QString key, value;
@ -218,8 +219,7 @@ QMap<QString, QString> Netctl::updateDataEngineConfiguration(const QMap<QString,
}
for (int i=0; i<config.keys().count(); i++)
if (debug) qDebug() << "[PLASMOID]" << "[updateDataEngineConfiguration]" << ":" <<
config.keys()[i] + QString("=") + config[config.keys()[i]];
if (debug) qDebug() << PDEBUG << ":" << config.keys()[i] + QString("=") + config[config.keys()[i]];
return config;
}
@ -227,8 +227,8 @@ QMap<QString, QString> Netctl::updateDataEngineConfiguration(const QMap<QString,
void Netctl::updateIcon()
{
if (debug) qDebug() << "[PLASMOID]" << "[updateIcon]";
if (debug) qDebug() << "[PLASMOID]" << "[updateIcon]" << ":" << "Status" << status;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Status" << status;
QString icon;
if (status)
@ -245,8 +245,8 @@ void Netctl::updateIcon()
void Netctl::updateInterface(bool setShown)
{
if (debug) qDebug() << "[PLASMOID]" << "[updateInterface]";
if (debug) qDebug() << "[PLASMOID]" << "[updateInterface]" << ":" << "State" << setShown;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "State" << setShown;
if (setShown)
layout->addWidget(textLabel);
@ -260,7 +260,7 @@ void Netctl::updateInterface(bool setShown)
// context menu
void Netctl::enableProfileSlot()
{
if (debug) qDebug() << "[PLASMOID]" << "[enableProfileSlot]";
if (debug) qDebug() << PDEBUG;
QString enableStatus = QString("");
if (info[QString("status")].contains(QString("enabled"))) {
@ -287,7 +287,7 @@ void Netctl::enableProfileSlot()
void Netctl::restartProfileSlot()
{
if (debug) qDebug() << "[PLASMOID]" << "[restartProfileSlot]";
if (debug) qDebug() << PDEBUG;
sendNotification(QString("Info"), i18n("Restart profile %1", info[QString("current")]));
if (useHelper) {
@ -307,8 +307,8 @@ void Netctl::restartProfileSlot()
void Netctl::startProfileSlot(QAction *profile)
{
if (debug) qDebug() << "[PLASMOID]" << "[startProfileSlot]";
if (debug) qDebug() << "[PLASMOID]" << "[startProfileSlot]" << ":" << "Profile" << profile->text().remove(QChar('&'));
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile->text().remove(QChar('&'));
sendNotification(QString("Info"), i18n("Start profile %1", profile->text().remove(QChar('&'))));
if (useHelper) {
@ -334,7 +334,7 @@ void Netctl::startProfileSlot(QAction *profile)
void Netctl::stopProfileSlot()
{
if (debug) qDebug() << "[PLASMOID]" << "[stopProfileSlot]";
if (debug) qDebug() << PDEBUG;
sendNotification(QString("Info"), i18n("Stop profile %1", info[QString("current")]));
if (useHelper) {
@ -354,8 +354,8 @@ void Netctl::stopProfileSlot()
void Netctl::switchToProfileSlot(QAction *profile)
{
if (debug) qDebug() << "[PLASMOID]" << "[switchToProfileSlot]";
if (debug) qDebug() << "[PLASMOID]" << "[switchToProfileSlot]" << ":" << "Profile" << profile->text().remove(QChar('&'));
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile->text().remove(QChar('&'));
sendNotification(QString("Info"), i18n("Switch to profile %1", profile->text().remove(QChar('&'))));
@ -374,7 +374,7 @@ void Netctl::switchToProfileSlot(QAction *profile)
void Netctl::startHelper()
{
if (debug) qDebug() << "[PLASMOID]" << "[startHelper]";
if (debug) qDebug() << PDEBUG;
QProcess command;
QString commandLine = paths[QString("helper")];
@ -385,7 +385,7 @@ void Netctl::startHelper()
void Netctl::checkHelperStatus()
{
if (debug) qDebug() << "[PLASMOID]" << "[checkHelperStatus]";
if (debug) qDebug() << PDEBUG;
if (useHelper)
useHelper = !sendDBusRequest(QString("Active"), QList<QVariant>()).isEmpty();
@ -394,7 +394,7 @@ void Netctl::checkHelperStatus()
QList<QAction*> Netctl::contextualActions()
{
if (debug) qDebug() << "[PLASMOID]" << "[contextualActions]";
if (debug) qDebug() << PDEBUG;
if (status)
contextMenu[QString("title")]->setIcon(QIcon(paths[QString("active")]));
@ -445,7 +445,7 @@ QList<QAction*> Netctl::contextualActions()
void Netctl::createActions()
{
if (debug) qDebug() << "[PLASMOID]" << "[createActions]";
if (debug) qDebug() << PDEBUG;
menuActions.clear();
@ -497,9 +497,9 @@ void Netctl::createActions()
// events
void Netctl::sendNotification(const QString eventId, const QString message)
{
if (debug) qDebug() << "[PLASMOID]" << "[sendNotification]";
if (debug) qDebug() << "[PLASMOID]" << "[sendNotification]" << ":" << "Event" << eventId;
if (debug) qDebug() << "[PLASMOID]" << "[sendNotification]" << ":" << "Message" << message;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Event" << eventId;
if (debug) qDebug() << PDEBUG << ":" << "Message" << message;
KNotification *notification = new KNotification(eventId);
notification->setComponentData(KComponentData("plasma_applet_netctl"));
@ -512,7 +512,7 @@ void Netctl::sendNotification(const QString eventId, const QString message)
void Netctl::showGui()
{
if (debug) qDebug() << "[PLASMOID]" << "[showGui]";
if (debug) qDebug() << PDEBUG;
sendNotification(QString("Info"), i18n("Start GUI"));
QProcess command;
@ -523,7 +523,7 @@ void Netctl::showGui()
void Netctl::showWifi()
{
if (debug) qDebug() << "[PLASMOID]" << "[showWifi]";
if (debug) qDebug() << PDEBUG;
sendNotification(QString("Info"), i18n("Start WiFi menu"));
QProcess command;
@ -535,7 +535,7 @@ void Netctl::showWifi()
// data engine interaction
void Netctl::connectToEngine()
{
if (debug) qDebug() << "[PLASMOID]" << "[connectToEngine]";
if (debug) qDebug() << PDEBUG;
netctlEngine->connectSource(QString("active"), this, autoUpdateInterval);
netctlEngine->connectSource(QString("current"), this, autoUpdateInterval);
@ -552,8 +552,8 @@ void Netctl::connectToEngine()
void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data)
{
if (debug) qDebug() << "[PLASMOID]" << "[dataUpdated]";
if (debug) qDebug() << "[PLASMOID]" << "[dataUpdated]" << ":" << "Source" << sourceName;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
if (isPopupShowing()) return;
if (isUserConfiguring()) return;
@ -601,7 +601,7 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
void Netctl::disconnectFromEngine()
{
if (debug) qDebug() << "[PLASMOID]" << "[disconnectFromEngine]";
if (debug) qDebug() << PDEBUG;
netctlEngine->disconnectSource(QString("currentProfile"), this);
netctlEngine->disconnectSource(QString("extIp4"), this);
@ -619,9 +619,9 @@ void Netctl::disconnectFromEngine()
QList<QVariant> Netctl::sendDBusRequest(const QString cmd, const QList<QVariant> args)
{
if (debug) qDebug() << "[PLASMOID]" << "[sendDBusRequest]";
if (debug) qDebug() << "[PLASMOID]" << "[sendDBusRequest]" << ":" << "cmd" << cmd;
if (debug) qDebug() << "[PLASMOID]" << "[sendDBusRequest]" << ":" << "args" << args;
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
QDBusConnection bus = QDBusConnection::systemBus();
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
@ -631,7 +631,7 @@ QList<QVariant> Netctl::sendDBusRequest(const QString cmd, const QList<QVariant>
QDBusMessage response = bus.call(request);
QList<QVariant> arguments = response.arguments();
if (arguments.size() == 0)
if (debug) qDebug() << "[PLASMOID]" << "[sendDBusRequest]" << ":" << "Error message" << response.errorMessage();
if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage();
return arguments;
}
@ -640,7 +640,7 @@ QList<QVariant> Netctl::sendDBusRequest(const QString cmd, const QList<QVariant>
// configuration interface
void Netctl::selectAbstractSomething()
{
if (debug) qDebug() << "[PLASMOID]" << "[selectAbstractSomething]";
if (debug) qDebug() << PDEBUG;
QString path = QString("/usr/bin");
QLineEdit *lineEdit = uiWidConfig.lineEdit_gui;
@ -678,7 +678,7 @@ void Netctl::selectAbstractSomething()
void Netctl::createConfigurationInterface(KConfigDialog *parent)
{
if (debug) qDebug() << "[PLASMOID]" << "[createConfigurationInterface]";
if (debug) qDebug() << PDEBUG;
QWidget *configWidget = new QWidget;
uiWidConfig.setupUi(configWidget);
@ -805,7 +805,7 @@ void Netctl::createConfigurationInterface(KConfigDialog *parent)
void Netctl::configAccepted()
{
if (debug) qDebug() << "[PLASMOID]" << "[configAccepted]";
if (debug) qDebug() << PDEBUG;
disconnectFromEngine();
KConfigGroup cg = config();
@ -865,7 +865,7 @@ void Netctl::configAccepted()
void Netctl::configChanged()
{
if (debug) qDebug() << "[PLASMOID]" << "[configChanged]";
if (debug) qDebug() << PDEBUG;
KConfigGroup cg = config();
@ -912,7 +912,7 @@ void Netctl::configChanged()
void Netctl::setBigInterface()
{
if (debug) qDebug() << "[PLASMOID]" << "[setBigInterface]";
if (debug) qDebug() << PDEBUG;
if (uiWidConfig.checkBox_showBigInterface->checkState() == 0)
uiWidConfig.textEdit->setDisabled(true);
@ -923,7 +923,7 @@ void Netctl::setBigInterface()
void Netctl::setDataEngineExternalIp4()
{
if (debug) qDebug() << "[PLASMOID]" << "[setDataEngineExternalIp4]";
if (debug) qDebug() << PDEBUG;
if (uiDEConfig.checkBox_extIp4->checkState() == 0) {
uiDEConfig.lineEdit_extIp4->setDisabled(true);
@ -937,7 +937,7 @@ void Netctl::setDataEngineExternalIp4()
void Netctl::setDataEngineExternalIp6()
{
if (debug) qDebug() << "[PLASMOID]" << "[setDataEngineExternalIp6]";
if (debug) qDebug() << PDEBUG;
if (uiDEConfig.checkBox_extIp6->checkState() == 0) {
uiDEConfig.lineEdit_extIp6->setDisabled(true);
@ -963,7 +963,7 @@ void Netctl::setHelper()
void Netctl::setSudo()
{
if (debug) qDebug() << "[PLASMOID]" << "[setSudo]";
if (debug) qDebug() << PDEBUG;
if (uiWidConfig.checkBox_sudo->checkState() == 0) {
uiWidConfig.lineEdit_sudo->setDisabled(true);
@ -977,7 +977,7 @@ void Netctl::setSudo()
void Netctl::setWifi()
{
if (debug) qDebug() << "[PLASMOID]" << "[setWifi]";
if (debug) qDebug() << PDEBUG;
if (uiWidConfig.checkBox_wifi->checkState() == 0) {
uiWidConfig.lineEdit_wifi->setDisabled(true);

1
sources/plasmoid/pdebug.h Symbolic link
View File

@ -0,0 +1 @@
../3rdparty/pdebug/pdebug.h