Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git cmake/modules/MacroLogFeature.cmake cmake/modules/MacroLogFeature.cmake
- index 45e27b6..631c7ac 100644
- --- cmake/modules/MacroLogFeature.cmake
- +++ cmake/modules/MacroLogFeature.cmake
- @@ -7,7 +7,7 @@
- # FEATURE: name of the feature, e.g. "libjpeg"
- # DESCRIPTION: description what this feature provides
- # URL: home page
- -# REQUIRED: TRUE or FALSE, indicating whether the featue is required
- +# REQUIRED: TRUE or FALSE, indicating whether the feature is required
- # MIN_VERSION: minimum version number. empty string if unneeded
- # COMMENTS: More info you may want to provide. empty string if unnecessary
- #
- diff --git format_sources format_sources
- new file mode 100644
- index 0000000..4416b43
- --- /dev/null
- +++ format_sources
- @@ -0,0 +1 @@
- +*.cpp *.cc *.h : astyle --indent=spaces=4 --brackets=linux --indent-labels --pad-oper --unpad-paren --pad-header --keep-one-line-statements --convert-tabs --indent-preprocessor $TMPFILE
- diff --git other/kcm_grub2.desktop other/kcm_grub2.desktop
- index f4c3e5f..e1f6d5d 100644
- --- other/kcm_grub2.desktop
- +++ other/kcm_grub2.desktop
- @@ -31,6 +31,7 @@ Name[pl]=Program rozruchowy GRUB2
- Name[pt]=Gestor de Arranque GRUB2
- Name[pt_BR]=Gerenciador de Inicialização GRUB2
- Name[ru]=Загрузчик GRUB2
- +Name[sk]=Bootloader GRUB2
- Name[sv]=GRUB2 startprogram
- Name[uk]=Завантажувач GRUB2
- Name[x-test]=xxGRUB2 Bootloaderxx
- @@ -39,17 +40,24 @@ Name[zh_TW]=GRUB2 開機載入器
- Comment=Customize the GRUB2 bootloader
- Comment[ca]=Personalitza el gestor d'arrencada Grub2
- Comment[cs]=Upravit zavaděč GRUB2
- +Comment[da]=Tilpas GRUB2-bootloaderen
- +Comment[de]=GRUB2-Bootloader einrichten
- Comment[el]=Προσαρμογή του προγράμματος εκκίνησης GRUB2
- Comment[es]=Personalizar el cargador de arranque de GRUB2
- +Comment[et]=GRUB2 alglaaduri kohandamine
- +Comment[fr]=Personnalise le chargeur d'amorçage GRUB2
- Comment[ga]=Saincheap luchtóir tosaithe GRUB2
- Comment[hu]=A GRUB2 rendszerbetöltő testreszabása
- Comment[it]=Configura il bootloader GRUB2
- +Comment[nb]=Tilpass GRUB2 oppstartslaster
- Comment[nds]=Systeemstarter Grub2 topassen
- Comment[nl]=De GRUB2-bootloader aanpassen
- Comment[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਨੂੰ ਕਸਟਮਾਈਜ਼ ਕਰੋ
- +Comment[pl]=Dostosuj program rozruchowy GRUB2
- Comment[pt]=Personalizar o gestor de arranque GRUB2
- Comment[pt_BR]=Personalize o gerenciador de inicialização GRUB2
- Comment[ru]=Настройка загрузчика GRUB2
- +Comment[sk]=Prispôsobiť bootloader GRUB2
- Comment[sv]=Anpassa GRUB2 startprogram
- Comment[uk]=Налаштування завантажувача GRUB2
- Comment[x-test]=xxCustomize the GRUB2 bootloaderxx
- @@ -60,10 +68,13 @@ X-KDE-Keywords[da]=grub,boot,menu,indgange,standard,timeout,tidsudløb,adgangsko
- X-KDE-Keywords[el]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader
- X-KDE-Keywords[es]=grub,arranque,menú,entradas,predeterminado,tiempo,contraseña,color,splash,imagen,cargador de arranque
- X-KDE-Keywords[et]=grub,alglaadimine,buutimine,kirjed,vaikimisi,aegumine,parool,värv,tiitelkuva,pilt,alglaadur
- +X-KDE-Keywords[fr]=grub,amorçage,menu,entrées,par défaut,temps imparti,mot de passe,couleur,écran d'accueil,image,chargeur d'amorçage
- X-KDE-Keywords[ga]=grub,tosaigh,tosú,roghchlár,iontrálacha,réamhshocrú,teorainn ama,focal faire,dath,splancscáileán,íomhá,luchtóir tosaithe
- X-KDE-Keywords[hu]=grub,betöltés,menü,bejegyzések,alapértelmezett,időtúllépés,jelszó,szín,indítóképernyő,kép,rendszerbetöltő
- X-KDE-Keywords[it]=grub,boot,menu,voci,predefinito,scadenza,password,colore,splash,immagine,bootloader
- +X-KDE-Keywords[nb]=grub,oppstart,meny,oppføringer,standard,tidsavbrudd,passord,farge,velkomst,bilde,oppstartslaster
- X-KDE-Keywords[nl]=grub,boot,menu,items,standaard,timeout,wachtwoord,kleur,splash,afbeelding,bootloader
- +X-KDE-Keywords[pl]=grub,uruchamianie,menu,wpisy,domyślne,czas oczekiwania,hasło,kolor,ekran powitalny,obraz,bootloader
- X-KDE-Keywords[pt]=grub,arranque,menu,itens,predefinido,tempo-limite,senha,cor,ecrã inicial,imagem,gestor de arranque
- X-KDE-Keywords[pt_BR]=grub,inicialização,menu,entradas,padrão,tempo de espera,senha,boot,cor,splash,imagem,carregador de inicialização
- X-KDE-Keywords[ru]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader,загрузка,загрузчик,пароль,меню,ядра,образ,приветствие,цвета,время ожидания
- diff --git src/helper/helper.cpp src/helper/helper.cpp
- index 801fc65..39b7ddd 100644
- --- src/helper/helper.cpp
- +++ src/helper/helper.cpp
- @@ -15,19 +15,23 @@
- * with this program. If not, see <http://www.gnu.org/licenses/>. *
- *******************************************************************************/
- +//Krazy
- +//krazy:excludeall=cpp
- +
- //Own
- #include "helper.h"
- //Qt
- -#include <QtCore/QDir>
- -#include <QtCore/QTextCodec>
- -#include <QtCore/QTextStream>
- +#include <QDir>
- +#include <QTextCodec>
- +#include <QTextStream>
- //KDE
- +#include <KDebug>
- +#include <kdeversion.h>
- #include <KGlobal>
- #include <KLocale>
- #include <KProcess>
- -#include <KShell>
- #include <KAuth/HelperSupport>
- //Project
- @@ -40,14 +44,91 @@
- Helper::Helper()
- {
- KGlobal::locale()->insertCatalog("kcm-grub2");
- + //TODO: system encoding should be sent from the core application
- QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
- }
- +ActionReply Helper::executeCommand(const QStringList &command)
- +{
- + ActionReply reply;
- + reply.addData("command", command);
- +
- + KProcess process;
- + process.setProgram(command);
- + process.setOutputChannelMode(KProcess::MergedChannels);
- +
- + kDebug() << "Executing" << command.join(" ");
- + int exitCode = process.execute();
- + reply.addData("exitCode", exitCode);
- + QString output = QString::fromUtf8(process.readAll());
- + reply.addData("output", output);
- +
- + if (exitCode == 0) {
- + return reply;
- + }
- +
- + QString errorMessage;
- + switch (exitCode) {
- + case -2:
- + errorMessage = i18nc("@info", "The process could not be started.");
- + break;
- + case -1:
- + errorMessage = i18nc("@info", "The process crashed.");
- + break;
- + default:
- + errorMessage = output;
- + break;
- + }
- + QString errorDescription = i18nc("@info", "Command: <command>%1</command><nl/>Error code: <numid>%2</numid><nl/>Error message:<nl/><message>%3</message>", command.join(" "), exitCode, errorMessage);
- +
- + reply = ActionReply::HelperErrorReply;
- + reply.setErrorCode(exitCode);
- + reply.addData("errorMessage", errorMessage);
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(errorDescription);
- +#else
- + reply.addData("errorDescription", errorDescription);
- +#endif
- + return reply;
- +}
- +
- ActionReply Helper::defaults(QVariantMap args)
- {
- + ActionReply reply;
- QString configFileName = args.value("configFileName").toString();
- QString originalConfigFileName = configFileName + ".original";
- - return (QFile::exists(originalConfigFileName) && QFile::remove(configFileName) && QFile::copy(originalConfigFileName, configFileName) ? ActionReply::SuccessReply : ActionReply::HelperErrorReply);
- +
- + if (!QFile::exists(originalConfigFileName)) {
- + reply = ActionReply::HelperErrorReply;
- + QString errorDescription = i18nc("@info", "Original configuration file <filename>%1</filename> does not exist.", originalConfigFileName);
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(errorDescription);
- +#else
- + reply.addData("errorDescription", errorDescription);
- +#endif
- + return reply;
- + }
- + if (!QFile::remove(configFileName)) {
- + reply = ActionReply::HelperErrorReply;
- + QString errorDescription = i18nc("@info", "Cannot remove current configuration file <filename>%1</filename>.", configFileName);
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(errorDescription);
- +#else
- + reply.addData("errorDescription", errorDescription);
- +#endif
- + return reply;
- + }
- + if (!QFile::copy(originalConfigFileName, configFileName)) {
- + reply = ActionReply::HelperErrorReply;
- + QString errorDescription = i18nc("@info", "Cannot copy original configuration file <filename>%1</filename> to <filename>%2</filename>.", originalConfigFileName, configFileName);
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(errorDescription);
- +#else
- + reply.addData("errorDescription", errorDescription);
- +#endif
- + return reply;
- + }
- + return reply;
- }
- ActionReply Helper::install(QVariantMap args)
- {
- @@ -55,36 +136,34 @@ ActionReply Helper::install(QVariantMap args)
- QString installExePath = args.value("installExePath").toString();
- QString partition = args.value("partition").toString();
- QString mountPoint = args.value("mountPoint").toString();
- + bool mbrInstall = args.value("mbrInstall").toBool();
- if (mountPoint.isEmpty()) {
- for (int i = 0; QDir(mountPoint = QString("%1/kcm-grub2-%2").arg(QDir::tempPath(), QString::number(i))).exists(); i++);
- - if (QDir().mkpath(mountPoint)) {
- - KProcess mount;
- - mount.setShellCommand(QString("mount %1 %2").arg(KShell::quoteArg(partition), KShell::quoteArg(mountPoint)));
- - mount.setOutputChannelMode(KProcess::MergedChannels);
- - if (mount.execute() != 0) {
- - reply = ActionReply::HelperErrorReply;
- - reply.addData("output", mount.readAll());
- - return reply;
- - }
- - } else {
- + if (!QDir().mkpath(mountPoint)) {
- reply = ActionReply::HelperErrorReply;
- - reply.addData("output", i18nc("@info", "Failed to create temporary mount point."));
- + QString errorDescription = i18nc("@info", "Failed to create temporary mount point.");
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(errorDescription);
- +#else
- + reply.addData("errorDescription", errorDescription);
- +#endif
- return reply;
- }
- + ActionReply mountReply = executeCommand(QStringList() << "mount" << partition << mountPoint);
- + if (mountReply.failed()) {
- + return mountReply;
- + }
- }
- - KProcess grub_install;
- - grub_install.setShellCommand(QString("%1 --root-directory=%2 %3").arg(installExePath, KShell::quoteArg(mountPoint), KShell::quoteArg(partition.remove(QRegExp("\\d+")))));
- - grub_install.setOutputChannelMode(KProcess::MergedChannels);
- - if (grub_install.execute() != 0) {
- - reply = ActionReply::HelperErrorReply;
- - reply.addData("output", grub_install.readAll());
- - return reply;
- + QStringList grub_installCommand;
- + grub_installCommand << installExePath << "--root-directory" << mountPoint;
- + if (mbrInstall) {
- + grub_installCommand << partition.remove(QRegExp("\\d+"));
- + } else {
- + grub_installCommand << "--force" << partition;
- }
- -
- - reply.addData("output", grub_install.readAll());
- - return reply;
- + return executeCommand(grub_installCommand);
- }
- ActionReply Helper::load(QVariantMap args)
- {
- @@ -94,12 +173,15 @@ ActionReply Helper::load(QVariantMap args)
- QFile file(fileName);
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- reply = ActionReply::HelperErrorReply;
- - reply.addData("output", file.errorString());
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(file.errorString());
- +#else
- + reply.addData("errorDescription", file.errorString());
- +#endif
- return reply;
- }
- QTextStream stream(&file);
- - stream.setCodec("UTF-8");
- reply.addData("fileContents", stream.readAll());
- return reply;
- }
- @@ -109,18 +191,14 @@ ActionReply Helper::probe(QVariantMap args)
- QString probeExePath = args.value("probeExePath").toString();
- QStringList mountPoints = args.value("mountPoints").toStringList();
- - KProcess grub_probe;
- QStringList grubPartitions;
- HelperSupport::progressStep(0);
- for (int i = 0; i < mountPoints.size(); i++) {
- - grub_probe.setShellCommand(QString("%1 -t drive %2").arg(probeExePath, KShell::quoteArg(mountPoints.at(i))));
- - grub_probe.setOutputChannelMode(KProcess::MergedChannels);
- - if (grub_probe.execute() != 0) {
- - reply = ActionReply::HelperErrorReply;
- - reply.addData("output", grub_probe.readAll());
- - return reply;
- + ActionReply grub_probeReply = executeCommand(QStringList() << probeExePath << "-t" << "drive" << mountPoints.at(i));
- + if (grub_probeReply.failed()) {
- + return grub_probeReply;
- }
- - grubPartitions.append(grub_probe.readAll().trimmed());
- + grubPartitions.append(grub_probeReply.data().value("output").toString().trimmed());
- HelperSupport::progressStep((i + 1) * 100. / mountPoints.size());
- }
- @@ -167,16 +245,18 @@ ActionReply Helper::save(QVariantMap args)
- QFile::copy(configFileName, configFileName + ".original");
- QFile file(configFileName);
- - if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- - QTextStream stream(&file);
- - stream.setCodec("UTF-8");
- - stream << configFileContents;
- - file.close();
- - } else {
- + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- reply = ActionReply::HelperErrorReply;
- - reply.addData("output", file.errorString());
- +#if KDE_IS_VERSION(4,7,0)
- + reply.setErrorDescription(file.errorString());
- +#else
- + reply.addData("errorDescription", file.errorString());
- +#endif
- return reply;
- }
- + QTextStream stream(&file);
- + stream << configFileContents;
- + file.close();
- if (args.contains("memtest")) {
- QFile::Permissions permissions = QFile::permissions(memtestFileName);
- @@ -188,26 +268,17 @@ ActionReply Helper::save(QVariantMap args)
- QFile::setPermissions(memtestFileName, permissions);
- }
- - KProcess grub_mkconfig;
- - grub_mkconfig.setShellCommand(QString("%1 -o %2").arg(mkconfigExePath, KShell::quoteArg(menuFileName)));
- - grub_mkconfig.setOutputChannelMode(KProcess::MergedChannels);
- - if (grub_mkconfig.execute() != 0) {
- - reply = ActionReply::HelperErrorReply;
- - reply.addData("output", grub_mkconfig.readAll());
- - return reply;
- + ActionReply grub_mkconfigReply = executeCommand(QStringList() << mkconfigExePath << "-o" << menuFileName);
- + if (grub_mkconfigReply.failed()) {
- + return grub_mkconfigReply;
- }
- - KProcess grub_set_default;
- - grub_set_default.setShellCommand(QString("%1 %2").arg(set_defaultExePath, defaultEntry));
- - grub_set_default.setOutputChannelMode(KProcess::MergedChannels);
- - if (grub_set_default.execute() != 0) {
- - reply = ActionReply::HelperErrorReply;
- - reply.addData("output", grub_set_default.readAll());
- - return reply;
- + ActionReply grub_set_defaultReply = executeCommand(QStringList() << set_defaultExePath << defaultEntry);
- + if (grub_set_defaultReply.failed()) {
- + return grub_set_defaultReply;
- }
- - reply.addData("output", grub_mkconfig.readAll());
- - return reply;
- + return grub_mkconfigReply;
- }
- KDE4_AUTH_HELPER_MAIN("org.kde.kcontrol.kcmgrub2", Helper)
- diff --git src/helper/helper.h src/helper/helper.h
- index 3530574..82bbed4 100644
- --- src/helper/helper.h
- +++ src/helper/helper.h
- @@ -27,6 +27,8 @@ class Helper : public QObject
- Q_OBJECT
- public:
- Helper();
- +private:
- + ActionReply executeCommand(const QStringList &command);
- public Q_SLOTS:
- ActionReply defaults(QVariantMap args);
- ActionReply install(QVariantMap args);
- diff --git src/helper/kcmgrub2.actions src/helper/kcmgrub2.actions
- index ae836da..b27b102 100644
- --- src/helper/kcmgrub2.actions
- +++ src/helper/kcmgrub2.actions
- @@ -21,6 +21,7 @@ Name[pl]=Moduł sterowania dla programu rozruchowego GRUB2
- Name[pt]=Módulo de Controlo do Gestor de Arranque GRUB2
- Name[pt_BR]=Módulo de Controle do Gerenciador de Inicialização GRUB2
- Name[ru]=Модуль настройки загрузчика GRUB2
- +Name[sk]=Ovládací modul bootloadera GRUB2
- Name[sv]=Inställningsmodul för GRUB2 startprogram
- Name[uk]=Модуль керування завантажувачем GRUB2
- Name[x-test]=xxGRUB2 Bootloader Control Modulexx
- @@ -107,6 +108,7 @@ Name[pl]=Zainstaluj program rozruchowy GRUB2
- Name[pt]=Instalar o Gestor de Arranque GRUB2
- Name[pt_BR]=Instalar o gerenciador de inicialização GRUB2
- Name[ru]=Установка загрузчика GRUB2
- +Name[sk]=Inštalovať bootloader GRUB2
- Name[sv]=Installera GRUB2 startprogram
- Name[uk]=Встановлення завантажувача GRUB2
- Name[x-test]=xxInstall the GRUB2 Bootloaderxx
- @@ -163,6 +165,7 @@ Name[pl]=Wczytaj ustawienia programu rozruchowego GRUB2
- Name[pt]=Carregar a configuração do gestor de arranque GRUB2
- Name[pt_BR]=Carregar a configuração do gerenciador de inicialização GRUB2
- Name[ru]=Считывание параметров загрузчика GRUB2
- +Name[sk]=Načítať nastavenia bootloadera GRUB2
- Name[sv]=Läs in inställningar för GRUB2 startprogram
- Name[uk]=Завантаження параметрів завантажувача GRUB2
- Name[x-test]=xxLoad the GRUB2 Bootloader settingsxx
- @@ -326,6 +329,7 @@ Name[pl]=Zapisz ustawienia programu rozruchowego GRUB2
- Name[pt]=Gravar a configuração do gestor de arranque do GRUB2
- Name[pt_BR]=Salvar a configuração do gerenciador de inicialização do GRUB2
- Name[ru]=Сохранение параметров загрузчика GRUB2
- +Name[sk]=Uložiť nastavenia bootloadera GRUB2
- Name[sv]=Spara GRUB2 startprogrammets inställningar
- Name[uk]=Збереження параметрів завантажувача GRUB2
- Name[x-test]=xxSave the GRUB2 Bootloader settingsxx
- diff --git src/installDlg.cpp src/installDlg.cpp
- index 7ce43c8..6325105 100644
- --- src/installDlg.cpp
- +++ src/installDlg.cpp
- @@ -19,8 +19,8 @@
- #include "installDlg.h"
- //Qt
- -#include <QtCore/QFile>
- -#include <QtGui/QRadioButton>
- +#include <QFile>
- +#include <QRadioButton>
- //KDE
- #include <kdeversion.h>
- @@ -64,7 +64,7 @@ InstallDialog::InstallDialog(const QString installExePath, QWidget *parent, Qt::
- QString uuidDir = "/dev/disk/by-uuid/", uuid = volume->uuid(), name;
- name = (QFile::exists((name = uuidDir + uuid)) || QFile::exists((name = uuidDir + uuid.toLower())) || QFile::exists((name = uuidDir + uuid.toUpper())) ? QFile::symLinkTarget(name) : QString());
- - QTreeWidgetItem *item = new QTreeWidgetItem(ui.treeWidget_recover, QStringList(QString()) << name << partition->filePath() << volume->label() << volume->fsType() << KGlobal::locale()->formatByteSize(volume->size()));
- + QTreeWidgetItem *item = new QTreeWidgetItem(ui.treeWidget_recover, QStringList() << QString() << name << partition->filePath() << volume->label() << volume->fsType() << KGlobal::locale()->formatByteSize(volume->size()));
- item->setIcon(1, KIcon(device.icon()));
- item->setTextAlignment(5, Qt::AlignRight | Qt::AlignVCenter);
- ui.treeWidget_recover->addTopLevelItem(item);
- @@ -85,6 +85,7 @@ void InstallDialog::slotButtonClicked(int button)
- installAction.addArgument("installExePath", m_installExePath);
- installAction.addArgument("partition", ui.treeWidget_recover->topLevelItem(i)->text(1));
- installAction.addArgument("mountPoint", ui.treeWidget_recover->topLevelItem(i)->text(2));
- + installAction.addArgument("mbrInstall", !ui.checkBox_partition->isChecked());
- break;
- }
- }
- @@ -118,12 +119,7 @@ void InstallDialog::slotButtonClicked(int button)
- dialog->setEscapeButton(KDialog::Ok);
- KMessageBox::createKMessageBox(dialog, QMessageBox::Information, i18nc("@info", "Successfully installed GRUB."), QStringList(), QString(), 0, KMessageBox::Notify, reply.data().value("output").toString()); // krazy:exclude=qclasses
- } else {
- - QString output = reply.data().value("output").toString();
- - if (output.isEmpty()) {
- - KMessageBox::error(this, i18nc("@info", "Failed to install GRUB."));
- - } else {
- - KMessageBox::detailedError(this, i18nc("@info", "Failed to install GRUB."), output);
- - }
- + KMessageBox::detailedError(this, i18nc("@info", "Failed to install GRUB."), KDE_IS_VERSION(4,7,0) ? reply.errorDescription() : reply.data().value("errorDescription").toString());
- }
- }
- KDialog::slotButtonClicked(button);
- diff --git src/kcm_grub2.cpp src/kcm_grub2.cpp
- index 9501374..223fb2b 100644
- --- src/kcm_grub2.cpp
- +++ src/kcm_grub2.cpp
- @@ -15,11 +15,14 @@
- * with this program. If not, see <http://www.gnu.org/licenses/>. *
- *******************************************************************************/
- +//Krazy
- +//krazy:excludeall=cpp
- +
- //Own
- #include "kcm_grub2.h"
- //Qt
- -#include <QtGui/QDesktopWidget>
- +#include <QDesktopWidget>
- //KDE
- #include <KAboutData>
- @@ -51,6 +54,9 @@ K_EXPORT_PLUGIN(GRUB2Factory("kcmgrub2"))
- KCMGRUB2::KCMGRUB2(QWidget *parent, const QVariantList &list) : KCModule(GRUB2Factory::componentData(), parent, list)
- {
- + //Isn't KAboutData's second argument supposed to do this?
- + KGlobal::locale()->insertCatalog("kcm-grub2");
- +
- KAboutData *about = new KAboutData("kcmgrub2", "kcm-grub2", ki18nc("@title", "KDE GRUB2 Bootloader Control Module"), KCM_GRUB2_VERSION, ki18nc("@title", "A KDE Control Module for configuring the GRUB2 bootloader."), KAboutData::License_GPL_V3, ki18nc("@info:credit", "Copyright (C) 2008-2012 Konstantinos Smanis"), KLocalizedString(), "http://ksmanis.wordpress.com/projects/grub2-editor/");
- about->addAuthor(ki18nc("@info:credit", "Κonstantinos Smanis"), ki18nc("@info:credit", "Main Developer"), "konstantinos.smanis@gmail.com", "http://ksmanis.wordpress.com/");
- setAboutData(about);
- @@ -78,7 +84,7 @@ void KCMGRUB2::defaults()
- save();
- KMessageBox::information(this, i18nc("@info", "Successfully restored the default values."));
- } else {
- - KMessageBox::error(this, i18nc("@info", "Failed to restore the default values."));
- + KMessageBox::detailedError(this, i18nc("@info", "Failed to restore the default values."), KDE_IS_VERSION(4,7,0) ? reply.errorDescription() : reply.data().value("errorDescription").toString());
- }
- }
- void KCMGRUB2::load()
- @@ -403,7 +409,7 @@ void KCMGRUB2::save()
- saveAction.addArgument("configFileName", configPath);
- saveAction.addArgument("configFileContents", configFileContents);
- saveAction.addArgument("menuFileName", menuPath);
- - saveAction.addArgument("defaultEntry", m_entries.size() > 0 ? m_entries.at(ui.kcombobox_default->currentIndex()) : m_settings.value("GRUB_DEFAULT"));
- + saveAction.addArgument("defaultEntry", m_entries.size() > 0 ? ui.kcombobox_default->currentText() : m_settings.value("GRUB_DEFAULT"));
- if (m_dirtyBits.testBit(memtestDirty)) {
- saveAction.addArgument("memtestFileName", memtestPath);
- saveAction.addArgument("memtest", ui.checkBox_memtest->isChecked());
- @@ -435,7 +441,7 @@ void KCMGRUB2::save()
- KMessageBox::createKMessageBox(dialog, QMessageBox::Information, i18nc("@info", "Successfully saved GRUB settings."), QStringList(), QString(), 0, KMessageBox::Notify, reply.data().value("output").toString()); // krazy:exclude=qclasses
- load();
- } else {
- - KMessageBox::detailedError(this, i18nc("@info", "Failed to save GRUB settings."), reply.data().value("output").toString());
- + KMessageBox::detailedError(this, i18nc("@info", "Failed to save GRUB settings."), KDE_IS_VERSION(4,7,0) ? reply.errorDescription() : reply.data().value("errorDescription").toString());
- }
- }
- @@ -490,8 +496,9 @@ void KCMGRUB2::slotGrubDisableOsProberChanged()
- }
- void KCMGRUB2::slotInstallBootloader()
- {
- - InstallDialog installDlg(installExePath, this);
- - installDlg.exec();
- + QPointer<InstallDialog> installDlg = new InstallDialog(installExePath, this);
- + installDlg->exec();
- + delete installDlg;
- }
- void KCMGRUB2::slotGrubGfxmodeChanged()
- {
- @@ -855,12 +862,29 @@ void KCMGRUB2::setupConnections()
- connect(ui.kpushbutton_install, SIGNAL(clicked(bool)), this, SLOT(slotInstallBootloader()));
- }
- +QString KCMGRUB2::findExe(const QString &exeName)
- +{
- + QString exePath = KStandardDirs::findExe(exeName);
- + if (!exePath.isEmpty()) {
- + return exePath;
- + }
- + KProcess whereis;
- + whereis << "whereis" << "-b" << exeName;
- + whereis.setOutputChannelMode(KProcess::OnlyStdoutChannel);
- + if (whereis.execute() == 0) {
- + QString output = whereis.readAllStandardOutput();
- + if (output.startsWith(exeName + ':')) {
- + return output.mid(exeName.length() + 1).trimmed();
- + }
- + }
- + return QString();
- +}
- bool KCMGRUB2::check()
- {
- - installExePath = KStandardDirs::findExe("grub-install");
- - mkconfigExePath = KStandardDirs::findExe("grub-mkconfig");
- - probeExePath = KStandardDirs::findExe("grub-probe");
- - set_defaultExePath = KStandardDirs::findExe("grub-set-default");
- + installExePath = findExe("grub-install");
- + mkconfigExePath = findExe("grub-mkconfig");
- + probeExePath = findExe("grub-probe");
- + set_defaultExePath = findExe("grub-set-default");
- if (!installExePath.isEmpty() && !mkconfigExePath.isEmpty() && !probeExePath.isEmpty() && !set_defaultExePath.isEmpty()) {
- kDebug() << "GRUB2 installation detected!";
- menuPath = "/boot/grub/grub.cfg";
- @@ -869,10 +893,10 @@ bool KCMGRUB2::check()
- memtestPath = "/etc/grub.d/20_memtest86+";
- return true;
- }
- - installExePath = KStandardDirs::findExe("grub2-install");
- - mkconfigExePath = KStandardDirs::findExe("grub2-mkconfig");
- - probeExePath = KStandardDirs::findExe("grub2-probe");
- - set_defaultExePath = KStandardDirs::findExe("grub2-set-default");
- + installExePath = findExe("grub2-install");
- + mkconfigExePath = findExe("grub2-mkconfig");
- + probeExePath = findExe("grub2-probe");
- + set_defaultExePath = findExe("grub2-set-default");
- if (!installExePath.isEmpty() && !mkconfigExePath.isEmpty() && !probeExePath.isEmpty() && !set_defaultExePath.isEmpty()) {
- kDebug() << "GRUB2 (RPM) installation detected!";
- menuPath = "/boot/grub2/grub.cfg";
- @@ -881,10 +905,10 @@ bool KCMGRUB2::check()
- memtestPath = "/etc/grub.d/20_memtest86+";
- return true;
- }
- - installExePath = KStandardDirs::findExe("burg-install");
- - mkconfigExePath = KStandardDirs::findExe("burg-mkconfig");
- - probeExePath = KStandardDirs::findExe("burg-probe");
- - set_defaultExePath = KStandardDirs::findExe("burg-set-default");
- + installExePath = findExe("burg-install");
- + mkconfigExePath = findExe("burg-mkconfig");
- + probeExePath = findExe("burg-probe");
- + set_defaultExePath = findExe("burg-set-default");
- if (!installExePath.isEmpty() && !mkconfigExePath.isEmpty() && !probeExePath.isEmpty() && !set_defaultExePath.isEmpty()) {
- kDebug() << "BURG installation detected!";
- menuPath = "/boot/burg/burg.cfg";
- @@ -943,7 +967,7 @@ QString KCMGRUB2::readFile(const QString &fileName)
- ActionReply reply = loadAction.execute();
- if (reply.failed()) {
- kError() << "Error reading:" << fileName;
- - kError() << "Error description:" << reply.data().value("output").toString();
- + kError() << "Error description:" << (KDE_IS_VERSION(4,7,0) ? reply.errorDescription() : reply.data().value("errorDescription").toString());
- return QString();
- }
- return reply.data().value("fileContents").toString();
- @@ -998,7 +1022,7 @@ void KCMGRUB2::readDevices()
- ActionReply reply = probeAction.execute();
- if (reply.failed()) {
- - KMessageBox::error(this, i18nc("@info", "Failed to get GRUB device names."));
- + KMessageBox::detailedError(this, i18nc("@info", "Failed to get GRUB device names."), KDE_IS_VERSION(4,7,0) ? reply.errorDescription() : reply.data().value("errorDescription").toString());
- return;
- }
- QStringList grubPartitions = reply.data().value("grubPartitions").toStringList();
- diff --git src/kcm_grub2.h src/kcm_grub2.h
- index 16cebec..6f4d2b7 100644
- --- src/kcm_grub2.h
- +++ src/kcm_grub2.h
- @@ -19,7 +19,7 @@
- #define KCMGRUB2_H
- //Qt
- -#include <QtCore/QBitArray>
- +#include <QBitArray>
- //KDE
- #include <KCModule>
- @@ -70,6 +70,7 @@ private:
- void setupObjects();
- void setupConnections();
- + QString findExe(const QString &exeName);
- bool check();
- //TODO: Maybe remove?
- diff --git src/qPkBackend.cpp src/qPkBackend.cpp
- index 414a197..72e0bfc 100644
- --- src/qPkBackend.cpp
- +++ src/qPkBackend.cpp
- @@ -25,118 +25,118 @@
- static QString statusToString(PackageKit::Enum::Status status)
- {
- switch (status) {
- - case PackageKit::Enum::LastStatus :
- - case PackageKit::Enum::UnknownStatus :
- + case PackageKit::Enum::LastStatus:
- + case PackageKit::Enum::UnknownStatus:
- return i18nc("This is when the transaction status is not known",
- - "Unknown state");
- - case PackageKit::Enum::StatusSetup :
- + "Unknown state");
- + case PackageKit::Enum::StatusSetup:
- return i18nc("transaction state, the daemon is in the process of starting",
- - "Waiting for service to start");
- - case PackageKit::Enum::StatusWait :
- + "Waiting for service to start");
- + case PackageKit::Enum::StatusWait:
- return i18nc("transaction state, the transaction is waiting for another to complete",
- - "Waiting for other tasks");
- - case PackageKit::Enum::StatusRunning :
- + "Waiting for other tasks");
- + case PackageKit::Enum::StatusRunning:
- return i18nc("transaction state, just started",
- - "Running task");
- - case PackageKit::Enum::StatusQuery :
- + "Running task");
- + case PackageKit::Enum::StatusQuery:
- return i18nc("transaction state, is querying data",
- - "Querying");
- - case PackageKit::Enum::StatusInfo :
- + "Querying");
- + case PackageKit::Enum::StatusInfo:
- return i18nc("transaction state, getting data from a server",
- - "Getting information");
- - case PackageKit::Enum::StatusRemove :
- + "Getting information");
- + case PackageKit::Enum::StatusRemove:
- return i18nc("transaction state, removing packages",
- - "Removing packages");
- - case PackageKit::Enum::StatusDownload :
- + "Removing packages");
- + case PackageKit::Enum::StatusDownload:
- return i18nc("transaction state, downloading package files",
- - "Downloading packages");
- - case PackageKit::Enum::StatusInstall :
- + "Downloading packages");
- + case PackageKit::Enum::StatusInstall:
- return i18nc("transaction state, installing packages",
- - "Installing packages");
- - case PackageKit::Enum::StatusRefreshCache :
- + "Installing packages");
- + case PackageKit::Enum::StatusRefreshCache:
- return i18nc("transaction state, refreshing internal lists",
- - "Refreshing software list");
- - case PackageKit::Enum::StatusUpdate :
- + "Refreshing software list");
- + case PackageKit::Enum::StatusUpdate:
- return i18nc("transaction state, installing updates",
- - "Updating packages");
- - case PackageKit::Enum::StatusCleanup :
- + "Updating packages");
- + case PackageKit::Enum::StatusCleanup:
- return i18nc("transaction state, removing old packages, and cleaning config files",
- - "Cleaning up packages");
- - case PackageKit::Enum::StatusObsolete :
- + "Cleaning up packages");
- + case PackageKit::Enum::StatusObsolete:
- return i18nc("transaction state, obsoleting old packages",
- - "Obsoleting packages");
- - case PackageKit::Enum::StatusDepResolve :
- + "Obsoleting packages");
- + case PackageKit::Enum::StatusDepResolve:
- return i18nc("transaction state, checking the transaction before we do it",
- - "Resolving dependencies");
- - case PackageKit::Enum::StatusSigCheck :
- + "Resolving dependencies");
- + case PackageKit::Enum::StatusSigCheck:
- return i18nc("transaction state, checking if we have all the security keys for the operation",
- - "Checking signatures");
- - case PackageKit::Enum::StatusRollback :
- + "Checking signatures");
- + case PackageKit::Enum::StatusRollback:
- return i18nc("transaction state, when we return to a previous system state",
- - "Rolling back");
- - case PackageKit::Enum::StatusTestCommit :
- + "Rolling back");
- + case PackageKit::Enum::StatusTestCommit:
- return i18nc("transaction state, when we're doing a test transaction",
- - "Testing changes");
- - case PackageKit::Enum::StatusCommit :
- + "Testing changes");
- + case PackageKit::Enum::StatusCommit:
- return i18nc("transaction state, when we're writing to the system package database",
- - "Committing changes");
- - case PackageKit::Enum::StatusRequest :
- + "Committing changes");
- + case PackageKit::Enum::StatusRequest:
- return i18nc("transaction state, requesting data from a server",
- - "Requesting data");
- - case PackageKit::Enum::StatusFinished :
- + "Requesting data");
- + case PackageKit::Enum::StatusFinished:
- return i18nc("transaction state, all done!",
- - "Finished");
- - case PackageKit::Enum::StatusCancel :
- + "Finished");
- + case PackageKit::Enum::StatusCancel:
- return i18nc("transaction state, in the process of cancelling",
- - "Cancelling");
- - case PackageKit::Enum::StatusDownloadRepository :
- + "Cancelling");
- + case PackageKit::Enum::StatusDownloadRepository:
- return i18nc("transaction state, downloading metadata",
- - "Downloading repository information");
- - case PackageKit::Enum::StatusDownloadPackagelist :
- + "Downloading repository information");
- + case PackageKit::Enum::StatusDownloadPackagelist:
- return i18nc("transaction state, downloading metadata",
- - "Downloading list of packages");
- - case PackageKit::Enum::StatusDownloadFilelist :
- + "Downloading list of packages");
- + case PackageKit::Enum::StatusDownloadFilelist:
- return i18nc("transaction state, downloading metadata",
- - "Downloading file lists");
- - case PackageKit::Enum::StatusDownloadChangelog :
- + "Downloading file lists");
- + case PackageKit::Enum::StatusDownloadChangelog:
- return i18nc("transaction state, downloading metadata",
- - "Downloading lists of changes");
- - case PackageKit::Enum::StatusDownloadGroup :
- + "Downloading lists of changes");
- + case PackageKit::Enum::StatusDownloadGroup:
- return i18nc("transaction state, downloading metadata",
- - "Downloading groups");
- - case PackageKit::Enum::StatusDownloadUpdateinfo :
- + "Downloading groups");
- + case PackageKit::Enum::StatusDownloadUpdateinfo:
- return i18nc("transaction state, downloading metadata",
- - "Downloading update information");
- - case PackageKit::Enum::StatusRepackaging :
- + "Downloading update information");
- + case PackageKit::Enum::StatusRepackaging:
- return i18nc("transaction state, repackaging delta files",
- - "Repackaging files");
- - case PackageKit::Enum::StatusLoadingCache :
- + "Repackaging files");
- + case PackageKit::Enum::StatusLoadingCache:
- return i18nc("transaction state, loading databases",
- - "Loading cache");
- - case PackageKit::Enum::StatusScanApplications :
- + "Loading cache");
- + case PackageKit::Enum::StatusScanApplications:
- return i18nc("transaction state, scanning for running processes",
- - "Scanning installed applications");
- - case PackageKit::Enum::StatusGeneratePackageList :
- + "Scanning installed applications");
- + case PackageKit::Enum::StatusGeneratePackageList:
- return i18nc("transaction state, generating a list of packages installed on the system",
- - "Generating package lists");
- - case PackageKit::Enum::StatusWaitingForLock :
- + "Generating package lists");
- + case PackageKit::Enum::StatusWaitingForLock:
- return i18nc("transaction state, when we're waiting for the native tools to exit",
- - "Waiting for package manager lock");
- - case PackageKit::Enum::StatusWaitingForAuth :
- + "Waiting for package manager lock");
- + case PackageKit::Enum::StatusWaitingForAuth:
- return i18nc("waiting for user to type in a password",
- - "Waiting for authentication");
- - case PackageKit::Enum::StatusScanProcessList :
- + "Waiting for authentication");
- + case PackageKit::Enum::StatusScanProcessList:
- return i18nc("we are updating the list of processes",
- - "Updating the list of running applications");
- - case PackageKit::Enum::StatusCheckExecutableFiles :
- + "Updating the list of running applications");
- + case PackageKit::Enum::StatusCheckExecutableFiles:
- return i18nc("we are checking executable files in use",
- - "Checking for applications currently in use");
- - case PackageKit::Enum::StatusCheckLibraries :
- + "Checking for applications currently in use");
- + case PackageKit::Enum::StatusCheckLibraries:
- return i18nc("we are checking for libraries in use",
- - "Checking for libraries currently in use");
- - case PackageKit::Enum::StatusCopyFiles :
- + "Checking for libraries currently in use");
- + case PackageKit::Enum::StatusCopyFiles:
- return i18nc("we are copying package files to prepare to install",
- - "Copying files");
- + "Copying files");
- }
- return QString();
- }
- diff --git src/qPkBackend.h src/qPkBackend.h
- index a08b0a4..d6c8c0f 100644
- --- src/qPkBackend.h
- +++ src/qPkBackend.h
- @@ -19,7 +19,7 @@
- #define QPKBACKEND_H
- //Qt
- -#include <QtCore/QStringList>
- +#include <QStringList>
- //QPackageKit
- #include <QPackageKit>
- diff --git src/qaptBackend.cpp src/qaptBackend.cpp
- index d84905c..4ae499b 100644
- --- src/qaptBackend.cpp
- +++ src/qaptBackend.cpp
- @@ -19,7 +19,7 @@
- #include "qaptBackend.h"
- //Qt
- -#include <QtCore/QEventLoop>
- +#include <QEventLoop>
- QAptBackend::QAptBackend(QObject *parent): QObject(parent)
- {
- diff --git src/qaptBackend.h src/qaptBackend.h
- index ed47b65..65ff5cf 100644
- --- src/qaptBackend.h
- +++ src/qaptBackend.h
- @@ -19,7 +19,7 @@
- #define QAPTBACKEND_H
- //Qt
- -#include <QtCore/QStringList>
- +#include <QStringList>
- //QApt
- #include <libqapt/backend.h>
- diff --git src/removeDlg.cpp src/removeDlg.cpp
- index 31a862d..76e35b8 100644
- --- src/removeDlg.cpp
- +++ src/removeDlg.cpp
- @@ -15,13 +15,16 @@
- * with this program. If not, see <http://www.gnu.org/licenses/>. *
- *******************************************************************************/
- +//Krazy
- +//krazy:excludeall=cpp
- +
- //Own
- #include "removeDlg.h"
- //Qt
- -#include <QtCore/QFile>
- -#include <QtCore/QTextStream>
- -#include <QtCore/QTimer>
- +#include <QFile>
- +#include <QTextStream>
- +#include <QTimer>
- //KDE
- #include <KMessageBox>
- diff --git src/removeDlg.h src/removeDlg.h
- index 4e989dd..35a036f 100644
- --- src/removeDlg.h
- +++ src/removeDlg.h
- @@ -15,6 +15,9 @@
- * with this program. If not, see <http://www.gnu.org/licenses/>. *
- *******************************************************************************/
- +//Krazy
- +//krazy:excludeall=cpp
- +
- #ifndef REMOVEDLG_H
- #define REMOVEDLG_H
- diff --git ui/installDlg.ui ui/installDlg.ui
- index de63903..af69fc0 100644
- --- ui/installDlg.ui
- +++ ui/installDlg.ui
- @@ -6,8 +6,8 @@
- <rect>
- <x>0</x>
- <y>0</y>
- - <width>264</width>
- - <height>217</height>
- + <width>291</width>
- + <height>242</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- @@ -70,6 +70,16 @@
- </column>
- </widget>
- </item>
- + <item row="2" column="0">
- + <widget class="QCheckBox" name="checkBox_partition">
- + <property name="toolTip">
- + <string comment="@info:tooltip">Install the bootloader on the boot sector of the selected partition instead of the MBR(=Master Boot Sector). Not recommended.</string>
- + </property>
- + <property name="text">
- + <string comment="@option:check">Install on partition instead of MBR (Advanced)</string>
- + </property>
- + </widget>
- + </item>
- </layout>
- </widget>
- <resources/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement