mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 23:47:21 +00:00
all works normally
This commit is contained in:
parent
3f006d845b
commit
1b818dbd7b
@ -21,9 +21,11 @@
|
|||||||
#include <KConfigDialog>
|
#include <KConfigDialog>
|
||||||
#include <KNotification>
|
#include <KNotification>
|
||||||
#include <Plasma/DataEngine>
|
#include <Plasma/DataEngine>
|
||||||
#include <QGraphicsLinearLayout>
|
|
||||||
|
|
||||||
#include <plasma/theme.h>
|
#include <plasma/theme.h>
|
||||||
|
|
||||||
|
#include <QGraphicsLinearLayout>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +37,6 @@ Netctl::Netctl(QObject *parent, const QVariantList &args) :
|
|||||||
// text format init
|
// text format init
|
||||||
formatLine.append(QString(""));
|
formatLine.append(QString(""));
|
||||||
formatLine.append(QString(""));
|
formatLine.append(QString(""));
|
||||||
profileStatus = QString("N\\A");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,16 +69,22 @@ void Netctl::init()
|
|||||||
QGraphicsLinearLayout *textLayout = new QGraphicsLinearLayout();
|
QGraphicsLinearLayout *textLayout = new QGraphicsLinearLayout();
|
||||||
textLabel = new Plasma::Label();
|
textLabel = new Plasma::Label();
|
||||||
textLayout->addItem(textLabel);
|
textLayout->addItem(textLabel);
|
||||||
|
textFrame->setLayout(textLayout);
|
||||||
|
fullSpaceLayout->addItem(textFrame);
|
||||||
|
textFrame->hide();
|
||||||
|
// stretch
|
||||||
fullSpaceLayout->addStretch(1);
|
fullSpaceLayout->addStretch(1);
|
||||||
|
|
||||||
// read variables
|
// read variables
|
||||||
configChanged();
|
configChanged();
|
||||||
this->resize(150,64);
|
// this->resize(150,64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Netctl::showGui()
|
int Netctl::showGui()
|
||||||
{
|
{
|
||||||
|
QProcess command;
|
||||||
|
command.startDetached(guiPath);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +117,7 @@ void Netctl::connectToEngine()
|
|||||||
netctlEngine->connectSource(QString("intIp"), this, autoUpdateInterval);
|
netctlEngine->connectSource(QString("intIp"), this, autoUpdateInterval);
|
||||||
if (showNetDev)
|
if (showNetDev)
|
||||||
netctlEngine->connectSource(QString("interfaces"), this, autoUpdateInterval);
|
netctlEngine->connectSource(QString("interfaces"), this, autoUpdateInterval);
|
||||||
fullSpaceLayout->insertItem(1, textFrame);
|
textFrame->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,8 +136,9 @@ void Netctl::disconnectFromEngine()
|
|||||||
netctlEngine->disconnectSource(QString("intIp"), this);
|
netctlEngine->disconnectSource(QString("intIp"), this);
|
||||||
if (showNetDev)
|
if (showNetDev)
|
||||||
netctlEngine->disconnectSource(QString("interfaces"), this);
|
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(""))
|
if (value == QString(""))
|
||||||
value = QString("N\\A");
|
value = QString("N\\A");
|
||||||
profileName = value;
|
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("<br>")) + formatLine[1]);
|
||||||
}
|
}
|
||||||
else if (sourceName == QString("extIp")) {
|
else if (sourceName == QString("extIp")) {
|
||||||
if (value == QString(""))
|
if (value == QString(""))
|
||||||
|
Loading…
Reference in New Issue
Block a user