mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-06 02:25:46 +00:00
update netctlProfileInfo structure
This commit is contained in:
@ -40,14 +40,17 @@ class NetctlProfile;
|
||||
* profile name
|
||||
* @var netctlProfileInfo::description
|
||||
* profile description
|
||||
* @var netctlProfileInfo::status
|
||||
* @var netctlProfileInfo::active
|
||||
* profile status
|
||||
* @var netctlProfileInfo::enabled
|
||||
* profile status
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
QString status;
|
||||
bool active;
|
||||
bool enabled;
|
||||
} netctlProfileInfo;
|
||||
|
||||
/**
|
||||
|
@ -164,7 +164,8 @@ QList<netctlProfileInfo> Netctl::getProfileList()
|
||||
netctlProfileInfo profileInfo;
|
||||
profileInfo.name = output[i].mid(2, -1);
|
||||
profileInfo.description = getProfileDescription(profileInfo.name);
|
||||
profileInfo.status = getProfileStatus(profileInfo.name);
|
||||
profileInfo.active = isProfileActive(profileInfo.name);
|
||||
profileInfo.enabled = isProfileEnabled(profileInfo.name);
|
||||
fullProfilesInfo.append(profileInfo);
|
||||
}
|
||||
|
||||
@ -186,7 +187,8 @@ QList<netctlProfileInfo> Netctl::getProfileListFromNetctlAuto()
|
||||
netctlProfileInfo profileInfo;
|
||||
profileInfo.name = output[i].mid(2, -1);
|
||||
profileInfo.description = getProfileDescription(profileInfo.name);
|
||||
profileInfo.status = output[i].left(1);
|
||||
profileInfo.active = autoIsProfileActive(profileInfo.name);
|
||||
profileInfo.enabled = autoIsProfileEnabled(profileInfo.name);
|
||||
fullProfilesInfo.append(profileInfo);
|
||||
}
|
||||
|
||||
@ -272,7 +274,7 @@ bool Netctl::autoIsProfileActive(const QString profile)
|
||||
bool status = false;
|
||||
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
||||
for (int i=0; i<profiles.count(); i++)
|
||||
if ((profiles[i].name == profile) && (profiles[i].status == QString("*"))) {
|
||||
if ((profiles[i].name == profile) && (profiles[i].active)) {
|
||||
status = true;
|
||||
break;
|
||||
}
|
||||
@ -292,7 +294,7 @@ bool Netctl::autoIsProfileEnabled(const QString profile)
|
||||
bool status = true;
|
||||
QList<netctlProfileInfo> profiles = getProfileListFromNetctlAuto();
|
||||
for (int i=0; i<profiles.count(); i++)
|
||||
if ((profiles[i].name == profile) && (profiles[i].status == QString("!"))) {
|
||||
if ((profiles[i].name == profile) && (!profiles[i].enabled)) {
|
||||
status = false;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user