implement datetime logging feature

This commit is contained in:
arcan1s
2015-06-19 02:23:44 +03:00
parent 168a270c98
commit 7dc1a5eda3
11 changed files with 61 additions and 11 deletions

View File

@ -21,7 +21,8 @@ include_directories (${CMAKE_SOURCE_DIR}
${Qt_INCLUDE}
${Kf5_INCLUDE})
file (GLOB SUBPROJECT_SOURCE *.cpp)
file (GLOB_RECURSE SUBPROJECT_SOURCE ${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp
*.cpp)
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})

View File

@ -27,6 +27,7 @@
#include <QStandardPaths>
#include <pdebug/pdebug.h>
#include <pdebug/pdebug-time.h>
#include "netctladds.h"
#include "version.h"
@ -35,6 +36,7 @@
NetctlAdds::NetctlAdds(QObject *parent)
: QObject(parent)
{
qInstallMessageHandler(debugString);
// debug
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
@ -169,6 +171,13 @@ void NetctlAdds::setDataBySource(const QString sourceName, const QVariantMap dat
void NetctlAdds::sendNotification(const QString eventId, const QString message)
{
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
bool debugLocal = (debugEnv == QString("yes"));
if (debugLocal) qDebug() << PDEBUG;
if (debugLocal) qDebug() << PDEBUG << ":" << "Event" << eventId;
if (debugLocal) qDebug() << PDEBUG << ":" << "Message" << message;
KNotification *notification = KNotification::event(eventId, QString("Netctl ::: %1").arg(eventId), message);
notification->setComponentName(QString("plasma-applet-org.kde.plasma.netctl"));
}