diff --git a/sources/awesome-widget/awesome-widget.cpp b/sources/awesome-widget/awesome-widget.cpp index 60e9e74..44326bb 100644 --- a/sources/awesome-widget/awesome-widget.cpp +++ b/sources/awesome-widget/awesome-widget.cpp @@ -83,9 +83,9 @@ void AwesomeWidget::createActions() connect(contextMenu[1], SIGNAL(triggered(bool)), this, SLOT(showReadme())); contextMenu.append(new QAction(QIcon::fromTheme(QString("stock-refresh")), i18n("Update text"), this)); + connect(contextMenu[2], SIGNAL(triggered(bool)), this, SLOT(updateNetworkDevice())); connect(contextMenu[2], SIGNAL(triggered(bool)), extsysmonEngine, SLOT(updateAllSources())); connect(contextMenu[2], SIGNAL(triggered(bool)), sysmonEngine, SLOT(updateAllSources())); - connect(contextMenu[2], SIGNAL(triggered(bool)), this, SLOT(updateNetworkDevice())); } diff --git a/sources/awesome-widget/awesome-widget.h b/sources/awesome-widget/awesome-widget.h index f256ea0..50c6e1f 100644 --- a/sources/awesome-widget/awesome-widget.h +++ b/sources/awesome-widget/awesome-widget.h @@ -65,7 +65,7 @@ public slots: void configChanged(); // update events void sendNotification(const QString eventId, const QString message); - void updateNetworkDevice(); + void updateNetworkDevice(const bool delay = true); void updateText(const bool clear = false); void updateTooltip(); diff --git a/sources/awesome-widget/deinteraction.cpp b/sources/awesome-widget/deinteraction.cpp index 4392c7c..4096087 100644 --- a/sources/awesome-widget/deinteraction.cpp +++ b/sources/awesome-widget/deinteraction.cpp @@ -340,12 +340,12 @@ void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEng tooltipValues[QString("down")].append(data[QString("value")].toFloat()); } networkDeviceUpdate++; - if (networkDeviceUpdate == 30) { + if (networkDeviceUpdate >= 30) { networkDeviceUpdate = 0; if (configuration[QString("useCustomNetdev")].toInt() == 2) { sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this); sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), this); - updateNetworkDevice(); + updateNetworkDevice(false); sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this, configuration[QString("interval")].toInt()); sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), diff --git a/sources/awesome-widget/reinit.cpp b/sources/awesome-widget/reinit.cpp index 47ececf..7e7be4f 100644 --- a/sources/awesome-widget/reinit.cpp +++ b/sources/awesome-widget/reinit.cpp @@ -43,7 +43,7 @@ void AwesomeWidget::reinit() keys = getKeys(); foundKeys = findKeys(); - updateNetworkDevice(); + updateNetworkDevice(false); connectToEngine(); } @@ -63,11 +63,14 @@ void AwesomeWidget::sendNotification(const QString eventId, const QString messag } -void AwesomeWidget::updateNetworkDevice() +void AwesomeWidget::updateNetworkDevice(const bool delay) { if (debug) qDebug() << PDEBUG; - values[QString("netdev")] = getNetworkDevice(); + if (delay) + networkDeviceUpdate = 30; + else + values[QString("netdev")] = getNetworkDevice(); }