fix startprofileslot

This commit is contained in:
arcan1s 2014-08-15 20:46:18 +04:00
parent abbc5641cd
commit f238ba3a6a

View File

@ -138,9 +138,10 @@ bool MainWindow::startProfileSlot(const QString profile)
if (useHelper) { if (useHelper) {
QList<QVariant> args; QList<QVariant> args;
args.append(profile); args.append(profile);
if (sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH, QString currentProfile = sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_LIB_PATH,
DBUS_HELPER_INTERFACE, QString("ActiveProfile"), DBUS_HELPER_INTERFACE, QString("ActiveProfile"),
QList<QVariant>(), true, debug)[0].toString().isEmpty()) QList<QVariant>(), true, debug)[0].toString();
if ((currentProfile.isEmpty()) || (currentProfile == profile))
sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH, sendDBusRequest(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH,
DBUS_HELPER_INTERFACE, QString("Start"), DBUS_HELPER_INTERFACE, QString("Start"),
args, true, debug); args, true, debug);
@ -152,7 +153,8 @@ bool MainWindow::startProfileSlot(const QString profile)
DBUS_HELPER_INTERFACE, QString("isProfileActive"), DBUS_HELPER_INTERFACE, QString("isProfileActive"),
args, true, debug)[0].toBool(); args, true, debug)[0].toBool();
} else { } else {
if (netctlCommand->getActiveProfile().isEmpty()) QString currentProfile = netctlCommand->getActiveProfile();
if ((currentProfile.isEmpty()) || (currentProfile == profile))
netctlCommand->startProfile(profile); netctlCommand->startProfile(profile);
else else
netctlCommand->switchToProfile(profile); netctlCommand->switchToProfile(profile);