diff --git a/arch/PKGBUILD-kde4 b/arch/PKGBUILD-kde4 index e78a170..1c157cb 100644 --- a/arch/PKGBUILD-kde4 +++ b/arch/PKGBUILD-kde4 @@ -20,7 +20,7 @@ optdepends=("amarok: for music player monitor" makedepends=('automoc4' 'cmake') source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) install=${pkgname}.install -md5sums=('b9e77735ca866164395b2b9d4124e0ac') +md5sums=('acfaaec09f7b8544e8e844b26f763388') backup=('usr/share/config/plasma-dataengine-extsysmon.conf') prepare() { diff --git a/arch/PKGBUILD-kf5 b/arch/PKGBUILD-kf5 index c3dfe19..fe33efa 100644 --- a/arch/PKGBUILD-kf5 +++ b/arch/PKGBUILD-kf5 @@ -20,7 +20,7 @@ optdepends=("amarok: for music player monitor" makedepends=('cmake' 'extra-cmake-modules') source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz) install=${pkgname}.install -md5sums=('b9e77735ca866164395b2b9d4124e0ac') +md5sums=('acfaaec09f7b8544e8e844b26f763388') backup=('etc/xdg/plasma-dataengine-extsysmon.conf') prepare() { diff --git a/sources/awesome-widget-kf5/package/contents/config/main.xml b/sources/awesome-widget-kf5/package/contents/config/main.xml index e49a2bd..1bb2b8c 100644 --- a/sources/awesome-widget-kf5/package/contents/config/main.xml +++ b/sources/awesome-widget-kf5/package/contents/config/main.xml @@ -14,6 +14,9 @@ + + true + true diff --git a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml index 1c1890a..8d660d9 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/advanced.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/advanced.qml @@ -58,6 +58,7 @@ Item { "batInTooltipColor": plasmoid.configuration.batInTooltipColor } + property alias cfg_notify: notify.checked property alias cfg_background: background.checked property alias cfg_customTime: customTime.text property alias cfg_customUptime: customUptime.text @@ -69,6 +70,20 @@ Item { Column { id: pageColumn width: units.gridUnit * 25 + Row { + height: implicitHeight + width: parent.width + QtControls.Label { + height: parent.heigth + width: parent.width * 2 / 5 + } + QtControls.CheckBox { + id: notify + width: parent.width * 3 / 5 + text: i18n("Enable notifications") + } + } + Row { height: implicitHeight width: parent.width diff --git a/sources/awesome-widget-kf5/package/contents/ui/main.qml b/sources/awesome-widget-kf5/package/contents/ui/main.qml index dec3a8c..0bd1b04 100644 --- a/sources/awesome-widget-kf5/package/contents/ui/main.qml +++ b/sources/awesome-widget-kf5/package/contents/ui/main.qml @@ -179,7 +179,7 @@ Item { if (debug) console.log("[main::onUserConfiguringChanged]") // init submodule - AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings) + AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings, plasmoid.configuration.notify) } function action_checkUpdates() { diff --git a/sources/awesome-widget-kf5/plugin/awkeys.cpp b/sources/awesome-widget-kf5/plugin/awkeys.cpp index 8395f35..3920ced 100644 --- a/sources/awesome-widget-kf5/plugin/awkeys.cpp +++ b/sources/awesome-widget-kf5/plugin/awkeys.cpp @@ -84,7 +84,8 @@ AWKeys::~AWKeys() void AWKeys::initKeys(const QString pattern, - const QMap tooltipParams) + const QMap tooltipParams, + const bool popup) { if (debug) qDebug() << PDEBUG; @@ -107,6 +108,7 @@ void AWKeys::initKeys(const QString pattern, toolTip = new AWToolTip(this, tooltipParams); ready = true; + enablePopup = popup; } @@ -438,7 +440,8 @@ bool AWKeys::setDataBySource(const QString sourceName, for (int i=0; i= 90.0) && (values[QString("cpu")].toFloat() < 90.0)) + if ((enablePopup) && + ((data[QString("value")].toFloat() >= 90.0) && (values[QString("cpu")].toFloat() < 90.0))) AWActions::sendNotification(QString("event"), i18n("High CPU load")); // value values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); @@ -517,7 +521,8 @@ bool AWKeys::setDataBySource(const QString sourceName, mount.remove(QString("partitions")).remove(QString("/filllevel")); for (int i=0; i= 90.0) && (values[QString("hdd") + QString::number(i)].toFloat() < 90.0)) + if ((enablePopup) && + ((data[QString("value")].toFloat() >= 90.0) && (values[QString("hdd") + QString::number(i)].toFloat() < 90.0))) AWActions::sendNotification(QString("event"), i18n("Free space on %1 less than 10%", mount)); values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1); break; @@ -583,7 +588,7 @@ bool AWKeys::setDataBySource(const QString sourceName, // percentage float value = 100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat(); // notification - if ((value >= 90.0) && (values[QString("mem")].toFloat() < 90.0)) + if ((enablePopup) && ((value >= 90.0) && (values[QString("mem")].toFloat() < 90.0))) AWActions::sendNotification(QString("event"), i18n("High memory usage")); // value values[QString("mem")] = QString("%1").arg(value, 5, 'f', 1); @@ -591,7 +596,7 @@ bool AWKeys::setDataBySource(const QString sourceName, } else if (sourceName == QString("netdev")) { // network device // notification - if (values[QString("netdev")] != data[QString("value")].toString()) + if ((enablePopup) && (values[QString("netdev")] != data[QString("value")].toString())) AWActions::sendNotification(QString("event"), i18n("Network device has been changed to %1", data[QString("value")].toString())); // value @@ -656,7 +661,7 @@ bool AWKeys::setDataBySource(const QString sourceName, // percentage float value = 100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat(); // notification - if ((value > 0.0) && (values[QString("swap")].toFloat() == 0.0)) + if ((enablePopup) && ((value > 0.0) && (values[QString("swap")].toFloat() == 0.0))) AWActions::sendNotification(QString("event"), i18n("Swap is used")); // value values[QString("swap")] = QString("%1").arg(value, 5, 'f', 1); diff --git a/sources/awesome-widget-kf5/plugin/awkeys.h b/sources/awesome-widget-kf5/plugin/awkeys.h index 0835609..1989459 100644 --- a/sources/awesome-widget-kf5/plugin/awkeys.h +++ b/sources/awesome-widget-kf5/plugin/awkeys.h @@ -50,7 +50,8 @@ public: ~AWKeys(); Q_INVOKABLE void initKeys(const QString pattern, - const QMap tooltipParams); + const QMap tooltipParams, + const bool popup = false); Q_INVOKABLE bool isDebugEnabled(); Q_INVOKABLE QString parsePattern(const QString pattern); Q_INVOKABLE QString toolTipImage(); @@ -106,6 +107,7 @@ private: RequestedItem requestedItem = Nothing; // variables bool debug = false; + bool enablePopup = false; bool ready = false; QList graphicalItems; QList extScripts; diff --git a/sources/extsysmon/extsysmon.cpp b/sources/extsysmon/extsysmon.cpp index a1b54a5..25f0c22 100644 --- a/sources/extsysmon/extsysmon.cpp +++ b/sources/extsysmon/extsysmon.cpp @@ -694,7 +694,7 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source) } else if (source == QString("netdev")) { setData(source, QString("value"), getNetworkDevice()); } else if (source == QString("pkg")) { - if (pkgTimeUpdate > MSEC_IN_HOUR) { + if (pkgTimeUpdate > SEC_IN_HOUR) { for (int i=0; irun()); pkgTimeUpdate = 0; diff --git a/sources/extsysmon/extsysmon.h b/sources/extsysmon/extsysmon.h index 1cc2d94..ef4620c 100644 --- a/sources/extsysmon/extsysmon.h +++ b/sources/extsysmon/extsysmon.h @@ -18,9 +18,9 @@ #ifndef EXTSYSMON_H #define EXTSYSMON_H -#ifndef MSEC_IN_HOUR -#define MSEC_IN_HOUR 60*60*1000 -#endif /* MSEC_IN_HOUR */ +#ifndef SEC_IN_HOUR +#define SEC_IN_HOUR 60*60 +#endif /* SEC_IN_HOUR */ #include #include @@ -64,7 +64,7 @@ private: QList times; bool debug; // FIXME dirty hack to avoid update package information every second - int pkgTimeUpdate = MSEC_IN_HOUR; + int pkgTimeUpdate = SEC_IN_HOUR; // reread configuration QStringList allHddDevices; QString getAllHdd();