From 31f52e5d22e52b3a1bcc2cb91a26ea2427bf1927 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Thu, 17 Jul 2014 19:36:15 +0400 Subject: [PATCH] small fixes --- sources/gui/src/wirelesswidget.cpp | 1 + sources/netctlgui/src/netctlinteract.cpp | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sources/gui/src/wirelesswidget.cpp b/sources/gui/src/wirelesswidget.cpp index f1a31ec..0a6bf85 100644 --- a/sources/gui/src/wirelesswidget.cpp +++ b/sources/gui/src/wirelesswidget.cpp @@ -63,6 +63,7 @@ void WirelessWidget::clear() ui->comboBox_drivers->setCurrentIndex(0); ui->listWidget_drivers->setCurrentRow(-1); ui->listWidget_drivers->clear(); + ui->comboBox_rfkill->clear(); ui->comboBox_rfkill->addItem(QString("auto")); if (rfkillDirectory->exists()) { QStringList rfkillDevices = rfkillDirectory->entryList(QDir::Dirs | QDir::NoDotAndDotDot); diff --git a/sources/netctlgui/src/netctlinteract.cpp b/sources/netctlgui/src/netctlinteract.cpp index d902076..731f9ff 100644 --- a/sources/netctlgui/src/netctlinteract.cpp +++ b/sources/netctlgui/src/netctlinteract.cpp @@ -323,31 +323,32 @@ QList Netctl::getProfileListFromNetctlAuto() /** * @fn getProfileDescription */ -QString Netctl::getProfileDescription(const QString profileName) +QString Netctl::getProfileDescription(const QString profile) { if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]"; - if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]" << ":" << "Profile" << profileName; + if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]" << ":" << "Profile" << profile; if (profileDirectory == 0) { if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]" << ":" << "Could not find directory"; return QString(); } QString description = QString(""); - QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + profileName; + QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + profile; if (debug) qDebug() << "[Netctl]" << "[getProfileDescription]" << ":" << "Check" << profileUrl; - QFile profile(profileUrl); + QFile profileFile(profileUrl); QString fileStr; - if (!profile.open(QIODevice::ReadOnly)) + if (!profileFile.open(QIODevice::ReadOnly)) return description; while (true) { - fileStr = QString(profile.readLine()); + fileStr = QString(profileFile.readLine()); if (fileStr[0] == QChar('#')) continue; if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2) if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("Description")) description = fileStr.split(QChar('='), QString::SkipEmptyParts)[1].trimmed(); - if (profile.atEnd()) + if (profileFile.atEnd()) break; } + profileFile.close(); description.remove(QChar('\'')).remove(QChar('"')); return description; @@ -371,21 +372,22 @@ QStringList Netctl::getProfileDescriptions(const QStringList profileList) QString description = QString(""); QString profileUrl = profileDirectory->absolutePath() + QDir::separator() + profileList[i]; if (debug) qDebug() << "[Netctl]" << "[getProfileDescriptions]" << ":" << "Check" << profileUrl; - QFile profile(profileUrl); + QFile profileFile(profileUrl); QString fileStr; - if (!profile.open(QIODevice::ReadOnly)) { + if (!profileFile.open(QIODevice::ReadOnly)) { descriptions.append(description); continue; } while (true) { - fileStr = QString(profile.readLine()); + fileStr = QString(profileFile.readLine()); if (fileStr[0] == QChar('#')) continue; if (fileStr.split(QChar('='), QString::SkipEmptyParts).count() == 2) if (fileStr.split(QChar('='), QString::SkipEmptyParts)[0] == QString("Description")) description = fileStr.split(QChar('='), QString::SkipEmptyParts)[1].trimmed(); - if (profile.atEnd()) + if (profileFile.atEnd()) break; } + profileFile.close(); description.remove(QChar('\'')).remove(QChar('"')); descriptions.append(description); }