From afed94745a540091fd03bfee2a1f5044142ffa82 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 29 Dec 2014 20:56:35 +0300 Subject: [PATCH] fix plugin --- sources/plasmoid/plugin/netctl.cpp | 10 ++---- sources/plasmoid/plugin/netctl.h | 1 - sources/plasmoid/plugin/netctladds.cpp | 42 ++++++++++++++++++++++++++ sources/plasmoid/plugin/netctladds.h | 39 ++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 sources/plasmoid/plugin/netctladds.cpp create mode 100644 sources/plasmoid/plugin/netctladds.h diff --git a/sources/plasmoid/plugin/netctl.cpp b/sources/plasmoid/plugin/netctl.cpp index 31d7886..d9668ef 100644 --- a/sources/plasmoid/plugin/netctl.cpp +++ b/sources/plasmoid/plugin/netctl.cpp @@ -20,21 +20,15 @@ #include #include "netctl.h" +#include "netctladds.h" #include "version.h" -QString NetctlPlugin::parsePattern(QString pattern, const QString key, const QString value) -{ -// if (debug) qDebug() << PDEBUG; - - return pattern.replace(QString("$") + key, value); -} - void NetctlPlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.netctl")); -// qmlRegisterType(uri, 1, 0, "ProcessRunner"); + qmlRegisterType(uri, 1, 0, "NetctlAdds"); // qmlRegisterType(uri, 1, 0, "TimeZoneModel"); // qmlRegisterSingletonType(uri, 1, 0, "TimezonesI18n", timezonesi18n_singletontype_provider); } diff --git a/sources/plasmoid/plugin/netctl.h b/sources/plasmoid/plugin/netctl.h index 4e4bd40..a77269e 100644 --- a/sources/plasmoid/plugin/netctl.h +++ b/sources/plasmoid/plugin/netctl.h @@ -31,7 +31,6 @@ class NetctlPlugin : public QQmlExtensionPlugin public: void registerTypes(const char *uri); - static QString parsePattern(QString pattern, const QString key, const QString value); }; diff --git a/sources/plasmoid/plugin/netctladds.cpp b/sources/plasmoid/plugin/netctladds.cpp new file mode 100644 index 0000000..8854263 --- /dev/null +++ b/sources/plasmoid/plugin/netctladds.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * This file is part of netctl-gui * + * * + * netctl-gui 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 3 of the * + * License, or (at your option) any later version. * + * * + * netctl-gui 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 netctl-gui. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +//#include + +#include "netctladds.h" +#include "version.h" + + +NetctlAdds::NetctlAdds(QObject *parent) + : QObject(parent) +{ +} + + +NetctlAdds::~NetctlAdds() +{ +// if (debug) qDebug() << PDEBUG; +} + + +QString NetctlAdds::parsePattern(QString pattern, const QString key, const QString value) +{ +// if (debug) qDebug() << PDEBUG; + + return pattern.replace(QString("$") + key, value); +} + diff --git a/sources/plasmoid/plugin/netctladds.h b/sources/plasmoid/plugin/netctladds.h new file mode 100644 index 0000000..ff341e7 --- /dev/null +++ b/sources/plasmoid/plugin/netctladds.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * This file is part of netctl-gui * + * * + * netctl-gui 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 3 of the * + * License, or (at your option) any later version. * + * * + * netctl-gui 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 netctl-gui. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + + +#ifndef NETCTLADDS_H +#define NETCTLADDS_H + +#include + + +class QQmlEngine; + +class NetctlAdds : public QObject +{ + Q_OBJECT + +public: + NetctlAdds(QObject *parent = 0); + ~NetctlAdds(); + + Q_INVOKABLE QString parsePattern(QString pattern, const QString key, const QString value); +}; + + +#endif /* NETCTLADDS_H */