mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
add roadmap to dataengine
This commit is contained in:
parent
3a0f0c252e
commit
7febf94233
@ -43,6 +43,8 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration();
|
||||
setProcesses();
|
||||
setKeys();
|
||||
}
|
||||
|
||||
|
||||
@ -63,6 +65,54 @@ QStringList Netctl::sources() const
|
||||
}
|
||||
|
||||
|
||||
void Netctl::initValues()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[initValues]";
|
||||
|
||||
netctlAutoStatus = false;
|
||||
QStringList sourcesList = sources();
|
||||
for (int i=0; i<sourcesList.count(); i++)
|
||||
sourceRequestEvent(sourcesList[i]);
|
||||
}
|
||||
|
||||
|
||||
void Netctl::setKeys()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[setKeys]";
|
||||
|
||||
QStringList sourcesList = sources();
|
||||
for (int i=0; i<sourcesList.count(); i++)
|
||||
setData(sourcesList[i], QString("value"), QString(""));
|
||||
|
||||
initValues();
|
||||
}
|
||||
|
||||
|
||||
void Netctl::setProcesses()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[setProcesses]";
|
||||
|
||||
processes[QString("currentProfile")] = new QProcess();
|
||||
connect(processes[QString("currentProfile")], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setCurrentProfile(int, QProcess::ExitStatus)));
|
||||
processes[QString("extIp")] = new QProcess();
|
||||
connect(processes[QString("extIp")], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setExtIp(int, QProcess::ExitStatus)));
|
||||
processes[QString("intIp")] = new QProcess();
|
||||
connect(processes[QString("intIp")], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setIntIp(int, QProcess::ExitStatus)));
|
||||
processes[QString("profiles")] = new QProcess();
|
||||
connect(processes[QString("profiles")], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setProfileList(int, QProcess::ExitStatus)));
|
||||
processes[QString("statusBool")] = new QProcess();
|
||||
connect(processes[QString("statusBool")], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setProfileStatus(int, QProcess::ExitStatus)));
|
||||
processes[QString("statusString")] = new QProcess();
|
||||
connect(processes[QString("statusString")], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setProfileStringStatus(int, QProcess::ExitStatus)));
|
||||
}
|
||||
|
||||
|
||||
void Netctl::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[readConfiguration]";
|
||||
|
@ -27,24 +27,39 @@ class Netctl : public Plasma::DataEngine
|
||||
|
||||
public:
|
||||
Netctl(QObject *parent, const QVariantList &args);
|
||||
QString getCurrentProfile(const QString cmd);
|
||||
QString getExtIp(const QString cmd);
|
||||
void getCurrentProfile(const QString cmd);
|
||||
void getExtIp(const QString cmd);
|
||||
QStringList getInterfaceList(const QString dir);
|
||||
QString getIntIp(const QString cmd, const QString dir);
|
||||
QStringList getProfileList(const QString cmd);
|
||||
bool getProfileStatus(const QString cmd);
|
||||
QString getProfileStringStatus(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
void getIntIp(const QString cmd, const QString dir);
|
||||
void getNetctlAutoStatus();
|
||||
void getProfileList(const QString cmd);
|
||||
void getProfileStatus(const QString cmd);
|
||||
void getProfileStringStatus(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &name);
|
||||
bool updateSourceEvent(const QString &source);
|
||||
QStringList sources() const;
|
||||
|
||||
private slots:
|
||||
void setCurrentProfile(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setExtIp(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setIntIp(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setNetctlAutoStatus(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setProfileList(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setProfileStatus(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setProfileStringStatus(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
bool isNetctlAutoRunning();
|
||||
// processes
|
||||
QMap<QString, QProcess *> processes;
|
||||
// configuration
|
||||
bool debug;
|
||||
bool netctlAutoStatus;
|
||||
QMap<QString, QString> configuration;
|
||||
void initValues();
|
||||
void setKeys();
|
||||
void setProcesses();
|
||||
void readConfiguration();
|
||||
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user