Merge branch 'kauth'
This commit is contained in:
commit
e2b31f81fb
|
@ -1,4 +1,5 @@
|
|||
# Copyright (C) 2008 by Volker Lanz <vl@fidra.de>
|
||||
# Copyright (C) 2014-2018 by Andrius Štikonas <andrius@stikonas.eu>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
|
@ -15,19 +16,21 @@
|
|||
|
||||
project(partitionmanager)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
|
||||
# Dependencies
|
||||
set(QT_MIN_VERSION "5.10.0")
|
||||
set(KF5_MIN_VERSION "5.31")
|
||||
set(KPMCORE_MIN_VERSION "3.50.0")
|
||||
|
||||
set(CMAKE_USE_RELATIVE_PATHS OFF)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
||||
set(KDE_INSTALL_USE_QT_SYS_PATHS ON CACHE BOOL "Install mkspecs files, Plugins and Imports to the Qt 5 install dir" FORCE)
|
||||
|
||||
set(QT_MIN_VERSION "5.7.0")
|
||||
set(KF5_MIN_VERSION "5.31")
|
||||
set(KPMCORE_MIN_VERSION "3.3.0")
|
||||
# Check KPMcore dependency when bumping
|
||||
set(VERSION_MAJOR "3")
|
||||
set(VERSION_MINOR "3")
|
||||
set(VERSION_RELEASE "1")
|
||||
set(VERSION_MINOR "50")
|
||||
set(VERSION_RELEASE "0")
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE})
|
||||
add_definitions(-D'VERSION="${VERSION}"') #"
|
||||
|
||||
|
@ -57,6 +60,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
|
|||
ConfigWidgets
|
||||
CoreAddons
|
||||
Crash
|
||||
DBusAddons
|
||||
I18n
|
||||
IconThemes
|
||||
JobWidgets
|
||||
|
|
|
@ -44,6 +44,7 @@ target_link_libraries(partitionmanager ${BLKID_LIBRARIES}
|
|||
KF5::ConfigWidgets
|
||||
KF5::CoreAddons
|
||||
KF5::Crash
|
||||
KF5::DBusAddons
|
||||
KF5::I18n
|
||||
KF5::IconThemes
|
||||
KF5::JobWidgets
|
||||
|
|
|
@ -84,8 +84,8 @@ void ConfigureOptionsDialog::updateSettings()
|
|||
|
||||
bool changed = false;
|
||||
|
||||
if (generalPageWidget().defaultFileSystem() != Config::defaultFileSystem()) {
|
||||
Config::setDefaultFileSystem(generalPageWidget().defaultFileSystem());
|
||||
if (generalPageWidget().defaultFileSystem() != static_cast<FileSystem::Type>(Config::defaultFileSystem())) {
|
||||
Config::setDefaultFileSystem(static_cast<int>(generalPageWidget().defaultFileSystem()));
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ bool ConfigureOptionsDialog::hasChanged()
|
|||
bool result = KConfigDialog::hasChanged();
|
||||
|
||||
KConfigSkeletonItem* kcItem = Config::self()->findItem(QStringLiteral("defaultFileSystem"));
|
||||
result = result || !kcItem->isEqual(generalPageWidget().defaultFileSystem());
|
||||
result = result || !kcItem->isEqual(static_cast<int>(generalPageWidget().defaultFileSystem()));
|
||||
result = result || (generalPageWidget().kcfg_shredSource->checkedId() != Config::shredSource());
|
||||
|
||||
if (advancedPageWidget().isVisible()) {
|
||||
|
|
|
@ -6,39 +6,11 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>367</width>
|
||||
<width>449</width>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Permissions</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="kcfg_allowApplyOperationsAsNonRoot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow applying operations without administrator privileges</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="sizePolicy">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>481</width>
|
||||
<width>484</width>
|
||||
<height>457</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -22,7 +22,7 @@
|
|||
<property name="title">
|
||||
<string>File Systems</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel">
|
||||
<property name="text">
|
||||
|
@ -37,7 +37,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode2"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeExt2"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
|
@ -66,7 +66,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode3"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeExt3"/>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
|
@ -94,8 +94,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode4"/>
|
||||
<item row="0" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeExt4"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="textLabel_21">
|
||||
|
@ -111,7 +111,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode17"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeBtrfs"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_15">
|
||||
|
@ -140,7 +140,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode8"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeNtfs"/>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
|
@ -156,6 +156,19 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QLabel" name="textLabel_18">
|
||||
<property name="text">
|
||||
<string>Linux RAID:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="textLabel_4">
|
||||
<property name="text">
|
||||
<string>Linux Swap:</string>
|
||||
|
@ -168,24 +181,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode5"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="textLabel_32">
|
||||
<property name="text">
|
||||
<string>FAT12:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode29"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeLinuxSwap"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_21">
|
||||
|
@ -201,9 +198,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="textLabel_6">
|
||||
<widget class="QLabel" name="textLabel_32">
|
||||
<property name="text">
|
||||
<string>FAT16:</string>
|
||||
<string>FAT12:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -214,7 +211,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode6"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeFat12"/>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<spacer name="horizontalSpacer_17">
|
||||
|
@ -230,9 +227,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QLabel" name="textLabel_5">
|
||||
<widget class="QLabel" name="textLabel_6">
|
||||
<property name="text">
|
||||
<string>FAT32:</string>
|
||||
<string>FAT16:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -242,10 +239,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode7"/>
|
||||
</item>
|
||||
<item row="2" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeFat16"/>
|
||||
</item>
|
||||
<item row="2" column="9">
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -258,10 +255,10 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="textLabel_25">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="textLabel_5">
|
||||
<property name="text">
|
||||
<string>ZFS:</string>
|
||||
<string>FAT32:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -271,10 +268,26 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeFat32"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QLabel" name="textLabel_7">
|
||||
<widget class="QLabel" name="textLabel_10">
|
||||
<property name="text">
|
||||
<string>ReiserFS:</string>
|
||||
<string>HPFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -285,7 +298,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode9"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeHpfs"/>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
|
@ -301,6 +314,22 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="6">
|
||||
<widget class="QLabel" name="textLabel_7">
|
||||
<property name="text">
|
||||
<string>ReiserFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeReiserFS"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="textLabel_8">
|
||||
<property name="text">
|
||||
<string>Reiser4:</string>
|
||||
|
@ -313,53 +342,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode10"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>28</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="textLabel_10">
|
||||
<property name="text">
|
||||
<string>HPFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode18"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="textLabel_11">
|
||||
<property name="text">
|
||||
<string>JFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode12"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeReiser4"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
|
@ -375,9 +359,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QLabel" name="textLabel_12">
|
||||
<widget class="QLabel" name="textLabel_11">
|
||||
<property name="text">
|
||||
<string>HFS:</string>
|
||||
<string>JFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -388,7 +372,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode13"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeJfs"/>
|
||||
</item>
|
||||
<item row="4" column="5">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
|
@ -404,6 +388,22 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="6">
|
||||
<widget class="QLabel" name="textLabel_12">
|
||||
<property name="text">
|
||||
<string>HFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeHfs"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="textLabel_14">
|
||||
<property name="text">
|
||||
<string>HFS+:</string>
|
||||
|
@ -416,24 +416,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode14"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="textLabel_15">
|
||||
<property name="text">
|
||||
<string>UFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode15"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeHfsPlus"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<spacer name="horizontalSpacer_10">
|
||||
|
@ -449,9 +433,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="3">
|
||||
<widget class="QLabel" name="textLabel_22">
|
||||
<widget class="QLabel" name="textLabel_15">
|
||||
<property name="text">
|
||||
<string>XFS:</string>
|
||||
<string>UFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -462,7 +446,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode11"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeUfs"/>
|
||||
</item>
|
||||
<item row="5" column="5">
|
||||
<spacer name="horizontalSpacer_9">
|
||||
|
@ -478,6 +462,22 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="6">
|
||||
<widget class="QLabel" name="textLabel_22">
|
||||
<property name="text">
|
||||
<string>XFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeXfs"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="textLabel_24">
|
||||
<property name="text">
|
||||
<string>OCFS2:</string>
|
||||
|
@ -490,37 +490,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode20"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode21"/>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLabel" name="textLabel_26">
|
||||
<property name="text">
|
||||
<string>exFAT:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode22"/>
|
||||
</item>
|
||||
<item row="6" column="6">
|
||||
<widget class="QLabel" name="textLabel_27">
|
||||
<property name="text">
|
||||
<string>NILFS2:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode23"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeOcfs2"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<spacer name="horizontalSpacer_13">
|
||||
|
@ -535,6 +506,22 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QLabel" name="textLabel_25">
|
||||
<property name="text">
|
||||
<string>ZFS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeZfs"/>
|
||||
</item>
|
||||
<item row="6" column="5">
|
||||
<spacer name="horizontalSpacer_14">
|
||||
<property name="orientation">
|
||||
|
@ -548,21 +535,31 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="textLabel_28">
|
||||
<item row="6" column="6">
|
||||
<widget class="QLabel" name="textLabel_26">
|
||||
<property name="text">
|
||||
<string>LVM2 PV:</string>
|
||||
<string>exFAT:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeExfat"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="textLabel_27">
|
||||
<property name="text">
|
||||
<string>NILFS2:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode24"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeNilfs2"/>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<spacer name="horizontalSpacer_22">
|
||||
|
@ -578,9 +575,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="3">
|
||||
<widget class="QLabel" name="textLabel_29">
|
||||
<widget class="QLabel" name="textLabel_28">
|
||||
<property name="text">
|
||||
<string>F2FS:</string>
|
||||
<string>LVM2 PV:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -591,7 +588,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode25"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeLvm2_PV"/>
|
||||
</item>
|
||||
<item row="7" column="5">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
|
@ -607,6 +604,22 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="6">
|
||||
<widget class="QLabel" name="textLabel_29">
|
||||
<property name="text">
|
||||
<string>F2FS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeF2fs"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="textLabel_30">
|
||||
<property name="text">
|
||||
<string>UDF:</string>
|
||||
|
@ -619,24 +632,8 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode26"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="textLabel_31">
|
||||
<property name="text">
|
||||
<string>ISO 9660:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode27"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeUdf"/>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<spacer name="horizontalSpacer_19">
|
||||
|
@ -652,9 +649,9 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="3">
|
||||
<widget class="QLabel" name="textLabel_20">
|
||||
<widget class="QLabel" name="textLabel_31">
|
||||
<property name="text">
|
||||
<string>LUKS:</string>
|
||||
<string>ISO 9660:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
|
@ -665,7 +662,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="8" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode19"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeIso9660"/>
|
||||
</item>
|
||||
<item row="8" column="5">
|
||||
<spacer name="horizontalSpacer_20">
|
||||
|
@ -681,6 +678,22 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="6">
|
||||
<widget class="QLabel" name="textLabel_20">
|
||||
<property name="text">
|
||||
<string>LUKS:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeLuks"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="textLabel_33">
|
||||
<property name="text">
|
||||
<string>LUKS2:</string>
|
||||
|
@ -693,10 +706,10 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode28"/>
|
||||
<item row="9" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeLuks2"/>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="8">
|
||||
<item row="10" column="0" colspan="9">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
@ -717,7 +730,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode1"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeExtended"/>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<spacer name="horizontalSpacer_12">
|
||||
|
@ -746,7 +759,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="11" column="4">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode16"/>
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeUnformatted"/>
|
||||
</item>
|
||||
<item row="11" column="5">
|
||||
<spacer name="horizontalSpacer_11">
|
||||
|
@ -774,8 +787,11 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="7">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode0"/>
|
||||
<item row="11" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeUnknown"/>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<widget class="KColorButton" name="kcfg_fileSystemColorCodeLinuxRaidMember"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -48,7 +48,7 @@ void GeneralPageWidget::setupDialog()
|
|||
{
|
||||
QStringList fsNames;
|
||||
for (const auto &fs : FileSystemFactory::map())
|
||||
if (fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended && fs->type() != FileSystem::Luks)
|
||||
if (fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Type::Extended && fs->type() != FileSystem::Type::Luks)
|
||||
fsNames.append(fs->name());
|
||||
|
||||
std::sort(fsNames.begin(), fsNames.end(), caseInsensitiveLessThan);
|
||||
|
|
|
@ -143,6 +143,7 @@ void ApplyProgressDialog::show()
|
|||
|
||||
dialogWidget().treeTasks().clear();
|
||||
okButton->setVisible(false);
|
||||
okButton->setEnabled(false);
|
||||
cancelButton->setVisible(true);
|
||||
cancelButton->setEnabled(true);
|
||||
|
||||
|
@ -244,6 +245,7 @@ void ApplyProgressDialog::allOpsDone(const QString& msg)
|
|||
dialogWidget().progressTotal().setValue(operationRunner().numJobs());
|
||||
cancelButton->setVisible(false);
|
||||
okButton->setVisible(true);
|
||||
okButton->setEnabled(true);
|
||||
detailsWidget().buttonSave().setEnabled(true);
|
||||
detailsWidget().buttonBrowser().setEnabled(true);
|
||||
timer().stop();
|
||||
|
@ -364,7 +366,7 @@ void ApplyProgressDialog::addTaskOutput(int num, const Operation& op)
|
|||
item->setFont(0, f);
|
||||
item->setFont(1, f);
|
||||
|
||||
item->setData(0, Qt::UserRole, reinterpret_cast<const qulonglong>(&op));
|
||||
item->setData(0, Qt::UserRole, reinterpret_cast<qulonglong>(&op));
|
||||
dialogWidget().treeTasks().addTopLevelItem(item);
|
||||
dialogWidget().treeTasks().scrollToBottom();
|
||||
setCurrentOpItem(item);
|
||||
|
|
|
@ -19,10 +19,14 @@
|
|||
#include "gui/createvolumegroupdialog.h"
|
||||
#include "gui/volumegroupwidget.h"
|
||||
|
||||
#include <core/device.h>
|
||||
#include <core/lvmdevice.h>
|
||||
#include <core/partitiontable.h>
|
||||
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
||||
#include <ops/deleteoperation.h>
|
||||
|
||||
#include <util/capacity.h>
|
||||
#include <util/helpers.h>
|
||||
|
||||
|
@ -32,10 +36,11 @@
|
|||
#include <KLocalizedString>
|
||||
#include <KSharedConfig>
|
||||
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& partList, qint32& peSize, QList<Device*> devices)
|
||||
CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& partList, qint32& peSize, QList<Device*> devices, QList<Operation*> pendingOps)
|
||||
: VolumeGroupDialog(parent, vgName, partList)
|
||||
, m_PESize(peSize)
|
||||
, m_Devices(devices)
|
||||
, m_PendingOps(pendingOps)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Create new Volume Group"));
|
||||
|
||||
|
@ -52,9 +57,49 @@ CreateVolumeGroupDialog::CreateVolumeGroupDialog(QWidget* parent, QString& vgNam
|
|||
|
||||
void CreateVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
for (const auto &p : qAsConst(LVM::pvList))
|
||||
for (const auto &p : qAsConst(LVM::pvList::list())) {
|
||||
bool toBeDeleted = false;
|
||||
|
||||
// Ignore partitions that are going to be deleted
|
||||
for (const auto &o : qAsConst(m_PendingOps)) {
|
||||
if (dynamic_cast<DeleteOperation *>(o) && o->targets(*p.partition())) {
|
||||
toBeDeleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (toBeDeleted)
|
||||
continue;
|
||||
|
||||
if (!p.isLuks() && p.vgName() == QString() && !LvmDevice::s_DirtyPVs.contains(p.partition()))
|
||||
dialogWidget().listPV().addPartition(*p.partition(), false);
|
||||
}
|
||||
|
||||
for (const Device *d : qAsConst(m_Devices)) {
|
||||
if (d->partitionTable() != nullptr) {
|
||||
for (const Partition *p : qAsConst(d->partitionTable()->children())) {
|
||||
// Looking if there is another VG creation that contains this partition
|
||||
if (LvmDevice::s_DirtyPVs.contains(p))
|
||||
continue;
|
||||
|
||||
// Including new LVM PVs (that are currently in OperationStack and that aren't at other VG creation)
|
||||
if (p->state() == Partition::State::New) {
|
||||
if (p->fileSystem().type() == FileSystem::Type::Lvm2_PV)
|
||||
dialogWidget().listPV().addPartition(*p, false);
|
||||
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
||||
FileSystem *fs = static_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
||||
|
||||
if (fs->type() == FileSystem::Type::Lvm2_PV)
|
||||
dialogWidget().listPV().addPartition(*p, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const Partition *p : qAsConst(LvmDevice::s_OrphanPVs))
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p))
|
||||
dialogWidget().listPV().addPartition(*p, false);
|
||||
}
|
||||
|
||||
void CreateVolumeGroupDialog::setupConnections()
|
||||
|
@ -76,6 +121,14 @@ void CreateVolumeGroupDialog::accept()
|
|||
QDialog::accept();
|
||||
}
|
||||
|
||||
void CreateVolumeGroupDialog::updateOkButtonStatus()
|
||||
{
|
||||
VolumeGroupDialog::updateOkButtonStatus();
|
||||
|
||||
if (okButton->isEnabled())
|
||||
okButton->setEnabled(!dialogWidget().listPV().checkedItems().empty());
|
||||
}
|
||||
|
||||
void CreateVolumeGroupDialog::onVGNameChanged(const QString& vgName)
|
||||
{
|
||||
for (const auto &d : m_Devices) {
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||
*************************************************************************/
|
||||
|
||||
#if !defined(CREATEVOLUMEGROUPDIALOG_H)
|
||||
|
||||
#ifndef CREATEVOLUMEGROUPDIALOG_H
|
||||
#define CREATEVOLUMEGROUPDIALOG_H
|
||||
|
||||
#include <core/device.h>
|
||||
|
@ -25,13 +24,14 @@
|
|||
#include "gui/volumegroupdialog.h"
|
||||
|
||||
class Device;
|
||||
class Operation;
|
||||
|
||||
class CreateVolumeGroupDialog : public VolumeGroupDialog
|
||||
{
|
||||
Q_DISABLE_COPY(CreateVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& pvList, qint32& peSize, QList<Device*> devices);
|
||||
CreateVolumeGroupDialog(QWidget* parent, QString& vgName, QVector<const Partition*>& pvList, qint32& peSize, QList<Device*> devices, QList<Operation*> pendingOps = QList<Operation *>());
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -39,6 +39,7 @@ protected:
|
|||
void setupConnections() override;
|
||||
|
||||
protected:
|
||||
virtual void updateOkButtonStatus() override;
|
||||
void onVGNameChanged(const QString& vgname);
|
||||
void onSpinPESizeChanged(int newsize);
|
||||
|
||||
|
@ -50,6 +51,7 @@ protected:
|
|||
|
||||
private:
|
||||
const QList<Device*> m_Devices; // List of all devices found on the system
|
||||
const QList<Operation*> m_PendingOps; // List of pending operations in KPM
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -106,15 +106,10 @@ void DevicePropsDialog::setupDialog()
|
|||
dialogWidget().capacity().setText(Capacity::formatByteSize(device().capacity()));
|
||||
dialogWidget().totalSectors().setText(QLocale().toString(device().totalLogical()));
|
||||
|
||||
if (device().type() == Device::Disk_Device) {
|
||||
if (device().type() == Device::Type::Disk_Device) {
|
||||
|
||||
const DiskDevice& disk = dynamic_cast<const DiskDevice&>(device());
|
||||
const QString cyls = QLocale().toString((disk.cylinders()));
|
||||
const QString heads = QLocale().toString((disk.heads()));
|
||||
const QString sectors = QLocale().toString((disk.sectorsPerTrack()));
|
||||
dialogWidget().chs().setText(QStringLiteral("%1/%2/%3").arg(cyls).arg(heads).arg(sectors));
|
||||
|
||||
dialogWidget().cylinderSize().setText(i18ncp("@label", "1 Sector", "%1 Sectors", disk.cylinderSize()));
|
||||
dialogWidget().primariesMax().setText(maxPrimaries);
|
||||
dialogWidget().logicalSectorSize().setText(Capacity::formatByteSize(disk.logicalSectorSize()));
|
||||
dialogWidget().physicalSectorSize().setText(Capacity::formatByteSize(disk.physicalSectorSize()));
|
||||
|
@ -132,8 +127,10 @@ void DevicePropsDialog::setupDialog()
|
|||
dialogWidget().buttonSmartMore().setVisible(false);
|
||||
}
|
||||
} else {
|
||||
if (device().type() == Device::LVM_Device)
|
||||
if (device().type() == Device::Type::LVM_Device)
|
||||
dialogWidget().type().setText(xi18nc("@label device", "LVM Volume Group"));
|
||||
else if (device().type() == Device::Type::SoftwareRAID_Device)
|
||||
dialogWidget().type().setText(xi18nc("@label device", "Software RAID Device"));
|
||||
else
|
||||
dialogWidget().type().setText(xi18nc("@label device", "Volume Manager Device"));
|
||||
//TODO: add Volume Manger Device info
|
||||
|
|
|
@ -37,18 +37,10 @@ public:
|
|||
return *m_PartTableWidget;
|
||||
}
|
||||
|
||||
QLabel& chs() {
|
||||
Q_ASSERT(m_LabelCHS);
|
||||
return *m_LabelCHS;
|
||||
}
|
||||
QLabel& capacity() {
|
||||
Q_ASSERT(m_LabelCapacity);
|
||||
return *m_LabelCapacity;
|
||||
}
|
||||
QLabel& cylinderSize() {
|
||||
Q_ASSERT(m_LabelCylinderSize);
|
||||
return *m_LabelCylinderSize;
|
||||
}
|
||||
QLabel& primariesMax() {
|
||||
Q_ASSERT(m_LabelPrimariesMax);
|
||||
return *m_LabelPrimariesMax;
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioSectorBased">
|
||||
<property name="text">
|
||||
<string>Sector based al&ignment</string>
|
||||
<string>Sector based align&ment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -149,35 +149,6 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextCHS">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cylinders/Heads/Sectors:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="m_LabelCHS">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>5</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextLogicalSectorSize">
|
||||
<property name="text">
|
||||
<string>Logical sector size:</string>
|
||||
|
@ -187,14 +158,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="m_LabelLogicalSectorSize">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextPhysicalSectorSize">
|
||||
<property name="text">
|
||||
<string>Physical sector size:</string>
|
||||
|
@ -204,38 +175,28 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="m_LabelPhysicalSectorSize">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextCylinderSize">
|
||||
<property name="text">
|
||||
<string>Cylinder size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="m_LabelCylinderSize">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextPrimariesMax">
|
||||
<property name="text">
|
||||
<string>Primaries/Max:</string>
|
||||
|
@ -245,21 +206,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="m_LabelPrimariesMax">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="2">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextSmartStatus">
|
||||
<property name="text">
|
||||
<string>SMART status:</string>
|
||||
|
@ -269,7 +223,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="13" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_LabelSmartStatusIcon">
|
||||
|
@ -306,7 +260,7 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="16" column="0" colspan="2">
|
||||
<item row="14" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
|
|
@ -49,10 +49,10 @@ EditMountPointDialog::EditMountPointDialog(QWidget* parent, Partition& p) :
|
|||
this );
|
||||
mainLayout->addWidget(dbb);
|
||||
connect(dbb, &QDialogButtonBox::accepted,
|
||||
this, [=] () {accept_(Edit);} );
|
||||
this, [=] () {accept_(MountPointAction::Edit);} );
|
||||
connect(dbb, &QDialogButtonBox::rejected,
|
||||
this, &EditMountPointDialog::reject);
|
||||
connect(widget().m_ButtonRemove, &QPushButton::clicked, this, [=] () {accept_(Remove);} );
|
||||
connect(widget().m_ButtonRemove, &QPushButton::clicked, this, [=] () {accept_(MountPointAction::Remove);} );
|
||||
}
|
||||
|
||||
/** Destroys an EditMountOptionsDialog instance */
|
||||
|
@ -72,12 +72,12 @@ void EditMountPointDialog::accept_(MountPointAction action)
|
|||
KStandardGuiItem::cancel(),
|
||||
QStringLiteral("reallyWriteMountPoints")) == KMessageBox::Cancel)
|
||||
return;
|
||||
if(action == Remove)
|
||||
if(action == MountPointAction::Remove)
|
||||
widget().removeMountPoint();
|
||||
else if (action == Edit)
|
||||
else if (action == MountPointAction::Edit)
|
||||
widget().acceptChanges();
|
||||
if (writeMountpoints(widget().fstabEntries())) {
|
||||
if (action == Edit)
|
||||
if (action == MountPointAction::Edit)
|
||||
partition().setMountPoint(widget().editPath().currentText());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -28,7 +28,7 @@ class Partition;
|
|||
class QWidget;
|
||||
class QString;
|
||||
|
||||
enum MountPointAction
|
||||
enum class MountPointAction
|
||||
{
|
||||
Remove,
|
||||
Edit
|
||||
|
|
|
@ -42,7 +42,7 @@ EditMountPointDialogWidget::EditMountPointDialogWidget(QWidget* parent, Partitio
|
|||
setupUi(this);
|
||||
|
||||
m_deviceNode = partition().deviceNode();
|
||||
if (partition().roles().has(PartitionRole::Luks) && partition().fileSystem().type() != FileSystem::Luks) {
|
||||
if (partition().roles().has(PartitionRole::Luks) && partition().fileSystem().type() != FileSystem::Type::Luks) {
|
||||
const FS::luks* luksFs = dynamic_cast<const FS::luks*>(&partition().fileSystem());
|
||||
m_deviceNode = luksFs->mapperName();
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ EditMountPointDialogWidget::EditMountPointDialogWidget(QWidget* parent, Partitio
|
|||
for (auto &e : m_fstabEntries) {
|
||||
QString canonicalEntryPath = QFileInfo(e.deviceNode()).canonicalFilePath();
|
||||
QString canonicalDevicePath = QFileInfo(m_deviceNode).canonicalFilePath();
|
||||
if (canonicalEntryPath == canonicalDevicePath) { // FIXME fix multiple mountpoints
|
||||
if (canonicalEntryPath == canonicalDevicePath) {
|
||||
entryFound = true;
|
||||
entry.append(&e);
|
||||
entry.push_back(&e);
|
||||
mountPointList = possibleMountPoints(e.deviceNode());
|
||||
}
|
||||
}
|
||||
|
@ -65,19 +65,19 @@ EditMountPointDialogWidget::EditMountPointDialogWidget(QWidget* parent, Partitio
|
|||
FileSystem::Type type = partition().fileSystem().type();
|
||||
QString fsName;
|
||||
switch (type) {
|
||||
case FileSystem::LinuxSwap:
|
||||
case FileSystem::Type::LinuxSwap:
|
||||
fsName = QStringLiteral("swap");
|
||||
break;
|
||||
case FileSystem::Fat16:
|
||||
case FileSystem::Fat32:
|
||||
case FileSystem::Type::Fat16:
|
||||
case FileSystem::Type::Fat32:
|
||||
fsName = QStringLiteral("vfat");
|
||||
break;
|
||||
default:
|
||||
fsName = partition().fileSystem().name();
|
||||
}
|
||||
|
||||
m_fstabEntries.append(FstabEntry(m_deviceNode, QString(), fsName, QString()));
|
||||
entry.append(&m_fstabEntries.last());
|
||||
m_fstabEntries.push_back(FstabEntry(m_deviceNode, QString(), fsName, QString()));
|
||||
entry.push_back(&m_fstabEntries.back());
|
||||
}
|
||||
currentEntry = entry[0];
|
||||
editPath().addItems(mountPointList);
|
||||
|
@ -127,7 +127,7 @@ void EditMountPointDialogWidget::setupOptions(const QStringList& options)
|
|||
m_Options = optTmpList.join(QLatin1Char(','));
|
||||
}
|
||||
|
||||
void EditMountPointDialogWidget::setupRadio(const FstabEntryType entryType)
|
||||
void EditMountPointDialogWidget::setupRadio(const FstabEntry::Type entryType)
|
||||
{
|
||||
if (partition().fileSystem().uuid().isEmpty()) {
|
||||
radioUUID().setEnabled(false);
|
||||
|
@ -141,26 +141,26 @@ void EditMountPointDialogWidget::setupRadio(const FstabEntryType entryType)
|
|||
radioDeviceNode().setChecked(true);
|
||||
}
|
||||
switch (entryType) {
|
||||
case FstabEntryType::uuid:
|
||||
case FstabEntry::Type::uuid:
|
||||
radioUUID().setChecked(true);
|
||||
break;
|
||||
|
||||
case FstabEntryType::label:
|
||||
case FstabEntry::Type::label:
|
||||
radioLabel().setChecked(true);
|
||||
break;
|
||||
|
||||
case FstabEntryType::partuuid:
|
||||
case FstabEntry::Type::partuuid:
|
||||
radioUUID().setChecked(true);
|
||||
break;
|
||||
|
||||
case FstabEntryType::partlabel:
|
||||
case FstabEntry::Type::partlabel:
|
||||
radioLabel().setChecked(true);
|
||||
break;
|
||||
|
||||
case FstabEntryType::deviceNode:
|
||||
case FstabEntry::Type::deviceNode:
|
||||
radioDeviceNode().setChecked(true);
|
||||
break;
|
||||
case FstabEntryType::comment:
|
||||
case FstabEntry::Type::comment:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -174,24 +174,24 @@ void EditMountPointDialogWidget::buttonSelectClicked(bool)
|
|||
|
||||
void EditMountPointDialogWidget::removeMountPoint()
|
||||
{
|
||||
int i=0;
|
||||
for (const auto &e : fstabEntries()) {
|
||||
if(editPath().count()<=1 && ((e.fsSpec().contains(partition().deviceNode()) && !partition().deviceNode().isEmpty() ) || (e.fsSpec().contains(partition().fileSystem().uuid()) && !partition().fileSystem().uuid().isEmpty()) ||
|
||||
(e.fsSpec().contains(partition().fileSystem().label()) && !partition().fileSystem().label().isEmpty()) || (e.fsSpec().contains(partition().label()) && !partition().label().isEmpty() ) || (e.fsSpec().contains(partition().uuid()) && !partition().uuid().isEmpty() )))
|
||||
{
|
||||
fstabEntries().removeAt(i);
|
||||
for (auto it = fstabEntries().begin(); it != fstabEntries().end(); ) {
|
||||
if (editPath().count() <= 1 && (
|
||||
(it->fsSpec().contains(partition().deviceNode()) && !partition().deviceNode().isEmpty() ) ||
|
||||
(it->fsSpec().contains(partition().fileSystem().uuid()) && !partition().fileSystem().uuid().isEmpty() ) ||
|
||||
(it->fsSpec().contains(partition().fileSystem().label()) && !partition().fileSystem().label().isEmpty()) ||
|
||||
(it->fsSpec().contains(partition().label()) && !partition().label().isEmpty() ) ||
|
||||
(it->fsSpec().contains(partition().uuid()) && !partition().uuid().isEmpty() )))
|
||||
{
|
||||
fstabEntries().erase(it);
|
||||
partition().setMountPoint(QString());
|
||||
i--;
|
||||
}
|
||||
else if(editPath().count()>1 && ((&e == currentEntry)))
|
||||
{
|
||||
fstabEntries().removeAt(i);
|
||||
}
|
||||
else if (editPath().count() > 1 && ((&*it == currentEntry)))
|
||||
{
|
||||
fstabEntries().erase(it);
|
||||
editPath().removeItem(editPath().currentIndex());
|
||||
partition().setMountPoint(editPath().itemText(editPath().currentIndex()));
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ protected:
|
|||
|
||||
private:
|
||||
void setupOptions(const QStringList& options);
|
||||
void setupRadio(const FstabEntryType entryType);
|
||||
void setupRadio(const FstabEntry::Type entryType);
|
||||
std::map<QString, QCheckBox*>& boxOptions() {
|
||||
return m_BoxOptions;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ private:
|
|||
|
||||
private:
|
||||
FstabEntryList m_fstabEntries;
|
||||
QList<FstabEntry *> entry;
|
||||
QList<FstabEntry *> entry; // All fstab entries for this partition
|
||||
FstabEntry *currentEntry;
|
||||
Partition& m_Partition;
|
||||
QString m_Options;
|
||||
|
|
|
@ -72,8 +72,8 @@ void FileSystemSupportDialog::setupDialog()
|
|||
dialogWidget().tree().clear();
|
||||
|
||||
for (const auto &fs : FileSystemFactory::map()) {
|
||||
if (fs->type() == FileSystem::Unknown || fs->type() == FileSystem::Extended ||
|
||||
fs->type() == FileSystem::Luks || fs->type() == FileSystem::Luks2) {
|
||||
if (fs->type() == FileSystem::Type::Unknown || fs->type() == FileSystem::Type::Extended ||
|
||||
fs->type() == FileSystem::Type::Luks || fs->type() == FileSystem::Type::Luks2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <core/diskdevice.h>
|
||||
#include <core/lvmdevice.h>
|
||||
#include <core/partition.h>
|
||||
#include <core/softwareraid.h>
|
||||
|
||||
#include <fs/filesystem.h>
|
||||
#include <fs/luks.h>
|
||||
|
@ -114,7 +115,7 @@ void InfoPane::showPartition(Qt::DockWidgetArea area, const Partition& p)
|
|||
|
||||
int x = 0;
|
||||
int y = createHeader(p.deviceNode(), cols(area));
|
||||
if (p.fileSystem().type() == FileSystem::Luks) { // inactive LUKS partition
|
||||
if (p.fileSystem().type() == FileSystem::Type::Luks) { // inactive LUKS partition
|
||||
const FS::luks* luksFs = static_cast<const FS::luks*>(&p.fileSystem());
|
||||
QString deviceNode = p.partitionPath();
|
||||
createLabels(i18nc("@label partition", "File system:"), p.fileSystem().name(), cols(area), x, y);
|
||||
|
@ -127,7 +128,7 @@ void InfoPane::showPartition(Qt::DockWidgetArea area, const Partition& p)
|
|||
createLabels(i18nc("@label partition", "First sector:"), QLocale().toString(p.firstSector()), cols(area), x, y);
|
||||
createLabels(i18nc("@label partition", "Last sector:"), QLocale().toString(p.lastSector()), cols(area), x, y);
|
||||
createLabels(i18nc("@label partition", "Number of sectors:"), QLocale().toString(p.length()), cols(area), x, y);
|
||||
} else if (p.fileSystem().type() == FileSystem::Lvm2_PV) {
|
||||
} else if (p.fileSystem().type() == FileSystem::Type::Lvm2_PV) {
|
||||
FS::lvm2_pv *lvm2PVFs;
|
||||
innerFS(&p, lvm2PVFs);
|
||||
QString deviceNode = p.partitionPath();
|
||||
|
@ -176,8 +177,8 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d)
|
|||
maxPrimaries = QStringLiteral("%1/%2").arg(d.partitionTable()->numPrimaries()).arg(d.partitionTable()->maxPrimaries());
|
||||
}
|
||||
|
||||
if (d.type() == Device::Disk_Device) {
|
||||
const DiskDevice& disk = dynamic_cast<const DiskDevice&>(d);
|
||||
if (d.type() == Device::Type::Disk_Device) {
|
||||
const DiskDevice& disk = static_cast<const DiskDevice&>(d);
|
||||
|
||||
createLabels(i18nc("@label device", "Type:"), type, cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Capacity:"), Capacity::formatByteSize(disk.capacity()), cols(area), x, y);
|
||||
|
@ -185,14 +186,22 @@ void InfoPane::showDevice(Qt::DockWidgetArea area, const Device& d)
|
|||
createLabels(i18nc("@label device", "Logical sector size:"), Capacity::formatByteSize(disk.logicalSectorSize()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Physical sector size:"), Capacity::formatByteSize(disk.physicalSectorSize()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Primaries/Max:"), maxPrimaries, cols(area), x, y);
|
||||
} else if (d.type() == Device::LVM_Device) {
|
||||
const LvmDevice& lvm = dynamic_cast<const LvmDevice&>(d);
|
||||
} else if (d.type() == Device::Type::LVM_Device) {
|
||||
const LvmDevice& lvm = static_cast<const LvmDevice&>(d);
|
||||
createLabels(i18nc("@label device", "Volume Type:"), QStringLiteral("LVM"), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Capacity:"), Capacity::formatByteSize(lvm.capacity()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "PE Size:"), Capacity::formatByteSize(lvm.peSize()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Total PE:"),QString::number(lvm.totalPE()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Allocated PE:"), QString::number(lvm.allocatedPE()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Free PE:"), QString::number(lvm.freePE()), cols(area), x, y);
|
||||
} else if (d.type() == Device::Type::SoftwareRAID_Device) {
|
||||
const SoftwareRAID& raid = static_cast<const SoftwareRAID&>(d);
|
||||
createLabels(i18nc("@label device", "Volume Type:"), QStringLiteral("RAID"), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Capacity:"), Capacity::formatByteSize(raid.capacity()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "RAID Level:"), raid.raidLevel() < 0 ? QStringLiteral("---") : QString::number(raid.raidLevel()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Chunk Size:"),Capacity::formatByteSize(raid.chunkSize()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Total Chunk:"), Capacity::formatByteSize(raid.totalChunk()), cols(area), x, y);
|
||||
createLabels(i18nc("@label device", "Array Size:"), Capacity::formatByteSize(raid.arraySize()), cols(area), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include <fs/filesystemfactory.h>
|
||||
#include <fs/luks.h>
|
||||
|
||||
#include <util/externalcommand.h>
|
||||
#include <util/helpers.h>
|
||||
#include <util/guihelpers.h>
|
||||
#include <util/report.h>
|
||||
|
@ -86,11 +87,7 @@
|
|||
#include <KIO/CopyJob>
|
||||
#include <KIO/Job>
|
||||
#include <KJobWidgets>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <typeinfo>
|
||||
#include "config.h"
|
||||
|
||||
/** Creates a new MainWindow instance.
|
||||
@param parent the parent widget
|
||||
|
@ -134,12 +131,15 @@ void MainWindow::init()
|
|||
|
||||
listDevices().setActionCollection(actionCollection());
|
||||
listOperations().setActionCollection(actionCollection());
|
||||
pmWidget().init(&operationStack());
|
||||
|
||||
setupGUI();
|
||||
|
||||
loadConfig();
|
||||
|
||||
show();
|
||||
ExternalCommand::setParentWidget(this);
|
||||
pmWidget().init(&operationStack());
|
||||
|
||||
scanDevices();
|
||||
}
|
||||
|
||||
|
@ -165,6 +165,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
saveConfig();
|
||||
|
||||
KXmlGuiWindow::closeEvent(event);
|
||||
ExternalCommand::stopHelper();
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent* event)
|
||||
|
@ -483,7 +484,8 @@ void MainWindow::enableActions()
|
|||
actionCollection()->action(QStringLiteral("createNewPartitionTable"))
|
||||
->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
|
||||
actionCollection()->action(QStringLiteral("createNewPartitionTable"))
|
||||
->setVisible(pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::Disk_Device);
|
||||
->setVisible(pmWidget().selectedDevice() && (pmWidget().selectedDevice()->type() == Device::Type::Disk_Device ||
|
||||
pmWidget().selectedDevice()->type() == Device::Type::SoftwareRAID_Device));
|
||||
actionCollection()->action(QStringLiteral("exportPartitionTable"))
|
||||
->setEnabled(pmWidget().selectedDevice() &&
|
||||
pmWidget().selectedDevice()->partitionTable() &&
|
||||
|
@ -491,10 +493,10 @@ void MainWindow::enableActions()
|
|||
actionCollection()->action(QStringLiteral("importPartitionTable"))
|
||||
->setEnabled(CreatePartitionTableOperation::canCreate(pmWidget().selectedDevice()));
|
||||
actionCollection()->action(QStringLiteral("smartStatusDevice"))
|
||||
->setEnabled(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Disk_Device &&
|
||||
->setEnabled(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Type::Disk_Device &&
|
||||
pmWidget().selectedDevice()->smartStatus().isValid());
|
||||
actionCollection()->action(QStringLiteral("smartStatusDevice"))
|
||||
->setVisible(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Disk_Device);
|
||||
->setVisible(pmWidget().selectedDevice() != nullptr && pmWidget().selectedDevice()->type() == Device::Type::Disk_Device);
|
||||
actionCollection()->action(QStringLiteral("propertiesDevice"))
|
||||
->setEnabled(pmWidget().selectedDevice() != nullptr);
|
||||
|
||||
|
@ -503,8 +505,7 @@ void MainWindow::enableActions()
|
|||
actionCollection()->action(QStringLiteral("clearAllOperations"))
|
||||
->setEnabled(operationStack().size() > 0);
|
||||
actionCollection()->action(QStringLiteral("applyAllOperations"))
|
||||
->setEnabled(operationStack().size() > 0 && (geteuid() == 0 ||
|
||||
Config::allowApplyOperationsAsNonRoot()));
|
||||
->setEnabled(operationStack().size() > 0);
|
||||
|
||||
const bool readOnly = pmWidget().selectedDevice() == nullptr ||
|
||||
pmWidget().selectedDevice()->partitionTable() == nullptr ||
|
||||
|
@ -513,7 +514,7 @@ void MainWindow::enableActions()
|
|||
actionCollection()->action(QStringLiteral("createVolumeGroup"))
|
||||
->setEnabled(CreateVolumeGroupOperation::canCreate());
|
||||
|
||||
bool lvmDevice = pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::LVM_Device;
|
||||
bool lvmDevice = pmWidget().selectedDevice() && pmWidget().selectedDevice()->type() == Device::Type::LVM_Device;
|
||||
bool removable = false;
|
||||
|
||||
if (lvmDevice)
|
||||
|
@ -707,7 +708,7 @@ void MainWindow::on_m_PartitionManagerWidget_selectedPartitionChanged(const Part
|
|||
|
||||
void MainWindow::scanDevices()
|
||||
{
|
||||
Log(Log::information) << xi18nc("@info:progress", "Using backend plugin: %1 (%2)",
|
||||
Log(Log::Level::information) << xi18nc("@info:progress", "Using backend plugin: %1 (%2)",
|
||||
CoreBackendManager::self()->backend()->id(),
|
||||
CoreBackendManager::self()->backend()->version());
|
||||
|
||||
|
@ -1062,11 +1063,11 @@ void MainWindow::onImportPartitionTable()
|
|||
if (fs->supportSetLabel() != FileSystem::cmdSupportNone && !volumeLabel.isEmpty())
|
||||
fs->setLabel(volumeLabel);
|
||||
|
||||
Partition* p = new Partition(parent, device, role, fs, firstSector, lastSector, QString(), PartitionTable::FlagNone, QString(), false, PartitionTable::FlagNone, Partition::StateNew);
|
||||
Partition* p = new Partition(parent, device, role, fs, firstSector, lastSector, QString(), PartitionTable::FlagNone, QString(), false, PartitionTable::FlagNone, Partition::State::New);
|
||||
|
||||
operationStack().push(new NewOperation(device, p));
|
||||
} else
|
||||
Log(Log::warning) << xi18nc("@info:status", "Could not parse line %1 from import file. Ignoring it.", lineNo);
|
||||
Log(Log::Level::warning) << xi18nc("@info:status", "Could not parse line %1 from import file. Ignoring it.", lineNo);
|
||||
}
|
||||
|
||||
if (ptable->type() == PartitionTable::msdos && ptable->isSectorBased(device))
|
||||
|
@ -1110,7 +1111,7 @@ void MainWindow::onCreateNewVolumeGroup()
|
|||
QVector<const Partition*> pvList;
|
||||
qint32 peSize = 4;
|
||||
// *NOTE*: vgName & pvList will be modified and validated by the dialog
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, vgName, pvList, peSize, operationStack().previewDevices());
|
||||
QPointer<CreateVolumeGroupDialog> dlg = new CreateVolumeGroupDialog(this, vgName, pvList, peSize, operationStack().previewDevices(), operationStack().operations());
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new CreateVolumeGroupOperation(vgName, pvList, peSize));
|
||||
|
||||
|
@ -1119,13 +1120,13 @@ void MainWindow::onCreateNewVolumeGroup()
|
|||
|
||||
void MainWindow::onResizeVolumeGroup()
|
||||
{
|
||||
if (pmWidget().selectedDevice()->type() == Device::LVM_Device) {
|
||||
if (pmWidget().selectedDevice()->type() == Device::Type::LVM_Device) {
|
||||
LvmDevice* d = dynamic_cast<LvmDevice*>(pmWidget().selectedDevice());
|
||||
|
||||
QVector<const Partition*> pvList;
|
||||
// *NOTE*: pvList will be modified and validated by the dialog
|
||||
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, d, pvList);
|
||||
QPointer<ResizeVolumeGroupDialog> dlg = new ResizeVolumeGroupDialog(this, d, pvList, operationStack().previewDevices(), operationStack().operations());
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
operationStack().push(new ResizeVolumeGroupOperation(*d, pvList));
|
||||
|
||||
|
@ -1136,7 +1137,7 @@ void MainWindow::onResizeVolumeGroup()
|
|||
void MainWindow::onRemoveVolumeGroup()
|
||||
{
|
||||
Device* tmpDev = pmWidget().selectedDevice();
|
||||
if (tmpDev->type() == Device::LVM_Device) {
|
||||
if (tmpDev->type() == Device::Type::LVM_Device) {
|
||||
operationStack().push(new RemoveVolumeGroupOperation(*(dynamic_cast<LvmDevice*>(tmpDev))));
|
||||
}
|
||||
}
|
||||
|
@ -1144,7 +1145,7 @@ void MainWindow::onRemoveVolumeGroup()
|
|||
void MainWindow::onDeactivateVolumeGroup()
|
||||
{
|
||||
Device* tmpDev = pmWidget().selectedDevice();
|
||||
if (tmpDev->type() == Device::LVM_Device) {
|
||||
if (tmpDev->type() == Device::Type::LVM_Device) {
|
||||
DeactivateVolumeGroupOperation* deactivate = new DeactivateVolumeGroupOperation( *(dynamic_cast<LvmDevice*>(tmpDev)) );
|
||||
Report* tmpReport = new Report(nullptr);
|
||||
if (deactivate->execute(*tmpReport)) {
|
||||
|
|
|
@ -73,9 +73,9 @@ void NewDialog::setupDialog()
|
|||
QStringList fsNames;
|
||||
for (const auto &fs : FileSystemFactory::map()) {
|
||||
if (fs->supportCreate() != FileSystem::cmdSupportNone &&
|
||||
fs->type() != FileSystem::Extended &&
|
||||
fs->type() != FileSystem::Luks &&
|
||||
fs->type() != FileSystem::Luks2)
|
||||
fs->type() != FileSystem::Type::Extended &&
|
||||
fs->type() != FileSystem::Type::Luks &&
|
||||
fs->type() != FileSystem::Type::Luks2)
|
||||
fsNames.append(fs->name());
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ void NewDialog::setupDialog()
|
|||
dialogWidget().checkBoxEncrypt().hide();
|
||||
dialogWidget().editPassphrase().hide();
|
||||
|
||||
if (device().type() == Device::LVM_Device) {
|
||||
if (device().type() == Device::Type::LVM_Device) {
|
||||
dialogWidget().comboFileSystem().removeItem(dialogWidget().comboFileSystem().findText(QStringLiteral("lvm2 pv")));
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,14 @@ void NewDialog::setupConnections()
|
|||
|
||||
bool NewDialog::canMove() const
|
||||
{
|
||||
return (device().type() == Device::LVM_Device) ? false : true;
|
||||
return (device().type() == Device::Type::LVM_Device) ? false : true;
|
||||
}
|
||||
|
||||
void NewDialog::accept()
|
||||
{
|
||||
if (partition().roles().has(PartitionRole::Extended)) {
|
||||
partition().deleteFileSystem();
|
||||
partition().setFileSystem(FileSystemFactory::create(FileSystem::Extended,
|
||||
partition().setFileSystem(FileSystemFactory::create(FileSystem::Type::Extended,
|
||||
partition().firstSector(),
|
||||
partition().lastSector(),
|
||||
partition().sectorSize()));
|
||||
|
@ -153,7 +153,7 @@ void NewDialog::accept()
|
|||
FileSystem::Type innerFsType = partition().fileSystem().type();
|
||||
partition().deleteFileSystem();
|
||||
FS::luks* luksFs = dynamic_cast< FS::luks* >(
|
||||
FileSystemFactory::create(FileSystem::Luks,
|
||||
FileSystemFactory::create(FileSystem::Type::Luks,
|
||||
partition().firstSector(),
|
||||
partition().lastSector(),
|
||||
partition().sectorSize()));
|
||||
|
@ -188,7 +188,7 @@ void NewDialog::onRoleChanged(bool)
|
|||
// Also make sure to set a primary's or logical's file system once the user goes back from
|
||||
// extended to any of those.
|
||||
if (r == PartitionRole::Extended)
|
||||
updateFileSystem(FileSystem::Extended);
|
||||
updateFileSystem(FileSystem::Type::Extended);
|
||||
else
|
||||
updateFileSystem(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText()));
|
||||
|
||||
|
@ -269,7 +269,7 @@ void NewDialog::updateHideAndShow()
|
|||
dialogWidget().label().setReadOnly(false);
|
||||
dialogWidget().noSetLabel().setVisible(false);
|
||||
}
|
||||
if (FS::luks::canEncryptType(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText())) && !partition().roles().has(PartitionRole::Extended) )
|
||||
if (FileSystemFactory::map()[FileSystem::Type::Luks]->supportCreate() && FS::luks::canEncryptType(FileSystem::typeForName(dialogWidget().comboFileSystem().currentText())) && !partition().roles().has(PartitionRole::Extended))
|
||||
{
|
||||
dialogWidget().checkBoxEncrypt().show();
|
||||
if (dialogWidget().checkBoxEncrypt().isChecked())
|
||||
|
|
|
@ -208,7 +208,7 @@ static QTreeWidgetItem* createTreeWidgetItem(const Partition& p)
|
|||
int i = 0;
|
||||
item->setText(i++, p.deviceNode());
|
||||
|
||||
if (p.roles().has(PartitionRole::Luks) && (p.fileSystem().name() != p.fileSystem().nameForType(FileSystem::Luks) && p.fileSystem().name() != p.fileSystem().nameForType(FileSystem::Luks2)))
|
||||
if (p.roles().has(PartitionRole::Luks) && (p.fileSystem().name() != p.fileSystem().nameForType(FileSystem::Type::Luks) && p.fileSystem().name() != p.fileSystem().nameForType(FileSystem::Type::Luks2)))
|
||||
item->setText(i, xi18nc("@item:intable Encrypted file systems, e.g. btrfs[Encrypted]", "%1 [Encrypted]", p.fileSystem().name()));
|
||||
else
|
||||
item->setText(i, p.fileSystem().name());
|
||||
|
@ -569,11 +569,11 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
|
|||
}
|
||||
|
||||
if (shred && Config::shredSource() == Config::EnumShredSource::random)
|
||||
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::RandomShred));
|
||||
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::RandomShred));
|
||||
else if (shred && Config::shredSource() == Config::EnumShredSource::zeros)
|
||||
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ZeroShred));
|
||||
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::ZeroShred));
|
||||
else
|
||||
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::NoShred));
|
||||
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::NoShred));
|
||||
}
|
||||
|
||||
void PartitionManagerWidget::onShredPartition()
|
||||
|
@ -605,7 +605,7 @@ void PartitionManagerWidget::onResizePartition()
|
|||
qint64 freeBefore = selectedDevice()->partitionTable()->freeSectorsBefore(p);
|
||||
qint64 freeAfter = selectedDevice()->partitionTable()->freeSectorsAfter(p);
|
||||
|
||||
if (selectedDevice()->type() == Device::LVM_Device) {
|
||||
if (selectedDevice()->type() == Device::Type::LVM_Device) {
|
||||
freeBefore = 0;
|
||||
freeAfter = selectedDevice()->partitionTable()->freeSectors();
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ void PartitionManagerWidget::onResizePartition()
|
|||
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
if (dlg->resizedFirstSector() == p.firstSector() && dlg->resizedLastSector() == p.lastSector())
|
||||
Log(Log::information) << xi18nc("@info:status", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode());
|
||||
Log(Log::Level::information) << xi18nc("@info:status", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode());
|
||||
else
|
||||
operationStack().push(new ResizeOperation(*selectedDevice(), p, dlg->resizedFirstSector(), dlg->resizedLastSector()));
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ PartPropsDialog::PartPropsDialog(QWidget* parent, Device& d, Partition& p) :
|
|||
m_Partition(p),
|
||||
m_WarnFileSystemChange(false),
|
||||
m_DialogWidget(new PartPropsWidget(this)),
|
||||
m_ReadOnly(partition().isMounted() || partition().state() == Partition::StateCopy || partition().state() == Partition::StateRestore || d.partitionTable()->isReadOnly()),
|
||||
m_ReadOnly(partition().isMounted() || partition().state() == Partition::State::Copy || partition().state() == Partition::State::Restore || d.partitionTable()->isReadOnly()),
|
||||
m_ForceRecreate(false)
|
||||
{
|
||||
mainLayout = new QVBoxLayout(this);
|
||||
|
@ -152,7 +152,7 @@ void PartPropsDialog::setupDialog()
|
|||
dialogWidget().label().setText(newLabel().isEmpty() ? partition().fileSystem().label() : newLabel());
|
||||
dialogWidget().capacity().setText(Capacity::formatByteSize(partition().capacity()));
|
||||
|
||||
if (Capacity(partition(), Capacity::Available).isValid()) {
|
||||
if (Capacity(partition(), Capacity::Type::Available).isValid()) {
|
||||
const qint64 availPercent = (partition().fileSystem().length() - partition().fileSystem().sectorsUsed()) * 100 / partition().fileSystem().length();
|
||||
|
||||
const QString availString = QStringLiteral("%1% - %2")
|
||||
|
@ -220,7 +220,7 @@ void PartPropsDialog::updateHideAndShow()
|
|||
|
||||
// when do we show the uuid?
|
||||
const bool showUuid =
|
||||
partition().state() != Partition::StateNew && // not for new partitions
|
||||
partition().state() != Partition::State::New && // not for new partitions
|
||||
!(fs == nullptr || fs->supportGetUUID() == FileSystem::cmdSupportNone); // not if the FS doesn't support it
|
||||
|
||||
dialogWidget().showUuid(showUuid);
|
||||
|
@ -229,10 +229,10 @@ void PartPropsDialog::updateHideAndShow()
|
|||
|
||||
// when do we show available and used capacity?
|
||||
const bool showAvailableAndUsed =
|
||||
partition().state() != Partition::StateNew && // not for new partitions
|
||||
partition().state() != Partition::State::New && // not for new partitions
|
||||
!partition().roles().has(PartitionRole::Extended) && // neither for extended
|
||||
!partition().roles().has(PartitionRole::Unallocated) && // or for unallocated
|
||||
newFileSystemType() != FileSystem::Unformatted; // and not for unformatted file systems
|
||||
newFileSystemType() != FileSystem::Type::Unformatted; // and not for unformatted file systems
|
||||
|
||||
dialogWidget().showAvailable(showAvailableAndUsed);
|
||||
dialogWidget().showUsed(showAvailableAndUsed);
|
||||
|
@ -242,22 +242,22 @@ void PartPropsDialog::updateHideAndShow()
|
|||
!partition().roles().has(PartitionRole::Extended) && // not for extended, they have no file system
|
||||
!partition().roles().has(PartitionRole::Unallocated) && // and not for unallocated: no choice there
|
||||
// do now show file system comboBox for open luks volumes.
|
||||
!(partition().roles().has(PartitionRole::Luks) && partition().fileSystem().type() != FileSystem::Luks);
|
||||
!(partition().roles().has(PartitionRole::Luks) && partition().fileSystem().type() != FileSystem::Type::Luks);
|
||||
dialogWidget().showFileSystem(showFileSystem);
|
||||
|
||||
// when do we show the recreate file system check box?
|
||||
const bool showCheckRecreate =
|
||||
showFileSystem && // only if we also show the file system
|
||||
partition().fileSystem().supportCreate() != FileSystem::cmdSupportNone && // and support creating this file system
|
||||
partition().fileSystem().type() != FileSystem::Unknown && // and not for unknown file systems
|
||||
partition().state() != Partition::StateNew && // or new partitions
|
||||
partition().fileSystem().type() != FileSystem::Type::Unknown && // and not for unknown file systems
|
||||
partition().state() != Partition::State::New && // or new partitions
|
||||
!partition().roles().has(PartitionRole::Luks); // or encrypted filesystems
|
||||
|
||||
dialogWidget().showCheckRecreate(showCheckRecreate);
|
||||
|
||||
// when do we show the list of partition flags?
|
||||
const bool showListFlags =
|
||||
partition().state() != Partition::StateNew && // not for new partitions
|
||||
partition().state() != Partition::State::New && // not for new partitions
|
||||
!partition().roles().has(PartitionRole::Unallocated); // and not for unallocated space
|
||||
|
||||
dialogWidget().showListFlags(showListFlags);
|
||||
|
@ -297,7 +297,7 @@ void PartPropsDialog::setupFileSystemComboBox()
|
|||
for(const auto &fs : FileSystemFactory::map())
|
||||
{
|
||||
// If the partition isn't encrypted, skip the luks FS
|
||||
if (fs->type() == FileSystem::Luks && partition().fileSystem().type() != FileSystem::Luks)
|
||||
if (fs->type() == FileSystem::Type::Luks && partition().fileSystem().type() != FileSystem::Type::Luks)
|
||||
continue;
|
||||
if (partition().fileSystem().type() == fs->type() || (fs->supportCreate() != FileSystem::cmdSupportNone &&
|
||||
partition().capacity() >= fs->minCapacity() && partition().capacity() <= fs->maxCapacity())) {
|
||||
|
@ -307,16 +307,16 @@ void PartPropsDialog::setupFileSystemComboBox()
|
|||
selected = name;
|
||||
|
||||
// If the partition isn't extended, skip the extended FS
|
||||
if (fs->type() == FileSystem::Extended && !partition().roles().has(PartitionRole::Extended))
|
||||
if (fs->type() == FileSystem::Type::Extended && !partition().roles().has(PartitionRole::Extended))
|
||||
continue;
|
||||
|
||||
// The user cannot change the filesystem back to "unformatted" once a filesystem has been created.
|
||||
if (fs->type() == FileSystem::Unformatted) {
|
||||
if (fs->type() == FileSystem::Type::Unformatted) {
|
||||
// .. but if the file system is unknown to us, show the unformatted option as the currently selected one
|
||||
if (partition().fileSystem().type() == FileSystem::Unknown) {
|
||||
name = FileSystem::nameForType(FileSystem::Unformatted);
|
||||
if (partition().fileSystem().type() == FileSystem::Type::Unknown) {
|
||||
name = FileSystem::nameForType(FileSystem::Type::Unformatted);
|
||||
selected = name;
|
||||
} else if (partition().fileSystem().type() != FileSystem::Unformatted && partition().state() != Partition::StateNew)
|
||||
} else if (partition().fileSystem().type() != FileSystem::Type::Unformatted && partition().state() != Partition::State::New)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ void PartPropsDialog::updatePartitionFileSystem()
|
|||
|
||||
void PartPropsDialog::onFilesystemChanged(int)
|
||||
{
|
||||
if (partition().state() == Partition::StateNew || warnFileSystemChange() || KMessageBox::warningContinueCancel(this,
|
||||
if (partition().state() == Partition::State::New || warnFileSystemChange() || KMessageBox::warningContinueCancel(this,
|
||||
xi18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>"
|
||||
"<para>Changing the file system on a partition already on disk will erase all its contents. If you continue now and apply the resulting operation in the main window, all data on <filename>%1</filename> will unrecoverably be lost.</para>", partition().deviceNode()),
|
||||
xi18nc("@title:window", "Really Recreate <filename>%1</filename> with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()),
|
||||
|
|
|
@ -91,7 +91,7 @@ void ResizeDialog::accept()
|
|||
if (partition().roles().has(PartitionRole::Luks)) {
|
||||
FS::luks2* luksFs = dynamic_cast<FS::luks2*>(&partition().fileSystem());
|
||||
if (luksFs) {
|
||||
if (luksFs->keyLocation() == FS::luks::keyring) {
|
||||
if (luksFs->keyLocation() == FS::luks::KeyLocation::keyring) {
|
||||
bool validPassphrase = false;
|
||||
QString errorMessage;
|
||||
QString passphrase;
|
||||
|
@ -130,7 +130,7 @@ void ResizeDialog::reject()
|
|||
void ResizeDialog::setupDialog()
|
||||
{
|
||||
SizeDialogBase::setupDialog();
|
||||
if (device().type() == Device::LVM_Device) {
|
||||
if (device().type() == Device::Type::LVM_Device) {
|
||||
dialogWidget().hideBeforeAndAfter();
|
||||
detailsWidget().checkAlign().setChecked(false);
|
||||
detailsWidget().checkAlign().setEnabled(false);
|
||||
|
@ -162,5 +162,5 @@ bool ResizeDialog::canShrink() const
|
|||
|
||||
bool ResizeDialog::canMove() const
|
||||
{
|
||||
return (device().type() == Device::LVM_Device) ? false : ResizeOperation::canMove(&partition());
|
||||
return (device().type() == Device::Type::LVM_Device) ? false : ResizeOperation::canMove(&partition());
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <core/partitiontable.h>
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
||||
#include <ops/deleteoperation.h>
|
||||
|
||||
#include <util/capacity.h>
|
||||
#include <util/helpers.h>
|
||||
|
||||
|
@ -35,9 +37,11 @@
|
|||
@param parent pointer to the parent widget
|
||||
@param d the Device to show properties for
|
||||
*/
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QVector<const Partition*>& partList)
|
||||
ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice* d, QVector<const Partition*>& partList, QList<Device*> devices, QList<Operation*> pendingOps)
|
||||
: VolumeGroupDialog(parent, d->name(), partList)
|
||||
, m_Devices(devices)
|
||||
, m_Device(d)
|
||||
, m_PendingOps(pendingOps)
|
||||
{
|
||||
setWindowTitle(xi18nc("@title:window", "Resize Volume Group"));
|
||||
|
||||
|
@ -51,7 +55,20 @@ ResizeVolumeGroupDialog::ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerD
|
|||
void ResizeVolumeGroupDialog::setupDialog()
|
||||
{
|
||||
if (dialogWidget().volumeType().currentText() == QStringLiteral("LVM")) {
|
||||
for (const auto &p : qAsConst(LVM::pvList)) {
|
||||
for (const auto &p : qAsConst(LVM::pvList::list())) {
|
||||
bool toBeDeleted = false;
|
||||
|
||||
// Ignore partitions that are going to be deleted
|
||||
for (const auto &o : qAsConst(m_PendingOps)) {
|
||||
if (dynamic_cast<DeleteOperation *>(o) && o->targets(*p.partition())) {
|
||||
toBeDeleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (toBeDeleted)
|
||||
continue;
|
||||
|
||||
if (p.isLuks())
|
||||
continue;
|
||||
if (p.vgName() == device()->name())
|
||||
|
@ -59,6 +76,32 @@ void ResizeVolumeGroupDialog::setupDialog()
|
|||
else if (p.vgName() == QString() && !LvmDevice::s_DirtyPVs.contains(p.partition())) // TODO: Remove LVM PVs in current VG
|
||||
dialogWidget().listPV().addPartition(*p.partition(), false);
|
||||
}
|
||||
|
||||
for (const Device *d : qAsConst(m_Devices)) {
|
||||
if (d->partitionTable() != nullptr) {
|
||||
for (const Partition *p : qAsConst(d->partitionTable()->children())) {
|
||||
// Looking if there is another VG creation that contains this partition
|
||||
if (LvmDevice::s_DirtyPVs.contains(p))
|
||||
continue;
|
||||
|
||||
// Including new LVM PVs (that are currently in OperationStack and that aren't at other VG creation)
|
||||
if (p->state() == Partition::State::New) {
|
||||
if (p->fileSystem().type() == FileSystem::Type::Lvm2_PV)
|
||||
dialogWidget().listPV().addPartition(*p, false);
|
||||
else if (p->fileSystem().type() == FileSystem::Type::Luks || p->fileSystem().type() == FileSystem::Type::Luks2) {
|
||||
FileSystem *fs = static_cast<const FS::luks *>(&p->fileSystem())->innerFS();
|
||||
|
||||
if (fs->type() == FileSystem::Type::Lvm2_PV)
|
||||
dialogWidget().listPV().addPartition(*p, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const Partition *p : qAsConst(LvmDevice::s_OrphanPVs))
|
||||
if (!LvmDevice::s_DirtyPVs.contains(p))
|
||||
dialogWidget().listPV().addPartition(*p, false);
|
||||
}
|
||||
|
||||
//update used size and LV infos
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||
*************************************************************************/
|
||||
|
||||
#if !defined(RESIZEVOLUMEGROUPDIALOG_H)
|
||||
|
||||
#ifndef RESIZEVOLUMEGROUPDIALOG_H
|
||||
#define RESIZEVOLUMEGROUPDIALOG_H
|
||||
|
||||
#include <fs/lvm2_pv.h>
|
||||
|
@ -24,6 +23,7 @@
|
|||
#include "gui/volumegroupdialog.h"
|
||||
|
||||
class Device;
|
||||
class Operation;
|
||||
class VolumeManagerDevice;
|
||||
|
||||
class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
||||
|
@ -31,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupDialog
|
|||
Q_DISABLE_COPY(ResizeVolumeGroupDialog)
|
||||
|
||||
public:
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QVector<const Partition*>& partList);
|
||||
ResizeVolumeGroupDialog(QWidget* parent, VolumeManagerDevice *d, QVector<const Partition*>& partList, QList<Device*> devices, QList<Operation*> pendingOps = QList<Operation *>());
|
||||
|
||||
protected:
|
||||
void accept() override;
|
||||
|
@ -43,7 +43,9 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
const QList<Device*> m_Devices; // List of all devices found on the system
|
||||
VolumeManagerDevice* m_Device;
|
||||
const QList<Operation*> m_PendingOps; // List of pending operations in KPM
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "gui/scanprogressdialog.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
ScanProgressDialog::ScanProgressDialog(QWidget* parent) :
|
||||
|
@ -26,9 +28,15 @@ ScanProgressDialog::ScanProgressDialog(QWidget* parent) :
|
|||
setWindowTitle(xi18nc("@title:window", "Scanning devices..."));
|
||||
setMinimumWidth(280);
|
||||
setMinimumDuration(150);
|
||||
setValue(0);
|
||||
setAttribute(Qt::WA_ShowModal, true);
|
||||
}
|
||||
|
||||
void ScanProgressDialog::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
void ScanProgressDialog::setDeviceName(const QString& d)
|
||||
{
|
||||
if (d.isEmpty())
|
||||
|
@ -39,7 +47,7 @@ void ScanProgressDialog::setDeviceName(const QString& d)
|
|||
|
||||
void ScanProgressDialog::showEvent(QShowEvent* e)
|
||||
{
|
||||
setCancelButton(0);
|
||||
setCancelButton(nullptr);
|
||||
|
||||
QProgressDialog::showEvent(e);
|
||||
}
|
||||
|
|
|
@ -15,14 +15,11 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||
*************************************************************************/
|
||||
|
||||
#if !defined(SCANPROGRESSDIALOG_H)
|
||||
|
||||
#ifndef SCANPROGRESSDIALOG_H
|
||||
#define SCANPROGRESSDIALOG_H
|
||||
|
||||
#include <QProgressDialog>
|
||||
|
||||
class QShowEvent;
|
||||
|
||||
class ScanProgressDialog : public QProgressDialog
|
||||
{
|
||||
public:
|
||||
|
@ -34,6 +31,7 @@ public:
|
|||
void setDeviceName(const QString& d);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* e) override;
|
||||
void showEvent(QShowEvent* e) override;
|
||||
|
||||
};
|
||||
|
|
|
@ -105,11 +105,11 @@ void SizeDialogBase::setupDialog()
|
|||
dialogWidget().partResizerWidget().init(device(), partition(), minimumFirstSector(), maximumLastSector(), true, canMove());
|
||||
dialogWidget().partResizerWidget().setAlign(Config::alignDefault());
|
||||
|
||||
if (device().type() == Device::Disk_Device) {
|
||||
if (device().type() == Device::Type::Disk_Device) {
|
||||
dialogWidget().lvName().hide();
|
||||
dialogWidget().textLVName().hide();
|
||||
}
|
||||
if (device().type() == Device::LVM_Device) {
|
||||
if (device().type() == Device::Type::LVM_Device) {
|
||||
dialogWidget().hideBeforeAndAfter();
|
||||
detailsWidget().checkAlign().setChecked(false);
|
||||
detailsWidget().checkAlign().setEnabled(false);
|
||||
|
@ -380,7 +380,7 @@ void SizeDialogBase::onLVNameChanged(const QString& newName)
|
|||
partition().setPartitionPath(device().deviceNode() + QStringLiteral("/") + newName.trimmed());
|
||||
if ((dialogWidget().lvName().isVisible() &&
|
||||
dialogWidget().lvName().text().isEmpty()) ||
|
||||
(device().type() == Device::LVM_Device &&
|
||||
(device().type() == Device::Type::LVM_Device &&
|
||||
dynamic_cast<LvmDevice&>(device()).partitionNodes().contains(partition().partitionPath())) ) {
|
||||
m_IsValidLVName = false;
|
||||
} else {
|
||||
|
@ -467,6 +467,6 @@ static double sectorsToDialogUnit(const Device& d, qint64 v)
|
|||
|
||||
static qint64 dialogUnitToSectors(const Device& d, double v)
|
||||
{
|
||||
return v * Capacity::unitFactor(Capacity::Byte, preferredUnit()) / d.logicalSize();
|
||||
return v * Capacity::unitFactor(Capacity::Unit::Byte, preferredUnit()) / d.logicalSize();
|
||||
}
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@ void SmartDialog::setupDialog()
|
|||
QStringList()
|
||||
<< QLocale().toString(a.id())
|
||||
<< QStringLiteral("<b>%1</b><br/>%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("</span>"))
|
||||
<< (a.failureType() == SmartAttribute::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age"))
|
||||
<< (a.updateType() == SmartAttribute::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline"))
|
||||
<< (a.failureType() == SmartAttribute::FailureType::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age"))
|
||||
<< (a.updateType() == SmartAttribute::UpdateType::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline"))
|
||||
<< QLocale().toString(a.worst())
|
||||
<< QLocale().toString(a.current())
|
||||
<< QLocale().toString(a.threshold())
|
||||
|
@ -187,8 +187,8 @@ QString SmartDialog::toHtml() const
|
|||
|
||||
s << "<td>" << QLocale().toString(a.id()) << "</td>\n"
|
||||
<< "<td>" << QStringLiteral("<b>%1</b><br/>%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("</span>")) << "</td>\n"
|
||||
<< "<td>" << (a.failureType() == SmartAttribute::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << "</td>\n"
|
||||
<< "<td>" << (a.updateType() == SmartAttribute::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << "</td>\n"
|
||||
<< "<td>" << (a.failureType() == SmartAttribute::FailureType::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << "</td>\n"
|
||||
<< "<td>" << (a.updateType() == SmartAttribute::UpdateType::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << "</td>\n"
|
||||
<< "<td>" << QLocale().toString(a.worst()) << "</td>\n"
|
||||
<< "<td>" << QLocale().toString(a.current()) << "</td>\n"
|
||||
<< "<td>" << QLocale().toString(a.threshold()) << "</td>\n"
|
||||
|
|
|
@ -150,10 +150,10 @@ void TreeLog::onNewLogMessage(Log::Level logLevel, const QString& s)
|
|||
|
||||
qDebug() << s;
|
||||
|
||||
if (logLevel >= Config::minLogLevel()) {
|
||||
if (static_cast<int>(logLevel) >= Config::minLogLevel()) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
|
||||
item->setIcon(0, QIcon::fromTheme(icons[logLevel]).pixmap(IconSize(KIconLoader::Small)));
|
||||
item->setIcon(0, QIcon::fromTheme(icons[static_cast<int>(logLevel)]).pixmap(IconSize(KIconLoader::Small)));
|
||||
item->setText(1, QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss")));
|
||||
item->setText(2, s);
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void VolumeGroupDialog::updateSectorInfos()
|
|||
{
|
||||
qint32 totalSectors = 0;
|
||||
// we can't use LvmDevice mothod here because pv that is not in any VG will return 0
|
||||
m_ExtentSize = dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Byte, Capacity::MiB);
|
||||
m_ExtentSize = dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB);
|
||||
if (m_ExtentSize > 0) {
|
||||
totalSectors = m_TotalSize / m_ExtentSize;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ void VolumeGroupDialog::updateSizeInfos()
|
|||
const QVector<const Partition *> checkedPartitions = dialogWidget().listPV().checkedItems();
|
||||
m_TotalSize = 0;
|
||||
for (const auto &p : checkedPartitions)
|
||||
m_TotalSize += p->capacity() - p->capacity() % (dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Byte, Capacity::MiB)); // subtract space which is too small to hold PE
|
||||
m_TotalSize += p->capacity() - p->capacity() % (dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB)); // subtract space which is too small to hold PE
|
||||
|
||||
dialogWidget().totalSize().setText(Capacity::formatByteSize(m_TotalSize));
|
||||
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -1,5 +1,6 @@
|
|||
/*************************************************************************
|
||||
* Copyright (C) 2008,2011 by Volker Lanz <vl@fidra.de> *
|
||||
* Copyright (C) 2014-2018 by Andrius Štikonas <andrius@stikonas.eu> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
|
@ -28,7 +29,7 @@
|
|||
|
||||
#include <KAboutData>
|
||||
#include <KCrash>
|
||||
#include <Kdelibs4ConfigMigrator>
|
||||
#include <KDBusService>
|
||||
#include <KMessageBox>
|
||||
#include <KLocalizedString>
|
||||
|
||||
|
@ -38,11 +39,6 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
Kdelibs4ConfigMigrator migrate(QLatin1Literal("partitionmanager"));
|
||||
migrate.setConfigFiles({ QLatin1Literal("partitionmanagerrc") });
|
||||
migrate.setUiFiles({ QStringLiteral("partitionmanagerui.rc") });
|
||||
migrate.migrate();
|
||||
|
||||
KLocalizedString::setApplicationDomain("partitionmanager");
|
||||
KAboutData aboutData (
|
||||
QStringLiteral("partitionmanager"),
|
||||
|
@ -50,7 +46,7 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
QStringLiteral(VERSION),
|
||||
xi18nc("@title", "Manage your disks, partitions and file systems"),
|
||||
KAboutLicense::GPL_V3,
|
||||
xi18nc("@info:credit", "© 2008-2013 Volker Lanz\n© 2012-2017 Andrius Štikonas"));
|
||||
xi18nc("@info:credit", "© 2008-2013 Volker Lanz\n© 2012-2018 Andrius Štikonas"));
|
||||
aboutData.setOrganizationDomain(QByteArray("kde.org"));
|
||||
aboutData.setProductName(QByteArray("partitionmanager"));
|
||||
|
||||
|
@ -68,15 +64,14 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
parser.addOption(QCommandLineOption(QLatin1Literal("dontsu"), xi18nc("@info:shell", "Do not try to gain super user privileges")));
|
||||
// FIXME parser.addPositionalArgument(QStringLiteral("device"), xi18nc("@info:shell", "Device(s) to manage"), QStringLiteral("[device...]"));
|
||||
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
|
||||
KDBusService service(KDBusService::Unique);
|
||||
|
||||
registerMetaTypes();
|
||||
if (!checkPermissions())
|
||||
return 0;
|
||||
|
||||
Config::instance(QStringLiteral("partitionmanagerrc"));
|
||||
|
||||
|
@ -84,7 +79,7 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
return 0;
|
||||
|
||||
MainWindow* mainWindow = new MainWindow();
|
||||
mainWindow->show();
|
||||
Q_UNUSED(mainWindow)
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -54,44 +54,75 @@
|
|||
<label context="@label">Align partitions per default</label>
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="allowApplyOperationsAsNonRoot" type="Bool">
|
||||
<label context="@label">Allow applying operations without administrator privileges</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry key="fileSystemColorCode$(colorNumber)" type="Color">
|
||||
<entry key="fileSystemColorCode$(FileSystem)" type="Color">
|
||||
<label context="@label">File system colors</label>
|
||||
<parameter name="colorNumber" type="UInt" max="29"/>
|
||||
<!-- numbers correspond to the enum in kpmcore/fs/filesystem.h -->
|
||||
<default param="0">220,205,175</default> <!-- unknown -->
|
||||
<default param="1">187,249,207</default> <!-- extended -->
|
||||
<default param="2">102,121,150</default> <!-- ext2 -->
|
||||
<default param="3">122,145,180</default> <!-- ext3 -->
|
||||
<default param="4">143,170,210</default> <!-- ext4 -->
|
||||
<default param="5">155,155,130</default> <!-- swap -->
|
||||
<default param="6">204,179,215</default> <!-- fat16 -->
|
||||
<default param="7">229,201,240</default> <!-- fat32 -->
|
||||
<default param="8">244,214,255</default> <!-- ntfs -->
|
||||
<default param="9">216,220,135</default> <!-- reiser-->
|
||||
<default param="10">251,255,157</default> <!-- reiser4 -->
|
||||
<default param="11">200,255,254</default> <!-- xfs -->
|
||||
<default param="12">137,200,198</default> <!-- jfs -->
|
||||
<default param="13">210,136,142</default> <!-- hfs -->
|
||||
<default param="14">240,165,171</default> <!-- hfs+ -->
|
||||
<default param="15">151,220,134</default> <!-- ufs -->
|
||||
<default param="16">220,205,175</default> <!-- unformatted -->
|
||||
<default param="17">173,205,255</default> <!-- btrfs -->
|
||||
<default param="18">176,155,185</default> <!-- hpfs -->
|
||||
<default param="19">170,30,77</default> <!-- luks -->
|
||||
<default param="20">96,140,85</default> <!-- ocfs2 -->
|
||||
<default param="21">33,137,108</default> <!-- zfs -->
|
||||
<default param="22">250,230,255</default> <!-- exfat -->
|
||||
<default param="23">242,155,104</default> <!-- nilfs2 -->
|
||||
<default param="24">160,210,180</default> <!-- lvm2 pv -->
|
||||
<default param="25">255,170,0</default> <!-- f2fs -->
|
||||
<default param="26">170,120,255</default> <!-- udf -->
|
||||
<default param="27">177,82,69</default> <!-- iso9660 -->
|
||||
<default param="28">223,39,104</default> <!-- luks2 -->
|
||||
<default param="29">204,179,255</default> <!-- fat12 -->
|
||||
<parameter name="FileSystem" type="Enum">
|
||||
<!-- values correspond to the enum in kpmcore/fs/filesystem.h -->
|
||||
<values>
|
||||
<value>Unknown</value>
|
||||
<value>Extended</value>
|
||||
<value>Ext2</value>
|
||||
<value>Ext3</value>
|
||||
<value>Ext4</value>
|
||||
<value>LinuxSwap</value>
|
||||
<value>Fat16</value>
|
||||
<value>Fat32</value>
|
||||
<value>Ntfs</value>
|
||||
<value>ReiserFS</value>
|
||||
<value>Reiser4</value>
|
||||
<value>Xfs</value>
|
||||
<value>Jfs</value>
|
||||
<value>Hfs</value>
|
||||
<value>HfsPlus</value>
|
||||
<value>Ufs</value>
|
||||
<value>Unformatted</value>
|
||||
<value>Btrfs</value>
|
||||
<value>Hpfs</value>
|
||||
<value>Luks</value>
|
||||
<value>Ocfs2</value>
|
||||
<value>Zfs</value>
|
||||
<value>Exfat</value>
|
||||
<value>Nilfs2</value>
|
||||
<value>Lvm2_PV</value>
|
||||
<value>F2fs</value>
|
||||
<value>Udf</value>
|
||||
<value>Iso9660</value>
|
||||
<value>Luks2</value>
|
||||
<value>Fat12</value>
|
||||
<value>LinuxRaidMember</value>
|
||||
</values>
|
||||
</parameter>
|
||||
<default param="Unknown">220,205,175</default>
|
||||
<default param="Extended">187,249,207</default>
|
||||
<default param="Ext2">102,121,150</default>
|
||||
<default param="Ext3">122,145,180</default>
|
||||
<default param="Ext4">143,170,210</default>
|
||||
<default param="LinuxSwap">155,155,130</default>
|
||||
<default param="Fat16">204,179,215</default>
|
||||
<default param="Fat32">229,201,240</default>
|
||||
<default param="Ntfs">244,214,255</default>
|
||||
<default param="ReiserFS">216,220,135</default>
|
||||
<default param="Reiser4">251,255,157</default>
|
||||
<default param="Xfs">200,255,254</default>
|
||||
<default param="Jfs">137,200,198</default>
|
||||
<default param="Hfs">210,136,142</default>
|
||||
<default param="HfsPlus">240,165,171</default>
|
||||
<default param="Ufs">151,220,134</default>
|
||||
<default param="Unformatted">220,205,175</default>
|
||||
<default param="Btrfs">173,205,255</default>
|
||||
<default param="Hpfs">176,155,185</default>
|
||||
<default param="Luks">170,30,77</default>
|
||||
<default param="Ocfs2">96,140,85</default>
|
||||
<default param="Zfs">33,137,108</default>
|
||||
<default param="Exfat">250,230,255</default>
|
||||
<default param="Nilfs2">242,155,104</default>
|
||||
<default param="Lvm2_PV">160,210,180</default>
|
||||
<default param="F2fs">255,170,0</default>
|
||||
<default param="Udf">170,120,255</default>
|
||||
<default param="Iso9660">177,82,69</default>
|
||||
<default param="Luks2">223,39,104</default>
|
||||
<default param="Fat12">204,179,255</default>
|
||||
<default param="LinuxRaidMember">255,100,100</default>
|
||||
</entry>
|
||||
<entry key="showMenuBar" type="Bool">
|
||||
<label context="@label">Show the application's menu bar</label>
|
||||
|
@ -101,7 +132,7 @@
|
|||
<label context="@label">Backend plugin</label>
|
||||
</entry>
|
||||
<entry key="defaultFileSystem" type="Int">
|
||||
<default>FileSystem::Ext4</default>
|
||||
<default>static_cast<int>(FileSystem::Type::Ext4)</default>
|
||||
</entry>
|
||||
<entry key="preferredUnit" type="Int">
|
||||
<label context="@label">Preferred unit:</label>
|
||||
|
|
|
@ -45,90 +45,13 @@ QIcon createFileSystemColor(FileSystem::Type type, quint32 size)
|
|||
QPixmap pixmap(size, size);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setPen(QColor(0, 0, 0));
|
||||
painter.setBrush(Config::fileSystemColorCode(type));
|
||||
painter.setBrush(Config::fileSystemColorCode(static_cast<int>(type)));
|
||||
painter.drawRect(QRect(0, 0, pixmap.width() - 1, pixmap.height() - 1));
|
||||
painter.end();
|
||||
|
||||
return QIcon(pixmap);
|
||||
}
|
||||
|
||||
bool checkPermissions()
|
||||
{
|
||||
if (geteuid() != 0) {
|
||||
// only try to gain root privileges if we have a valid (kde|gk)su(do) command and
|
||||
// we did not try so before: the dontsu-option is there to make sure there are no
|
||||
// endless loops of calling the same non-working (kde|gk)su(do) binary again and again.
|
||||
if (!suCommand().isEmpty() && !QCoreApplication::arguments().contains(QLatin1String("--dontsu"))) {
|
||||
QString argList;
|
||||
|
||||
const QString suCmd = suCommand();
|
||||
|
||||
// kdesu broke backward compatibility at some point and now only works with "-c";
|
||||
// kdesudo accepts either (with or without "-c"), but the gk* helpers only work
|
||||
// without. kdesu maintainers won't fix their app, so we need to work around that here.
|
||||
if (suCmd.indexOf(QStringLiteral("kdesu")) != -1)
|
||||
argList = QStringLiteral("-c ");
|
||||
|
||||
// Workaround for ugly GUI when kdesu uses sudo
|
||||
QString DBusString = QStringLiteral("DBUS_SESSION_BUS_ADDRESS");
|
||||
const QStringList envVars = { QStringLiteral("KDE_FULL_SESSION"),
|
||||
QStringLiteral("QT_WAYLAND_FORCE_DPI"),
|
||||
QStringLiteral("QT_QPA_PLATFORM"),
|
||||
QStringLiteral("XDG_RUNTIME_DIR"),
|
||||
DBusString };
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
for (const auto &var : envVars)
|
||||
if (env.contains(var))
|
||||
argList += var + QStringLiteral("=") + env.value(var) + QStringLiteral(" ");
|
||||
|
||||
QString displayString = QStringLiteral("DISPLAY");
|
||||
QString homeString = QStringLiteral("HOME");
|
||||
if (!env.contains(DBusString) && env.contains(displayString) && env.contains(homeString)) {
|
||||
QFile file(QStringLiteral("/var/lib/dbus/machine-id"));
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QTextStream in(&file);
|
||||
QString machineId = in.readLine();
|
||||
file.close();
|
||||
QString display = env.value(displayString).remove(0,1);
|
||||
QFile sessionFile(env.value(homeString) + QStringLiteral("/.dbus/session-bus/") + machineId + QStringLiteral("-") + display);
|
||||
if (sessionFile.open(QIODevice::ReadOnly)) {
|
||||
QTextStream in2(&sessionFile);
|
||||
while (!in2.atEnd()) {
|
||||
QString line = in2.readLine();
|
||||
if (line.startsWith(DBusString)) {
|
||||
argList += line + QStringLiteral(" ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
argList += QCoreApplication::arguments().join(QStringLiteral(" ")) + QStringLiteral(" --dontsu");
|
||||
|
||||
qDebug() << "Executing: " << suCmd << argList;
|
||||
if (QProcess::execute(suCmd, QStringList(argList)) == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return KMessageBox::warningContinueCancel(nullptr, xi18nc("@info",
|
||||
"<para><warning>You do not have administrative privileges.</warning></para>"
|
||||
"<para>It is possible to run <application>%1</application> without these privileges. "
|
||||
"You will, however, <emphasis>not</emphasis> be allowed to apply operations.</para>"
|
||||
"<para>Do you want to continue running <application>%1</application>?</para>"
|
||||
"<para><note>If administrator login is disabled and your password is "
|
||||
"not accepted, then check <command>kdesu</command> "
|
||||
"<link url='https://wiki.archlinux.org/index.php/sudo#kdesu'>configuration</link>.</note></para>",
|
||||
QGuiApplication::applicationDisplayName()),
|
||||
xi18nc("@title:window", "No administrative privileges"),
|
||||
KGuiItem(xi18nc("@action:button", "Run without administrative privileges"), QStringLiteral("arrow-right")),
|
||||
KStandardGuiItem::cancel(),
|
||||
QStringLiteral("runWithoutRootPrivileges"), KMessageBox::AllowLink) == KMessageBox::Continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool loadBackend()
|
||||
{
|
||||
if (CoreBackendManager::self()->load(Config::backend()) == false) {
|
||||
|
@ -153,21 +76,6 @@ bool loadBackend()
|
|||
return true;
|
||||
}
|
||||
|
||||
QString suCommand()
|
||||
{
|
||||
// First look for KF5 version of kdesu in libexec folder
|
||||
const QString candidates[] = { QStringLiteral(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5"/kdesu"), QStringLiteral("kdesu"), QStringLiteral("kdesudo"), QStringLiteral("gksudo"), QStringLiteral("gksu") };
|
||||
QString rval;
|
||||
|
||||
for (const auto &candidate : candidates) {
|
||||
rval = QStandardPaths::findExecutable(candidate);
|
||||
if (QFileInfo(rval).isExecutable())
|
||||
return rval;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
Capacity::Unit preferredUnit()
|
||||
{
|
||||
return static_cast<Capacity::Unit>(Config::preferredUnit());
|
||||
|
@ -208,12 +116,13 @@ FileSystem::Type defaultFileSystem()
|
|||
return static_cast<FileSystem::Type>(Config::defaultFileSystem());
|
||||
}
|
||||
|
||||
std::array< QColor, FileSystem::__lastType > fileSystemColorCodesFromSettings()
|
||||
std::vector<QColor> fileSystemColorCodesFromSettings()
|
||||
{
|
||||
std::array< QColor, FileSystem::__lastType > cc;
|
||||
for (int i = 0; i < FileSystem::__lastType; ++i)
|
||||
std::vector<QColor> cc;
|
||||
cc.resize(Config::EnumFileSystem::type::COUNT);
|
||||
for (int i = 0; i < Config::EnumFileSystem::type::COUNT; ++i)
|
||||
{
|
||||
cc[ i ] = Config::fileSystemColorCode( i );
|
||||
cc[i] = Config::fileSystemColorCode(i);
|
||||
}
|
||||
return cc;
|
||||
}
|
||||
|
|
|
@ -16,19 +16,19 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.*
|
||||
*************************************************************************/
|
||||
|
||||
#if !defined(GUIHELPERS_H)
|
||||
|
||||
#ifndef GUIHELPERS_H
|
||||
#define GUIHELPERS_H
|
||||
|
||||
#include <fs/filesystem.h>
|
||||
#include <util/capacity.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class QIcon;
|
||||
class QPoint;
|
||||
class QString;
|
||||
class QTreeWidget;
|
||||
|
||||
bool checkPermissions();
|
||||
bool loadBackend();
|
||||
QIcon createFileSystemColor(FileSystem::Type type, quint32 size);
|
||||
Capacity::Unit preferredUnit();
|
||||
|
@ -36,9 +36,7 @@ void showColumnsContextMenu(const QPoint& p, QTreeWidget& tree);
|
|||
namespace GuiHelpers
|
||||
{
|
||||
FileSystem::Type defaultFileSystem();
|
||||
std::array< QColor, FileSystem::__lastType > fileSystemColorCodesFromSettings();
|
||||
std::vector<QColor> fileSystemColorCodesFromSettings();
|
||||
}
|
||||
|
||||
QString suCommand();
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue