From 1b818dbd7bb67a1e4bd6f6e9e68f537bfc469236 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Fri, 31 Jan 2014 19:40:14 +0400 Subject: [PATCH] all works normally --- sources/plasmoid/netctl.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/sources/plasmoid/netctl.cpp b/sources/plasmoid/netctl.cpp index a56679a..dc993ce 100644 --- a/sources/plasmoid/netctl.cpp +++ b/sources/plasmoid/netctl.cpp @@ -21,9 +21,11 @@ #include #include #include -#include - #include + +#include +#include + #include @@ -35,7 +37,6 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) : // text format init formatLine.append(QString("")); formatLine.append(QString("")); - profileStatus = QString("N\\A"); } @@ -68,16 +69,22 @@ void Netctl::init() QGraphicsLinearLayout *textLayout = new QGraphicsLinearLayout(); textLabel = new Plasma::Label(); textLayout->addItem(textLabel); + textFrame->setLayout(textLayout); + fullSpaceLayout->addItem(textFrame); + textFrame->hide(); + // stretch fullSpaceLayout->addStretch(1); // read variables configChanged(); - this->resize(150,64); +// this->resize(150,64); } int Netctl::showGui() { + QProcess command; + command.startDetached(guiPath); return 0; } @@ -110,7 +117,7 @@ void Netctl::connectToEngine() netctlEngine->connectSource(QString("intIp"), this, autoUpdateInterval); if (showNetDev) netctlEngine->connectSource(QString("interfaces"), this, autoUpdateInterval); - fullSpaceLayout->insertItem(1, textFrame); + textFrame->show(); } } @@ -129,8 +136,9 @@ void Netctl::disconnectFromEngine() netctlEngine->disconnectSource(QString("intIp"), this); if (showNetDev) netctlEngine->disconnectSource(QString("interfaces"), this); - fullSpaceLayout->removeItem(textFrame); + textFrame->hide(); } + update(); } @@ -144,6 +152,17 @@ void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da if (value == QString("")) value = QString("N\\A"); profileName = value; + + // update text + QStringList text; + text.append(profileName + QString(" ") + profileStatus); + if (showIntIp) + text.append(intIp); + if (showExtIp) + text.append(extIp); + if (showNetDev) + text.append(interfaces); + textLabel->setText(formatLine[0] + text.join(QString("
")) + formatLine[1]); } else if (sourceName == QString("extIp")) { if (value == QString(""))