[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kcm-grub2] /: Unified password dialog on startup.
From:       Konstantinos Smanis <konstantinos.smanis () gmail ! com>
Date:       2013-10-22 20:55:58
Message-ID: E1VYize-0002Rf-ON () scm ! kde ! org
[Download RAW message or body]

Git commit 5bfc946b472261b9943085d9c2db0d6ac90452a7 by Konstantinos Smanis.
Committed on 22/10/2013 at 20:43.
Pushed by ksmanis into branch 'master'.

Unified password dialog on startup.

Ask for password only once (on startup), not every time a privileged
action is about to run.

Sacrifice fine-tuned privilege escalation for the sake of simplicity.
I doubt any administrator will actually notice, plus the users won't be
confused with all these password dialogs.

We'll see how this idea pans out.

M  +0    -7    config.h.cmake
M  +12   -1    src/common.h
M  +51   -43   src/helper/helper.cpp
M  +0    -1    src/helper/helper.h
M  +0    -73   src/helper/kcmgrub2.actions
M  +92   -95   src/kcm_grub2.cpp
M  +2    -8    src/kcm_grub2.h

http://commits.kde.org/kcm-grub2/5bfc946b472261b9943085d9c2db0d6ac90452a7

diff --git a/config.h.cmake b/config.h.cmake
index 5d57a67..2270142 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -18,11 +18,4 @@
 #define GRUB_ENV "@GRUB_ENV@"
 #define GRUB_MEMTEST "@GRUB_MEMTEST@"
 
-enum GrubFile {
-    GrubMenuFile,
-    GrubConfigurationFile,
-    GrubEnvironmentFile,
-    GrubMemtestFile
-};
-
 #endif
diff --git a/src/common.h b/src/common.h
index 100cefc..153d876 100644
--- a/src/common.h
+++ b/src/common.h
@@ -19,7 +19,18 @@
 #define COMMON_H
 
 //Qt
-class QString;
+#include <QFlags>
+
+enum LoadOperation {
+    NoOperation = 0x0,
+    MenuFile = 0x1,
+    ConfigurationFile = 0x2,
+    EnvironmentFile = 0x4,
+    MemtestFile = 0x8,
+    Vbe = 0x10
+};
+Q_DECLARE_FLAGS(LoadOperations, LoadOperation)
+Q_DECLARE_OPERATORS_FOR_FLAGS(LoadOperations)
 
 QString quoteWord(const QString &word);
 QString unquoteWord(const QString &word);
diff --git a/src/helper/helper.cpp b/src/helper/helper.cpp
index 5164db2..a40f879 100644
--- a/src/helper/helper.cpp
+++ b/src/helper/helper.cpp
@@ -32,6 +32,7 @@
 #include <KAuth/HelperSupport>
 
 //Project
+#include "../common.h"
 #include "../config.h"
 #if HAVE_HD
 #undef slots
@@ -123,57 +124,64 @@ ActionReply Helper::install(QVariantMap args)
 ActionReply Helper::load(QVariantMap args)
 {
     ActionReply reply;
-    QString fileName;
-    switch (args.value("grubFile").toInt()) {
-    case GrubMenuFile:
-        fileName = GRUB_MENU;
-        break;
-    case GrubConfigurationFile:
-        fileName = GRUB_CONFIG;
-        break;
-    case GrubEnvironmentFile:
-        fileName = GRUB_ENV;
-        break;
-    case GrubMemtestFile:
+    LoadOperations operations = (LoadOperations)(args.value("operations").toInt());
+
+    if (operations.testFlag(MenuFile)) {
+        QFile file(GRUB_MENU);
+        bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text);
+        reply.addData(QLatin1String("menuSuccess"), ok);
+        if (ok) {
+            reply.addData(QLatin1String("menuContents"), file.readAll());
+        } else {
+            reply.addData(QLatin1String("menuError"), file.error());
+            reply.addData(QLatin1String("menuErrorString"), file.errorString());
+        }
+    }
+    if (operations.testFlag(ConfigurationFile)) {
+        QFile file(GRUB_CONFIG);
+        bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text);
+        reply.addData(QLatin1String("configSuccess"), ok);
+        if (ok) {
+            reply.addData(QLatin1String("configContents"), file.readAll());
+        } else {
+            reply.addData(QLatin1String("configError"), file.error());
+            reply.addData(QLatin1String("configErrorString"), file.errorString());
+        }
+    }
+    if (operations.testFlag(EnvironmentFile)) {
+        QFile file(GRUB_ENV);
+        bool ok = file.open(QIODevice::ReadOnly | QIODevice::Text);
+        reply.addData(QLatin1String("envSuccess"), ok);
+        if (ok) {
+            reply.addData(QLatin1String("envContents"), file.readAll());
+        } else {
+            reply.addData(QLatin1String("envError"), file.error());
+            reply.addData(QLatin1String("envErrorString"), file.errorString());
+        }
+    }
+    if (operations.testFlag(MemtestFile)) {
         bool memtest = QFile::exists(GRUB_MEMTEST);
-        reply.addData("memtest", memtest);
+        reply.addData(QLatin1String("memtest"), memtest);
         if (memtest) {
-            reply.addData("memtestOn", (bool)(QFile::permissions(GRUB_MEMTEST) & \
(QFile::ExeOwner | QFile::ExeGroup | QFile::ExeOther))); +            \
reply.addData(QLatin1String("memtestOn"), (bool)(QFile::permissions(GRUB_MEMTEST) & \
(QFile::ExeOwner | QFile::ExeGroup | QFile::ExeOther)));  }
-        return reply;
-    }
-
-    QFile file(fileName);
-    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
-        reply = ActionReply::HelperErrorReply;
-        reply.addData("errorDescription", file.errorString());
-        return reply;
     }
-    reply.addData("rawFileContents", file.readAll());
-    return reply;
-}
-ActionReply Helper::probevbe(QVariantMap args)
-{
-    Q_UNUSED(args)
-    ActionReply reply;
-
 #if HAVE_HD
-    QStringList gfxmodes;
-    hd_data_t hd_data;
-    memset(&hd_data, 0, sizeof(hd_data));
-    hd_t *hd = hd_list(&hd_data, hw_framebuffer, 1, NULL);
-    for (hd_res_t *res = hd->res; res; res = res->next) {
-        if (res->any.type == res_framebuffer) {
-            gfxmodes += \
QString("%1x%2x%3").arg(QString::number(res->framebuffer.width), \
QString::number(res->framebuffer.height), \
QString::number(res->framebuffer.colorbits)); +    if (operations.testFlag(Vbe)) {
+        QStringList gfxmodes;
+        hd_data_t hd_data;
+        memset(&hd_data, 0, sizeof(hd_data));
+        hd_t *hd = hd_list(&hd_data, hw_framebuffer, 1, NULL);
+        for (hd_res_t *res = hd->res; res; res = res->next) {
+            if (res->any.type == res_framebuffer) {
+                gfxmodes += \
QString("%1x%2x%3").arg(QString::number(res->framebuffer.width), \
QString::number(res->framebuffer.height), \
QString::number(res->framebuffer.colorbits)); +            }
         }
+        hd_free_hd_list(hd);
+        hd_free_hd_data(&hd_data);
+        reply.addData("gfxmodes", gfxmodes);
     }
-    hd_free_hd_list(hd);
-    hd_free_hd_data(&hd_data);
-    reply.addData("gfxmodes", gfxmodes);
-#else
-    reply = ActionReply::HelperErrorReply;
 #endif
-
     return reply;
 }
 ActionReply Helper::save(QVariantMap args)
diff --git a/src/helper/helper.h b/src/helper/helper.h
index 2ede191..11e8935 100644
--- a/src/helper/helper.h
+++ b/src/helper/helper.h
@@ -33,7 +33,6 @@ public Q_SLOTS:
     ActionReply defaults(QVariantMap args);
     ActionReply install(QVariantMap args);
     ActionReply load(QVariantMap args);
-    ActionReply probevbe(QVariantMap args);
     ActionReply save(QVariantMap args);
 };
 
diff --git a/src/helper/kcmgrub2.actions b/src/helper/kcmgrub2.actions
index 839e524..2089070 100644
--- a/src/helper/kcmgrub2.actions
+++ b/src/helper/kcmgrub2.actions
@@ -259,79 +259,6 @@ Description[zh_TW]=載入 GRUB2 \
開機載入器設定需要管理者權限  Policy=auth_admin
 Persistence=session
 
-[org.kde.kcontrol.kcmgrub2.probevbe]
-Name=Probe VESA BIOS Extensions
-Name[bs]=Ispitaj VESA BIOS proširenja
-Name[ca]=Prova les extensions VESA del BIOS
-Name[ca@valencia]=Prova les extensions VESA del BIOS
-Name[cs]=Prozkoumat rozšířeni VESA BIOS (VBE)
-Name[da]=Søg efter VESA BIOS-udvidelser
-Name[de]=VESA-BIOS-Erweiterungen ermitteln
-Name[el]=Έλεγχος για VESA BIOS επεκτάσεις
-Name[es]=Examinar las extensiones BIOS de VESA
-Name[et]=VESA BIOS-e laiendite kontrollimine
-Name[fi]=Tunnustele VESA BIOS -laajennukset
-Name[fr]=Détecter les extensions    BIOS VESA   
-Name[ga]=Fiosraigh Eisínteachtaí BIOS VESA
-Name[gl]=Probar os engadidos VESA BIOS
-Name[hu]=VESA BIOS kiterjesztések vizsgálata
-Name[it]=Sonda le estensioni per il BIOS della VESA
-Name[lt]=Tikrinti VESA BIOS plėtinius
-Name[mr]=VESA BIOS विस्तारणे शोधा
-Name[nb]=Se etter VESA BIOS-utvidelser
-Name[nds]=VESA-BIOS-Verwiedern opdecken
-Name[nl]=VESA BIOS extensies aftasten
-Name[pa]=VESA BIOS ਇਕਸਟੈਨਸ਼ਨ ਲਈ ਪੜਤਾਲ
-Name[pl]=Wykryj rozszerzenia VESA BIOS
-Name[pt]=Testar as extensões da BIOS para o VESA
-Name[pt_BR]=Testar as extensões da BIOS para o VESA
-Name[ro]=Sondează extensiile BIOS  VESA
-Name[ru]=Проверка расширений BIOS в стандарте VESA (VBE)
-Name[sk]=Vyskúšať rozšírenia VESA BIOSu
-Name[sl]=Preizkusi razširitve VESA BIOS
-Name[sv]=Sök efter VESA BIOS-utökningar
-Name[tr]=VESA BIOS Uzantılarını Araştır
-Name[uk]=Виявлення розширень BIOS VESA
-Name[x-test]=xxProbe VESA BIOS Extensionsxx
-Name[zh_CN]=探测 VESA BIOS 扩展
-Name[zh_TW]=偵測 VESA BIOS 延伸
-Description=Administrator authorization is required to probe VESA BIOS Extensions
-Description[bs]=Administratorska potvrda je potrebna za testiranje VESA BIOS \
                proširenja
-Description[ca]=Es requereix autorització de l'administrador per a provar les \
                extensions VESA del BIOS
-Description[ca@valencia]=Es requereix autorització de l'administrador per a provar \
                les extensions VESA del BIOS
-Description[cs]=Pro prozkoumání rozšíření VESA BIOS (VBE) je potřeba \
                oprávnění administrátora
-Description[da]=Administrator-godkendelse kræves for at søge efter VESA \
                BIOS-udvidelser
-Description[de]=Zur Ermittlung der VESA-BIOS-Erweiterungen sind \
                Systemverwalterrechte erforderlich.
-Description[el]=Απαιτείται εξουσιοδότηση \
                διαχειριστή για τον έλεγχο VESA BIOS \
                επεκτάσεων
-Description[es]=Se requiere la autorización del administrador para examinar las \
                extensiones BIOS de VESA
-Description[et]=VESA BIOS-e laiendite kontrollimiseks on vajalik autentimine \
                administraatorina
-Description[fi]=VESA BIOS -laajennusten tunnusteleminen vaatii pääkäyttäjän \
                oikeudet
-Description[fr]=L'autorisation de l'administrateur est requise pour détecter les \
                extensions BIOS VESA
-Description[ga]=Is é riarthóir an chórais amháin atá  in ann Eisínteachtaí \
                BIOS VESA a fhiosrú
-Description[gl]=Precísase a autorización do administrador para probar os engadidos \
                VESA BIOS
-Description[hu]=Rendszergazdai jogosultságok szükségesek a VESA BIOS \
                kiterjesztések vizsgálatához
-Description[it]=Sono i richiesti i privilegi amministrativi per sondare le \
                estensioni per il BIOS della VESA
-Description[lt]=Administratoriaus įgaliojimas reikalingas, kad patikrinti VESA BIOS \
                plėtinius
-Description[mr]=VESA BIOS विस्तारणे \
शोधण्याकरिता व्यवस्थापकाची \
                परवानगी आवश्यक आहे
-Description[nb]=Det kreves autorisasjon som administrator for å søke etter VESA \
                BIOS-utvidcelser
-Description[nds]=De VESA-BIOS-Verwiedern laat sik bloots mit Systeempleger-Verlööf \
                opdecken.
-Description[nl]=Autorisatie van systeembeheerder is vereist om VESA BIOS extensies \
                af te tasten
-Description[pl]=Do wykrycia rozszerzeń VESA BIOS potrzebne są uprawnienia \
                administratora
-Description[pt]=É necessária a autorização do administrador para testar a \
                extensões da BIOS para o VESA
-Description[pt_BR]=É necessária a autorização do administrador para testar a \
                extensões da BIOS para o VESA
-Description[ro]=Este necesară autorizarea ca administrator pentru a sonda \
                extensiile BIOS  VESA
-Description[ru]=Для проверки расширений BIOS в \
стандарте VESA (VBE) необходимы права \
                администратора
-Description[sk]=Vyžaduje sa overenie administrátora na vyskúšanie rozšírení \
                VESA BIOSu
-Description[sl]=Za preizkus razširitev VESA BIOS GRUB2 je zahtevana pooblastitev \
                skrbnika
-Description[sv]=Administratörsbehörighet krävs för att söka efter VESA \
                BIOS-utökningar
-Description[tr]=VESA BIOS Uzantılarını araştırmak için yönetici \
                yetkilendirmesi gerekli
-Description[uk]=Для виявлення розширень BIOS VESA слід \
                набути прав доступу адміністратора
-Description[x-test]=xxAdministrator authorization is required to probe VESA BIOS \
                Extensionsxx
-Description[zh_CN]=探测 VESA BIOS 扩展需要管理员权限
-Description[zh_TW]=偵測 VESA BIOS 延伸需要管理者權限
-Policy=auth_admin
-Persistence=session
-
 [org.kde.kcontrol.kcmgrub2.save]
 Name=Save the GRUB2 Bootloader settings
 Name[bs]=Snimie postavke GRUB2 pokretača sistema
diff --git a/src/kcm_grub2.cpp b/src/kcm_grub2.cpp
index 1ed7e57..68a0ef9 100644
--- a/src/kcm_grub2.cpp
+++ b/src/kcm_grub2.cpp
@@ -32,13 +32,13 @@
 #include <KInputDialog>
 #include <KMenu>
 #include <KMessageBox>
-#include <kmountpoint.h>
 #include <KPluginFactory>
 #include <KProgressDialog>
 #include <KAuth/ActionWatcher>
 
 //Project
 #include "common.h"
+#include "config.h"
 #if HAVE_IMAGEMAGICK
 #include "convertDlg.h"
 #endif
@@ -93,13 +93,8 @@ void KCMGRUB2::defaults()
 }
 void KCMGRUB2::load()
 {
-    readEntries();
-    readSettings();
-    readEnv();
-    readMemtest();
-#if HAVE_HD
-    readResolutions();
-#endif
+    readAll();
+
     QString grubDefault = unquoteWord(m_settings.value("GRUB_DEFAULT"));
     if (grubDefault == QLatin1String("saved")) {
         grubDefault = (m_env.value("saved_entry").isEmpty() ? "0" : \
m_env.value("saved_entry")); @@ -927,107 +922,103 @@ void \
                KCMGRUB2::setupConnections()
     connect(ui->kpushbutton_install, SIGNAL(clicked(bool)), this, \
SLOT(slotInstallBootloader()));  }
 
-ActionReply KCMGRUB2::loadFile(GrubFile grubFile)
-{
-    Action loadAction("org.kde.kcontrol.kcmgrub2.load");
-    loadAction.setHelperID("org.kde.kcontrol.kcmgrub2");
-    loadAction.addArgument("grubFile", grubFile);
-#if KDE_IS_VERSION(4,6,0)
-    loadAction.setParentWidget(this);
-#endif
-
-    ActionReply reply = loadAction.execute();
-    processReply(reply);
-    return reply;
-}
-QString KCMGRUB2::readFile(GrubFile grubFile)
+bool KCMGRUB2::readFile(const QString &fileName, QByteArray &fileContents)
 {
-    QString fileName;
-    switch (grubFile) {
-    case GrubMenuFile:
-        fileName = GRUB_MENU;
-        break;
-    case GrubConfigurationFile:
-        fileName = GRUB_CONFIG;
-        break;
-    case GrubEnvironmentFile:
-        fileName = GRUB_ENV;
-        break;
-    case GrubMemtestFile:
-        return QString();
-    }
-
     QFile file(fileName);
-    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
-        QTextStream stream(&file);
-        return stream.readAll();
-    }
-
-    ActionReply reply = loadFile(grubFile);
-    if (reply.failed()) {
-        kError() << "Error loading:" << fileName;
-        kError() << "Error description:" << reply.errorDescription();
-        return QString();
+    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+        kDebug() << "Failed to read file:" << fileName;
+        kDebug() << "Error code:" << file.error();
+        kDebug() << "Error description:" << file.errorString();
+        kDebug() << "The helper will now attempt to read this file.";
+        return false;
     }
-    return QString::fromLocal8Bit(reply.data().value("rawFileContents").toByteArray());
                
-}
-void KCMGRUB2::readEntries()
-{
-    QString fileContents = readFile(GrubMenuFile);
-
-    m_entries.clear();
-    parseEntries(fileContents);
-}
-void KCMGRUB2::readSettings()
-{
-    QString fileContents = readFile(GrubConfigurationFile);
-
-    m_settings.clear();
-    parseSettings(fileContents);
+    fileContents = file.readAll();
+    return true;
 }
-void KCMGRUB2::readEnv()
+void KCMGRUB2::readAll()
 {
-    QString fileContents = readFile(GrubEnvironmentFile);
+    QByteArray fileContents;
+    LoadOperations operations = NoOperation;
 
-    m_env.clear();
-    parseEnv(fileContents);
-}
-void KCMGRUB2::readMemtest()
-{
-    bool memtest = QFile::exists(GRUB_MEMTEST);
-    if (memtest) {
+    if (readFile(GRUB_MENU, fileContents)) {
+        parseEntries(QString::fromUtf8(fileContents.constData()));
+    } else {
+        operations |= MenuFile;
+    }
+    if (readFile(GRUB_CONFIG, fileContents)) {
+        parseSettings(QString::fromUtf8(fileContents.constData()));
+    } else {
+        operations |= ConfigurationFile;
+    }
+    if (readFile(GRUB_ENV, fileContents)) {
+        parseEnv(QString::fromUtf8(fileContents.constData()));
+    } else {
+        operations |= EnvironmentFile;
+    }
+    if (QFile::exists(GRUB_MEMTEST)) {
         m_memtest = true;
         m_memtestOn = (bool)(QFile::permissions(GRUB_MEMTEST) & (QFile::ExeOwner | \
                QFile::ExeGroup | QFile::ExeOther));
-        return;
+    } else {
+        operations |= MemtestFile;
     }
+#if HAVE_HD
+    operations |= Vbe;
+#endif
 
-    ActionReply reply = loadFile(GrubMemtestFile);
-    if (reply.failed()) {
-        kError() << "Error loading:" << GRUB_MEMTEST;
-        kError() << "Error description:" << reply.errorDescription();
-        return;
-    }
-    m_memtest = reply.data().value("memtest").toBool();
-    if (m_memtest) {
-        m_memtestOn = reply.data().value("memtestOn").toBool();
-    }
-}
-void KCMGRUB2::readResolutions()
-{
-    Action probeVbeAction("org.kde.kcontrol.kcmgrub2.probevbe");
-    probeVbeAction.setHelperID("org.kde.kcontrol.kcmgrub2");
+    if (operations) {
+        Action loadAction("org.kde.kcontrol.kcmgrub2.load");
+        loadAction.setHelperID("org.kde.kcontrol.kcmgrub2");
+        loadAction.addArgument("operations", (int)(operations));
 #if KDE_IS_VERSION(4,6,0)
-    probeVbeAction.setParentWidget(this);
+        loadAction.setParentWidget(this);
 #endif
 
-    ActionReply reply = probeVbeAction.execute();
-    processReply(reply);
-    if (reply.failed()) {
-        return;
-    }
+        ActionReply reply = loadAction.execute();
+        processReply(reply);
+        if (reply.failed()) {
+            kError() << "KAuth error!";
+            kError() << "Error code:" << reply.errorCode();
+            kError() << "Error description:" << reply.errorDescription();
+            return;
+        }
 
-    m_resolutions.clear();
-    m_resolutions = reply.data().value("gfxmodes").toStringList();
+        if (operations.testFlag(MenuFile)) {
+            if (reply.data().value(QLatin1String("menuSuccess")).toBool()) {
+                parseEntries(QString::fromUtf8(reply.data().value(QLatin1String("menuContents")).toByteArray().constData()));
 +            } else {
+                kError() << "Helper failed to read file:" << GRUB_MENU;
+                kError() << "Error code:" << \
reply.data().value(QLatin1String("menuError")).toInt(); +                kError() << \
"Error description:" << \
reply.data().value(QLatin1String("menuErrorString")).toString(); +            }
+        }
+        if (operations.testFlag(ConfigurationFile)) {
+            if (reply.data().value(QLatin1String("configSuccess")).toBool()) {
+                parseSettings(QString::fromUtf8(reply.data().value(QLatin1String("configContents")).toByteArray().constData()));
 +            } else {
+                kError() << "Helper failed to read file:" << GRUB_CONFIG;
+                kError() << "Error code:" << \
reply.data().value(QLatin1String("configError")).toInt(); +                kError() \
<< "Error description:" << \
reply.data().value(QLatin1String("configErrorString")).toString(); +            }
+        }
+        if (operations.testFlag(EnvironmentFile)) {
+            if (reply.data().value(QLatin1String("envSuccess")).toBool()) {
+                parseEnv(QString::fromUtf8(reply.data().value(QLatin1String("envContents")).toByteArray().constData()));
 +            } else {
+                kError() << "Helper failed to read file:" << GRUB_ENV;
+                kError() << "Error code:" << \
reply.data().value(QLatin1String("envError")).toInt(); +                kError() << \
"Error description:" << \
reply.data().value(QLatin1String("envErrorString")).toString(); +            }
+        }
+        if (operations.testFlag(MemtestFile)) {
+            m_memtest = reply.data().value(QLatin1String("memtest")).toBool();
+            if (m_memtest) {
+                m_memtestOn = \
reply.data().value(QLatin1String("memtestOn")).toBool(); +            }
+        }
+        if (operations.testFlag(Vbe)) {
+            m_resolutions = \
reply.data().value(QLatin1String("gfxmodes")).toStringList(); +        }
+    }
 }
 
 void KCMGRUB2::sortResolutions()
@@ -1150,6 +1141,8 @@ void KCMGRUB2::parseEntries(const QString &config)
     QList<Entry::Title> submenus;
     QString word, configStr = config;
     QTextStream stream(&configStr, QIODevice::ReadOnly | QIODevice::Text);
+
+    m_entries.clear();
     while (!stream.atEnd()) {
         //Read the first word of the line
         stream >> word;
@@ -1215,6 +1208,8 @@ void KCMGRUB2::parseSettings(const QString &config)
 {
     QString line, configStr = config;
     QTextStream stream(&configStr, QIODevice::ReadOnly | QIODevice::Text);
+
+    m_settings.clear();
     while (!stream.atEnd()) {
         line = stream.readLine().trimmed();
         if (line.startsWith(QLatin1String("GRUB_"))) {
@@ -1226,6 +1221,8 @@ void KCMGRUB2::parseEnv(const QString &config)
 {
     QString line, configStr = config;
     QTextStream stream(&configStr, QIODevice::ReadOnly | QIODevice::Text);
+
+    m_env.clear();
     while (!stream.atEnd()) {
         line = stream.readLine().trimmed();
         if (line.startsWith('#')) {
diff --git a/src/kcm_grub2.h b/src/kcm_grub2.h
index 886a826..014847f 100644
--- a/src/kcm_grub2.h
+++ b/src/kcm_grub2.h
@@ -30,7 +30,6 @@ namespace KAuth
 using namespace KAuth;
 
 //Project
-#include "config.h"
 class Entry;
 
 //Ui
@@ -85,13 +84,8 @@ private:
     void setupObjects();
     void setupConnections();
 
-    ActionReply loadFile(GrubFile grubFile);
-    QString readFile(GrubFile grubFile);
-    void readEntries();
-    void readSettings();
-    void readEnv();
-    void readMemtest();
-    void readResolutions();
+    bool readFile(const QString &fileName, QByteArray &fileContents);
+    void readAll();
 
     void sortResolutions();
     void showResolutions();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic