├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── Messages.sh ├── README.md ├── README.old ├── cmake └── modules │ ├── COPYING-CMAKE-SCRIPTS │ ├── FindHD.cmake │ ├── FindImageMagick.cmake │ ├── FindMsgfmt.cmake │ ├── GRUBPaths.cmake │ ├── MacroBoolTo01.cmake │ └── MacroLogFeature.cmake ├── config.h.cmake ├── other ├── CMakeLists.txt ├── grub2-editor.svg ├── kcm-grub2-languages └── kcm_grub2.desktop ├── po ├── CMakeLists.txt ├── ca │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── ca@valencia │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── cs │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── da │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── de │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── el │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── es │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── et │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── fi │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── fr │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── ga │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── gl │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── hu │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── it │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── kcm-grub2.pot ├── lt │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── nb │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── nl │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── pa │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── pl │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── pt │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── pt_BR │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── ro │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── ru │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── sk │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── sl │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── sv │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── tr │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── uk │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── zh_CN │ ├── CMakeLists.txt │ └── kcm-grub2.po └── zh_TW │ ├── CMakeLists.txt │ └── kcm-grub2.po ├── screenshot.png ├── src ├── CMakeLists.txt ├── common.cpp ├── common.h ├── convertDlg.cpp ├── convertDlg.h ├── entry.cpp ├── entry.h ├── groupDlg.cpp ├── groupDlg.h ├── helper │ ├── CMakeLists.txt │ ├── grub_rmecho.sh │ ├── helper.cpp │ ├── helper.h │ └── kcmgrub2.actions ├── installDlg.cpp ├── installDlg.h ├── kcm_grub2.cpp ├── kcm_grub2.h ├── qPkBackend.cpp ├── qPkBackend.h ├── qaptBackend.cpp ├── qaptBackend.h ├── removeDlg.cpp ├── removeDlg.h ├── userDlg.cpp ├── userDlg.h └── widgets │ ├── regexpinputdialog.cpp │ └── regexpinputdialog.h └── ui ├── convertDlg.ui ├── groupDlg.ui ├── installDlg.ui ├── kcm_grub2.ui ├── removeDlg.ui └── userDlg.ui /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required( VERSION 2.8.12 ) 2 | cmake_policy(SET CMP0002 OLD) 3 | cmake_policy(SET CMP0026 OLD) 4 | cmake_policy(SET CMP0054 OLD) 5 | cmake_policy(SET CMP0063 OLD) 6 | cmake_policy(SET CMP0064 OLD) 7 | 8 | project(kcm-grub2) 9 | set(KCM_GRUB2_VERSION_MAJOR "0") 10 | set(KCM_GRUB2_VERSION_MINOR "7") 11 | set(KCM_GRUB2_VERSION_PATCH "0") 12 | set(KCM_GRUB2_VERSION "${KCM_GRUB2_VERSION_MAJOR}.${KCM_GRUB2_VERSION_MINOR}.${KCM_GRUB2_VERSION_PATCH}") 13 | set(KDE_ENABLE_EXCEPTIONS "-fexceptions -UQT_NO_EXCEPTIONS") 14 | 15 | find_package(ECM 0.0.11 REQUIRED NO_MODULE) 16 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) 17 | 18 | include(KDEInstallDirs) 19 | include(KDECMakeSettings) 20 | include(KDECompilerSettings) 21 | include(FeatureSummary) 22 | 23 | find_package(Qt5 REQUIRED COMPONENTS Widgets DBus) 24 | find_package(KF5 REQUIRED COMPONENTS CoreAddons I18n Auth ConfigWidgets KIO Solid) 25 | #find_package(Qca-qt5 REQUIRED) 26 | 27 | include(GRUBPaths) 28 | 29 | include(MacroLogFeature) 30 | include(MacroBoolTo01) 31 | 32 | add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0) 33 | 34 | find_package(ImageMagick COMPONENTS Magick++ MagickCore) 35 | macro_log_feature(ImageMagick_FOUND "ImageMagick" "Create splash images compatible with GRUB2" "http://www.imagemagick.org/" FALSE "" "") 36 | macro_bool_to_01(ImageMagick_FOUND HAVE_IMAGEMAGICK) 37 | 38 | find_package(HD) 39 | macro_log_feature(HD_FOUND "hwinfo" "Retrieve list of resolutions valid in GRUB2" "http://www.opensuse.org/" FALSE "" "") 40 | macro_bool_to_01(HD_FOUND HAVE_HD) 41 | 42 | find_package(QApt 3.0.0) 43 | macro_log_feature(QAPT_FOUND "LibQApt" "Remove unneeded old entries (qapt backend)" "https://projects.kde.org/projects/extragear/sysadmin/libqapt/" FALSE "" "") 44 | macro_bool_to_01(QApt_FOUND HAVE_QAPT) 45 | 46 | find_package(PackageKitQt5) 47 | macro_log_feature(QPACKAGEKIT_FOUND "QPackageKit" "Remove unneeded old entries (qpackagekit backend)" "http://www.packagekit.org/" FALSE "" "") 48 | macro_bool_to_01(QPACKAGEKIT_FOUND HAVE_QPACKAGEKIT) 49 | 50 | macro_display_feature_log() 51 | configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) 52 | 53 | add_subdirectory(other) 54 | add_subdirectory(src) 55 | find_package( Msgfmt REQUIRED ) 56 | find_package( Gettext REQUIRED ) 57 | add_subdirectory( po ) 58 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | v.0.5.8 (18/06/2012) 2 | -------------------- 3 | *ADDED: Install on the boot sector of a partition instead of the MBR. 4 | *FIXED: Fix installation detection in Gentoo. 5 | *FIXED: Fix translation loading. 6 | 7 | v.0.5.5 (09/01/2012) 8 | -------------------- 9 | *ADDED: Experimental BURG support (only commands shared with GRUB2). 10 | *ADDED: Option to disable Plymouth (Advanced -> Linux Kernel Arguments). 11 | *FIXED: Fedora/openSUSE: the GRUB installation is now properly detected. 12 | *FIXED: Encoding issue (UTF-8 encoding is now supported). 13 | *FIXED: A QPackageKit backend bug where previous results were returned. 14 | 15 | *I18N: Translations included: Catalan, Czech, Danish, German, Greek, Spanish, Estonian, French, Irish [Gaelic], Hungarian, Lithuanian, Dutch, Panjabi/Punjabi, Polish, Portuguese, Brazilian Portuguese, Russian, Swedish, Ukrainian, Traditional Chinese. 16 | 17 | v.0.5.0 (09/05/2011) 18 | -------------------- 19 | *ADDED: Recover GRUB2 (from a Live CD). 20 | *ADDED: Option to toggle generation of memtest entries. 21 | *ADDED: Manually find missing configuration files which are needed. 22 | *ADDED: Restore default settings. 23 | *FIXED: Warn the user when trying to uninstall the current kernel. 24 | 25 | *I18N: Added 9 new translations: Danish, German, Estonian, Hungarian, Dutch, Portuguese, Portuguese (Brazil), Swedish, Ukrainian. 26 | 27 | v.0.4.5 (29/04/2011) 28 | -------------------- 29 | *ADDED: Remove old entries (using QApt or QPackageKit). 30 | *FIXED: Simplify the default-entry-picking UI. 31 | *ADDED: Provide list of valid GRUB resolutions. 32 | *FIXED: Simplify [GRUB & Linux] resolution picking UI. 33 | *ADDED: Perform variable substitution and unquoting using 'echo'. 34 | *FIXED: Suggest GRUB's resolution when creating a splash image. 35 | *FIXED: Query ImageMagick for supported mimetypes. 36 | *FIXED: Merge save and update actions. 37 | *FIXED: Polishing all around the codebase. 38 | 39 | v.0.3.6 (03/04/2011) 40 | -------------------- 41 | A security issue which was accidentally introduced in v0.3.5. 42 | Various fixes and polishing all around. 43 | 44 | v.0.3.5 (31/03/2011) 45 | -------------------- 46 | *ADDED: Splash image creation dialog. 47 | *ADDED: Linux Kernel parameters suggestions. 48 | *ADDED: Terminal suggestions. 49 | *FIXED: Reload configuration after updating GRUB. 50 | *FIXED: Preview GRUB wallpapers (=splash images) fullscreen. 51 | 52 | v.0.3.0 (21/03/2011) 53 | -------------------- 54 | *ADDED: Allow previewing a wallpaper (=splash image). 55 | *ADDED: Support for GRUB_INIT_TUNE. 56 | *FIXED: Make colors actually work. 57 | *FIXED: Handle better GRUB device naming. 58 | *FIXED: Rewrote big part of the code. 59 | 60 | v.0.2.5 (13/03/2011) 61 | -------------------- 62 | *ADDED: Resolution options improved. 63 | *ADDED: Visual color management. 64 | *ADDED: File selection dialogs for Wallpaper and Theme. 65 | *ADDED: Incorporated CPack in the build system. 66 | *FIXED: Improved detection of GRUB's configuration files (depends on distributions). 67 | 68 | v.0.2.0 (10/03/2011) 69 | -------------------- 70 | *ADDED: A script to extract translatable strings into a translation template. 71 | *ADDED: Option to choose another GRUB file, in case a file other than the default is used. 72 | *ADDED: Support for GRUB_DISABLE_LINUX_UUID, GRUB_DISABLE_RECOVERY, GRUB_DISABLE_OS_PROBER. 73 | *FIXED: More consistent reporting of 'grub-mkconfig' output. 74 | *FIXED: A bug which always set GRUB_SAVEDEFAULT to an empty string if not explicitly set. 75 | 76 | v.0.1.5 (09/03/2011) 77 | -------------------- 78 | *ADDED: Process and view the output from 'grub-mkconfig' while updating the menu. 79 | *ADDED: Option whether or not to run 'grub-mkconfig' after saving. 80 | *ADDED: Detailed information in case 'grub-mkconfig' fails. 81 | *FIXED: Proper argument quoting for 'grub-mkconfig' (to avoid potential security holes). 82 | *FIXED: Quote only values that need quoting, not all of them. 83 | 84 | v.0.1.0 (07/03/2011) 85 | -------------------- 86 | *Initial release 87 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | /==========================\ 2 | | Build & Run Instructions | 3 | \==========================/ 4 | 5 | Enter the directory where you extracted the source code and run: 6 | 7 | $ mkdir build 8 | $ cd build 9 | $ cmake .. -DCMAKE_INSTALL_PREFIX=`kf5-config --prefix` 10 | $ make 11 | $ sudo make install 12 | 13 | You may then find the GRUB2 KCModule under "Startup and Shutdown" in 14 | System Settings. You may also launch it running: 15 | 16 | $ kcmshell5 kcm_grub2 17 | 18 | In order to appear in System Settings the first time you install the 19 | GRUB2 KCModule, you may have to run: 20 | 21 | $ kbuildsycoca5 22 | 23 | Note: '$' indicates a shell prompt. 24 | 25 | /=============================\ 26 | | Dependencies & Requirements | 27 | \=============================/ 28 | 29 | Requires Plasma framework 5, GRUB2. 30 | Suggests ImageMagick for GRUB splash image management. 31 | Suggests hwinfo for valid GRUB resolution detection. 32 | Suggests LibQApt or QPackageKit for removing old entries. 33 | 34 | /======================\ 35 | | GRUB Path Resolution | 36 | \======================/ 37 | 38 | Almost every distribution has different paths for GRUB executable and 39 | configuration files. Thus, the need to automatically detect them arises. 40 | Hopefully the most prevalent naming schemes boil down to three cases: 41 | 42 | * vanilla grub-foo executables and boot directory, 43 | * modified grub2-foo executables and boot directory (allows for parallel 44 | installation of both major versions of GRUB), 45 | * and as a third, last case we consider BURG installations with vanilla 46 | burg-foo executables and boot directory. 47 | 48 | CMake will detect the above cases in the order specified and 49 | appropriately fill in the following variables: 50 | 51 | * GRUB_INSTALL_EXE = executable which installs GRUB 52 | * GRUB_MKCONFIG_EXE = executable which generates GRUB's menu file 53 | * GRUB_PROBE_EXE = executable which probes devices for GRUB information 54 | * GRUB_SET_DEFAULT_EXE = executable which sets the default entry in 55 | GRUB's environment file 56 | * GRUB_MENU = GRUB's menu file 57 | * GRUB_CONFIG = GRUB's main configuration file 58 | * GRUB_ENV = GRUB's environment file 59 | * GRUB_MEMTEST = script installed by memtest (usually under /etc/grub.d) 60 | 61 | For security reasons these variables can only be set at compile time and 62 | will be embedded in the binary, so that they cannot be altered 63 | afterwards. 64 | 65 | The following options exist: 66 | 67 | * Do not manually specify any of the above variables, in which case 68 | CMake will try to resolve them automatically. If it fails you will be 69 | prompted to manually specify them all. 70 | * If you specify at least one of the *_EXE variables, you will have to 71 | specify all other variables as well. 72 | * You can make changes to the non-EXE variables as long as you don't 73 | alter any of the *_EXE ones. 74 | 75 | Package maintainers are encouraged to manually specify all of the above 76 | variables in order to fit with each distribution's naming scheme. 77 | -------------------------------------------------------------------------------- /Messages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR="." # root of translatable sources 4 | PODIR="po" # folder for po files 5 | PROJECT="kcm-grub2" # project name 6 | BUGADDR="ohmygod19993@gmail.com" # MSGID-Bugs 7 | WDIR=`pwd` # working dir 8 | 9 | 10 | echo "Preparing rc files" 11 | cd ${BASEDIR} 12 | # we use simple sorting to make sure the lines do not jump around too much from system to system 13 | find . ! -path './build/*' -a \( -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' \) | sort > ${WDIR}/rcfiles.list 14 | xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp 15 | # additional string for KAboutData 16 | echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/rc.cpp 17 | echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/rc.cpp 18 | cd ${WDIR} 19 | echo "Done preparing rc files" 20 | 21 | 22 | echo "Extracting messages" 23 | cd ${BASEDIR} 24 | # see above on sorting 25 | find . ! -path './build/*' -a \( -name '*.cpp' -o -name '*.h' -o -name '*.c' \) | sort > ${WDIR}/infiles.list 26 | echo "rc.cpp" >> ${WDIR}/infiles.list 27 | cd ${WDIR} 28 | xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \ 29 | -kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \ 30 | --msgid-bugs-address="${BUGADDR}" \ 31 | --files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o po/${PROJECT}.pot || { echo "error while calling xgettext. aborting."; exit 1; } 32 | echo "Done extracting messages" 33 | 34 | 35 | echo "Merging translations" 36 | catalogs=`find . -name '*.po'` 37 | for cat in $catalogs; do 38 | echo $cat 39 | msgmerge -v -o $cat.new $cat po/${PROJECT}.pot 40 | mv $cat.new $cat 41 | done 42 | echo "Done merging translations" 43 | 44 | 45 | echo "Cleaning up" 46 | cd ${WDIR} 47 | rm rcfiles.list 48 | rm infiles.list 49 | rm rc.cpp 50 | echo "Done" 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # grub2-editor 2 | 3 | A KDE Control Module for configuring the GRUB2 bootloader. 4 | 5 | ![ScreenShot](https://raw.githubusercontent.com/maz-1/grub2-editor/master/screenshot.png) 6 | 7 | Smoothly integrated in KDE System Settings, it is the central place for managing your GRUB2 configuration. Supports many GRUB2 configuration options 8 | 9 | # Features 10 | * Manage default boot entry 11 | * Manage boot timeout 12 | * Manage boot resolutions 13 | * Manage boot menu colors 14 | * Manage boot menu theme 15 | * Manage linux kernel arguments 16 | * Save and update the configuration files of GRUB2 17 | * Password protection setup(only tested on archlinux). 18 | * Recover GRUB2 19 | * Remove old entries(deb/rpm backend) 20 | * Create and preview GRUB2 splash images 21 | 22 | For installation instructions see the INSTALL file. 23 | -------------------------------------------------------------------------------- /README.old: -------------------------------------------------------------------------------- 1 | A KDE Control Module for configuring the GRUB2 bootloader. 2 | 3 | Smoothly integrated in KDE System Settings, it is the central place for managing your GRUB2 configuration. Supports many GRUB2 configuration options, most notably: 4 | 5 | * Manage default boot entry 6 | * Manage boot timeout 7 | * Manage boot resolutions 8 | * Manage boot menu colors 9 | * Manage boot menu theme 10 | * Manage linux kernel arguments 11 | * Save and update the configuration files of GRUB2 12 | 13 | Extra features include: 14 | 15 | * Recover GRUB2 16 | * Remove old entries 17 | * Create and preview GRUB2 splash images 18 | 19 | Related Blog: http://ksmanis.wordpress.com/category/grub2-editor/ 20 | SourceForge Page: https://sourceforge.net/projects/kcm-grub2/ 21 | KDE-Apps.org Page: http://kde-apps.org/content/show.php?content=139643 22 | KDE Extragear Page: https://projects.kde.org/projects/extragear/sysadmin/kcm-grub2 23 | 24 | For installation instructions see the INSTALL file. 25 | -------------------------------------------------------------------------------- /cmake/modules/COPYING-CMAKE-SCRIPTS: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 2. Redistributions in binary form must reproduce the copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | 3. The name of the author may not be used to endorse or promote products 11 | derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /cmake/modules/FindHD.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the hd library 2 | # Once done this will define 3 | # 4 | # HD_FOUND - system has the hd library 5 | # HD_INCLUDE_DIR - the hd include directory 6 | # HD_LIBRARY - Link this to use the hd library 7 | # 8 | # Copyright (C) 2008, Pino Toscano, 9 | # 10 | # Redistribution and use is allowed according to the terms of the BSD license. 11 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 12 | 13 | if (HD_LIBRARY AND HD_INCLUDE_DIR) 14 | # in cache already 15 | set(HD_FOUND TRUE) 16 | else (HD_LIBRARY AND HD_INCLUDE_DIR) 17 | 18 | find_path(HD_INCLUDE_DIR hd.h 19 | ) 20 | 21 | find_library(HD_LIBRARY 22 | NAMES hd 23 | ) 24 | 25 | include(FindPackageHandleStandardArgs) 26 | find_package_handle_standard_args(HD DEFAULT_MSG HD_LIBRARY HD_INCLUDE_DIR) 27 | # ensure that they are cached 28 | set(HD_INCLUDE_DIR ${HD_INCLUDE_DIR} CACHE INTERNAL "The hd include path") 29 | set(HD_LIBRARY ${HD_LIBRARY} CACHE INTERNAL "The libraries needed to use hd") 30 | 31 | endif (HD_LIBRARY AND HD_INCLUDE_DIR) 32 | -------------------------------------------------------------------------------- /cmake/modules/FindImageMagick.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #.rst: 5 | # FindImageMagick 6 | # --------------- 7 | # 8 | # Find the ImageMagick binary suite. 9 | # 10 | # This module will search for a set of ImageMagick tools specified as 11 | # components in the FIND_PACKAGE call. Typical components include, but 12 | # are not limited to (future versions of ImageMagick might have 13 | # additional components not listed here): 14 | # 15 | # :: 16 | # 17 | # animate 18 | # compare 19 | # composite 20 | # conjure 21 | # convert 22 | # display 23 | # identify 24 | # import 25 | # mogrify 26 | # montage 27 | # stream 28 | # 29 | # 30 | # 31 | # If no component is specified in the FIND_PACKAGE call, then it only 32 | # searches for the ImageMagick executable directory. This code defines 33 | # the following variables: 34 | # 35 | # :: 36 | # 37 | # ImageMagick_FOUND - TRUE if all components are found. 38 | # ImageMagick_EXECUTABLE_DIR - Full path to executables directory. 39 | # ImageMagick__FOUND - TRUE if is found. 40 | # ImageMagick__EXECUTABLE - Full path to executable. 41 | # ImageMagick_VERSION_STRING - the version of ImageMagick found 42 | # (since CMake 2.8.8) 43 | # 44 | # 45 | # 46 | # ImageMagick_VERSION_STRING will not work for old versions like 5.2.3. 47 | # 48 | # There are also components for the following ImageMagick APIs: 49 | # 50 | # :: 51 | # 52 | # Magick++ 53 | # MagickWand 54 | # MagickCore 55 | # 56 | # 57 | # 58 | # For these components the following variables are set: 59 | # 60 | # :: 61 | # 62 | # ImageMagick_FOUND - TRUE if all components are found. 63 | # ImageMagick_INCLUDE_DIRS - Full paths to all include dirs. 64 | # ImageMagick_LIBRARIES - Full paths to all libraries. 65 | # ImageMagick__FOUND - TRUE if is found. 66 | # ImageMagick__INCLUDE_DIRS - Full path to include dirs. 67 | # ImageMagick__LIBRARIES - Full path to libraries. 68 | # 69 | # 70 | # 71 | # Example Usages: 72 | # 73 | # :: 74 | # 75 | # find_package(ImageMagick) 76 | # find_package(ImageMagick COMPONENTS convert) 77 | # find_package(ImageMagick COMPONENTS convert mogrify display) 78 | # find_package(ImageMagick COMPONENTS Magick++) 79 | # find_package(ImageMagick COMPONENTS Magick++ convert) 80 | # 81 | # 82 | # 83 | # Note that the standard FIND_PACKAGE features are supported (i.e., 84 | # QUIET, REQUIRED, etc.). 85 | 86 | find_package(PkgConfig QUIET) 87 | 88 | #--------------------------------------------------------------------- 89 | # Helper functions 90 | #--------------------------------------------------------------------- 91 | function(FIND_IMAGEMAGICK_API component header) 92 | set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) 93 | 94 | pkg_check_modules(PC_${component} QUIET ${component}) 95 | 96 | find_path(ImageMagick_${component}_INCLUDE_DIR 97 | NAMES ${header} 98 | HINTS 99 | ${PC_${component}_INCLUDEDIR} 100 | ${PC_${component}_INCLUDE_DIRS} 101 | PATHS 102 | ${ImageMagick_INCLUDE_DIRS} 103 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" 104 | PATH_SUFFIXES 105 | ImageMagick ImageMagick-7 106 | DOC "Path to the ImageMagick arch-independent include dir." 107 | NO_DEFAULT_PATH 108 | ) 109 | find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR 110 | NAMES magick/magick-baseconfig.h 111 | HINTS 112 | ${PC_${component}_INCLUDEDIR} 113 | ${PC_${component}_INCLUDE_DIRS} 114 | PATHS 115 | ${ImageMagick_INCLUDE_DIRS} 116 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" 117 | PATH_SUFFIXES 118 | ImageMagick ImageMagick-7 119 | DOC "Path to the ImageMagick arch-specific include dir." 120 | NO_DEFAULT_PATH 121 | ) 122 | find_library(ImageMagick_${component}_LIBRARY 123 | NAMES ${ARGN} 124 | HINTS 125 | ${PC_${component}_LIBDIR} 126 | ${PC_${component}_LIB_DIRS} 127 | PATHS 128 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib" 129 | DOC "Path to the ImageMagick Magick++ library." 130 | NO_DEFAULT_PATH 131 | ) 132 | 133 | # old version have only indep dir 134 | if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY) 135 | set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) 136 | 137 | # Construct per-component include directories. 138 | set(ImageMagick_${component}_INCLUDE_DIRS 139 | ${ImageMagick_${component}_INCLUDE_DIR} 140 | ) 141 | if(ImageMagick_${component}_ARCH_INCLUDE_DIR) 142 | list(APPEND ImageMagick_${component}_INCLUDE_DIRS 143 | ${ImageMagick_${component}_ARCH_INCLUDE_DIR}) 144 | endif() 145 | list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS) 146 | set(ImageMagick_${component}_INCLUDE_DIRS 147 | ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE) 148 | 149 | # Add the per-component include directories to the full include dirs. 150 | list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS}) 151 | list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS) 152 | set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE) 153 | 154 | list(APPEND ImageMagick_LIBRARIES 155 | ${ImageMagick_${component}_LIBRARY} 156 | ) 157 | set(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES} PARENT_SCOPE) 158 | endif() 159 | endfunction() 160 | 161 | function(FIND_IMAGEMAGICK_EXE component) 162 | set(_IMAGEMAGICK_EXECUTABLE 163 | ${ImageMagick_EXECUTABLE_DIR}/${component}${CMAKE_EXECUTABLE_SUFFIX}) 164 | if(EXISTS ${_IMAGEMAGICK_EXECUTABLE}) 165 | set(ImageMagick_${component}_EXECUTABLE 166 | ${_IMAGEMAGICK_EXECUTABLE} 167 | PARENT_SCOPE 168 | ) 169 | set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE) 170 | else() 171 | set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) 172 | endif() 173 | endfunction() 174 | 175 | #--------------------------------------------------------------------- 176 | # Start Actual Work 177 | #--------------------------------------------------------------------- 178 | # Try to find a ImageMagick installation binary path. 179 | find_path(ImageMagick_EXECUTABLE_DIR 180 | NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX} 181 | PATHS 182 | "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]" 183 | DOC "Path to the ImageMagick binary directory." 184 | NO_DEFAULT_PATH 185 | ) 186 | find_path(ImageMagick_EXECUTABLE_DIR 187 | NAMES mogrify${CMAKE_EXECUTABLE_SUFFIX} 188 | ) 189 | 190 | # Find each component. Search for all tools in same dir 191 | # ; otherwise they should be found 192 | # independently and not in a cohesive module such as this one. 193 | unset(ImageMagick_REQUIRED_VARS) 194 | unset(ImageMagick_DEFAULT_EXECUTABLES) 195 | foreach(component ${ImageMagick_FIND_COMPONENTS} 196 | # DEPRECATED: forced components for backward compatibility 197 | convert mogrify import montage composite 198 | ) 199 | if(component STREQUAL "Magick++") 200 | FIND_IMAGEMAGICK_API(Magick++ Magick++.h 201 | Magick++ CORE_RL_Magick++_ 202 | Magick++-7 203 | Magick++-Q8 Magick++-Q16 Magick++-Q16HDRI Magick++-Q8HDRI 204 | Magick++-7.Q64 Magick++-7.Q32 Magick++-7.Q64HDRI Magick++-7.Q32HDRI 205 | Magick++-7.Q16 Magick++-7.Q8 Magick++-7.Q16HDRI Magick++-7.Q8HDRI 206 | ) 207 | list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY) 208 | elseif(component STREQUAL "MagickWand") 209 | FIND_IMAGEMAGICK_API(MagickWand "wand/MagickWand.h;MagickWand/MagickWand.h" 210 | Wand MagickWand CORE_RL_wand_ CORE_RL_MagickWand_ 211 | MagickWand-7 212 | MagickWand-Q16 MagickWand-Q8 MagickWand-Q16HDRI MagickWand-Q8HDRI 213 | MagickWand-7.Q64 MagickWand-7.Q32 MagickWand-7.Q64HDRI MagickWand-7.Q32HDRI 214 | MagickWand-7.Q16 MagickWand-7.Q8 MagickWand-7.Q16HDRI MagickWand-7.Q8HDRI 215 | ) 216 | list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY) 217 | elseif(component STREQUAL "MagickCore") 218 | FIND_IMAGEMAGICK_API(MagickCore "magick/MagickCore.h;MagickCore/MagickCore.h" 219 | Magick MagickCore CORE_RL_magick_ CORE_RL_MagickCore_ 220 | MagickCore-7 221 | MagickCore-Q16 MagickCore-Q8 MagickCore-Q16HDRI MagickCore-Q8HDRI 222 | MagickCore-7.Q64 MagickCore-7.Q32 MagickCore-7.Q64HDRI MagickCore-7.Q32HDRI 223 | MagickCore-7.Q16 MagickCore-7.Q8 MagickCore-7.Q16HDRI MagickCore-7.Q8HDRI 224 | ) 225 | list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickCore_LIBRARY) 226 | else() 227 | if(ImageMagick_EXECUTABLE_DIR) 228 | FIND_IMAGEMAGICK_EXE(${component}) 229 | endif() 230 | 231 | if(ImageMagick_FIND_COMPONENTS) 232 | list(FIND ImageMagick_FIND_COMPONENTS ${component} is_requested) 233 | if(is_requested GREATER -1) 234 | list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_${component}_EXECUTABLE) 235 | endif() 236 | elseif(ImageMagick_${component}_EXECUTABLE) 237 | # if no components were requested explicitly put all (default) executables 238 | # in the list 239 | list(APPEND ImageMagick_DEFAULT_EXECUTABLES ImageMagick_${component}_EXECUTABLE) 240 | endif() 241 | endif() 242 | endforeach() 243 | 244 | if(NOT ImageMagick_FIND_COMPONENTS AND NOT ImageMagick_DEFAULT_EXECUTABLES) 245 | # No components were requested, and none of the default components were 246 | # found. Just insert mogrify into the list of the default components to 247 | # find so FPHSA below has something to check 248 | list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_mogrify_EXECUTABLE) 249 | elseif(ImageMagick_DEFAULT_EXECUTABLES) 250 | list(APPEND ImageMagick_REQUIRED_VARS ${ImageMagick_DEFAULT_EXECUTABLES}) 251 | endif() 252 | 253 | set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS}) 254 | set(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES}) 255 | 256 | if(ImageMagick_mogrify_EXECUTABLE) 257 | execute_process(COMMAND ${ImageMagick_mogrify_EXECUTABLE} -version 258 | OUTPUT_VARIABLE imagemagick_version 259 | ERROR_QUIET 260 | OUTPUT_STRIP_TRAILING_WHITESPACE) 261 | if(imagemagick_version MATCHES "^Version: ImageMagick ([-0-9\\.]+)") 262 | set(ImageMagick_VERSION_STRING "${CMAKE_MATCH_1}") 263 | endif() 264 | unset(imagemagick_version) 265 | endif() 266 | 267 | #--------------------------------------------------------------------- 268 | # Standard Package Output 269 | #--------------------------------------------------------------------- 270 | include(FindPackageHandleStandardArgs) 271 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(ImageMagick 272 | REQUIRED_VARS ${ImageMagick_REQUIRED_VARS} 273 | VERSION_VAR ImageMagick_VERSION_STRING 274 | ) 275 | # Maintain consistency with all other variables. 276 | set(ImageMagick_FOUND ${IMAGEMAGICK_FOUND}) 277 | 278 | #--------------------------------------------------------------------- 279 | # DEPRECATED: Setting variables for backward compatibility. 280 | #--------------------------------------------------------------------- 281 | set(IMAGEMAGICK_BINARY_PATH ${ImageMagick_EXECUTABLE_DIR} 282 | CACHE PATH "Path to the ImageMagick binary directory.") 283 | set(IMAGEMAGICK_CONVERT_EXECUTABLE ${ImageMagick_convert_EXECUTABLE} 284 | CACHE FILEPATH "Path to ImageMagick's convert executable.") 285 | set(IMAGEMAGICK_MOGRIFY_EXECUTABLE ${ImageMagick_mogrify_EXECUTABLE} 286 | CACHE FILEPATH "Path to ImageMagick's mogrify executable.") 287 | set(IMAGEMAGICK_IMPORT_EXECUTABLE ${ImageMagick_import_EXECUTABLE} 288 | CACHE FILEPATH "Path to ImageMagick's import executable.") 289 | set(IMAGEMAGICK_MONTAGE_EXECUTABLE ${ImageMagick_montage_EXECUTABLE} 290 | CACHE FILEPATH "Path to ImageMagick's montage executable.") 291 | set(IMAGEMAGICK_COMPOSITE_EXECUTABLE ${ImageMagick_composite_EXECUTABLE} 292 | CACHE FILEPATH "Path to ImageMagick's composite executable.") 293 | mark_as_advanced( 294 | IMAGEMAGICK_BINARY_PATH 295 | IMAGEMAGICK_CONVERT_EXECUTABLE 296 | IMAGEMAGICK_MOGRIFY_EXECUTABLE 297 | IMAGEMAGICK_IMPORT_EXECUTABLE 298 | IMAGEMAGICK_MONTAGE_EXECUTABLE 299 | IMAGEMAGICK_COMPOSITE_EXECUTABLE 300 | ) 301 | -------------------------------------------------------------------------------- /cmake/modules/FindMsgfmt.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find msgfmt 2 | # Once done this will define 3 | # 4 | # MSGFMT_FOUND - system has msgfmt 5 | 6 | # Copyright (c) 2007, Montel Laurent 7 | # 8 | # Redistribution and use is allowed according to the terms of the BSD license. 9 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 10 | 11 | ### TODO: KDE4 needs msgfmt of version 0.15 or greater (cf. msgfmt --version ) 12 | 13 | if(MSGFMT_EXECUTABLE) 14 | set(MSGFMT_FOUND TRUE) 15 | else(MSGFMT_EXECUTABLE) 16 | 17 | FIND_PROGRAM(MSGFMT_EXECUTABLE NAMES msgfmt) 18 | if (MSGFMT_EXECUTABLE) 19 | set(MSGFMT_FOUND TRUE) 20 | else (MSGFMT_EXECUTABLE) 21 | if (Msgfmt_FIND_REQUIRED) 22 | message(SEND_ERROR "Could NOT find msgfmt program") 23 | endif (Msgfmt_FIND_REQUIRED) 24 | endif (MSGFMT_EXECUTABLE) 25 | MARK_AS_ADVANCED(MSGFMT_EXECUTABLE) 26 | 27 | endif (MSGFMT_EXECUTABLE) 28 | 29 | -------------------------------------------------------------------------------- /cmake/modules/GRUBPaths.cmake: -------------------------------------------------------------------------------- 1 | if(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE AND GRUB_MENU AND GRUB_MENU_CUSTOM AND GRUB_CONFIG AND GRUB_ENV AND GRUB_MEMTEST AND GRUB_CONFIGDIR AND GRUB_SECURITY AND GRUB_RMECHO) 2 | message(STATUS "All GRUB paths were defined in the CMake cache. By-passing automatic resolution.") 3 | elseif(NOT (GRUB_INSTALL_EXE OR GRUB_MKCONFIG_EXE OR GRUB_PROBE_EXE OR GRUB_SET_DEFAULT_EXE)) 4 | find_program(GRUB_INSTALL_EXE NAMES grub-install DOC "GRUB install executable file path.") 5 | find_program(GRUB_MKCONFIG_EXE NAMES grub-mkconfig DOC "GRUB mkconfig executable file path.") 6 | find_program(GRUB_PROBE_EXE NAMES grub-probe DOC "GRUB probe executable file path.") 7 | find_program(GRUB_SET_DEFAULT_EXE NAMES grub-set-default DOC "GRUB set-default executable file path.") 8 | find_program(GRUB_MAKE_PASSWD_EXE NAMES grub-mkpasswd-pbkdf2 DOC "GRUB mkpasswd-pbkdf2 executable file path.") 9 | if(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 10 | set(GRUB_MENU "/boot/grub/grub.cfg" CACHE FILEPATH "GRUB menu file path.") 11 | set(GRUB_MENU_CUSTOM "/boot/grub/custom.cfg" CACHE FILEPATH "GRUB menu file path.") 12 | set(GRUB_CONFIG "/etc/default/grub" CACHE FILEPATH "GRUB configuration file path.") 13 | set(GRUB_ENV "/boot/grub/grubenv" CACHE FILEPATH "GRUB environment file path.") 14 | set(GRUB_MEMTEST "/etc/grub.d/60_memtest86+" CACHE FILEPATH "GRUB memtest file path.") 15 | set(GRUB_CONFIGDIR "/etc/grub.d/" CACHE FILEPATH "GRUB configuration path.") 16 | set(GRUB_SECURITY "01_header_passwd" CACHE FILEPATH "GRUB security configuration file.") 17 | set(GRUB_RMECHO "99_rmecho" CACHE FILEPATH "GRUB script to remove echo commands.") 18 | else(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 19 | unset(GRUB_INSTALL_EXE CACHE) 20 | unset(GRUB_MKCONFIG_EXE CACHE) 21 | unset(GRUB_PROBE_EXE CACHE) 22 | unset(GRUB_SET_DEFAULT_EXE CACHE) 23 | unset(GRUB_MAKE_PASSWD_EXE CACHE) 24 | find_program(GRUB_INSTALL_EXE NAMES grub2-install DOC "GRUB install executable file path.") 25 | find_program(GRUB_MKCONFIG_EXE NAMES grub2-mkconfig DOC "GRUB mkconfig executable file path.") 26 | find_program(GRUB_PROBE_EXE NAMES grub2-probe DOC "GRUB probe executable file path.") 27 | find_program(GRUB_SET_DEFAULT_EXE NAMES grub2-set-default DOC "GRUB set-default executable file path.") 28 | find_program(GRUB_MAKE_PASSWD_EXE NAMES grub-mkpasswd-pbkdf2 DOC "GRUB mkpasswd-pbkdf2 executable file path.") 29 | if(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 30 | set(GRUB_MENU "/boot/grub2/grub.cfg" CACHE FILEPATH "GRUB menu file path.") 31 | set(GRUB_MENU_CUSTOM "/boot/grub2/custom.cfg" CACHE FILEPATH "GRUB menu file path.") 32 | set(GRUB_CONFIG "/etc/default/grub" CACHE FILEPATH "GRUB configuration file path.") 33 | set(GRUB_ENV "/boot/grub2/grubenv" CACHE FILEPATH "GRUB environment file path.") 34 | set(GRUB_MEMTEST "/etc/grub.d/60_memtest86+" CACHE FILEPATH "GRUB memtest file path.") 35 | set(GRUB_CONFIGDIR "/etc/grub.d/" CACHE FILEPATH "GRUB configuration path.") 36 | set(GRUB_SECURITY "01_header_passwd" CACHE FILEPATH "GRUB security configuration file.") 37 | set(GRUB_RMECHO "99_rmecho" CACHE FILEPATH "GRUB script to remove echo commands.") 38 | else(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 39 | unset(GRUB_INSTALL_EXE CACHE) 40 | unset(GRUB_MKCONFIG_EXE CACHE) 41 | unset(GRUB_PROBE_EXE CACHE) 42 | unset(GRUB_SET_DEFAULT_EXE CACHE) 43 | unset(GRUB_MAKE_PASSWD_EXE CACHE) 44 | find_program(GRUB_INSTALL_EXE NAMES burg-install DOC "GRUB install executable file path.") 45 | find_program(GRUB_MKCONFIG_EXE NAMES burg-mkconfig DOC "GRUB mkconfig executable file path.") 46 | find_program(GRUB_PROBE_EXE NAMES burg-probe DOC "GRUB probe executable file path.") 47 | find_program(GRUB_SET_DEFAULT_EXE NAMES burg-set-default DOC "GRUB set-default executable file path.") 48 | find_program(GRUB_MAKE_PASSWD_EXE NAMES grub-mkpasswd-pbkdf2 DOC "GRUB mkpasswd-pbkdf2 executable file path.") 49 | if(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 50 | set(GRUB_MENU "/boot/burg/burg.cfg" CACHE FILEPATH "GRUB menu file path.") 51 | set(GRUB_MENU_CUSTOM "/boot/burg/custom.cfg" CACHE FILEPATH "GRUB menu file path.") 52 | set(GRUB_CONFIG "/etc/default/burg" CACHE FILEPATH "GRUB configuration file path.") 53 | set(GRUB_ENV "/boot/burg/burgenv" CACHE FILEPATH "GRUB environment file path.") 54 | set(GRUB_MEMTEST "/etc/burg.d/20_memtest86+" CACHE FILEPATH "GRUB memtest file path.") 55 | set(GRUB_CONFIGDIR "/etc/grub.d/" CACHE FILEPATH "GRUB configuration path.") 56 | set(GRUB_SECURITY "01_header_passwd" CACHE FILEPATH "GRUB security configuration file.") 57 | set(GRUB_RMECHO "99_rmecho" CACHE FILEPATH "GRUB script to remove echo commands.") 58 | else(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 59 | message(FATAL_ERROR "Could not automatically resolve GRUB paths. Please specify all of them manually.") 60 | endif(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 61 | endif(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 62 | endif(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE) 63 | else(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE AND GRUB_MENU AND GRUB_MENU_CUSTOM AND GRUB_CONFIG AND GRUB_ENV AND GRUB_MEMTEST AND GRUB_CONFIGDIR AND GRUB_SECURITY AND GRUB_RMECHO) 64 | message(FATAL_ERROR "Some, but not all, GRUB paths were defined in the CMake cache. Please define them all or let CMake do it. In the latter case define none.") 65 | endif(GRUB_INSTALL_EXE AND GRUB_MKCONFIG_EXE AND GRUB_PROBE_EXE AND GRUB_SET_DEFAULT_EXE AND GRUB_MAKE_PASSWD_EXE AND GRUB_MENU AND GRUB_MENU_CUSTOM AND GRUB_CONFIG AND GRUB_ENV AND GRUB_MEMTEST AND GRUB_CONFIGDIR AND GRUB_SECURITY AND GRUB_RMECHO) 66 | 67 | message(STATUS "--------------------------------------------------------------------------") 68 | message(STATUS "GRUB_INSTALL_EXE: ${GRUB_INSTALL_EXE}") 69 | message(STATUS "GRUB_MKCONFIG_EXE: ${GRUB_MKCONFIG_EXE}") 70 | message(STATUS "GRUB_PROBE_EXE: ${GRUB_PROBE_EXE}") 71 | message(STATUS "GRUB_SET_DEFAULT_EXE: ${GRUB_SET_DEFAULT_EXE}") 72 | message(STATUS "GRUB_MAKE_PASSWD_EXE: ${GRUB_MAKE_PASSWD_EXE}") 73 | message(STATUS "GRUB_MENU: ${GRUB_MENU}") 74 | message(STATUS "GRUB_MENU_CUSTOM: ${GRUB_MENU_CUSTOM}") 75 | message(STATUS "GRUB_CONFIG: ${GRUB_CONFIG}") 76 | message(STATUS "GRUB_ENV: ${GRUB_ENV}") 77 | message(STATUS "GRUB_MEMTEST: ${GRUB_MEMTEST}") 78 | message(STATUS "GRUB_CONFIGDIR: ${GRUB_CONFIGDIR}") 79 | message(STATUS "GRUB_SECURITY: ${GRUB_SECURITY}") 80 | message(STATUS "GRUB_RMECHO: ${GRUB_RMECHO}") 81 | message(STATUS "--------------------------------------------------------------------------") 82 | -------------------------------------------------------------------------------- /cmake/modules/MacroBoolTo01.cmake: -------------------------------------------------------------------------------- 1 | # MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN ) 2 | # This macro evaluates its first argument 3 | # and sets all the given vaiables either to 0 or 1 4 | # depending on the value of the first one 5 | 6 | # Copyright (c) 2006, Alexander Neundorf, 7 | # 8 | # Redistribution and use is allowed according to the terms of the BSD license. 9 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 10 | 11 | 12 | MACRO(MACRO_BOOL_TO_01 FOUND_VAR ) 13 | FOREACH (_current_VAR ${ARGN}) 14 | IF(${FOUND_VAR}) 15 | SET(${_current_VAR} 1) 16 | ELSE(${FOUND_VAR}) 17 | SET(${_current_VAR} 0) 18 | ENDIF(${FOUND_VAR}) 19 | ENDFOREACH(_current_VAR) 20 | ENDMACRO(MACRO_BOOL_TO_01) 21 | -------------------------------------------------------------------------------- /cmake/modules/MacroLogFeature.cmake: -------------------------------------------------------------------------------- 1 | # This file defines the Feature Logging macros. 2 | # 3 | # MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]]) 4 | # Logs the information so that it can be displayed at the end 5 | # of the configure run 6 | # VAR : TRUE or FALSE, indicating whether the feature is supported 7 | # FEATURE: name of the feature, e.g. "libjpeg" 8 | # DESCRIPTION: description what this feature provides 9 | # URL: home page 10 | # REQUIRED: TRUE or FALSE, indicating whether the featue is required 11 | # MIN_VERSION: minimum version number. empty string if unneeded 12 | # COMMENTS: More info you may want to provide. empty string if unnecessary 13 | # 14 | # MACRO_DISPLAY_FEATURE_LOG() 15 | # Call this to display the collected results. 16 | # Exits CMake with a FATAL error message if a required feature is missing 17 | # 18 | # Example: 19 | # 20 | # INCLUDE(MacroLogFeature) 21 | # 22 | # FIND_PACKAGE(JPEG) 23 | # MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "") 24 | # ... 25 | # MACRO_DISPLAY_FEATURE_LOG() 26 | 27 | # Copyright (c) 2006, Alexander Neundorf, 28 | # Copyright (c) 2006, Allen Winter, 29 | # Copyright (c) 2009, Sebastian Trueg, 30 | # 31 | # Redistribution and use is allowed according to the terms of the BSD license. 32 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 33 | 34 | IF (NOT _macroLogFeatureAlreadyIncluded) 35 | SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) 36 | IF (EXISTS ${_file}) 37 | FILE(REMOVE ${_file}) 38 | ENDIF (EXISTS ${_file}) 39 | 40 | SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) 41 | IF (EXISTS ${_file}) 42 | FILE(REMOVE ${_file}) 43 | ENDIF (EXISTS ${_file}) 44 | 45 | SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) 46 | IF (EXISTS ${_file}) 47 | FILE(REMOVE ${_file}) 48 | ENDIF (EXISTS ${_file}) 49 | 50 | SET(_macroLogFeatureAlreadyIncluded TRUE) 51 | 52 | INCLUDE(FeatureSummary) 53 | 54 | ENDIF (NOT _macroLogFeatureAlreadyIncluded) 55 | 56 | 57 | MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments) 58 | 59 | STRING(TOUPPER "${ARGV4}" _required) 60 | SET(_minvers "${ARGV5}") 61 | SET(_comments "${ARGV6}") 62 | 63 | IF (${_var}) 64 | SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) 65 | ELSE (${_var}) 66 | IF ("${_required}" STREQUAL "TRUE") 67 | SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt) 68 | ELSE ("${_required}" STREQUAL "TRUE") 69 | SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) 70 | ENDIF ("${_required}" STREQUAL "TRUE") 71 | ENDIF (${_var}) 72 | 73 | SET(_logtext " * ${_package}") 74 | 75 | IF (NOT ${_var}) 76 | IF (${_minvers} MATCHES ".*") 77 | SET(_logtext "${_logtext} (${_minvers} or higher)") 78 | ENDIF (${_minvers} MATCHES ".*") 79 | SET(_logtext "${_logtext} <${_url}>\n ") 80 | ELSE (NOT ${_var}) 81 | SET(_logtext "${_logtext} - ") 82 | ENDIF (NOT ${_var}) 83 | 84 | SET(_logtext "${_logtext}${_description}") 85 | 86 | IF (NOT ${_var}) 87 | IF (${_comments} MATCHES ".*") 88 | SET(_logtext "${_logtext}\n ${_comments}") 89 | ENDIF (${_comments} MATCHES ".*") 90 | # SET(_logtext "${_logtext}\n") #double-space missing features? 91 | ENDIF (NOT ${_var}) 92 | 93 | FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") 94 | 95 | IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3 96 | SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"") 97 | ENDIF(COMMAND SET_PACKAGE_INFO) 98 | 99 | ENDMACRO(MACRO_LOG_FEATURE) 100 | 101 | 102 | MACRO(MACRO_DISPLAY_FEATURE_LOG) 103 | IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3 104 | FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt 105 | WHAT ALL) 106 | ENDIF(COMMAND FEATURE_SUMMARY) 107 | 108 | SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt) 109 | SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) 110 | SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) 111 | 112 | IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) 113 | SET(_printSummary TRUE) 114 | ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile}) 115 | 116 | IF(_printSummary) 117 | SET(_missingDeps 0) 118 | IF (EXISTS ${_enabledFile}) 119 | FILE(READ ${_enabledFile} _enabled) 120 | FILE(REMOVE ${_enabledFile}) 121 | SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}") 122 | ENDIF (EXISTS ${_enabledFile}) 123 | 124 | 125 | IF (EXISTS ${_disabledFile}) 126 | SET(_missingDeps 1) 127 | FILE(READ ${_disabledFile} _disabled) 128 | FILE(REMOVE ${_disabledFile}) 129 | SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}") 130 | ENDIF (EXISTS ${_disabledFile}) 131 | 132 | 133 | IF (EXISTS ${_missingFile}) 134 | SET(_missingDeps 1) 135 | FILE(READ ${_missingFile} _requirements) 136 | SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}") 137 | FILE(REMOVE ${_missingFile}) 138 | SET(_haveMissingReq 1) 139 | ENDIF (EXISTS ${_missingFile}) 140 | 141 | 142 | IF (NOT ${_missingDeps}) 143 | SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.") 144 | ENDIF (NOT ${_missingDeps}) 145 | 146 | 147 | MESSAGE(${_summary}) 148 | MESSAGE("-----------------------------------------------------------------------------\n") 149 | 150 | 151 | IF(_haveMissingReq) 152 | MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") 153 | ENDIF(_haveMissingReq) 154 | 155 | ENDIF(_printSummary) 156 | 157 | ENDMACRO(MACRO_DISPLAY_FEATURE_LOG) 158 | -------------------------------------------------------------------------------- /config.h.cmake: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | #define KCM_GRUB2_VERSION "@KCM_GRUB2_VERSION@" 5 | 6 | #define HAVE_IMAGEMAGICK @HAVE_IMAGEMAGICK@ 7 | #define HAVE_HD @HAVE_HD@ 8 | #define HAVE_QAPT @HAVE_QAPT@ 9 | #define HAVE_QPACKAGEKIT @HAVE_QPACKAGEKIT@ 10 | 11 | #define GRUB_INSTALL_EXE "@GRUB_INSTALL_EXE@" 12 | #define GRUB_MKCONFIG_EXE "@GRUB_MKCONFIG_EXE@" 13 | #define GRUB_PROBE_EXE "@GRUB_PROBE_EXE@" 14 | #define GRUB_SET_DEFAULT_EXE "@GRUB_SET_DEFAULT_EXE@" 15 | #define GRUB_MAKE_PASSWD_EXE "@GRUB_MAKE_PASSWD_EXE@" 16 | #define GRUB_MENU "@GRUB_MENU@" 17 | #define GRUB_MENU_CUSTOM "@GRUB_MENU_CUSTOM@" 18 | #define GRUB_CONFIG "@GRUB_CONFIG@" 19 | #define GRUB_ENV "@GRUB_ENV@" 20 | #define GRUB_MEMTEST "@GRUB_MEMTEST@" 21 | #define GRUB_CONFIGDIR "@GRUB_CONFIGDIR@/" 22 | #define GRUB_SECURITY "@GRUB_SECURITY@" 23 | #define GRUB_RMECHO "@GRUB_RMECHO@" 24 | 25 | enum actionType { 26 | actionLoad, 27 | actionProbe, 28 | actionProbevbe 29 | }; 30 | 31 | enum GrubFile { 32 | GrubMenuFile, 33 | GrubConfigurationFile, 34 | GrubEnvironmentFile, 35 | GrubMemtestFile, 36 | GrubGroupFile, 37 | GrubCustomEntryFile 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /other/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Install 2 | install(FILES kcm_grub2.desktop DESTINATION ${SERVICES_INSTALL_DIR}) 3 | install(FILES grub2-editor.svg DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps) 4 | install(FILES kcm-grub2-languages DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME}/config RENAME languages) 5 | -------------------------------------------------------------------------------- /other/grub2-editor.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 48 | 50 | 52 | 56 | 60 | 61 | 69 | 70 | 80 | 84 | 87 | 92 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /other/kcm-grub2-languages: -------------------------------------------------------------------------------- 1 | en_US.UTF-8 2 | English 3 | ru_RU.UTF-8 4 | Русский 5 | ast_ES.UTF-8 6 | Asturianu 7 | ca_ES.UTF-8 8 | català 9 | da_DK.UTF-8 10 | dansk 11 | de_CH.UTF-8 12 | Schwyzerdütsch 13 | de_DE.UTF-8 14 | Deutsch 15 | eo_XX.UTF-8 16 | Esperanto 17 | fi_FI.UTF-8 18 | suomi 19 | fr_FR.UTF-8 20 | français 21 | hu.UTF-8 22 | magyar 23 | id_ID.UTF-8 24 | Bahasa Indonesia 25 | it_IT.UTF-8 26 | italiano 27 | ja_JP.UTF-8 28 | 日本語 29 | nl_NL.UTF-8 30 | Nederlands 31 | pa_IN.UTF-8 32 | ﺏﺎﺠﻨﭘ 33 | pl.UTF-8 34 | polszczyzna 35 | sv_SE.UTF-8 36 | Svenska 37 | uk_UA.UTF-8 38 | Українська 39 | vi_VN.UTF-8 40 | tiếng việt 41 | zh_CN.UTF-8 42 | 简体中文 43 | zh_TW.UTF-8 44 | 繁體中文 45 | -------------------------------------------------------------------------------- /other/kcm_grub2.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Icon=grub2-editor 3 | Type=Service 4 | X-KDE-ServiceTypes=KCModule 5 | Exec=kcmshell5 kcm_grub2 6 | 7 | X-KDE-Library=kcm_grub2 8 | X-KDE-ParentApp=kcontrol 9 | 10 | X-KDE-System-Settings-Parent-Category=session 11 | 12 | Name=GRUB2 Bootloader 13 | Name[bs]=GRUB2 pokretač sistemar 14 | Name[ca]=Gestor d'arrencada Grub2 15 | Name[ca@valencia]=Gestor d'arrencada Grub2 16 | Name[cs]=Zavaděč GRUB2 17 | Name[da]=GRUB2 Bootloader 18 | Name[de]=GRUB2-Bootloader 19 | Name[el]=GRUB2 Bootloader 20 | Name[es]=Cargador de arranque GRUB2 21 | Name[et]=GRUB2 alglaadur 22 | Name[fi]=GRUB2-käynnistyslatain 23 | Name[fr]=Chargeur d'amorçage GRUB2 24 | Name[ga]=Luchtóir Tosaithe GRUB2 25 | Name[gl]=Cargador de arrinque GRUB2 26 | Name[hu]=GRUB2 rendszerbetöltő 27 | Name[it]=Bootloader GRUB2 28 | Name[lt]=GRUB2 įkrovos tvarkyklė 29 | Name[mr]=GRUB2 बूटलोडर 30 | Name[nb]=GRUB2 oppstartslaster 31 | Name[nds]=Systeemstarter Grub2 32 | Name[nl]=GRUB2 bootloader 33 | Name[pa]=GRUB2 ਬੂਟ-ਲੋਡਰ 34 | Name[pl]=Program rozruchowy GRUB2 35 | Name[pt]=Gestor de Arranque GRUB2 36 | Name[pt_BR]=Gerenciador de Inicialização GRUB2 37 | Name[ro]=Încărcătorul GRUB2 38 | Name[ru]=Загрузчик GRUB2 39 | Name[sk]=Bootloader GRUB2 40 | Name[sl]=Zagonski nalagalnik GRUB2 41 | Name[sv]=GRUB2 startprogram 42 | Name[tr]=GRUB2 Önyükleyici 43 | Name[ug]=Grub2 سىستېما باشلىغۇچ 44 | Name[uk]=Завантажувач GRUB2 45 | Name[x-test]=xxGRUB2 Bootloaderxx 46 | Name[zh_CN]=GRUB2 启动加载器 47 | Name[zh_TW]=GRUB2 開機載入器 48 | Comment=Customize the GRUB2 bootloader 49 | Comment[ca]=Personalitza el gestor d'arrencada Grub2 50 | Comment[ca@valencia]=Personalitza el gestor d'arrencada Grub2 51 | Comment[cs]=Upravit zavaděč GRUB2 52 | Comment[da]=Tilpas GRUB2-bootloaderen 53 | Comment[de]=GRUB2-Bootloader einrichten 54 | Comment[el]=Προσαρμογή του προγράμματος εκκίνησης GRUB2 55 | Comment[es]=Personalizar el cargador de arranque de GRUB2 56 | Comment[et]=GRUB2 alglaaduri kohandamine 57 | Comment[fi]=GRUB2-käynnistyslataimen asetukset 58 | Comment[fr]=Personnalise le chargeur d'amorçage GRUB2 59 | Comment[ga]=Saincheap luchtóir tosaithe GRUB2 60 | Comment[gl]=Personalizar o cargador de arrinque GRUB2 61 | Comment[hu]=A GRUB2 rendszerbetöltő testreszabása 62 | Comment[it]=Configura il bootloader GRUB2 63 | Comment[lt]=Prisitaikyti GRUB2 įkrovos tvarkyklę 64 | Comment[mr]=GRUB2 बूटलोडर मध्ये ऐच्छिक बदल करा 65 | Comment[nb]=Tilpass GRUB2 oppstartslaster 66 | Comment[nds]=Systeemstarter Grub2 topassen 67 | Comment[nl]=De GRUB2-bootloader aanpassen 68 | Comment[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਨੂੰ ਕਸਟਮਾਈਜ਼ ਕਰੋ 69 | Comment[pl]=Dostosuj program rozruchowy GRUB2 70 | Comment[pt]=Personalizar o gestor de arranque GRUB2 71 | Comment[pt_BR]=Personalize o gerenciador de inicialização GRUB2 72 | Comment[ro]=Personalizează încărcătorul GRUB2 73 | Comment[ru]=Настройка загрузчика GRUB2 74 | Comment[sk]=Prispôsobiť bootloader GRUB2 75 | Comment[sl]=Prilagodite zagonski nalagalnik GRUB2 76 | Comment[sv]=Anpassa GRUB2 startprogram 77 | Comment[tr]=GRUB2 önyükleyiciyi özelleştirin 78 | Comment[ug]=Grub2 سىستېما باشلىغۇچنى ئۆزلەشتۈرۈش 79 | Comment[uk]=Налаштування завантажувача GRUB2 80 | Comment[x-test]=xxCustomize the GRUB2 bootloaderxx 81 | Comment[zh_TW]=自訂 GRUB2 開機載入器 82 | Comment[zh_CN]=自定义 GRUB2 启动加载器 83 | X-KDE-Keywords=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader 84 | X-KDE-Keywords[ca]=grub,arrencada,menú,entrades,omissió,temps d'expiració,contrasenya,color,benvinguda,imatge,carregador d'arrencada 85 | X-KDE-Keywords[ca@valencia]=grub,arrencada,menú,entrades,omissió,temps d'expiració,contrasenya,color,benvinguda,imatge,carregador d'arrencada 86 | X-KDE-Keywords[cs]=grub,boot,nabídka,položky,výchozí,timeout,heslo,barva,splash,obrázek,bootloader 87 | X-KDE-Keywords[da]=grub,boot,menu,indgange,standard,timeout,tidsudløb,adgangskode,farve,splash,billed,bootloader 88 | X-KDE-Keywords[de]=Grub,Boot,Menü,Einträge,Standard,Zeitüberschreitung,Passwort,Farbe,Image,Bootloader 89 | X-KDE-Keywords[el]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader 90 | X-KDE-Keywords[es]=grub,arranque,menú,entradas,predeterminado,tiempo,contraseña,color,splash,imagen,cargador de arranque 91 | X-KDE-Keywords[et]=grub,alglaadimine,buutimine,kirjed,vaikimisi,aegumine,parool,värv,tiitelkuva,pilt,alglaadur 92 | X-KDE-Keywords[fi]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader,valikko,valinnat,oletus,aikakatkaisu,salasana,väri,käynnistyslataaja,käynnistyslatain 93 | 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 94 | 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 95 | X-KDE-Keywords[gl]=grub,arrinque,menú,entradas,por defecto,tempo de espera,contrasinal,cor,pantalla,imaxe,cargador de arrinque 96 | 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ő 97 | X-KDE-Keywords[it]=grub,boot,menu,voci,predefinito,scadenza,password,colore,splash,immagine,bootloader 98 | X-KDE-Keywords[lt]=grub,įkėlimas,meniu,Įrašai,numatyta,laikas,slaptažodis,spalva,splash,atvaizdis,paleidimas 99 | X-KDE-Keywords[mr]=ग्रब, बूट, मेन्यू, नोंदी, मूलभूत, टाइमआउट, गुप्तशब्द, रंग, स्प्लॅश, प्रतिमा, बूटलोडर 100 | X-KDE-Keywords[nb]=grub,oppstart,meny,oppføringer,standard,tidsavbrudd,passord,farge,velkomst,bilde,oppstartslaster 101 | X-KDE-Keywords[nl]=grub,boot,menu,items,standaard,timeout,wachtwoord,kleur,splash,afbeelding,bootloader 102 | X-KDE-Keywords[pl]=grub,uruchamianie,menu,wpisy,domyślne,czas oczekiwania,hasło,kolor,ekran powitalny,obraz,bootloader 103 | X-KDE-Keywords[pt]=grub,arranque,menu,itens,predefinido,tempo-limite,senha,cor,ecrã inicial,imagem,gestor de arranque 104 | X-KDE-Keywords[pt_BR]=grub,inicialização,menu,entradas,padrão,tempo de espera,senha,boot,cor,splash,imagem,carregador de inicialização 105 | X-KDE-Keywords[ro]=grub,încărcare,demarare,boot,meniu,implicit,temporizare,parolă,culori,imagine,încărcător 106 | X-KDE-Keywords[ru]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader,загрузка,загрузчик,пароль,меню,ядра,образ,приветствие,цвета,время ожидания 107 | X-KDE-Keywords[sk]=grub,boot,menu,položky,predvolené,timeout,heslo,farba,splash,obrázok,zavádzač 108 | X-KDE-Keywords[sl]=grub,zagon,meni,vnosi,privzeto,časovna omejitev,geslo,barva,pozdravni zaslon,slika,zagonski nalagalnik 109 | X-KDE-Keywords[sv]=grub,start,meny,alternativ,förval,tidsgräns,lösenord,färg,startskärm,bild,startprogram 110 | X-KDE-Keywords[tr]=grub,önyükleme,menü,girdiler,öntanımlı,zaman aşımı,parola,renk,açılış,görüntüsü,ön yükleyici 111 | X-KDE-Keywords[uk]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader,завантаження,меню,записи,типовий,час очікування,тайм-аут,пароль,паролі,колір,кольори,вітання,вікно,зображення,завантажувач 112 | X-KDE-Keywords[x-test]=xxgrub,boot,menu,entries,default,timeout,password,color,splash,image,bootloaderxx 113 | X-KDE-Keywords[zh_TW]=grub,boot,menu,entries,default,timeout,password,color,splash,image,bootloader 114 | Categories=Qt;KDE;X-KDE-settings-system; 115 | -------------------------------------------------------------------------------- /po/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory( ca ) 2 | add_subdirectory( ca@valencia ) 3 | add_subdirectory( cs ) 4 | add_subdirectory( da ) 5 | add_subdirectory( de ) 6 | add_subdirectory( el ) 7 | add_subdirectory( es ) 8 | add_subdirectory( et ) 9 | add_subdirectory( fi ) 10 | add_subdirectory( fr ) 11 | add_subdirectory( ga ) 12 | add_subdirectory( gl ) 13 | add_subdirectory( hu ) 14 | add_subdirectory( it ) 15 | add_subdirectory( lt ) 16 | add_subdirectory( nb ) 17 | add_subdirectory( nl ) 18 | add_subdirectory( pa ) 19 | add_subdirectory( pl ) 20 | add_subdirectory( pt ) 21 | add_subdirectory( pt_BR ) 22 | add_subdirectory( ro ) 23 | add_subdirectory( ru ) 24 | add_subdirectory( sk ) 25 | add_subdirectory( sl ) 26 | add_subdirectory( sv ) 27 | add_subdirectory( tr ) 28 | add_subdirectory( uk ) 29 | add_subdirectory( zh_CN ) 30 | add_subdirectory( zh_TW ) 31 | -------------------------------------------------------------------------------- /po/ca/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( ca ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/ca@valencia/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( ca@valencia ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/cs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( cs ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/da/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( da ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/de/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( de ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/el/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( el ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/es/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( es ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/et/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( et ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/fi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( fi ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/fr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( fr ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/ga/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( ga ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/gl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( gl ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/hu/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( hu ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/it/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( it ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/lt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( lt ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/nb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( nb ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/nl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( nl ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/pa/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( pa ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/pl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( pl ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/pt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( pt ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/pt_BR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( pt_BR ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/ro/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( ro ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/ru/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( ru ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/sk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( sk ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/sl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( sl ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/sv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( sv ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/tr/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( tr ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/uk/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( uk ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/zh_CN/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( zh_CN ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /po/zh_TW/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB _po_files *.po ) 2 | GETTEXT_PROCESS_PO_FILES( zh_TW ALL INSTALL_DESTINATION ${LOCALE_INSTALL_DIR} PO_FILES ${_po_files} ) 3 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maz-1/grub2-editor/2f7de2ce74e8f92107c26efdfad90d9cdbcb9a06/screenshot.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(helper) 2 | 3 | # Set Include Directories 4 | # set(kcm_grub2_INCLUDE_DIRS ${KDE4_INCLUDES}) 5 | if(HAVE_IMAGEMAGICK) 6 | set(kcm_grub2_INCLUDE_DIRS ${kcm_grub2_INCLUDE_DIRS} ${ImageMagick_INCLUDE_DIRS}) 7 | endif(HAVE_IMAGEMAGICK) 8 | 9 | # Set Sources 10 | set(kcm_grub2_SRCS common.cpp entry.cpp installDlg.cpp userDlg.cpp groupDlg.cpp kcm_grub2.cpp widgets/regexpinputdialog.cpp) 11 | ki18n_wrap_ui(kcm_grub2_SRCS ../ui/installDlg.ui ../ui/groupDlg.ui ../ui/userDlg.ui ../ui/kcm_grub2.ui) 12 | if(HAVE_IMAGEMAGICK) 13 | set(kcm_grub2_SRCS ${kcm_grub2_SRCS} convertDlg.cpp) 14 | ki18n_wrap_ui(kcm_grub2_SRCS ../ui/convertDlg.ui) 15 | endif(HAVE_IMAGEMAGICK) 16 | if(HAVE_QAPT OR HAVE_QPACKAGEKIT) 17 | set(kcm_grub2_SRCS ${kcm_grub2_SRCS} removeDlg.cpp) 18 | ki18n_wrap_ui(kcm_grub2_SRCS ../ui/removeDlg.ui) 19 | endif(HAVE_QAPT OR HAVE_QPACKAGEKIT) 20 | if(HAVE_QAPT) 21 | set(kcm_grub2_SRCS ${kcm_grub2_SRCS} qaptBackend.cpp) 22 | elseif(HAVE_QPACKAGEKIT) 23 | set(kcm_grub2_SRCS ${kcm_grub2_SRCS} qPkBackend.cpp) 24 | endif(HAVE_QAPT) 25 | 26 | # Set Link Libraries 27 | set(kcm_grub2_LINK_LIBS 28 | Qt5::Widgets 29 | KF5::ConfigWidgets 30 | KF5::KIOWidgets 31 | KF5::I18n 32 | KF5::Auth 33 | KF5::Solid 34 | #qca-qt5 35 | ) 36 | if(HAVE_IMAGEMAGICK) 37 | set(kcm_grub2_LINK_LIBS ${kcm_grub2_LINK_LIBS} ${ImageMagick_LIBRARIES}) 38 | endif(HAVE_IMAGEMAGICK) 39 | if(HAVE_QAPT) 40 | set(kcm_grub2_LINK_LIBS ${kcm_grub2_LINK_LIBS} QApt::Main) 41 | elseif(HAVE_QPACKAGEKIT) 42 | set(kcm_grub2_LINK_LIBS ${kcm_grub2_LINK_LIBS} ${PackageKitQt5_LIBRARIES}) 43 | endif(HAVE_QAPT) 44 | 45 | # Definitions 46 | if(HAVE_IMAGEMAGICK) 47 | add_definitions(${KDE_ENABLE_EXCEPTIONS}) 48 | endif(HAVE_IMAGEMAGICK) 49 | 50 | # Build & Link 51 | include_directories(${kcm_grub2_INCLUDE_DIRS}) 52 | add_library(kcm_grub2 MODULE ${kcm_grub2_SRCS}) 53 | target_link_libraries(kcm_grub2 ${kcm_grub2_LINK_LIBS}) 54 | 55 | # Install 56 | install(TARGETS kcm_grub2 DESTINATION ${PLUGIN_INSTALL_DIR}) 57 | -------------------------------------------------------------------------------- /src/common.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "common.h" 20 | 21 | //Qt 22 | #include 23 | 24 | //KDE 25 | #include 26 | #include 27 | 28 | QString quoteWord(const QString &word) 29 | { 30 | return !word.startsWith('`') || !word.endsWith('`') ? KShell::quoteArg(word.simplified()) : word.simplified(); 31 | } 32 | QString unquoteWord(const QString &word) 33 | { 34 | KProcess echo; 35 | echo.setShellCommand(QString("echo -n %1").arg(word)); 36 | echo.setOutputChannelMode(KProcess::OnlyStdoutChannel); 37 | if (echo.execute() == 0) { 38 | return QString::fromLocal8Bit(echo.readAllStandardOutput()); 39 | } 40 | 41 | QChar ch; 42 | QString quotedWord = word, unquotedWord; 43 | QTextStream stream("edWord, QIODevice::ReadOnly | QIODevice::Text); 44 | while (!stream.atEnd()) { 45 | stream >> ch; 46 | if (ch == '\'') { 47 | while (true) { 48 | if (stream.atEnd()) { 49 | return QString(); 50 | } 51 | stream >> ch; 52 | if (ch == '\'') { 53 | return unquotedWord; 54 | } else { 55 | unquotedWord.append(ch); 56 | } 57 | } 58 | } else if (ch == '"') { 59 | while (true) { 60 | if (stream.atEnd()) { 61 | return QString(); 62 | } 63 | stream >> ch; 64 | if (ch == '\\') { 65 | if (stream.atEnd()) { 66 | return QString(); 67 | } 68 | stream >> ch; 69 | switch (ch.toLatin1()) { 70 | case '$': 71 | case '"': 72 | case '\\': 73 | unquotedWord.append(ch); 74 | break; 75 | case '\n': 76 | unquotedWord.append(' '); 77 | break; 78 | default: 79 | unquotedWord.append('\\').append(ch); 80 | break; 81 | } 82 | } else if (ch == '"') { 83 | return unquotedWord; 84 | } else { 85 | unquotedWord.append(ch); 86 | } 87 | } 88 | } else { 89 | while (true) { 90 | if (ch == '\\') { 91 | if (stream.atEnd()) { 92 | return unquotedWord; 93 | } 94 | stream >> ch; 95 | switch (ch.toLatin1()) { 96 | case '\n': 97 | break; 98 | default: 99 | unquotedWord.append(ch); 100 | break; 101 | } 102 | } else if (ch.isSpace()) { 103 | return unquotedWord; 104 | } else { 105 | unquotedWord.append(ch); 106 | } 107 | if (stream.atEnd()) { 108 | return unquotedWord; 109 | } 110 | stream >> ch; 111 | } 112 | } 113 | } 114 | return QString(); 115 | } 116 | -------------------------------------------------------------------------------- /src/common.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef COMMON_H 19 | #define COMMON_H 20 | 21 | //Qt 22 | class QString; 23 | 24 | QString quoteWord(const QString &word); 25 | QString unquoteWord(const QString &word); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/convertDlg.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "convertDlg.h" 20 | 21 | //KDE 22 | #include 23 | //#include 24 | //Qt 25 | #include 26 | #include 27 | #include 28 | #include 29 | //ImageMagick 30 | #include 31 | 32 | //Ui 33 | #include "ui_convertDlg.h" 34 | 35 | ConvertDialog::ConvertDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags) 36 | { 37 | QWidget *widget = new QWidget(this); 38 | ui = new Ui::ConvertDialog; 39 | ui->setupUi(widget); 40 | QVBoxLayout *mainLayout = new QVBoxLayout; 41 | setLayout(mainLayout); 42 | mainLayout->addWidget(widget); 43 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 44 | mainLayout->addWidget(buttonBox); 45 | buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); 46 | buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); 47 | connect(buttonBox, SIGNAL(accepted()), this, SLOT(SlotOkButtonClicked())); 48 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); 49 | 50 | QMimeDatabase db; 51 | QString readFilter; 52 | QList coderList; 53 | coderInfoList(&coderList, Magick::CoderInfo::TrueMatch, Magick::CoderInfo::AnyMatch, Magick::CoderInfo::AnyMatch); 54 | QList::const_iterator it = coderList.constBegin(); 55 | QList::const_iterator end = coderList.constEnd(); 56 | for (; it != end; ++it) { 57 | readFilter.append(QString(" *.%1").arg(QString::fromStdString(it->name()).toLower())); 58 | } 59 | readFilter.remove(0, 1); 60 | readFilter.append('|').append(i18nc("@item:inlistbox", "ImageMagick supported image formats")); 61 | 62 | QString writeFilter = QString("*%1|%5 (%1)\n*%2|%6 (%2)\n*%3 *%4|%7 (%3 %4)").arg(".png", ".tga", ".jpg", ".jpeg", db.mimeTypeForName("image/png").comment(), db.mimeTypeForName("image/x-tga").comment(), db.mimeTypeForName("image/jpeg").comment()); 63 | 64 | ui->kurlrequester_image->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly); 65 | ui->kurlrequester_image->setAcceptMode(QFileDialog::AcceptOpen); 66 | ui->kurlrequester_image->setFilter(readFilter); 67 | ui->kurlrequester_converted->setMode(KFile::File | KFile::LocalOnly); 68 | ui->kurlrequester_converted->setAcceptMode(QFileDialog::AcceptSave); 69 | ui->kurlrequester_converted->setFilter(writeFilter); 70 | } 71 | ConvertDialog::~ConvertDialog() 72 | { 73 | delete ui; 74 | } 75 | 76 | void ConvertDialog::setResolution(int width, int height) 77 | { 78 | if (width > 0 && height > 0) { 79 | ui->spinBox_width->setValue(width); 80 | ui->spinBox_height->setValue(height); 81 | } 82 | } 83 | 84 | void ConvertDialog::slotOkButtonClicked() 85 | { 86 | QRegularExpression getdirectory("\\S*/"); 87 | 88 | if (ui->kurlrequester_image->text().isEmpty() || ui->kurlrequester_converted->text().isEmpty()) { 89 | KMessageBox::information(this, i18nc("@info", "Please fill in both Image and Convert To fields.")); 90 | return; 91 | } else if (ui->spinBox_width->value() == 0 || ui->spinBox_height->value() == 0) { 92 | KMessageBox::information(this, i18nc("@info", "Please fill in both Width and Height fields.")); 93 | return; 94 | } else if (!QFileInfo(getdirectory.match(ui->kurlrequester_converted->url().toLocalFile()).captured(1)).isWritable()) { 95 | KMessageBox::information(this, i18nc("@info", "You do not have write permissions in this directory, please select another destination.")); 96 | return; 97 | } 98 | Magick::Geometry resolution(ui->spinBox_width->value(), ui->spinBox_height->value()); 99 | resolution.aspect(ui->checkBox_force->isChecked()); 100 | Magick::Image image(ui->kurlrequester_image->url().toLocalFile().toStdString()); 101 | image.zoom(resolution); 102 | image.depth(8); 103 | image.classType(Magick::DirectClass); 104 | image.write(ui->kurlrequester_converted->url().toLocalFile().toStdString()); 105 | if (ui->checkBox_wallpaper->isChecked()) { 106 | emit splashImageCreated(ui->kurlrequester_converted->url().toLocalFile()); 107 | } 108 | this->accept(); 109 | } 110 | -------------------------------------------------------------------------------- /src/convertDlg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef CONVERTDLG_H 19 | #define CONVERTDLG_H 20 | 21 | //Qt 22 | #include 23 | 24 | //Ui 25 | namespace Ui 26 | { 27 | class ConvertDialog; 28 | } 29 | 30 | class ConvertDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit ConvertDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); 35 | virtual ~ConvertDialog(); 36 | 37 | void setResolution(int width, int height); 38 | protected Q_SLOTS: 39 | virtual void slotOkButtonClicked(); 40 | Q_SIGNALS: 41 | void splashImageCreated(const QString &splashImage); 42 | private: 43 | Ui::ConvertDialog *ui; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/entry.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "entry.h" 20 | 21 | //Project 22 | #include "common.h" 23 | 24 | Entry::Entry(const QString &strTitle, int numTitle, Entry::Type type, int level) 25 | { 26 | m_title.str = strTitle; 27 | m_title.num = numTitle; 28 | m_type = type; 29 | m_level = level; 30 | } 31 | 32 | Entry::Title Entry::title() const 33 | { 34 | return m_title; 35 | } 36 | QString Entry::prettyTitle() const 37 | { 38 | return unquoteWord(m_title.str); 39 | } 40 | QString Entry::fullTitle() const 41 | { 42 | QString fullTitle; 43 | Q_FOREACH(const Entry::Title &ancestor, m_ancestors) { 44 | fullTitle += unquoteWord(ancestor.str) += '>'; 45 | } 46 | return fullTitle + unquoteWord(m_title.str); 47 | } 48 | QString Entry::fullNumTitle() const 49 | { 50 | QString fullNumTitle; 51 | Q_FOREACH(const Entry::Title &ancestor, m_ancestors) { 52 | fullNumTitle += QString::number(ancestor.num) += '>'; 53 | } 54 | return fullNumTitle + QString::number(m_title.num); 55 | } 56 | Entry::Type Entry::type() const 57 | { 58 | return m_type; 59 | } 60 | int Entry::level() const 61 | { 62 | return m_level; 63 | } 64 | QList Entry::ancestors() const 65 | { 66 | return m_ancestors; 67 | } 68 | QString Entry::kernel() const 69 | { 70 | return m_kernel; 71 | } 72 | 73 | void Entry::setTitle(const Entry::Title &title) 74 | { 75 | m_title = title; 76 | } 77 | void Entry::setTitle(const QString &strTitle, int numTitle) 78 | { 79 | m_title.str = strTitle; 80 | m_title.num = numTitle; 81 | } 82 | void Entry::setType(Entry::Type type) 83 | { 84 | m_type = type; 85 | } 86 | void Entry::setLevel(int level) 87 | { 88 | m_level = level; 89 | } 90 | void Entry::setAncestors(const QList &ancestors) 91 | { 92 | m_ancestors = ancestors; 93 | } 94 | void Entry::setKernel(const QString &kernel) 95 | { 96 | m_kernel = kernel; 97 | } 98 | 99 | void Entry::clear() 100 | { 101 | m_title.str.clear(); 102 | m_title.num = -1; 103 | m_type = Entry::Invalid; 104 | m_level = -1; 105 | m_ancestors.clear(); 106 | m_kernel.clear(); 107 | } 108 | -------------------------------------------------------------------------------- /src/entry.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef ENTRY_H 19 | #define ENTRY_H 20 | 21 | //Qt 22 | #include 23 | #include 24 | 25 | class Entry 26 | { 27 | public: 28 | struct Title { 29 | QString str; 30 | int num; 31 | }; 32 | enum Type { 33 | Invalid, 34 | Menuentry, 35 | Submenu 36 | }; 37 | 38 | explicit Entry(const QString &strTitle = QString(), int numTitle = -1, Entry::Type type = Entry::Invalid, int level = -1); 39 | 40 | Entry::Title title() const; 41 | QString prettyTitle() const; 42 | QString fullTitle() const; 43 | QString fullNumTitle() const; 44 | Entry::Type type() const; 45 | int level() const; 46 | QList ancestors() const; 47 | QString kernel() const; 48 | 49 | void setTitle(const Entry::Title &title); 50 | void setTitle(const QString &strTitle, int numTitle); 51 | void setType(Entry::Type type); 52 | void setLevel(int level); 53 | void setAncestors(const QList &ancestors); 54 | void setKernel(const QString &kernel); 55 | 56 | void clear(); 57 | private: 58 | Entry::Title m_title; 59 | Entry::Type m_type; 60 | int m_level; 61 | QList m_ancestors; 62 | QString m_kernel; 63 | }; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/groupDlg.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "groupDlg.h" 20 | 21 | //KDE 22 | #include 23 | //Qt 24 | #include 25 | #include 26 | //Ui 27 | #include "ui_groupDlg.h" 28 | //Strange, not included by KActionSelector 29 | #include 30 | 31 | GroupDialog::GroupDialog(QWidget *parent, QString groupName, QStringList allUsers, QStringList usersInGroup, bool Locked, Qt::WindowFlags flags) : QDialog(parent, flags) 32 | { 33 | resize(parent->size().width(), parent->size().height() / 2); 34 | this->setWindowTitle(i18nc("@title:window", "Edit Group %1", groupName)); 35 | QWidget *widget = new QWidget(this); 36 | ui = new Ui::GroupDialog; 37 | ui->setupUi(widget); 38 | QVBoxLayout *mainLayout = new QVBoxLayout; 39 | setLayout(mainLayout); 40 | mainLayout->addWidget(widget); 41 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 42 | mainLayout->addWidget(buttonBox); 43 | buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); 44 | buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); 45 | connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOkButtonClicked())); 46 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); 47 | //initialize users list 48 | ui->userSelector->setEnabled(Locked); 49 | ui->checkbox_locked->setCheckState(Locked ? Qt::Checked : Qt::Unchecked); 50 | m_selectedUsers.clear(); 51 | m_unselectedUsers.clear(); 52 | for (int i=0; iuserSelector->availableListWidget()->clear(); 59 | ui->userSelector->availableListWidget()->addItems(m_unselectedUsers); 60 | ui->userSelector->selectedListWidget()->clear(); 61 | ui->userSelector->selectedListWidget()->addItems(m_selectedUsers); 62 | 63 | connect(ui->checkbox_locked, SIGNAL(toggled(bool)), this, SLOT(slotTriggerLocked(bool))); 64 | 65 | } 66 | GroupDialog::~GroupDialog() 67 | { 68 | delete ui; 69 | } 70 | 71 | 72 | void GroupDialog::slotOkButtonClicked() 73 | { 74 | //if (ui->userSelector->availableListWidget() && ui->userSelector->selectedListWidget()) { 75 | //KMessageBox::sorry(this, i18nc("@info", "Passwords don't match!")); 76 | //return; 77 | //} else { 78 | this->accept(); 79 | //} 80 | } 81 | 82 | void GroupDialog::slotTriggerLocked(bool lockStatus) 83 | { 84 | ui->userSelector->setEnabled(lockStatus); 85 | } 86 | 87 | QStringList GroupDialog::allowedUsers() 88 | { 89 | m_selectedUsers.clear(); 90 | QListWidget *selectedUsersWidget = ui->userSelector->selectedListWidget(); 91 | for (int i=0; icount(); ++i) { 92 | m_selectedUsers.append(selectedUsersWidget->item(i)->text()); 93 | } 94 | return m_selectedUsers; 95 | } 96 | bool GroupDialog::isLocked() { 97 | if (ui->checkbox_locked->checkState() == Qt::Checked) 98 | return true; 99 | else 100 | return false; 101 | } -------------------------------------------------------------------------------- /src/groupDlg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef GROUPDLG_H 19 | #define GROUPDLG_H 20 | 21 | //Qt 22 | #include 23 | 24 | //Ui 25 | namespace Ui 26 | { 27 | class GroupDialog; 28 | } 29 | 30 | class GroupDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit GroupDialog(QWidget *parent = 0, QString userName = QString(), QStringList allUsers = QStringList(), QStringList usersInGroup = QStringList(), bool Locked = true, Qt::WindowFlags flags = 0); 35 | virtual ~GroupDialog(); 36 | QStringList allowedUsers(); 37 | bool isLocked(); 38 | protected Q_SLOTS: 39 | virtual void slotOkButtonClicked(); 40 | virtual void slotTriggerLocked(bool lockStatus); 41 | private: 42 | Ui::GroupDialog *ui; 43 | QStringList m_selectedUsers; 44 | QStringList m_unselectedUsers; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/helper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Set Include Directories 2 | set(kcmgrub2helper_INCLUDE_DIRS ${KDE4_INCLUDES}) 3 | if(HAVE_HD) 4 | set(kcmgrub2helper_INCLUDE_DIRS ${kcmgrub2helper_INCLUDE_DIRS} ${HD_INCLUDE_DIR}) 5 | endif(HAVE_HD) 6 | 7 | # Set Sources 8 | set(kcmgrub2helper_SRCS helper.cpp) 9 | 10 | # Set Link Libraries 11 | set(kcmgrub2helper_LINK_LIBS Qt5::DBus KF5::Auth KF5::I18n) 12 | if(HAVE_HD) 13 | set(kcmgrub2helper_LINK_LIBS ${kcmgrub2helper_LINK_LIBS} ${HD_LIBRARY}) 14 | endif(HAVE_HD) 15 | 16 | # Build & Link 17 | include_directories(${kcmgrub2helper_INCLUDE_DIRS}) 18 | add_executable(kcmgrub2helper ${kcmgrub2helper_SRCS}) 19 | target_link_libraries(kcmgrub2helper ${kcmgrub2helper_LINK_LIBS}) 20 | 21 | # Install 22 | install(PROGRAMS grub_rmecho.sh DESTINATION ${GRUB_CONFIGDIR} RENAME ${GRUB_RMECHO}) 23 | install(TARGETS kcmgrub2helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR}) 24 | kauth_install_helper_files(kcmgrub2helper org.kde.kcontrol.kcmgrub2 root) 25 | kauth_install_actions(org.kde.kcontrol.kcmgrub2 kcmgrub2.actions) 26 | -------------------------------------------------------------------------------- /src/helper/grub_rmecho.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | argument () { 4 | opt=$1 5 | shift 6 | if test $# -eq 0; then 7 | exit 1 8 | fi 9 | echo $1 10 | } 11 | 12 | SCRIPT=$(realpath -s $0) 13 | SCRIPT_ESCAPED=$(echo $SCRIPT|sed -e 's/[\/&]/\\&/g') 14 | PARENT_FULLCMD=$(ps -o args= $PPID) 15 | eval set -- $PARENT_FULLCMD 16 | shift 2 17 | while test $# -gt 0 18 | do 19 | option=$1 20 | shift 21 | 22 | case "$option" in 23 | -o | --output) 24 | grub_cfg=`argument $option "$@"`; shift;; 25 | --output=*) 26 | grub_cfg=`echo "$option" | sed 's/--output=//'` 27 | ;; 28 | -*) 29 | ;; 30 | esac 31 | done 32 | if test -z "$grub_cfg" 33 | then 34 | grub_cfg=$(readlink -f /proc/$PPID/fd/1) 35 | fi 36 | . /etc/default/grub 37 | 38 | if [ "z$GRUB_NOECHO" = "ztrue" ] && test -f $grub_cfg 39 | then 40 | echo "Remove echo commands from \"$grub_cfg\"" >&2 41 | echo "while kill -0 $PPID 2> /dev/null; do sleep 0.2; done;sed -i -E -e '/^\s*echo\s+.*$/d' -e '/^\s*#+\s*BEGIN $SCRIPT_ESCAPED/d' -e '/^\s*#+\s*END $SCRIPT_ESCAPED/d' '$grub_cfg' 2>&1; rm -f /tmp/rmecho.$PPID" >/tmp/rmecho.$PPID 42 | nohup bash /tmp/rmecho.$PPID >/dev/null 2>&1 & 43 | fi 44 | -------------------------------------------------------------------------------- /src/helper/helper.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Krazy 19 | //krazy:excludeall=cpp 20 | 21 | //Own 22 | #include "helper.h" 23 | 24 | //Qt 25 | #include 26 | #include 27 | #include 28 | 29 | //KDE 30 | //#include 31 | #include 32 | #include 33 | 34 | //Project 35 | #include "../config.h" 36 | #if HAVE_HD 37 | #undef slots 38 | #include 39 | #endif 40 | 41 | //The $PATH environment variable is emptied by D-Bus activation, 42 | //so let's provide a sane default. Needed for os-prober to work. 43 | static const QString path = QLatin1String("/usr/sbin:/usr/bin:/sbin:/bin"); 44 | 45 | Helper::Helper() 46 | { 47 | qputenv("PATH", path.toLatin1()); 48 | } 49 | 50 | ActionReply Helper::executeCommand(const QStringList &command, QHash &environment) 51 | { 52 | KProcess process; 53 | process.setProgram(command); 54 | process.setOutputChannelMode(KProcess::MergedChannels); 55 | 56 | if (!environment.isEmpty()) { 57 | QStringList grub_envKeys = environment.keys(); 58 | Q_FOREACH(const QString &envKey, grub_envKeys) { 59 | process.setEnv(envKey, environment.value(envKey)); 60 | } 61 | } 62 | 63 | qDebug() << "Executing" << command.join(" "); 64 | int exitCode = process.execute(); 65 | 66 | ActionReply reply; 67 | if (exitCode != 0) { 68 | reply = ActionReply::HelperErrorReply(); 69 | //TO BE FIXED 70 | reply.setErrorCode(ActionReply::Error::InvalidActionError); 71 | } 72 | reply.addData("command", command); 73 | reply.addData("output", process.readAll()); 74 | return reply; 75 | } 76 | 77 | ActionReply Helper::initialize(QVariantMap args) 78 | { 79 | ActionReply reply; 80 | switch (args.value("actionType").toInt()) { 81 | case actionLoad: 82 | reply = load(args); 83 | break; 84 | case actionProbe: 85 | reply = probe(args); 86 | break; 87 | case actionProbevbe: 88 | reply = probevbe(args); 89 | } 90 | return reply; 91 | } 92 | 93 | ActionReply Helper::executeLongCommand(const QStringList &command, QHash &environment) 94 | { 95 | KProcess process; 96 | process.setProgram(command); 97 | process.setOutputChannelMode(KProcess::MergedChannels); 98 | 99 | if (!environment.isEmpty()) { 100 | QStringList grub_envKeys = environment.keys(); 101 | Q_FOREACH(const QString &envKey, grub_envKeys) { 102 | process.setEnv(envKey, environment.value(envKey)); 103 | } 104 | } 105 | 106 | qDebug() << "Executing" << command.join(" "); 107 | process.start(); 108 | bool finished = false; HelperSupport::progressStep(0); int i=0; 109 | do { 110 | finished = process.waitForFinished(10000); 111 | 112 | HelperSupport::progressStep(i++); 113 | 114 | } while(!finished); 115 | 116 | int exitCode = process.exitCode(); 117 | 118 | ActionReply reply; 119 | if (exitCode != 0) { 120 | reply = ActionReply::HelperErrorReply(); 121 | reply.setErrorCode(ActionReply::Error::InvalidActionError); 122 | } 123 | reply.addData("command", command); 124 | reply.addData("output", process.readAll()); 125 | return reply; 126 | } 127 | 128 | ActionReply Helper::defaults(QVariantMap args) 129 | { 130 | Q_UNUSED(args) 131 | //Disable security 132 | QString filePath(QString(GRUB_CONFIGDIR)+QString(GRUB_SECURITY)); 133 | QFile::Permissions permissions = QFile::permissions(filePath); 134 | permissions &= ~(QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther); 135 | QFile::setPermissions(filePath, permissions); 136 | 137 | ActionReply reply; 138 | QString configFileName = GRUB_CONFIG; 139 | QString originalConfigFileName = configFileName + ".original"; 140 | 141 | if (!QFile::exists(originalConfigFileName)) { 142 | reply = ActionReply::HelperErrorReply(); 143 | reply.addData("errorDescription", i18nc("@info", "Original configuration file %1 does not exist.", originalConfigFileName)); 144 | return reply; 145 | } 146 | if (!QFile::remove(configFileName)) { 147 | reply = ActionReply::HelperErrorReply(); 148 | reply.addData("errorDescription", i18nc("@info", "Cannot remove current configuration file %1.", configFileName)); 149 | return reply; 150 | } 151 | if (!QFile::copy(originalConfigFileName, configFileName)) { 152 | reply = ActionReply::HelperErrorReply(); 153 | reply.addData("errorDescription", i18nc("@info", "Cannot copy original configuration file %1 to %2.", originalConfigFileName, configFileName)); 154 | return reply; 155 | } 156 | return reply; 157 | } 158 | ActionReply Helper::install(QVariantMap args) 159 | { 160 | ActionReply reply; 161 | QHash empty_hash; 162 | QString partition = args.value("partition").toString(); 163 | QString mountPoint = args.value("mountPoint").toString(); 164 | bool mbrInstall = args.value("mbrInstall").toBool(); 165 | 166 | if (mountPoint.isEmpty()) { 167 | for (int i = 0; QDir(mountPoint = QString("%1/kcm-grub2-%2").arg(QDir::tempPath(), QString::number(i))).exists(); i++); 168 | if (!QDir().mkpath(mountPoint)) { 169 | reply = ActionReply::HelperErrorReply(); 170 | reply.addData("errorDescription", i18nc("@info", "Failed to create temporary mount point.")); 171 | return reply; 172 | } 173 | ActionReply mountReply = executeCommand(QStringList() << "mount" << partition << mountPoint, empty_hash); 174 | if (mountReply.failed()) { 175 | return mountReply; 176 | } 177 | } 178 | 179 | QStringList grub_installCommand; 180 | grub_installCommand << GRUB_INSTALL_EXE << "--root-directory" << mountPoint; 181 | if (mbrInstall) { 182 | grub_installCommand << partition.remove(QRegExp("\\d+")); 183 | } else { 184 | grub_installCommand << "--force" << partition; 185 | } 186 | return executeCommand(grub_installCommand, empty_hash); 187 | } 188 | ActionReply Helper::load(QVariantMap args) 189 | { 190 | QHash empty_hash; 191 | ActionReply reply; 192 | QString fileName; 193 | switch (args.value("grubFile").toInt()) { 194 | case GrubMenuFile: 195 | fileName = GRUB_MENU; 196 | break; 197 | case GrubConfigurationFile: 198 | fileName = GRUB_CONFIG; 199 | break; 200 | case GrubEnvironmentFile: 201 | fileName = GRUB_ENV; 202 | break; 203 | //Security 204 | case GrubGroupFile: 205 | fileName = GRUB_CONFIGDIR + args.value("groupFile").toString(); 206 | if (args.value("groupFile").toString() == GRUB_SECURITY) { 207 | if (!QFile::exists(fileName)) 208 | executeCommand(QStringList() << "touch" << fileName, empty_hash); 209 | bool security = QFile::exists(fileName); 210 | reply.addData("security", security); 211 | reply.addData("securityOn", (bool)(QFile::permissions(fileName) & (QFile::ExeOwner | QFile::ExeGroup | QFile::ExeOther))); 212 | if (!security) 213 | qDebug() << "Unable to create" << fileName << ", please check file permissions."; 214 | } 215 | break; 216 | case GrubMemtestFile: 217 | bool memtest = QFile::exists(GRUB_MEMTEST); 218 | reply.addData("memtest", memtest); 219 | if (memtest) { 220 | reply.addData("memtestOn", (bool)(QFile::permissions(GRUB_MEMTEST) & (QFile::ExeOwner | QFile::ExeGroup | QFile::ExeOther))); 221 | } 222 | return reply; 223 | } 224 | 225 | QFile file(fileName); 226 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { 227 | reply = ActionReply::HelperErrorReply(); 228 | reply.addData("errorDescription", file.errorString()); 229 | return reply; 230 | } 231 | reply.addData("rawFileContents", file.readAll()); 232 | return reply; 233 | } 234 | ActionReply Helper::probe(QVariantMap args) 235 | { 236 | ActionReply reply; 237 | QHash empty_hash; 238 | QStringList mountPoints = args.value("mountPoints").toStringList(); 239 | 240 | QStringList grubPartitions; 241 | HelperSupport::progressStep(0); 242 | for (int i = 0; i < mountPoints.size(); i++) { 243 | ActionReply grub_probeReply = executeCommand(QStringList() << GRUB_PROBE_EXE << "-t" << "drive" << mountPoints.at(i), empty_hash); 244 | if (grub_probeReply.failed()) { 245 | return grub_probeReply; 246 | } 247 | grubPartitions.append(grub_probeReply.data().value("output").toString().trimmed()); 248 | HelperSupport::progressStep((i + 1) * 100. / mountPoints.size()); 249 | } 250 | 251 | reply.addData("grubPartitions", grubPartitions); 252 | return reply; 253 | } 254 | ActionReply Helper::probevbe(QVariantMap args) 255 | { 256 | Q_UNUSED(args) 257 | ActionReply reply; 258 | 259 | #if HAVE_HD 260 | QStringList gfxmodes; 261 | hd_data_t hd_data; 262 | memset(&hd_data, 0, sizeof(hd_data)); 263 | hd_t *hd = hd_list(&hd_data, hw_framebuffer, 1, NULL); 264 | for (hd_res_t *res = hd->res; res; res = res->next) { 265 | if (res->any.type == res_framebuffer) { 266 | gfxmodes += QString("%1x%2x%3").arg(QString::number(res->framebuffer.width), QString::number(res->framebuffer.height), QString::number(res->framebuffer.colorbits)); 267 | } 268 | } 269 | hd_free_hd_list(hd); 270 | hd_free_hd_data(&hd_data); 271 | reply.addData("gfxmodes", gfxmodes); 272 | #else 273 | reply = ActionReply::HelperErrorReply(); 274 | #endif 275 | 276 | return reply; 277 | } 278 | ActionReply Helper::save(QVariantMap args) 279 | { 280 | ActionReply reply; 281 | QString configFileName = GRUB_CONFIG; 282 | QByteArray rawConfigFileContents = args.value("rawConfigFileContents").toByteArray(); 283 | QByteArray rawDefaultEntry = args.value("rawDefaultEntry").toByteArray(); 284 | QString resultLanguage = args.value("resultLanguage").toString(); 285 | bool memtest = args.value("memtest").toBool(); 286 | bool security = args.value("security").toBool(); 287 | bool noecho = args.value("noecho").toBool(); 288 | 289 | QFile::copy(configFileName, configFileName + ".original"); 290 | 291 | QFile file(configFileName); 292 | if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { 293 | reply = ActionReply::HelperErrorReply(); 294 | reply.addData("errorDescription", file.errorString()); 295 | return reply; 296 | } 297 | file.write(rawConfigFileContents); 298 | file.close(); 299 | 300 | if (args.contains("customEntries")) { 301 | QByteArray rawCustomEntries = args.value("customEntries").toByteArray(); 302 | //qDebug() << customEntries; 303 | QFile file(GRUB_MENU_CUSTOM); 304 | if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { 305 | reply = ActionReply::HelperErrorReply(); 306 | reply.addData("errorDescription", file.errorString()); 307 | return reply; 308 | } 309 | file.write(rawCustomEntries); 310 | file.close(); 311 | } 312 | 313 | if (args.contains("memtest")) { 314 | QFile::Permissions permissions = QFile::permissions(GRUB_MEMTEST); 315 | if (memtest) { 316 | permissions |= (QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther); 317 | } else { 318 | permissions &= ~(QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther); 319 | } 320 | QFile::setPermissions(GRUB_MEMTEST, permissions); 321 | } 322 | 323 | if (args.contains("security")) { 324 | QString filePath(QString(GRUB_CONFIGDIR)+QString(GRUB_SECURITY)); 325 | QFile::Permissions permissions = QFile::permissions(filePath); 326 | if (security) { 327 | permissions |= (QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther); 328 | } else { 329 | permissions &= ~(QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther); 330 | } 331 | QFile::setPermissions(filePath, permissions); 332 | } 333 | 334 | if (args.contains("securityUsers")) { 335 | QByteArray rawUsersFileContents = args.value("securityUsers").toByteArray(); 336 | //qDebug() << rawUsersFileContents; 337 | QFile usersFile(QString(GRUB_CONFIGDIR)+QString(GRUB_SECURITY)); 338 | usersFile.open(QIODevice::WriteOnly | QIODevice::Text); 339 | usersFile.write(rawUsersFileContents); 340 | usersFile.close(); 341 | 342 | } 343 | 344 | if (args.contains("securityGroupsList")) { 345 | QStringList groupFilesList = args.value("securityGroupsList").toString().split("/"); 346 | for ( int i=0; i environment; 369 | 370 | 371 | if(resultLanguage == "") 372 | { 373 | QFile file("/etc/locale.conf"); 374 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { 375 | 376 | 377 | QString configStr = file.readAll(); 378 | 379 | 380 | QString line; 381 | QTextStream stream(&configStr, QIODevice::ReadOnly | QIODevice::Text); 382 | while (!stream.atEnd()) { 383 | line = stream.readLine().trimmed(); 384 | environment[line.section('=', 0, 0)] = line.section('=', 1); 385 | } 386 | 387 | } 388 | 389 | } 390 | else 391 | { 392 | environment["LANG"] = resultLanguage; 393 | environment["LANGUAGE"] = resultLanguage; 394 | } 395 | 396 | ActionReply grub_mkconfigReply = executeLongCommand(QStringList() << GRUB_MKCONFIG_EXE << "-o" << GRUB_MENU, environment); 397 | if (grub_mkconfigReply.failed()) { 398 | return grub_mkconfigReply; 399 | } 400 | 401 | ActionReply grub_set_defaultReply = executeCommand(QStringList() << GRUB_SET_DEFAULT_EXE << rawDefaultEntry, environment); 402 | if (grub_set_defaultReply.failed()) { 403 | return grub_set_defaultReply; 404 | } 405 | 406 | return grub_mkconfigReply; 407 | } 408 | 409 | KAUTH_HELPER_MAIN("org.kde.kcontrol.kcmgrub2", Helper) 410 | -------------------------------------------------------------------------------- /src/helper/helper.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef HELPER_H 19 | #define HELPER_H 20 | //Qt 21 | #include 22 | //KDE 23 | #include 24 | using namespace KAuth; 25 | 26 | class Helper : public QObject 27 | { 28 | Q_OBJECT 29 | public: 30 | Helper(); 31 | private: 32 | ActionReply executeCommand(const QStringList &command, QHash &environment); 33 | ActionReply executeLongCommand(const QStringList &command, QHash &environment); 34 | //merge 35 | ActionReply load(QVariantMap args); 36 | ActionReply probe(QVariantMap args); 37 | ActionReply probevbe(QVariantMap args); 38 | public Q_SLOTS: 39 | ActionReply initialize(QVariantMap args); 40 | ActionReply defaults(QVariantMap args); 41 | ActionReply install(QVariantMap args); 42 | ActionReply save(QVariantMap args); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/helper/kcmgrub2.actions: -------------------------------------------------------------------------------- 1 | [Domain] 2 | Name=GRUB2 Bootloader Control Module 3 | Name[bs]=Kontrolni modul GRUB2 pokretača sistema 4 | Name[ca]=Mòdul de control del gestor d'arrencada Grub2 5 | Name[ca@valencia]=Mòdul de control del gestor d'arrencada Grub2 6 | Name[cs]=Ovládací modul pro zavaděč GRUB2 7 | Name[da]=Kontrolmodul til GRUB2-bootloaderen 8 | Name[de]=Einstellungsmodul für den GRUB2-Bootloader 9 | Name[el]=Άρθρωμα ελέγχου του προγράμματος εκκίνησης GRUB2 10 | Name[es]=Módulo de control del cargador de arranque de GRUB2 11 | Name[et]=GRUB2 alglaaduri seadistusmoodul 12 | Name[fi]=GRUB2-käynnistyslataimen asetusosio 13 | Name[fr]=Module de contrôle du chargeur d'amorçage GRUB2 14 | Name[ga]=Modúl Rialaithe Luchtóir Tosaithe GRUB2 15 | Name[gl]=Módulo de control do cargador de arrinque 16 | Name[hu]=GRUB2 rendszerbetöltő beállítómodul 17 | Name[it]=Modulo di controllo del bootloader GRUB2 18 | Name[lt]=GRUB2 įkrovos tvarkyklės valdymo modulis 19 | Name[mr]=GRUB2 बूटलोडर नियंत्रण विभाग 20 | Name[nb]=Styringsmodul for GRUB2 oppstartslaster 21 | Name[nds]=Kuntrullmoduul för den Systeemstarter Grub2 22 | Name[nl]=Besturingsmodule van GRUB2 bootloader 23 | Name[pa]=GRUB2 ਬੂਟਲੋਡਰ ਕੰਟਰੋਲ ਮੋਡੀਊਲ 24 | Name[pl]=Moduł sterowania dla programu rozruchowego GRUB2 25 | Name[pt]=Módulo de Controlo do Gestor de Arranque GRUB2 26 | Name[pt_BR]=Módulo de Controle do Gerenciador de Inicialização GRUB2 27 | Name[ro]=Modul de control pentru încărcătorul GRUB2 28 | Name[ru]=Модуль настройки загрузчика GRUB2 29 | Name[sk]=Ovládací modul bootloadera GRUB2 30 | Name[sl]=Nadzorni modul zagonskega nalagalnika GRUB2 31 | Name[sv]=Inställningsmodul för GRUB2 startprogram 32 | Name[tr]=GRUB2 Önyükleyici Denetim Modülü 33 | Name[uk]=Модуль керування завантажувачем GRUB2 34 | Name[x-test]=xxGRUB2 Bootloader Control Modulexx 35 | Name[zh_CN]=GRUB2 启动加载器控制模块 36 | Name[zh_TW]=GRUB2 開機載入器控制模組 37 | Icon=system-reboot 38 | 39 | [org.kde.kcontrol.kcmgrub2.defaults] 40 | Name=Restore the default GRUB2 Bootloader settings 41 | Name[bs]=Obnovi uobičajene postavke GRUB2 pokretača sistema 42 | Name[ca]=Restaura l'arranjament per omissió del gestor d'arrencada Grub2 43 | Name[ca@valencia]=Restaura l'arranjament per omissió del gestor d'arrencada Grub2 44 | Name[cs]=Obnovit výchozí nastavení zavaděče GRUB2 45 | Name[da]=Genskab indstillingerne for GRUB2-bootloaderen 46 | Name[de]=GRUB2-Standardeinstellungen wiederherstellen 47 | Name[el]=Επαναφορά των προκαθορισμένων ρυθμίσεων του προγράμματος εκκίνησης GRUB2 48 | Name[es]=Restablecer la configuración predeterminada del cargador de arranque de GRUB2 49 | Name[et]=GRUB2 alglaaduri seadistuste taastamine 50 | Name[fi]=Palauta GRUB2-käynnistyslataimen oletusasetukset 51 | Name[fr]=Restaure les paramètres par défaut du chargeur d'amorçage GRUB2 52 | Name[ga]=Athchóirigh réamhshocruithe Luchtóir Tosaithe GRUB2 53 | Name[gl]=Restaurar as configuracións iniciais do cargador de arrinque GRUB2 54 | Name[hu]=A GRUB2 rendszerbetöltő alapértelmezett beállításainak visszaállítása 55 | Name[it]=Ripristina le impostazioni predefinite del bootloader GRUB2 56 | Name[lt]=Atstatyti numatytus GRUB2 įkrovos tvarkyklės nustatymus 57 | Name[mr]=मूलभूत GRUB2 बूटलोडर संयोजना पुन्हस्थापित करा 58 | Name[nb]=Gjenopprett standard innstillinger for GRUB2 oppstartslaster 59 | Name[nds]=De Standard-Instellen för den Systeemstarter Grub2 wedderherstellen 60 | Name[nl]=De standaard instellingen van de GRUB2 bootloader herstellen 61 | Name[pa]=ਡਿਫਾਲਟ ਗਰਬ2 ਬੂਟਲੋਡਰ ਸੈਟਿੰਗ ਮੁੜ-ਸਟੋਰ ਕਰੋ 62 | Name[pl]=Przywróć domyślne ustawienia programu rozruchowego GRUB2 63 | Name[pt]=Repor a configuração por omissão do gestor de arranque GRUB2 64 | Name[pt_BR]=Restaurar a configuração padrão do gerenciador de inicialização GRUB2 65 | Name[ro]=Restabilește configurările implicite ale încărcătorului GRUB2 66 | Name[ru]=Восстановление параметров по умолчанию для загрузчика GRUB2 67 | Name[sk]=Obnoviť predvolené nastavenia zavádzača GRUB2 68 | Name[sl]=Obnovi privzete nastavitve zagonskega nalagalnika GRUB2 69 | Name[sv]=Återställ standardinställningar för GRUB2 startprogram 70 | Name[tr]=Varsayılan GRUB2 Önyükleyici ayarlarını geri yükle 71 | Name[uk]=Відновлення типових параметрів завантажувача GRUB2 72 | Name[x-test]=xxRestore the default GRUB2 Bootloader settingsxx 73 | Name[zh_CN]=恢复默认的 GRUB2 启动加载器设置 74 | Name[zh_TW]=回覆預設的 GRUB2 開機載入器設定 75 | Description=Administrator authorization is required to restore the default GRUB2 Bootloader settings 76 | Description[bs]=Potrebna je administratorska potvrda za obnovu podrazumijevanihpostavki GRUB2 pokretača sistema 77 | Description[ca]=Es requereix autorització de l'administrador per a restaurar l'arranjament del gestor d'arrencada Grub2 78 | Description[ca@valencia]=Es requereix autorització de l'administrador per a restaurar l'arranjament del gestor d'arrencada Grub2 79 | Description[cs]=Pro obnovení výchozího nastavení zavaděče GRUB2 je potřeba oprávnění administrátora 80 | Description[da]=Administrator-godkendelse kræves for at genskabe standardindstillingerne for GRUB2-bootloaderen 81 | Description[de]=Zur Wiederherstellung der GRUB2-Standardeinstellungen sind Systemverwalterrechte erforderlich. 82 | Description[el]=Απαιτείται εξουσιοδότηση διαχειριστή για την επαναφορά των προκαθορισμένων ρυθμίσεων του προγράμματος εκκίνησης GRUB2 83 | Description[es]=Se requiere la autorización del administrador para restablecer la configuración predeterminada del cargador de arranque de GRUB2 84 | Description[et]=GRUB2 alglaaduri vaikeseadistuste taastamiseks on vajalik autentimine administraatorina 85 | Description[fi]=GRUB2-käynnistyslataimen oletusasetuksien palautus vaatii pääkäyttäjän oikeudet 86 | Description[fr]=L'autorisation de l'administrateur est requise pour restaurer les paramètres par défaut du chargeur d'amorçage GRUB2 87 | Description[ga]=Is é riarthóir an chórais amháin atá in ann na réamhshocruithe GRUB2 a athchóiriú 88 | Description[gl]=Precísase ter a autorización de administrador para restaurar as configuracións iniciais de GRUB2 89 | Description[hu]=Rendszergazdai jogosultságok szükségesek a GRUB2 rendszerbetöltő menü alapértelmezett beállításainak visszaállításához 90 | Description[it]=Sono i richiesti i privilegi amministrativi per ripristinare le impostazioni predefinite del bootloader GRUB2 91 | Description[lt]=Administratoriaus įgaliojimas reikalingas, kad atstatyti numatytus GRUB2 įkrovos tvarkyklės nustatymus 92 | Description[mr]=मूलभूत GRUB2 बूटलोडर संयोजना पुन्हस्थापित करण्याकरिता व्यवस्थापकाची परवानगी आवश्यक आहे 93 | Description[nb]=Det kreves autorisasjon som administrator for å gjenopprette standard innstillinger for GRUB2 oppstartslaster 94 | Description[nds]=De Standard-Instellen för den Systeemstarter Grub2 laat sik bloots mit Systeempleger-Verlööf wedderherstellen. 95 | Description[nl]=Autorisatie van systeembeheerder is vereist om standaard instellingen van de GRUB2 bootloader te herstellen 96 | Description[pl]=Do przywrócenia domyślnych ustawień programu rozruchowego GRUB2 potrzebne są uprawnienia administratora 97 | Description[pt]=É necessária a autorização do administrador para repor a configuração predefinida do gestor de arranque GRUB2 98 | Description[pt_BR]=É necessária a autorização do administrador para restaurar a configuração padrão do gerenciador de inicialização GRUB2 99 | Description[ro]=Este necesară autorizarea ca administrator pentru a restabili configurările implicite ale încărcătorului GRUB2 100 | Description[ru]=Необходимы права администратора для восстановления параметров по умолчанию для загрузчика GRUB2 101 | Description[sk]=Vyžaduje sa overenie administrátora na obnovenie predvolených nastavení zavádzača GRUB2 102 | Description[sl]=Za obnovitev privzetih vrednosti zagonskega nalagalnika GRUB2 je zahtevana pooblastitev skrbnika 103 | Description[sv]=Administratörsbehörighet krävs för att återställa GRUB2 startprogrammets standardinställningar 104 | Description[tr]=GRUB2 Önyükleyici ayarlarını geri yüklemek için yönetici yetkilendirmesi gerekli 105 | Description[uk]=Для відновлення типових параметрів завантажувача GRUB2 слід набути прав доступу адміністратора 106 | Description[x-test]=xxAdministrator authorization is required to restore the default GRUB2 Bootloader settingsxx 107 | Description[zh_CN]=恢复默认 GRUB2 启动加载器设置需要管理员权限 108 | Description[zh_TW]=回覆預設的 GRUB2 開機載入器設定需要管理者權限 109 | Policy=auth_admin 110 | Persistence=session 111 | 112 | [org.kde.kcontrol.kcmgrub2.install] 113 | Name=Install the GRUB2 Bootloader 114 | Name[bs]=Instaliraj GRUB2 pokretač sistema 115 | Name[ca]=Instal·la el gestor d'arrencada Grub2 116 | Name[ca@valencia]=Instal·la el gestor d'arrencada Grub2 117 | Name[cs]=Nainstalovat zavaděč GRUB2 118 | Name[da]=Installér GRUB2-bootloaderen 119 | Name[de]=GRUB2-Bootloader installieren 120 | Name[el]=Εγκατάσταση του προγράμματος εκκίνησης GRUB2 121 | Name[es]=Instalar el cargador de arranque GRUB2 122 | Name[et]=GRUB2 alglaaduri paigaldamine 123 | Name[fi]=Asenna GRUB2-käynnistyslatain 124 | Name[fr]=Installer le chargeur d'amorçage GRUB2 125 | Name[ga]=Suiteáil an Luchtóir Tosaithe GRUB2 126 | Name[gl]=Instalar o cargador de arrinque GRUB2 127 | Name[hu]=A GRUB2 rendszerbetöltő telepítése 128 | Name[it]=Installa il bootloader GRUB2 129 | Name[lt]=Įdiegti GRUB2 įkrovos tvarkyklę 130 | Name[mr]=GRUB2 बूटलोडर प्रतिष्ठापीत करा 131 | Name[nb]=Installer GRUB2 oppstartslaster 132 | Name[nds]=Systeemstarter Grub2 installeren 133 | Name[nl]=De GRUB2 bootloader installeren 134 | Name[pa]=ਗਰਬ2 ਬੂਟ-ਲੋਡਰ ਇੰਸਟਾਲ ਕਰੋ 135 | Name[pl]=Zainstaluj program rozruchowy GRUB2 136 | Name[pt]=Instalar o Gestor de Arranque GRUB2 137 | Name[pt_BR]=Instalar o gerenciador de inicialização GRUB2 138 | Name[ro]=Instalează încărcătorul GRUB2 139 | Name[ru]=Установка загрузчика GRUB2 140 | Name[sk]=Inštalovať bootloader GRUB2 141 | Name[sl]=Namesti zagonski nalagalnik GRUB2 142 | Name[sv]=Installera GRUB2 startprogram 143 | Name[tr]=GRUB2 Önyükleyiciyi Kur 144 | Name[ug]=Grub2 سىستېما باشلىغۇچنى ئورنىتىش 145 | Name[uk]=Встановлення завантажувача GRUB2 146 | Name[x-test]=xxInstall the GRUB2 Bootloaderxx 147 | Name[zh_CN]=安装 GRUB2 启动加载器 148 | Name[zh_TW]=安裝 GRUB2 開機載入器 149 | Description=Administrator authorization is required to install the GRUB2 Bootloader 150 | Description[bs]=Administratorska potvrda je potrebna za instaliranje GRUB2 pokretača sistema 151 | Description[ca]=Es requereix autorització de l'administrador per a instal·lar el gestor d'arrencada Grub2 152 | Description[ca@valencia]=Es requereix autorització de l'administrador per a instal·lar el gestor d'arrencada Grub2 153 | Description[cs]=Pro instalaci zavaděče GRUB2 je potřeba oprávnění administrátora 154 | Description[da]=Administrator-godkendelse kræves for at installere GRUB2-bootloaderen 155 | Description[de]=Zur Installation des GRUB2-Bootloaders sind Systemverwalterrechte erforderlich. 156 | Description[el]=Απαιτείται εξουσιοδότηση διαχειριστή για την εγκατάσταση του προγράμματος εκκίνησης GRUB2 157 | Description[es]=Se requiere la autorización del administrador para instalar el cargador de arranque de GRUB2 158 | Description[et]=GRUB2 alglaaduri paigaldamiseks on vajalik autentimine administraatorina 159 | Description[fi]=GRUB2-käynnistyslataimen asennus vaatii pääkäyttäjän oikeudet 160 | Description[fr]=L'autorisation de l'administrateur est requise pour installer le chargeur d'amorçage GRUB2 161 | Description[ga]=Is é riarthóir an chórais amháin atá in ann an Luchtóir Tosaithe GRUB2 a shuiteáil 162 | Description[gl]=Precísase a autorización do administrador para instalar o cargador de arrinque GRUB2 163 | Description[hu]=Rendszergazdai jogosultságok szükségesek a GRUB2 rendszerbetöltő menü telepítéséhez 164 | Description[it]=Sono i richiesti i privilegi amministrativi per installare il bootloader GRUB2 165 | Description[lt]=Administratoriaus įgaliojimas reikalingas, kad įdiegti GRUB2 įkrovos tvarkyklę 166 | Description[mr]=GRUB2 बूटलोडर प्रतिष्ठापीत करण्याकरिता व्यवस्थापकाची परवानगी आवश्यक आहे 167 | Description[nb]=Det kreves autorisasjon som administrator for å installere GRUB2 oppstartslaster 168 | Description[nds]=De Systeemstarter Grub2 lett sik bloots mit Systeempleger-Verlööf installeren 169 | Description[nl]=Autorisatie van systeembeheerder is vereist om instellingen van de GRUB2 bootloader te installeren 170 | Description[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਨੂੰ ਇੰਸਟਾਲ ਕਰਨ ਲਈ ਐਡਮਿਸਟੇਟਰ ਵਜੋਂ ਪਰਮਾਣਿਤ ਹੋਣ ਦੀ ਲੋੜ ਹੈ 171 | Description[pl]=Do zainstalowania programu rozruchowego GRUB2 potrzebne są uprawnienia administratora 172 | Description[pt]=É necessária a autorização do administrador para instalar o gestor de arranque GRUB2 173 | Description[pt_BR]=É necessária a autorização do administrador para instalar o gerenciador de inicialização GRUB2 174 | Description[ro]=Este necesară autorizarea ca administrator pentru a instala încărcătorul GRUB2 175 | Description[ru]=Необходимы права администратора для установки загрузчика GRUB2 176 | Description[sk]=Vyžaduje sa overenie administrátora na inštaláciu zavádzača GRUB2 177 | Description[sl]=Za namestitev zagonskega nalagalnika GRUB2 je zahtevana pooblastitev skrbnika 178 | Description[sv]=Administratörsbehörighet krävs för att installera GRUB2 startprogrammet 179 | Description[tr]=GRUB2 Önyükleyici'yi kurmak için yönetici yetkilendirmesi gerekli 180 | Description[uk]=Для встановлення завантажувача GRUB2 слід набути прав доступу адміністратора 181 | Description[x-test]=xxAdministrator authorization is required to install the GRUB2 Bootloaderxx 182 | Description[zh_CN]=安装 GRUB2 启动加载器需要管理员权限 183 | Description[zh_TW]=安裝 GRUB2 開機載入器設定需要管理者權限 184 | Policy=auth_admin 185 | Persistence=session 186 | 187 | [org.kde.kcontrol.kcmgrub2.initialize] 188 | Name=Load the GRUB2 Bootloader settings 189 | Name[bs]=Učitaj postavke GRUB2 pokretača sistema 190 | Name[ca]=Carrega l'arranjament del gestor d'arrencada Grub2 191 | Name[ca@valencia]=Carrega l'arranjament del gestor d'arrencada Grub2 192 | Name[cs]=Načíst nastavení zavaděče GRUB2 193 | Name[da]=Indlæs indstillingerne for GRUB2-bootloaderen 194 | Name[de]=GRUB2-Einstellungen laden 195 | Name[el]=Φόρτωση ρυθμίσεων του προγράμματος εκκίνησης GRUB2 196 | Name[es]=Cargar la configuración del cargador de arranque de GRUB2 197 | Name[et]=GRUB2 alglaaduri seadistuste laadimine 198 | Name[fi]=Lataa GRUB2-käynnistyslataimen asetukset 199 | Name[fr]=Charger les paramètres du chargeur d'amorçage GRUB2 200 | Name[ga]=Luchtaigh socruithe Luchtóir Tosaithe GRUB2 201 | Name[gl]=Cargar as configuracións do cargador de arrinque GRUB2 202 | Name[hu]=A GRUB2 rendszerbetöltő beállításainak betöltése 203 | Name[it]=Carica le impostazioni del bootloader GRUB2 204 | Name[lt]=Įkelti GRUB2 įkrovos tvarkyklės nustatymus 205 | Name[mr]=GRUB2 बूटलोडर संयोजना दाखल करा 206 | Name[nb]=Last inn innstillinger for GRUB2 oppstartslaster 207 | Name[nds]=De Instellen för den Systeemstarter Grub2 laden 208 | Name[nl]=De instellingen van de GRUB2 bootloader laden 209 | Name[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਸੈਟਿੰਗ ਲੋਡ ਕਰੋ 210 | Name[pl]=Wczytaj ustawienia programu rozruchowego GRUB2 211 | Name[pt]=Carregar a configuração do gestor de arranque GRUB2 212 | Name[pt_BR]=Carregar a configuração do gerenciador de inicialização GRUB2 213 | Name[ro]=Încarcă configurările încărcătorului GRUB2 214 | Name[ru]=Считывание параметров загрузчика GRUB2 215 | Name[sk]=Načítať nastavenia bootloadera GRUB2 216 | Name[sl]=Naloži nastavitve zagonskega nalagalnika GRUB2 217 | Name[sv]=Läs in inställningar för GRUB2 startprogram 218 | Name[tr]=GRUB2 Önyükleyici ayarlarını yükle 219 | Name[ug]=Grub2 سىستېما باشلىغۇچنىڭ تەڭشەكلىرىنى ئوقۇش 220 | Name[uk]=Завантаження параметрів завантажувача GRUB2 221 | Name[x-test]=xxLoad the GRUB2 Bootloader settingsxx 222 | Name[zh_CN]=载入 GRUB2 启动加载器设置 223 | Name[zh_TW]=載入 GRUB2 開機載入器設定 224 | Description=Administrator authorization is required to load the GRUB2 Bootloader settings 225 | Description[bs]=Administratorska potvrda je potrebna za čitanje postavki GRUB2 pokretača sistema 226 | Description[ca]=Es requereix autorització de l'administrador per a carregar l'arranjament del gestor d'arrencada Grub2 227 | Description[ca@valencia]=Es requereix autorització de l'administrador per a carregar l'arranjament del gestor d'arrencada Grub2 228 | Description[cs]=Pro načtení nastavení zavaděče GRUB2 je potřeba oprávnění administrátora 229 | Description[da]=Administrator-godkendelse kræves for at indlæse indstillingerne for GRUB2-bootloaderen 230 | Description[de]=Zum Laden der GRUB2-Einstellungen sind Systemverwalterrechte erforderlich. 231 | Description[el]=Απαιτείται εξουσιοδότηση διαχειριστή για τη φόρτωση των ρυθμίσεων του προγράμματος εκκίνησης GRUB2 232 | Description[es]=Se requiere la autorización del administrador para cargar la configuración del cargador de arranque de GRUB2 233 | Description[et]=GRUB2 alglaaduri seadistuste laadimiseks on vajalik autentimine administraatorina 234 | Description[fi]=GRUB2-käynnistyslataimen asetuksien lataus vaatii pääkäyttäjän oikeudet 235 | Description[fr]=L'autorisation de l'administrateur est requise pour charger les paramètres du chargeur d'amorçage GRUB2 236 | Description[ga]=Is é riarthóir an chórais amháin atá in ann socruithe Luchtóir Tosaithe GRUB2 a luchtú 237 | Description[gl]=Precísase a autorización do administrador para cargar as configuracións do cargador de arrinque GRUB2 238 | Description[hu]=Rendszergazdai jogosultságok szükségesek a GRUB2 rendszerbetöltő menü beállításainak betöltéséhez 239 | Description[it]=Sono i richiesti i privilegi amministrativi per caricare le impostazioni del bootloader GRUB2 240 | Description[lt]=Administratoriaus įgaliojimas reikalingas, kad įkelti GRUB2 įkrovos tvarkyklės nustatymus 241 | Description[mr]=GRUB2 बूटलोडर संयोजना दाखल करण्याकरिता व्यवस्थापकाची परवानगी आवश्यक आहे 242 | Description[nb]=Det kreves autorisasjon som administrator for å laste inn innstillinger for GRUB2 oppstartslaster 243 | Description[nds]=De Instellen för den Systeemstarter Grub2 laat sik bloots mit Systeempleger-Verlööf laden. 244 | Description[nl]=Autorisatie van systeembeheerder is vereist om instellingen van de GRUB2 bootloader te laden 245 | Description[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਨੂੰ ਲੋਡ ਕਰਨ ਲਈ ਐਡਮਿਸਟੇਟਰ ਵਜੋਂ ਪਰਮਾਣਿਤ ਹੋਣ ਦੀ ਲੋੜ ਹੈ 246 | Description[pl]=Do wczytania ustawień GRUB2 potrzebne są uprawnienia administratora 247 | Description[pt]=É necessária a autorização do administrador para carregar a configuração do Gestor de Arranque GRUB2 248 | Description[pt_BR]=É necessária a autorização do administrador para carregar a configuração do Gerenciador de Inicialização GRUB2 249 | Description[ro]=Este necesară autorizarea ca administrator pentru a încărca configurările încărcătorului GRUB2 250 | Description[ru]=Необходимы права администратора для считывания параметров загрузчика GRUB2 251 | Description[sk]=Vyžaduje sa overenie administrátora na načítanie nastavení zavádzača GRUB2 252 | Description[sl]=Za nalaganje vrednosti zagonskega nalagalnika GRUB2 je zahtevana pooblastitev skrbnika 253 | Description[sv]=Administratörsbehörighet krävs för att läsa in GRUB2 startprogrammets inställningar 254 | Description[tr]=GRUB2 Önyükleyici ayarlarını yüklemek için yönetici yetkilendirmesi gerekli 255 | Description[uk]=Для завантаження параметрів завантажувача GRUB2 слід набути прав доступу адміністратора 256 | Description[x-test]=xxAdministrator authorization is required to load the GRUB2 Bootloader settingsxx 257 | Description[zh_CN]=载入 GRUB2 启动加载器设置需要管理员权限 258 | Description[zh_TW]=載入 GRUB2 開機載入器設定需要管理者權限 259 | Policy=auth_admin 260 | Persistence=session 261 | 262 | [org.kde.kcontrol.kcmgrub2.save] 263 | Name=Save the GRUB2 Bootloader settings 264 | Name[bs]=Snimie postavke GRUB2 pokretača sistema 265 | Name[ca]=Desa l'arranjament del gestor d'arrencada Grub2 266 | Name[ca@valencia]=Guarda l'arranjament del gestor d'arrencada Grub2 267 | Name[cs]=Uložit nastavení zavaděče GRUB2 268 | Name[da]=Gem indstillingerne for GRUB2-bootloader 269 | Name[de]=GRUB2-Einstellungen speichern 270 | Name[el]=Αποθήκευση των ρυθμίσεων του προγράμματος εκκίνησης GRUB2 271 | Name[es]=Guardar la configuración del cargador de arranque de GRUB2 272 | Name[et]=GRUB2 alglaaduri seadistuste salvestamine 273 | Name[fi]=Tallenna GRUB2-käynnistyslataimen asetukset 274 | Name[fr]=Enregistrer les paramètres du chargeur d'amorçage GRUB2 275 | Name[ga]=Sábháil socruithe Luchtóir Tosaithe GRUB2 276 | Name[gl]=Gardar as configuracións do cargador de arrinque GRUB2 277 | Name[hu]=A GRUB2 rendszerbetöltő beállításainak mentése 278 | Name[it]=Salva le impostazioni del bootloader GRUB2 279 | Name[lt]=Įrašyti GRUB2 įkrovos tvarkyklės nustatymus 280 | Name[mr]=GRUB2 बूटलोडर संयोजना साठवा 281 | Name[nb]=Lagre innstillinger for GRUB2 oppstartslaster 282 | Name[nds]=De Instellen för den Systeemstarter Grub2 sekern 283 | Name[nl]=De instellingen van de GRUB2 bootloader opslaan 284 | Name[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਸੈਟਿੰਗ ਸੰਭਾਲੋ 285 | Name[pl]=Zapisz ustawienia programu rozruchowego GRUB2 286 | Name[pt]=Gravar a configuração do gestor de arranque do GRUB2 287 | Name[pt_BR]=Salvar a configuração do gerenciador de inicialização do GRUB2 288 | Name[ro]=Salvează configurările încărcătorului GRUB2 289 | Name[ru]=Сохранение параметров загрузчика GRUB2 290 | Name[sk]=Uložiť nastavenia bootloadera GRUB2 291 | Name[sl]=Shrani nastavitve zagonskega nalagalnika GRUB2 292 | Name[sv]=Spara GRUB2 startprogrammets inställningar 293 | Name[tr]=GRUB2 Önyükleyici ayarlarını kaydet 294 | Name[uk]=Збереження параметрів завантажувача GRUB2 295 | Name[x-test]=xxSave the GRUB2 Bootloader settingsxx 296 | Name[zh_CN]=保存 GRUB2 启动加载器设置 297 | Name[zh_TW]=儲存 GRUB2 開機載入器設定 298 | Description=Administrator authorization is required to save the GRUB2 Bootloader settings 299 | Description[bs]=Administratorska potvrda je potrebna za snimanje postavki GRUB2 pokretača sistema 300 | Description[ca]=Es requereix autorització de l'administrador per a desar l'arranjament del gestor d'arrencada Grub2 301 | Description[ca@valencia]=Es requereix autorització de l'administrador per a guardar l'arranjament del gestor d'arrencada Grub2 302 | Description[cs]=Pro uložení nastavení zavaděče GRUB2 je potřeba oprávnění administrátora 303 | Description[da]=Administrator-godkendelse kræves for at gemme indstillingerne for GRUB2-bootloaderen 304 | Description[de]=Zum Speichern der GRUB2-Einstellungen sind Systemverwalterrechte erforderlich. 305 | Description[el]=Απαιτείται εξουσιοδότηση διαχειριστή για την αποθήκευση ρυθμίσεων του προγράμματος εκκίνησης GRUB2 306 | Description[es]=Se requiere la autorización del administrador para guardar la configuración del cargador de arranque de GRUB2 307 | Description[et]=GRUB2 alglaaduri seadistuste salvestamiseks on vajalik autentimine administraatorina 308 | Description[fi]=GRUB2-käynnistyslataimen asetuksien tallennus vaatii pääkäyttäjän oikeudet 309 | Description[fr]=L'autorisation de l'administrateur est requise pour enregistrer les paramètres du chargeur d'amorçage GRUB2 310 | Description[ga]=Is é riarthóir an chórais amháin atá in ann na socruithe Luchtóir Tosaithe GRUB2 a shábháil 311 | Description[gl]=Precísase a autorización do administrado para gardar as configuracións do cargador de arrinque GRUB2 312 | Description[hu]=Rendszergazdai jogosultságok szükségesek a GRUB2 rendszerbetöltő menü beállításainak mentéséhez 313 | Description[it]=Sono i richiesti i privilegi amministrativi per salvare le impostazioni del bootloader GRUB2 314 | Description[lt]=Administratoriaus įgaliojimas reikalingas, kad išsaugoti GRUB2 įkrovos tvarkyklės nustatymus 315 | Description[mr]=GRUB2 बूटलोडर संयोजना साठवण्याकरिता व्यवस्थापकाची परवानगी आवश्यक आहे 316 | Description[nb]=Det kreves autorisasjon som administrator for å lagre innstillinger for GRUB2 oppstartslaster 317 | Description[nds]=De Instellen för den Systeemstarter Grub2 laat sik bloots mit Systeempleger-Verlööf sekern. 318 | Description[nl]=Autorisatie van systeembeheerder is vereist om instellingen van de GRUB2 bootloader op te slaan 319 | Description[pa]=ਗਰਬ2 ਬੂਟਲੋਡਰ ਨੂੰ ਸੰਭਾਲਣ ਲਈ ਐਡਮਿਸਟੇਟਰ ਵਜੋਂ ਪਰਮਾਣਿਤ ਹੋਣ ਦੀ ਲੋੜ ਹੈ 320 | Description[pl]=Do zapisania ustawień programu rozruchowego GRUB2 potrzebne są uprawnienia administratora 321 | Description[pt]=É necessária a autorização do administrador para gravar a configuração do gestor de arranque GRUB2 322 | Description[pt_BR]=É necessária a autorização do administrador para gravar a configuração do gerenciador de inicialização GRUB2 323 | Description[ro]=Este necesară autorizarea ca administrator pentru a salva configurările încărcătorului GRUB2 324 | Description[ru]=Необходимы права администратора для сохранения параметров загрузчика GRUB2 325 | Description[sk]=Vyžaduje sa overenie administrátora na uloženie nastavení zavádzača GRUB2 326 | Description[sl]=Za shranjevanje vrednosti zagonskega nalagalnika GRUB2 je zahtevana pooblastitev skrbnika 327 | Description[sv]=Administratörsbehörighet krävs för att spara GRUB2 startprogrammets inställningar 328 | Description[tr]=GRUB2 Önyükleyici ayarlarını kaydetmek için yönetici yetkilendirmesi gerekli 329 | Description[uk]=Для збереження параметрів завантажувача GRUB2 слід набути прав доступу адміністратора 330 | Description[x-test]=xxAdministrator authorization is required to save the GRUB2 Bootloader settingsxx 331 | Description[zh_CN]=保存 GRUB2 启动加载器设置需要管理员权限 332 | Description[zh_TW]=儲存 GRUB2 開機載入器設定需要管理者權限 333 | Policy=auth_admin 334 | Persistence=session 335 | -------------------------------------------------------------------------------- /src/installDlg.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "installDlg.h" 20 | 21 | //Qt 22 | #include 23 | #include 24 | #include 25 | //KDE 26 | #include 27 | //#include 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | using namespace KAuth; 36 | 37 | //Ui 38 | #include "ui_installDlg.h" 39 | 40 | InstallDialog::InstallDialog(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags) 41 | { 42 | QWidget *widget = new QWidget(this); 43 | KFormat format; 44 | ui = new Ui::InstallDialog; 45 | ui->setupUi(widget); 46 | QVBoxLayout *mainLayout = new QVBoxLayout; 47 | setLayout(mainLayout); 48 | mainLayout->addWidget(widget); 49 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 50 | mainLayout->addWidget(buttonBox); 51 | buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); 52 | buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); 53 | connect(buttonBox, SIGNAL(accepted()), this, SLOT(SlotOkButtonClicked())); 54 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); 55 | buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 56 | setWindowTitle(i18nc("@title:window", "Install/Recover Bootloader")); 57 | setWindowIcon(QIcon::fromTheme(QStringLiteral("system-software-update"))); 58 | if (parent) { 59 | resize(parent->size()); 60 | } 61 | 62 | ui->treeWidget_recover->headerItem()->setText(0, QString()); 63 | ui->treeWidget_recover->header()->setSectionResizeMode(QHeaderView::Stretch); 64 | ui->treeWidget_recover->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); 65 | Q_FOREACH(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::StorageAccess)) { 66 | if (!device.is() || !device.is()) { 67 | continue; 68 | } 69 | const Solid::StorageAccess *partition = device.as(); 70 | if (!partition) { 71 | continue; 72 | } 73 | const Solid::StorageVolume *volume = device.as(); 74 | if (!volume || volume->usage() != Solid::StorageVolume::FileSystem) { 75 | continue; 76 | } 77 | 78 | QString uuidDir = "/dev/disk/by-uuid/", uuid = volume->uuid(), name; 79 | name = (QFile::exists((name = uuidDir + uuid)) || QFile::exists((name = uuidDir + uuid.toLower())) || QFile::exists((name = uuidDir + uuid.toUpper())) ? QFile::symLinkTarget(name) : QString()); 80 | QTreeWidgetItem *item = new QTreeWidgetItem(ui->treeWidget_recover, QStringList() << QString() << name << partition->filePath() << volume->label() << volume->fsType() << format.formatByteSize(volume->size())); //KGlobal::locale()-> 81 | item->setIcon(1, QIcon::fromTheme(device.icon())); 82 | item->setTextAlignment(5, Qt::AlignRight | Qt::AlignVCenter); 83 | ui->treeWidget_recover->addTopLevelItem(item); 84 | QRadioButton *radio = new QRadioButton(ui->treeWidget_recover); 85 | connect(radio, SIGNAL(clicked(bool)), buttonBox->button(QDialogButtonBox::Ok), SLOT(setEnabled(bool))); 86 | ui->treeWidget_recover->setItemWidget(item, 0, radio); 87 | } 88 | } 89 | InstallDialog::~InstallDialog() 90 | { 91 | delete ui; 92 | } 93 | 94 | void InstallDialog::SlotOkButtonClicked() 95 | { 96 | Action installAction("org.kde.kcontrol.kcmgrub2.install"); 97 | installAction.setHelperId("org.kde.kcontrol.kcmgrub2"); 98 | for (int i = 0; i < ui->treeWidget_recover->topLevelItemCount(); i++) { 99 | QRadioButton *radio = qobject_cast(ui->treeWidget_recover->itemWidget(ui->treeWidget_recover->topLevelItem(i), 0)); 100 | if (radio && radio->isChecked()) { 101 | installAction.addArgument("partition", ui->treeWidget_recover->topLevelItem(i)->text(1)); 102 | installAction.addArgument("mountPoint", ui->treeWidget_recover->topLevelItem(i)->text(2)); 103 | installAction.addArgument("mbrInstall", !ui->checkBox_partition->isChecked()); 104 | break; 105 | } 106 | } 107 | if (installAction.arguments().value("partition").toString().isEmpty()) { 108 | KMessageBox::sorry(this, i18nc("@info", "Sorry, you have to select a partition with a proper name!")); 109 | return; 110 | } 111 | 112 | 113 | QProgressDialog progressDlg(this, Qt::Dialog); 114 | progressDlg.setWindowTitle(i18nc("@title:window", "Installing")); 115 | progressDlg.setLabelText(i18nc("@info:progress", "Installing GRUB...")); 116 | progressDlg.setCancelButton(0); 117 | progressDlg.setModal(true); 118 | progressDlg.setRange(0,0); 119 | progressDlg.show(); 120 | 121 | ExecuteJob* reply = installAction.execute(); 122 | reply->exec(); 123 | 124 | if (reply->action().status() != Action::AuthorizedStatus ) { 125 | progressDlg.hide(); 126 | return; 127 | } 128 | 129 | //connect(reply, SIGNAL(result()), &progressDlg, SLOT(hide())); 130 | progressDlg.hide(); 131 | if (reply->error()) { 132 | KMessageBox::detailedError(this, i18nc("@info", "Failed to install GRUB."), reply->data().value("errorDescription").toString()); 133 | this->reject(); 134 | } else { 135 | progressDlg.hide(); 136 | QDialog *dialog = new QDialog(this, Qt::Dialog); 137 | dialog->setWindowTitle(i18nc("@title:window", "Information")); 138 | dialog->setModal(true); 139 | QDialogButtonBox *btnbox = new QDialogButtonBox(QDialogButtonBox::Ok); 140 | KMessageBox::createKMessageBox(dialog, btnbox, QMessageBox::Information, i18nc("@info", "Successfully installed GRUB."), QStringList(), QString(), 0, KMessageBox::Notify, reply->data().value("output").toString()); // krazy:exclude=qclasses 141 | this->accept(); 142 | } 143 | //this->accept(); 144 | } 145 | -------------------------------------------------------------------------------- /src/installDlg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef INSTALLDLG_H 19 | #define INSTALLDLG_H 20 | 21 | //KDE 22 | #include 23 | #include 24 | //Ui 25 | namespace Ui 26 | { 27 | class InstallDialog; 28 | } 29 | 30 | class InstallDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit InstallDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0); 35 | virtual ~InstallDialog(); 36 | protected Q_SLOTS: 37 | virtual void SlotOkButtonClicked(); 38 | private: 39 | Ui::InstallDialog *ui; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/kcm_grub2.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef KCMGRUB2_H 19 | #define KCMGRUB2_H 20 | 21 | //Qt 22 | #include 23 | #include 24 | #include 25 | //KDE 26 | #include 27 | 28 | #include 29 | #include 30 | using namespace KAuth; 31 | 32 | //Project 33 | #include "config.h" 34 | class Entry; 35 | 36 | //Ui 37 | namespace Ui 38 | { 39 | class KCMGRUB2; 40 | } 41 | 42 | class KCMGRUB2 : public KCModule 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit KCMGRUB2(QWidget *parent = 0, const QVariantList &list = QVariantList()); 47 | virtual ~KCMGRUB2(); 48 | 49 | virtual void defaults(); 50 | virtual void load(); 51 | virtual void save(); 52 | private Q_SLOTS: 53 | void saveComplete(KJob*); 54 | void slotRetry(); 55 | void slotRemoveOldEntries(); 56 | void slotGrubSavedefaultChanged(); 57 | void slotGrubNoEchoChanged(); 58 | void slotGrubHiddenTimeoutToggled(bool checked); 59 | void slotGrubHiddenTimeoutChanged(); 60 | void slotGrubHiddenTimeoutQuietChanged(); 61 | void slotGrubTimeoutToggled(bool checked); 62 | void slotGrubTimeoutChanged(); 63 | void slotGrubDisableRecoveryChanged(); 64 | void slotMemtestChanged(); 65 | void slotGrubDisableOsProberChanged(); 66 | void slotInstallBootloader(); 67 | void slotGrubGfxmodeChanged(); 68 | void slotGrubGfxpayloadLinuxChanged(); 69 | void slotReadResolutions(); 70 | void slotGrubColorNormalChanged(); 71 | void slotGrubColorHighlightChanged(); 72 | void slowGrubBackgroundChanged(); 73 | void slotPreviewGrubBackground(); 74 | void slotCreateGrubBackground(); 75 | void slotGrubThemeChanged(); 76 | void slotGrubCmdlineLinuxDefaultChanged(); 77 | void slotGrubCmdlineLinuxChanged(); 78 | void slotGrubTerminalChanged(); 79 | void slotGrubTerminalInputChanged(); 80 | void slotGrubTerminalOutputChanged(); 81 | void slotGrubDistributorChanged(); 82 | void slotGrubSerialCommandChanged(); 83 | void slotGrubInitTuneChanged(); 84 | void slotGrubDisableLinuxUuidChanged(); 85 | void slotGrubLanguageChanged(); 86 | 87 | //Security 88 | void slotSecurityChanged(); 89 | //users 90 | void slotAddUser(); 91 | void slotDeleteUser(); 92 | void slotEditUser(); 93 | //groups 94 | void slotEditGroup(); 95 | 96 | //custom entries 97 | void slotCustomChanged(); 98 | 99 | void slotUpdateSuggestions(); 100 | void slotTriggeredSuggestion(QAction *action); 101 | private: 102 | void setupObjects(); 103 | void setupConnections(); 104 | 105 | //TODO: Maybe remove? 106 | QString convertToGRUBFileName(const QString &fileName); 107 | QString convertToLocalFileName(const QString &grubFileName); 108 | 109 | ExecuteJob * loadFile(GrubFile grubFile); 110 | QString readFile(GrubFile grubFile); 111 | void readEntries(); 112 | bool initializeAuthorized = false; 113 | bool saveAuthorized = false; 114 | void readSettings(); 115 | void readEnv(); 116 | void readMemtest(); 117 | void readDevices(); 118 | void readLanguages(); 119 | void initResolutions(); 120 | void readResolutions(); 121 | //Security 122 | void parseGroupDir(); 123 | void getSuperUsers(); 124 | void getUsers(); 125 | void getGroups(); 126 | //Encryption 127 | QString pbkdf2Encrypt(QString passwd); //, int key_length, int iteration_count 128 | 129 | void sortResolutions(); 130 | void showResolutions(); 131 | 132 | void showLanguages(); 133 | 134 | QString processReply(ExecuteJob *reply); 135 | QString parseTitle(const QString &line); 136 | void parseEntries(const QString &config, bool clearOnError = true); 137 | void parseSettings(const QString &config); 138 | void parseEnv(const QString &config); 139 | 140 | Ui::KCMGRUB2 *ui; 141 | 142 | enum { 143 | grubSavedefaultDirty, 144 | grubHiddenTimeoutDirty, 145 | grubHiddenTimeoutQuietDirty, 146 | grubTimeoutDirty, 147 | grubNoEchoDirty, 148 | grubDisableRecoveryDirty, 149 | memtestDirty, 150 | grubDisableOsProberDirty, 151 | grubGfxmodeDirty, 152 | grubGfxpayloadLinuxDirty, 153 | grubColorNormalDirty, 154 | grubColorHighlightDirty, 155 | grubBackgroundDirty, 156 | grubThemeDirty, 157 | grubCmdlineLinuxDefaultDirty, 158 | grubCmdlineLinuxDirty, 159 | grubTerminalDirty, 160 | grubTerminalInputDirty, 161 | grubTerminalOutputDirty, 162 | grubDistributorDirty, 163 | grubSerialCommandDirty, 164 | grubInitTuneDirty, 165 | grubDisableLinuxUuidDirty, 166 | grubLanguageDirty, 167 | //Security 168 | //------------------------------------------------- 169 | securityDirty, 170 | securityUsersDirty, 171 | securityGroupsDirty, 172 | //------------------------------------------------- 173 | //custom entries 174 | customEntriesDirty, 175 | //-------------- 176 | lastDirtyBit 177 | }; 178 | QBitArray m_dirtyBits; 179 | QBitArray m_dirtyBitsBak; 180 | 181 | QString resultLanguage; 182 | 183 | QList m_entries; 184 | QHash m_settings; 185 | QHash m_env; 186 | bool m_memtest; 187 | bool m_memtestOn; 188 | QHash m_devices; 189 | QHash m_languages; 190 | QStringList m_resolutions; 191 | //Security 192 | bool m_security; 193 | bool m_securityOn; 194 | //Group 195 | //----------------------------------------------------- 196 | QStringList m_groupFilesList; 197 | QHash m_groupFilesContent; 198 | QHash m_groupFileLocked; 199 | QHash m_groupFileAllowedUsers; 200 | //----------------------------------------------------- 201 | QString m_headerFile; 202 | //SuperUsers 203 | QStringList m_superUsers; 204 | //Users 205 | //----------------------------------------------------- 206 | QStringList m_users; 207 | QHash m_userPassword; 208 | QHash m_userPasswordEncrypted; 209 | QHash m_userIsSuper; 210 | //----------------------------------------------------- 211 | }; 212 | 213 | 214 | #endif 215 | -------------------------------------------------------------------------------- /src/qPkBackend.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "qPkBackend.h" 20 | 21 | //Qt 22 | #include 23 | 24 | //KDE 25 | #include 26 | 27 | //PackageKit 28 | #include 29 | 30 | //Taken from KDE playground/sysadmin/apper "as is" 31 | static QString statusToString(PackageKit::Transaction::Status status) 32 | { 33 | switch (status) { 34 | case PackageKit::Transaction::StatusSetup: 35 | return i18nc("transaction state, the daemon is in the process of starting", 36 | "Waiting for service to start"); 37 | case PackageKit::Transaction::StatusWait: 38 | return i18nc("transaction state, the transaction is waiting for another to complete", 39 | "Waiting for other tasks"); 40 | case PackageKit::Transaction::StatusRunning: 41 | return i18nc("transaction state, just started", 42 | "Running task"); 43 | case PackageKit::Transaction::StatusQuery: 44 | return i18nc("transaction state, is querying data", 45 | "Querying"); 46 | case PackageKit::Transaction::StatusInfo: 47 | return i18nc("transaction state, getting data from a server", 48 | "Getting information"); 49 | case PackageKit::Transaction::StatusRemove: 50 | return i18nc("transaction state, removing packages", 51 | "Removing packages"); 52 | case PackageKit::Transaction::StatusDownload: 53 | return i18nc("transaction state, downloading package files", 54 | "Downloading packages"); 55 | case PackageKit::Transaction::StatusInstall: 56 | return i18nc("transaction state, installing packages", 57 | "Installing packages"); 58 | case PackageKit::Transaction::StatusRefreshCache: 59 | return i18nc("transaction state, refreshing internal lists", 60 | "Refreshing software list"); 61 | case PackageKit::Transaction::StatusUpdate: 62 | return i18nc("transaction state, installing updates", 63 | "Updating packages"); 64 | case PackageKit::Transaction::StatusCleanup: 65 | return i18nc("transaction state, removing old packages, and cleaning config files", 66 | "Cleaning up packages"); 67 | case PackageKit::Transaction::StatusObsolete: 68 | return i18nc("transaction state, obsoleting old packages", 69 | "Obsoleting packages"); 70 | case PackageKit::Transaction::StatusDepResolve: 71 | return i18nc("transaction state, checking the transaction before we do it", 72 | "Resolving dependencies"); 73 | case PackageKit::Transaction::StatusSigCheck: 74 | return i18nc("transaction state, checking if we have all the security keys for the operation", 75 | "Checking signatures"); 76 | case PackageKit::Transaction::StatusTestCommit: 77 | return i18nc("transaction state, when we're doing a test transaction", 78 | "Testing changes"); 79 | case PackageKit::Transaction::StatusCommit: 80 | return i18nc("transaction state, when we're writing to the system package database", 81 | "Committing changes"); 82 | case PackageKit::Transaction::StatusRequest: 83 | return i18nc("transaction state, requesting data from a server", 84 | "Requesting data"); 85 | case PackageKit::Transaction::StatusFinished: 86 | return i18nc("transaction state, all done!", 87 | "Finished"); 88 | case PackageKit::Transaction::StatusCancel: 89 | return i18nc("transaction state, in the process of cancelling", 90 | "Cancelling"); 91 | case PackageKit::Transaction::StatusDownloadRepository: 92 | return i18nc("transaction state, downloading metadata", 93 | "Downloading repository information"); 94 | case PackageKit::Transaction::StatusDownloadPackagelist: 95 | return i18nc("transaction state, downloading metadata", 96 | "Downloading list of packages"); 97 | case PackageKit::Transaction::StatusDownloadFilelist: 98 | return i18nc("transaction state, downloading metadata", 99 | "Downloading file lists"); 100 | case PackageKit::Transaction::StatusDownloadChangelog: 101 | return i18nc("transaction state, downloading metadata", 102 | "Downloading lists of changes"); 103 | case PackageKit::Transaction::StatusDownloadGroup: 104 | return i18nc("transaction state, downloading metadata", 105 | "Downloading groups"); 106 | case PackageKit::Transaction::StatusDownloadUpdateinfo: 107 | return i18nc("transaction state, downloading metadata", 108 | "Downloading update information"); 109 | case PackageKit::Transaction::StatusRepackaging: 110 | return i18nc("transaction state, repackaging delta files", 111 | "Repackaging files"); 112 | case PackageKit::Transaction::StatusLoadingCache: 113 | return i18nc("transaction state, loading databases", 114 | "Loading cache"); 115 | case PackageKit::Transaction::StatusScanApplications: 116 | return i18nc("transaction state, scanning for running processes", 117 | "Scanning installed applications"); 118 | case PackageKit::Transaction::StatusGeneratePackageList: 119 | return i18nc("transaction state, generating a list of packages installed on the system", 120 | "Generating package lists"); 121 | case PackageKit::Transaction::StatusWaitingForLock: 122 | return i18nc("transaction state, when we're waiting for the native tools to exit", 123 | "Waiting for package manager lock"); 124 | case PackageKit::Transaction::StatusWaitingForAuth: 125 | return i18nc("waiting for user to type in a password", 126 | "Waiting for authentication"); 127 | case PackageKit::Transaction::StatusScanProcessList: 128 | return i18nc("we are updating the list of processes", 129 | "Updating the list of running applications"); 130 | case PackageKit::Transaction::StatusCheckExecutableFiles: 131 | return i18nc("we are checking executable files in use", 132 | "Checking for applications currently in use"); 133 | case PackageKit::Transaction::StatusCheckLibraries: 134 | return i18nc("we are checking for libraries in use", 135 | "Checking for libraries currently in use"); 136 | case PackageKit::Transaction::StatusCopyFiles: 137 | return i18nc("we are copying package files to prepare to install", 138 | "Copying files"); 139 | } 140 | return QString(); 141 | } 142 | 143 | QPkBackend::QPkBackend(QObject *parent) : QObject(parent) 144 | { 145 | m_t = 0; 146 | } 147 | QPkBackend::~QPkBackend() 148 | { 149 | } 150 | 151 | QStringList QPkBackend::ownerPackage(const QString &fileName) 152 | { 153 | auto *t = PackageKit::Daemon::searchFiles(fileName); 154 | m_packageId.clear(); 155 | QEventLoop loop; 156 | connect(t, &PackageKit::Transaction::finished, &loop, &QEventLoop::quit); 157 | connect(t, &PackageKit::Transaction::finished, this, &QPkBackend::slotFinished); 158 | connect(t, &PackageKit::Transaction::package, this, &QPkBackend::slotPackage); 159 | loop.exec(); 160 | return m_status == PackageKit::Transaction::ExitSuccess && !m_packageId.isNull() ? 161 | QStringList() << PackageKit::Transaction::packageName(m_packageId) << PackageKit::Transaction::packageVersion(m_packageId) : QStringList(); 162 | } 163 | void QPkBackend::markForRemoval(const QString &packageName) 164 | { 165 | if (!m_remove.contains(packageName) && packageExists(packageName)) { 166 | m_remove.append(PackageKit::Transaction::packageName(m_packageId)); 167 | m_removeIds.append(m_packageId); 168 | } 169 | } 170 | QStringList QPkBackend::markedForRemoval() const 171 | { 172 | return m_remove; 173 | } 174 | void QPkBackend::removePackages() 175 | { 176 | m_t = PackageKit::Daemon::removePackages(m_removeIds, false, true); 177 | connect(m_t, &PackageKit::Transaction::percentageChanged, this, &QPkBackend::slotUpdateProgress); 178 | connect(m_t, &PackageKit::Transaction::statusChanged, this, &QPkBackend::slotUpdateProgress); 179 | connect(m_t, &PackageKit::Transaction::finished, this, &QPkBackend::slotFinished); 180 | } 181 | void QPkBackend::undoChanges() 182 | { 183 | m_remove.clear(); 184 | m_removeIds.clear(); 185 | } 186 | 187 | void QPkBackend::slotFinished(PackageKit::Transaction::Exit status, uint runtime) 188 | { 189 | Q_UNUSED(runtime) 190 | m_status = status; 191 | if (m_t && m_t->role() == PackageKit::Transaction::RoleRemovePackages) { 192 | Q_EMIT finished(m_status == PackageKit::Transaction::ExitSuccess); 193 | } 194 | } 195 | void QPkBackend::slotPackage(PackageKit::Transaction::Info, const QString &packageId, const QString &) 196 | { 197 | m_packageId = packageId; 198 | } 199 | void QPkBackend::slotUpdateProgress() 200 | { 201 | Q_EMIT progress(statusToString(m_t->status()), m_t->percentage()); 202 | } 203 | 204 | bool QPkBackend::packageExists(const QString &packageName) 205 | { 206 | auto *t = PackageKit::Daemon::resolve(packageName); 207 | m_packageId.clear(); 208 | QEventLoop loop; 209 | connect(t, &PackageKit::Transaction::finished, &loop, &QEventLoop::quit); 210 | connect(t, &PackageKit::Transaction::finished, this, &QPkBackend::slotFinished); 211 | connect(t, &PackageKit::Transaction::package, this, &QPkBackend::slotPackage); 212 | loop.exec(); 213 | return m_status == PackageKit::Transaction::ExitSuccess && !m_packageId.isNull(); 214 | } 215 | -------------------------------------------------------------------------------- /src/qPkBackend.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef QPKBACKEND_H 19 | #define QPKBACKEND_H 20 | 21 | //Qt 22 | #include 23 | 24 | //PackageKit 25 | #include 26 | 27 | class QPkBackend : public QObject 28 | { 29 | Q_OBJECT 30 | public: 31 | explicit QPkBackend(QObject *parent = 0); 32 | virtual ~QPkBackend(); 33 | 34 | QStringList ownerPackage(const QString &fileName); 35 | void markForRemoval(const QString &packageName); 36 | QStringList markedForRemoval() const; 37 | void removePackages(); 38 | void undoChanges(); 39 | Q_SIGNALS: 40 | void finished(bool success); 41 | void progress(const QString &status, int percentage); 42 | private Q_SLOTS: 43 | void slotFinished(PackageKit::Transaction::Exit status, uint runtime); 44 | void slotPackage(PackageKit::Transaction::Info info, const QString &packageId, const QString &summary); 45 | void slotUpdateProgress(); 46 | private: 47 | bool packageExists(const QString &packageName); 48 | 49 | PackageKit::Transaction *m_t; 50 | PackageKit::Transaction::Exit m_status; 51 | QString m_packageId; 52 | QStringList m_remove; 53 | QStringList m_removeIds; 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/qaptBackend.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "qaptBackend.h" 20 | 21 | QAptBackend::QAptBackend(QObject *parent) : QObject(parent) 22 | { 23 | m_backend = new QApt::Backend; 24 | m_backend->init(); 25 | m_exitStatus = QApt::ExitSuccess; 26 | } 27 | QAptBackend::~QAptBackend() 28 | { 29 | delete m_backend; 30 | } 31 | 32 | QStringList QAptBackend::ownerPackage(const QString &fileName) 33 | { 34 | QApt::Package *package; 35 | return (package = m_backend->packageForFile(fileName)) ? QStringList() << package->name() << package->version() : QStringList(); 36 | } 37 | void QAptBackend::markForRemoval(const QString &packageName) 38 | { 39 | Q_FOREACH(const QApt::Package *package, m_backend->markedPackages()) { 40 | if (packageName.compare(package->name()) == 0) { 41 | return; 42 | } 43 | } 44 | QApt::Package *package; 45 | if ((package = m_backend->package(packageName))) { 46 | package->setRemove(); 47 | } 48 | } 49 | QStringList QAptBackend::markedForRemoval() const 50 | { 51 | QStringList marked; 52 | Q_FOREACH(const QApt::Package *package, m_backend->markedPackages()) { 53 | marked.append(package->name()); 54 | } 55 | return marked; 56 | } 57 | void QAptBackend::removePackages() 58 | { 59 | m_trans = m_backend->commitChanges(); 60 | 61 | connect(m_trans, SIGNAL(progressChanged(int)), this, SLOT(slotUpdateProgress())); 62 | connect(m_trans, SIGNAL(finished(QApt::ExitStatus)), this, SLOT(slotTransactionFinished(QApt::ExitStatus))); 63 | m_trans->run(); 64 | } 65 | void QAptBackend::undoChanges() 66 | { 67 | m_backend->init(); 68 | } 69 | 70 | void QAptBackend::slotUpdateProgress() 71 | { 72 | Q_EMIT progress(m_trans->statusDetails(), m_trans->progress()); 73 | } 74 | void QAptBackend::slotTransactionFinished(QApt::ExitStatus status) 75 | { 76 | m_exitStatus = status; 77 | Q_EMIT finished(status == QApt::ExitSuccess); 78 | } 79 | -------------------------------------------------------------------------------- /src/qaptBackend.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef QAPTBACKEND_H 19 | #define QAPTBACKEND_H 20 | 21 | //Qt 22 | #include 23 | 24 | //QApt 25 | #include 26 | #include 27 | 28 | class QAptBackend : public QObject 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit QAptBackend(QObject *parent = 0); 33 | virtual ~QAptBackend(); 34 | 35 | QStringList ownerPackage(const QString &fileName); 36 | void markForRemoval(const QString &packageName); 37 | QStringList markedForRemoval() const; 38 | void removePackages(); 39 | void undoChanges(); 40 | Q_SIGNALS: 41 | void finished(bool success); 42 | void progress(const QString &status, int percentage); 43 | private Q_SLOTS: 44 | void slotUpdateProgress(); 45 | void slotTransactionFinished(QApt::ExitStatus status); 46 | private: 47 | QApt::Backend *m_backend; 48 | QApt::ExitStatus m_exitStatus; 49 | QApt::Transaction *m_trans; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/removeDlg.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Krazy 19 | //krazy:excludeall=cpp 20 | 21 | //Own 22 | #include "removeDlg.h" 23 | 24 | //Qt 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | //KDE 33 | #include 34 | #include 35 | 36 | //Project 37 | #include "entry.h" 38 | 39 | //Ui 40 | #include "ui_removeDlg.h" 41 | 42 | RemoveDialog::RemoveDialog(const QList &entries, QWidget *parent) : QDialog(parent) 43 | { 44 | QWidget *widget = new QWidget(this); 45 | ui = new Ui::RemoveDialog; 46 | ui->setupUi(widget); 47 | ui->gridLayout->setContentsMargins(0, 0, 0, 0); 48 | 49 | auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 50 | connect(buttonBox, &QDialogButtonBox::accepted, this, &RemoveDialog::slotAccepted); 51 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); 52 | m_okButton = buttonBox->button(QDialogButtonBox::Ok); 53 | m_okButton->setEnabled(false); 54 | 55 | QVBoxLayout *mainLayout = new QVBoxLayout; 56 | setLayout(mainLayout); 57 | mainLayout->addWidget(widget); 58 | mainLayout->addWidget(buttonBox); 59 | 60 | setWindowTitle(i18nc("@title:window", "Remove Old Entries")); 61 | setWindowIcon(QIcon::fromTheme(QLatin1String("list-remove"))); 62 | 63 | m_progressDlg = 0; 64 | 65 | #if HAVE_QAPT 66 | m_backend = new QAptBackend; 67 | #elif HAVE_QPACKAGEKIT 68 | m_backend = new QPkBackend; 69 | #endif 70 | 71 | detectCurrentKernelImage(); 72 | QProgressDialog progressDlg(this); 73 | progressDlg.setWindowTitle(i18nc("@title:window", "Finding Old Entries")); 74 | progressDlg.setLabelText(i18nc("@info:progress", "Finding Old Entries...")); 75 | progressDlg.setCancelButton(nullptr); 76 | progressDlg.setModal(true); 77 | progressDlg.show(); 78 | bool found = false; 79 | for (int i = 0; i < entries.size(); i++) { 80 | progressDlg.setValue(100. / entries.size() * (i + 1)); 81 | QString file = entries.at(i).kernel(); 82 | if (file.isEmpty() || file == m_currentKernelImage) { 83 | continue; 84 | } 85 | QStringList package = m_backend->ownerPackage(file); 86 | if (package.size() < 2) { 87 | continue; 88 | } 89 | found = true; 90 | QString packageName = package.takeFirst(); 91 | QString packageVersion = package.takeFirst(); 92 | QTreeWidgetItem *item = 0; 93 | for (int j = 0; j < ui->treeWidget->topLevelItemCount(); j++) { 94 | if (ui->treeWidget->topLevelItem(j)->data(0, Qt::UserRole).toString() == packageName && ui->treeWidget->topLevelItem(j)->data(0, Qt::UserRole + 1).toString() == packageVersion) { 95 | item = ui->treeWidget->topLevelItem(j); 96 | break; 97 | } 98 | } 99 | if (!item) { 100 | item = new QTreeWidgetItem(ui->treeWidget, QStringList(i18nc("@item:inlistbox", "Kernel %1", packageVersion))); 101 | item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); 102 | item->setData(0, Qt::UserRole, packageName); 103 | item->setData(0, Qt::UserRole + 1, packageVersion); 104 | item->setCheckState(0, Qt::Checked); 105 | ui->treeWidget->addTopLevelItem(item); 106 | } 107 | item->addChild(new QTreeWidgetItem(QStringList(entries.at(i).prettyTitle()))); 108 | } 109 | if (found) { 110 | ui->treeWidget->expandAll(); 111 | ui->treeWidget->resizeColumnToContents(0); 112 | ui->treeWidget->setMinimumWidth(ui->treeWidget->columnWidth(0) + ui->treeWidget->sizeHintForRow(0)); 113 | connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(slotItemChanged())); 114 | m_okButton->setEnabled(true); 115 | } else { 116 | KMessageBox::sorry(this, i18nc("@info", "No removable entries were found.")); 117 | QTimer::singleShot(0, this, SLOT(reject())); 118 | } 119 | } 120 | RemoveDialog::~RemoveDialog() 121 | { 122 | delete m_backend; 123 | delete ui; 124 | } 125 | void RemoveDialog::slotAccepted() 126 | { 127 | for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { 128 | if (ui->treeWidget->topLevelItem(i)->checkState(0) == Qt::Checked) { 129 | QString packageName = ui->treeWidget->topLevelItem(i)->data(0, Qt::UserRole).toString(); 130 | m_backend->markForRemoval(packageName); 131 | if (ui->checkBox_headers->isChecked()) { 132 | packageName.replace(QLatin1String("image"), QLatin1String("headers")); 133 | m_backend->markForRemoval(packageName); 134 | } 135 | } 136 | } 137 | if (KMessageBox::questionYesNoList(this, i18nc("@info", "Are you sure you want to remove the following packages?"), m_backend->markedForRemoval()) == KMessageBox::Yes) { 138 | connect(m_backend, SIGNAL(progress(QString,int)), this, SLOT(slotProgress(QString,int))); 139 | connect(m_backend, SIGNAL(finished(bool)), this, SLOT(slotFinished(bool))); 140 | m_backend->removePackages(); 141 | } else { 142 | m_backend->undoChanges(); 143 | } 144 | 145 | accept(); 146 | } 147 | void RemoveDialog::slotItemChanged() 148 | { 149 | for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) { 150 | if (ui->treeWidget->topLevelItem(i)->checkState(0) == Qt::Checked) { 151 | m_okButton->setEnabled(true); 152 | return; 153 | } 154 | } 155 | m_okButton->setEnabled(false); 156 | } 157 | void RemoveDialog::slotProgress(const QString &status, int percentage) 158 | { 159 | if (!m_progressDlg) { 160 | m_progressDlg = new QProgressDialog(this); 161 | m_progressDlg->setWindowTitle(i18nc("@title:window", "Removing Old Entries")); 162 | m_progressDlg->setCancelButton(nullptr); 163 | m_progressDlg->setModal(true); 164 | m_progressDlg->show(); 165 | } 166 | m_progressDlg->setLabelText(status); 167 | m_progressDlg->setValue(percentage); 168 | } 169 | void RemoveDialog::slotFinished(bool success) 170 | { 171 | if (success) { 172 | accept(); 173 | } else { 174 | KMessageBox::error(this, i18nc("@info", "Package removal failed.")); 175 | reject(); 176 | } 177 | } 178 | void RemoveDialog::detectCurrentKernelImage() 179 | { 180 | QFile file(QLatin1String("/proc/cmdline")); 181 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { 182 | return; 183 | } 184 | 185 | QTextStream stream(&file); 186 | Q_FOREACH(const QString &argument, stream.readAll().split(QRegExp(QLatin1String("\\s+")))) { 187 | if (argument.startsWith(QLatin1String("BOOT_IMAGE"))) { 188 | m_currentKernelImage = argument.section(QLatin1Char('='), 1); 189 | return; 190 | } 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /src/removeDlg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Krazy 19 | //krazy:excludeall=cpp 20 | 21 | #ifndef REMOVEDLG_H 22 | #define REMOVEDLG_H 23 | 24 | //Qt 25 | #include 26 | class QProgressDialog; 27 | 28 | //Project 29 | #include 30 | class Entry; 31 | #if HAVE_QAPT 32 | #include "qaptBackend.h" 33 | #elif HAVE_QPACKAGEKIT 34 | #include "qPkBackend.h" 35 | #endif 36 | 37 | //Ui 38 | namespace Ui 39 | { 40 | class RemoveDialog; 41 | } 42 | 43 | class RemoveDialog : public QDialog 44 | { 45 | Q_OBJECT 46 | public: 47 | explicit RemoveDialog(const QList &entries, QWidget *parent = 0); 48 | virtual ~RemoveDialog(); 49 | private Q_SLOTS: 50 | void slotAccepted(); 51 | void slotItemChanged(); 52 | void slotProgress(const QString &status, int percentage); 53 | void slotFinished(bool success); 54 | private: 55 | void detectCurrentKernelImage(); 56 | 57 | #if HAVE_QAPT 58 | QAptBackend *m_backend; 59 | #elif HAVE_QPACKAGEKIT 60 | QPkBackend *m_backend; 61 | #endif 62 | QString m_currentKernelImage; 63 | QProgressDialog *m_progressDlg; 64 | Ui::RemoveDialog *ui; 65 | QPushButton *m_okButton; 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/userDlg.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | //Own 19 | #include "userDlg.h" 20 | 21 | //KDE 22 | #include 23 | //Qt 24 | #include 25 | #include 26 | #include 27 | //Ui 28 | #include "ui_userDlg.h" 29 | 30 | UserDialog::UserDialog(QWidget *parent, QString userName, bool isSuperUser, bool isEncrypted, Qt::WindowFlags flags) : QDialog(parent, flags) 31 | { 32 | resize(parent->size().width() / 2, parent->size().height() / 4); 33 | this->setWindowTitle(i18nc("@title:window", "Edit User")); 34 | QWidget *widget = new QWidget(this); 35 | ui = new Ui::UserDialog; 36 | ui->setupUi(widget); 37 | QVBoxLayout *mainLayout = new QVBoxLayout; 38 | setLayout(mainLayout); 39 | mainLayout->addWidget(widget); 40 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 41 | mainLayout->addWidget(buttonBox); 42 | buttonBox->button(QDialogButtonBox::Ok)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); 43 | buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); 44 | connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOkButtonClicked())); 45 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); 46 | 47 | QRegExp regExp("[A-Za-z0-9]+"); 48 | regExp.setPatternSyntax(QRegExp::RegExp); 49 | QRegExpValidator *validator; 50 | validator = new QRegExpValidator(regExp); 51 | ui->lineEdit_username->setValidator(validator); 52 | if (userName != QString()) { 53 | ui->lineEdit_username->setText(userName); 54 | ui->lineEdit_username->setEnabled(false); 55 | ui->checkBox_superuser->setCheckState(isSuperUser ? Qt::Checked : Qt::Unchecked); 56 | ui->checkBox_cryptpass->setCheckState(isEncrypted ? Qt::Checked : Qt::Unchecked); 57 | } 58 | 59 | } 60 | UserDialog::~UserDialog() 61 | { 62 | delete ui; 63 | } 64 | 65 | 66 | void UserDialog::slotOkButtonClicked() 67 | { 68 | if (ui->lineEdit_password->text() != ui->lineEdit_passwordconfirm->text()) { 69 | KMessageBox::sorry(this, i18nc("@info", "Passwords don't match!")); 70 | return; 71 | } else if (ui->lineEdit_password->text().isEmpty()) { 72 | KMessageBox::sorry(this, i18nc("@info", "Please fill in passwords!")); 73 | return; 74 | } else if (ui->lineEdit_username->text().isEmpty()) { 75 | KMessageBox::sorry(this, i18nc("@info", "Please fill in username!")); 76 | return; 77 | } else { 78 | this->accept(); 79 | } 80 | } 81 | 82 | QString UserDialog::getPassword() 83 | { 84 | return ui->lineEdit_password->text(); 85 | } 86 | QString UserDialog::getUserName() 87 | { 88 | return ui->lineEdit_username->text(); 89 | } 90 | 91 | bool UserDialog::isSuperUser() 92 | { 93 | if (ui->checkBox_superuser->checkState() == Qt::Checked) 94 | return true; 95 | else 96 | return false; 97 | } 98 | 99 | bool UserDialog::requireEncryption() 100 | { 101 | if (ui->checkBox_cryptpass->checkState() == Qt::Checked) 102 | return true; 103 | else 104 | return false; 105 | } 106 | -------------------------------------------------------------------------------- /src/userDlg.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (C) 2008-2013 Konstantinos Smanis * 3 | * * 4 | * This program is free software: you can redistribute it and/or modify it * 5 | * under the terms of the GNU General Public License as published by the Free * 6 | * Software Foundation, either version 3 of the License, or (at your option) * 7 | * any later version. * 8 | * * 9 | * This program is distributed in the hope that it will be useful, but WITHOUT * 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 12 | * more details. * 13 | * * 14 | * You should have received a copy of the GNU General Public License along * 15 | * with this program. If not, see . * 16 | *******************************************************************************/ 17 | 18 | #ifndef USERDLG_H 19 | #define USERDLG_H 20 | 21 | //Qt 22 | #include 23 | 24 | //Ui 25 | namespace Ui 26 | { 27 | class UserDialog; 28 | } 29 | 30 | class UserDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit UserDialog(QWidget *parent = 0, QString userName = QString(), bool isSuperUser = false, bool isEncrypted = false, Qt::WindowFlags flags = 0); 35 | virtual ~UserDialog(); 36 | QString getPassword(); 37 | QString getUserName(); 38 | bool isSuperUser(); 39 | bool requireEncryption(); 40 | protected Q_SLOTS: 41 | virtual void slotOkButtonClicked(); 42 | private: 43 | Ui::UserDialog *ui; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/widgets/regexpinputdialog.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "regexpinputdialog.h" 3 | 4 | RegExpInputDialog::RegExpInputDialog(QWidget *parent, Qt::WindowFlags flags) : 5 | QDialog(parent) 6 | { 7 | if(flags!=0) setWindowFlags(flags); 8 | QVBoxLayout *l=new QVBoxLayout(this); 9 | 10 | label=new QLabel(this); 11 | 12 | regExp=QRegExp("*"); 13 | regExp.setPatternSyntax(QRegExp::Wildcard); 14 | validator=new QRegExpValidator(regExp); 15 | 16 | text=new QLineEdit(this); 17 | text->setValidator(validator); 18 | connect(text, SIGNAL(textChanged(QString)), this, SLOT(checkValid(QString))); 19 | 20 | buttonBox=new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, this); 21 | connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); 22 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); 23 | 24 | l->addWidget(label); 25 | l->addWidget(text); 26 | l->addWidget(buttonBox); 27 | } 28 | 29 | void RegExpInputDialog::setTitle(const QString &title){ setWindowTitle(title); } 30 | void RegExpInputDialog::setLabelText(const QString &label){ this->label->setText(label); } 31 | void RegExpInputDialog::setText(const QString &text){ this->text->setText(text); } 32 | 33 | void RegExpInputDialog::setRegExp(const QRegExp ®Exp){ 34 | validator->setRegExp(regExp); 35 | checkValid(text->text()); 36 | } 37 | 38 | QString RegExpInputDialog::getLabelText(){ return label->text(); } 39 | QString RegExpInputDialog::getText(){ return text->text(); } 40 | 41 | void RegExpInputDialog::checkValid(const QString &text){ 42 | QString _text=QString(text); 43 | int pos=0; 44 | bool valid=validator->validate(_text, pos)==QRegExpValidator::Acceptable; 45 | buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid); 46 | } 47 | 48 | QString RegExpInputDialog::getText(QWidget *parent, const QString &title, const QString &label, const QString &text, const QRegExp ®Exp, bool *ok, Qt::WindowFlags flags){ 49 | RegExpInputDialog *r=new RegExpInputDialog(parent, flags); 50 | r->setTitle(title); 51 | r->setLabelText(label); 52 | r->setText(text); 53 | r->setRegExp(regExp); 54 | *ok=r->exec()==QDialog::Accepted; 55 | if(*ok) return r->getText(); 56 | else return QString(); 57 | } -------------------------------------------------------------------------------- /src/widgets/regexpinputdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef REGEXPINPUTDIALOG_H 2 | #define REGEXPINPUTDIALOG_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class QLabel; 12 | class QLineEdit; 13 | class QDialogButtonBox; 14 | class QRegExpValidator; 15 | 16 | class RegExpInputDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | public: 20 | explicit RegExpInputDialog(QWidget *parent = 0, Qt::WindowFlags=0); 21 | 22 | void setTitle(const QString &title); 23 | void setLabelText(const QString &label); 24 | void setText(const QString &text); 25 | void setRegExp(const QRegExp ®Exp); 26 | 27 | QString getLabelText(); 28 | QString getText(); 29 | 30 | static QString getText(QWidget *parent, const QString &title, const QString &label, const QString &text, const QRegExp ®Exp, bool *ok, Qt::WindowFlags flags=0); 31 | 32 | signals: 33 | 34 | private slots: 35 | void checkValid(const QString &text); 36 | 37 | private: 38 | QLabel *label; 39 | QLineEdit *text; 40 | QDialogButtonBox *buttonBox; 41 | QRegExp regExp; 42 | QRegExpValidator *validator; 43 | }; 44 | 45 | #endif // REGEXPINPUTDIALOG_H -------------------------------------------------------------------------------- /ui/convertDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ConvertDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 216 10 | 196 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Image: 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Convert To: 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Conversion Options 42 | 43 | 44 | 45 | 46 | 47 | Width: 48 | 49 | 50 | 51 | 52 | 53 | 54 | 9999 55 | 56 | 57 | 58 | 59 | 60 | 61 | Height: 62 | 63 | 64 | 65 | 66 | 67 | 68 | 9999 69 | 70 | 71 | 72 | 73 | 74 | 75 | Force resolution: 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Set As GRUB Wallpaper: 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | KUrlRequester 100 | QFrame 101 |
kurlrequester.h
102 |
103 |
104 | 105 | 106 |
107 | -------------------------------------------------------------------------------- /ui/groupDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GroupDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | 15 | 16 | 17 | Lock group 18 | 19 | 20 | 21 | 22 | 23 | 24 | &Available users: 25 | 26 | 27 | Selected &users: 28 | 29 | 30 | false 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | KActionSelector 39 | QWidget 40 |
kactionselector.h
41 |
42 |
43 | 44 | 45 |
46 | -------------------------------------------------------------------------------- /ui/installDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | InstallDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 291 10 | 242 11 | 12 | 13 | 14 | 15 | 16 | 17 | Select partition to install/recover GRUB: 18 | 19 | 20 | 21 | 22 | 23 | 24 | QAbstractItemView::NoEditTriggers 25 | 26 | 27 | 28 | 32 29 | 32 30 | 31 | 32 | 33 | false 34 | 35 | 36 | 6 37 | 38 | 39 | false 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Partition 49 | 50 | 51 | 52 | 53 | Mountpoint 54 | 55 | 56 | 57 | 58 | Label 59 | 60 | 61 | 62 | 63 | File System 64 | 65 | 66 | 67 | 68 | Size 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Install the bootloader on the boot sector of the selected partition instead of the MBR(=Master Boot Sector). Not recommended. 77 | 78 | 79 | Install on partition instead of MBR (Advanced) 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ui/removeDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | RemoveDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 264 10 | 243 11 | 12 | 13 | 14 | 15 | 16 | 17 | Select entries to remove: 18 | 19 | 20 | 21 | 22 | 23 | 24 | true 25 | 26 | 27 | false 28 | 29 | 30 | 31 | 32 | 33 | 34 | Remove associated kernel header files. 35 | 36 | 37 | Also remove associated old packages 38 | 39 | 40 | true 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ui/userDlg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | UserDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 445 10 | 150 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | User Name 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Password 30 | 31 | 32 | 33 | 34 | 35 | 36 | QLineEdit::Password 37 | 38 | 39 | 40 | 41 | 42 | 43 | Confirm password 44 | 45 | 46 | 47 | 48 | 49 | 50 | QLineEdit::Password 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Superuser 60 | 61 | 62 | 63 | 64 | 65 | 66 | Crypt password 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | --------------------------------------------------------------------------------