Compare commits
92 Commits
Author | SHA1 | Date |
---|---|---|
Heiko Becker | fc385fd89c | |
l10n daemon script | 66fa786e00 | |
Andrius Štikonas | bb6cd82f6d | |
Tomaz Canabrava | 4f0ff7b63a | |
Tomaz Canabrava | 90f6cb74d2 | |
Andrius Štikonas | 87eb4cdadd | |
Andrius Štikonas | d795c3d9f8 | |
Andrius Štikonas | 3b290d606d | |
Andrius Štikonas | 983c46a7ac | |
Andrius Štikonas | 48c5f67506 | |
Andrius Štikonas | 6a66203744 | |
Andrius Štikonas | 479631455c | |
Andrius Štikonas | 458872f359 | |
Andrius Štikonas | 850151655e | |
Andrius Štikonas | adacc91e75 | |
Andrius Štikonas | 909a03347a | |
Andrius Štikonas | e47827e20c | |
Andrius Štikonas | 20d41ef501 | |
Andrius Štikonas | 0ff20194b0 | |
Andrius Štikonas | ca788a9e69 | |
Andrius Štikonas | 7d4ca72118 | |
Andrius Štikonas | 312079422a | |
l10n daemon script | 843d7e9f19 | |
l10n daemon script | b29953b6b9 | |
l10n daemon script | 31bdb87514 | |
l10n daemon script | fb8249cbc9 | |
l10n daemon script | 55f525d5a4 | |
l10n daemon script | 1430b89952 | |
l10n daemon script | 28df23863e | |
Andrius Štikonas | e57c9d1552 | |
Nate Graham | 4703517c75 | |
Tomaz Canabrava | 825ca30ce7 | |
Tomaz Canabrava | a8da9ef6c1 | |
Tomaz Canabrava | afcc0c6c47 | |
Andrius Štikonas | 6f28900350 | |
Heiko Becker | d24f5cd2c1 | |
Andrius Štikonas | c9751910e8 | |
Andrius Štikonas | b9e5a055d4 | |
Andrius Štikonas | 850ab0df40 | |
Andrius Štikonas | 519bea8fd5 | |
Andrius Štikonas | 47e6d5f3d2 | |
Andrius Štikonas | 4e5cbcdb65 | |
Tomaz Canabrava | 1edb947525 | |
Tomaz Canabrava | 2bcd994bf1 | |
Tomaz Canabrava | bfc445bd7c | |
Tomaz Canabrava | 6b27467943 | |
Alessio Bonfiglio | 4f17fc5548 | |
Albert Astals Cid | dffa270506 | |
Andrius Štikonas | 81bbfea449 | |
Tomaz Canabrava | 479c3f4678 | |
Tomaz Canabrava | a577f8a0b8 | |
Tomaz Canabrava | a85b63c004 | |
Tomaz Canabrava | 099c753516 | |
Tomaz Canabrava | ae088e1ace | |
Albert Astals Cid | 1c5d0f5b4a | |
Tomaz Canabrava | a389b0e9ff | |
Tomaz Canabrava | a41c31c66f | |
Heiko Becker | 26ef5d3342 | |
Heiko Becker | d951b24fd8 | |
Heiko Becker | 6339ca235c | |
Andrius Štikonas | 4fbf432640 | |
Heiko Becker | 90b0aa2ed4 | |
Heiko Becker | d4afb41e87 | |
l10n daemon script | 5264203fe8 | |
Albert Astals Cid | c0565bd091 | |
Heiko Becker | a3d219f401 | |
Andrius Štikonas | 9212d74464 | |
Heiko Becker | 03fad35e25 | |
Heiko Becker | 2b7cf50f5c | |
l10n daemon script | 789a014df2 | |
Carl Schwan | 072e8c4720 | |
Heiko Becker | 03dd7cb0e0 | |
l10n daemon script | 8ecb5373c1 | |
l10n daemon script | 4407b41a21 | |
Andrius Štikonas | bdb0d25ace | |
Albert Astals Cid | 2e80aa5bdd | |
Heiko Becker | d23a3bde10 | |
Luigi Toscano | d58f97bf51 | |
Heiko Becker | c8e2afccb1 | |
l10n daemon script | 2fcaecab43 | |
l10n daemon script | 6385967402 | |
l10n daemon script | a428b26f2e | |
Christoph Feck | 42c46fa674 | |
l10n daemon script | c1ca4a3399 | |
l10n daemon script | 69d03099b0 | |
l10n daemon script | 03da1748bc | |
Christoph Feck | 2f226daa00 | |
Andrius Štikonas | 175eaef1b9 | |
Andrius Štikonas | 03edda5de6 | |
Andrius Štikonas | aa32927848 | |
Albert Astals Cid | f419683cd6 | |
Albert Astals Cid | e40ef5d88d |
|
@ -0,0 +1,7 @@
|
|||
# SPDX-FileCopyrightText: None
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include:
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
|
||||
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
|
|
@ -0,0 +1,19 @@
|
|||
# SPDX-FileCopyrightText: None
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
Dependencies:
|
||||
- 'on': ['@all']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@stable'
|
||||
'frameworks/kconfig': '@stable'
|
||||
'frameworks/kconfigwidgets': '@stable'
|
||||
'frameworks/kcoreaddons': '@stable'
|
||||
'frameworks/kcrash': '@stable'
|
||||
'frameworks/kdbusaddons': '@stable'
|
||||
'frameworks/kdoctools': '@stable'
|
||||
'frameworks/ki18n': '@stable'
|
||||
'frameworks/kio': '@stable'
|
||||
'frameworks/kjobwidgets': '@stable'
|
||||
'frameworks/kwidgetaddons': '@stable'
|
||||
'frameworks/kxmlgui': '@stable'
|
||||
'system/kpmcore': '@same'
|
|
@ -1,30 +1,26 @@
|
|||
# SPDX-FileCopyrightText: 2008 Volker Lanz <vl@fidra.de>
|
||||
# SPDX-FileCopyrightText: 2014-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2014-2022 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||
|
||||
# KDE Application Version, managed by release script
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "20")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "12")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "2")
|
||||
set (RELEASE_SERVICE_VERSION_MAJOR "22")
|
||||
set (RELEASE_SERVICE_VERSION_MINOR "03")
|
||||
set (RELEASE_SERVICE_VERSION_MICRO "70")
|
||||
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
|
||||
project(partitionmanager VERSION ${RELEASE_SERVICE_VERSION})
|
||||
|
||||
# Dependencies
|
||||
set(QT_MIN_VERSION "5.10.0")
|
||||
set(KF5_MIN_VERSION "5.73")
|
||||
set(QT_MIN_VERSION "5.15.0")
|
||||
set(KF5_MIN_VERSION "5.90")
|
||||
set(KPMCORE_MIN_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}")
|
||||
|
||||
set(KDE_COMPILERSETTINGS_LEVEL "5.85")
|
||||
|
||||
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)
|
||||
|
||||
add_definitions(-D'VERSION="${RELEASE_SERVICE_VERSION}"')
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
|
||||
|
@ -36,7 +32,11 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
|
|||
include(FeatureSummary)
|
||||
include(GenerateExportHeader)
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||||
if (NOT QT_MAJOR_VERSION)
|
||||
set(QT_MAJOR_VERSION "5")
|
||||
endif()
|
||||
|
||||
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||||
Core
|
||||
Gui
|
||||
Widgets
|
||||
|
@ -59,24 +59,12 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
|
|||
DocTools
|
||||
)
|
||||
|
||||
# use sane compile flags
|
||||
add_definitions(
|
||||
-DQT_USE_QSTRINGBUILDER
|
||||
-DQT_NO_CAST_TO_ASCII
|
||||
-DQT_NO_CAST_FROM_ASCII
|
||||
-DQT_STRICT_ITERATORS
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||
-DQT_NO_CAST_TO_BYTEARRAY
|
||||
-DQT_USE_FAST_OPERATOR_PLUS
|
||||
-DQT_DISABLE_DEPRECATED_BEFORE=0x050900
|
||||
-DQT_NO_KEYWORDS
|
||||
)
|
||||
find_package(PolkitQt${QT_MAJOR_VERSION}-1 REQUIRED)
|
||||
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
|
||||
|
||||
find_package(KPMcore ${KPMCORE_MIN_VERSION} REQUIRED)
|
||||
|
||||
include_directories(${Qt5Core_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} ${KPMCORE_INCLUDE_DIR} lib/ src/)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(icons)
|
||||
if (KF5DocTools_FOUND)
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
kdoctools_create_handbook( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR partitionmanager )
|
||||
kdoctools_create_handbook( index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR partitionmanager )
|
||||
|
|
|
@ -7,6 +7,8 @@ include(config/CMakeLists.txt)
|
|||
include(gui/CMakeLists.txt)
|
||||
include(util/CMakeLists.txt)
|
||||
|
||||
set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS "VERSION=\"${RELEASE_SERVICE_VERSION}\"")
|
||||
|
||||
set(partitionmanager_SRCS
|
||||
main.cpp
|
||||
${CONFIG_SRC}
|
||||
|
@ -19,13 +21,13 @@ file(GLOB partitionmanager_UIFILES config/*.ui gui/*.ui)
|
|||
ki18n_wrap_ui(partitionmanager_SRCS ${partitionmanager_UIFILES})
|
||||
|
||||
kconfig_add_kcfg_files(partitionmanager_SRCS config.kcfgc)
|
||||
install(FILES partitionmanager.kcfg DESTINATION ${KCFG_INSTALL_DIR})
|
||||
install(FILES partitionmanager.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
|
||||
|
||||
############################################
|
||||
|
||||
add_executable(partitionmanager ${partitionmanager_SRCS} )
|
||||
|
||||
target_link_libraries(partitionmanager ${BLKID_LIBRARIES}
|
||||
target_link_libraries(partitionmanager
|
||||
kpmcore
|
||||
KF5::ConfigCore
|
||||
KF5::ConfigGui
|
||||
|
@ -38,13 +40,18 @@ target_link_libraries(partitionmanager ${BLKID_LIBRARIES}
|
|||
KF5::KIOWidgets
|
||||
KF5::WidgetsAddons
|
||||
KF5::XmlGui
|
||||
PolkitQt${QT_MAJOR_VERSION}-1::Core
|
||||
)
|
||||
|
||||
target_compile_definitions(partitionmanager PRIVATE -DCMAKE_INSTALL_FULL_LIBEXECDIR_KF5=\"${CMAKE_INSTALL_FULL_LIBEXECDIR_KF5}\")
|
||||
|
||||
install(TARGETS partitionmanager ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
install(TARGETS partitionmanager ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
install(FILES org.kde.partitionmanager.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
|
||||
install(FILES gui/partitionmanagerui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/partitionmanager)
|
||||
install(PROGRAMS org.kde.partitionmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
|
||||
install(PROGRAMS org.kde.partitionmanager.desktop DESTINATION ${KDE_INSTALL_APPDIR})
|
||||
|
||||
############################################
|
||||
|
||||
install(FILES open_in_partitionmanager.desktop
|
||||
open_in_partitionmanager.desktop
|
||||
DESTINATION ${KDE_INSTALL_DATADIR}/solid/actions/)
|
||||
|
|
|
@ -139,7 +139,7 @@ void CreateVolumeGroupDialog::onVGNameChanged(const QString& vgName)
|
|||
|
||||
void CreateVolumeGroupDialog::onSpinPESizeChanged(int newsize)
|
||||
{
|
||||
Q_UNUSED(newsize);
|
||||
Q_UNUSED(newsize)
|
||||
updateOkButtonStatus();
|
||||
updateSectorInfos();
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#define EDITMOUNTOPTIONSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStringList>
|
||||
|
||||
class EditMountOptionsDialogWidget;
|
||||
class QStringList;
|
||||
class QString;
|
||||
class QWidget;
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
#include "ui_editmountoptionsdialogwidgetbase.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
|
||||
class QStringList;
|
||||
class QPlainTextEdit;
|
||||
|
||||
class EditMountOptionsDialogWidget : public QWidget, public Ui::EditMountOptionsDialogWidgetBase
|
||||
|
|
|
@ -63,7 +63,7 @@ EditMountPointDialogWidget::EditMountPointDialogWidget(QWidget* parent, Partitio
|
|||
fsName = QStringLiteral("vfat");
|
||||
break;
|
||||
default:
|
||||
fsName = partition().fileSystem().name();
|
||||
fsName = partition().fileSystem().name({QStringLiteral("C")});
|
||||
}
|
||||
|
||||
m_fstabEntries.push_back(FstabEntry(m_deviceNode, QString(), fsName, QString()));
|
||||
|
@ -152,6 +152,8 @@ void EditMountPointDialogWidget::setupRadio(const FstabEntry::Type entryType)
|
|||
break;
|
||||
case FstabEntry::Type::comment:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +200,7 @@ void EditMountPointDialogWidget::buttonMoreClicked(bool)
|
|||
|
||||
QStringList EditMountPointDialogWidget::options() const
|
||||
{
|
||||
QStringList optList = m_Options.split(QLatin1Char(','), QString::SkipEmptyParts);
|
||||
QStringList optList = m_Options.split(QLatin1Char(','), Qt::SkipEmptyParts);
|
||||
|
||||
const auto keys = boxOptions();
|
||||
for (const auto &s : keys)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <map>
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QWidget>
|
||||
|
||||
class Partition;
|
||||
|
@ -25,7 +26,6 @@ class QSpinBox;
|
|||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
class QStringList;
|
||||
|
||||
class EditMountPointDialogWidget : public QWidget, public Ui::EditMountPointDialogWidgetBase
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
double valueFromText(const QString& text) const override;
|
||||
|
||||
private:
|
||||
QString stripped(const QString &t, int *pos = 0) const;
|
||||
QString stripped(const QString &t, int *pos = nullptr) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QLocale>
|
||||
#include <QPalette>
|
||||
|
||||
#include <KLocalizedString>
|
||||
|
||||
|
@ -37,7 +38,7 @@ InfoPane::InfoPane(QWidget* parent) :
|
|||
QWidget(parent),
|
||||
m_GridLayout(new QGridLayout(this))
|
||||
{
|
||||
layout()->setMargin(0);
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/** Clears the InfoPane, leaving it empty */
|
||||
|
@ -55,7 +56,7 @@ int InfoPane::createHeader(const QString& title, const int num_cols)
|
|||
QLabel* label = new QLabel(title, this);
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
font.setWeight(75);
|
||||
font.setWeight(QFont::Bold);
|
||||
label->setFont(font);
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
gridLayout().addWidget(label, y++, 0, 1, num_cols);
|
||||
|
@ -75,9 +76,9 @@ void InfoPane::createLabels(const QString& title, const QString& value, const in
|
|||
labelTitle->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||
|
||||
QPalette palette = labelTitle->palette();
|
||||
QColor f = palette.color(QPalette::Foreground);
|
||||
QColor f = palette.color(QPalette::WindowText);
|
||||
f.setAlpha(128);
|
||||
palette.setColor(QPalette::Foreground, f);
|
||||
palette.setColor(QPalette::WindowText, f);
|
||||
labelTitle->setPalette(palette);
|
||||
|
||||
gridLayout().addWidget(labelTitle, y, x, 1, 1);
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
void setActionCollection(KActionCollection* coll) {
|
||||
m_ActionCollection = coll;
|
||||
}
|
||||
|
||||
// Selects the device specified by the device node, such as /dev/sda
|
||||
bool setSelectedDevice(const QString& device_node);
|
||||
|
||||
void updateDevices(const OperationStack::Devices& devices);
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include <util/guihelpers.h>
|
||||
#include <util/report.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
#include <QCollator>
|
||||
|
@ -70,6 +72,9 @@
|
|||
#include <QTemporaryFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <PolkitQt1/Authority>
|
||||
#include <polkitqt1-version.h>
|
||||
|
||||
#include <KAboutApplicationDialog>
|
||||
#include <KActionCollection>
|
||||
#include <KMessageBox>
|
||||
|
@ -95,11 +100,10 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||
m_ScanProgressDialog(new ScanProgressDialog(this)),
|
||||
m_StatusText(new QLabel(this))
|
||||
{
|
||||
CoreBackend::isPolkitInstalledCorrectly();
|
||||
|
||||
setupObjectNames();
|
||||
setupUi(this);
|
||||
connect(&m_ListDevices->listDevices(), &QListWidget::customContextMenuRequested, this, &MainWindow::listDevicesContextMenuRequested);
|
||||
connect(&m_TreeLog->treeLog(), &QTreeWidget::customContextMenuRequested, this, &MainWindow::treeLogContextMenuRequested);
|
||||
connect(&m_ListOperations->listOperations(), &QListWidget::customContextMenuRequested, this, &MainWindow::listOperationsContextMenuRequested);
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -112,12 +116,35 @@ void MainWindow::setupObjectNames()
|
|||
m_ScanProgressDialog->setObjectName(QStringLiteral("m_ScanProgressDialog"));
|
||||
}
|
||||
|
||||
void MainWindow::setDisallowOtherDevices()
|
||||
{
|
||||
// We need to store that we are hiding this for this session only
|
||||
// but only if it's currently visible (ie, the user didn't select
|
||||
// that it should be hidden on purpose.
|
||||
if (m_DockDevices->isVisible() == true) {
|
||||
Config::self()->setHideDeviceDockWidgetByCmdArgs(true);
|
||||
}
|
||||
|
||||
// because of how Qt works, the user still can enable the
|
||||
// dock widget via a mouse click, so we need to also set it to disabled.
|
||||
// so that the user doesn't select it by mistake.
|
||||
|
||||
m_DockDevices->setVisible(false);
|
||||
m_DockDevices->setEnabled(false);
|
||||
}
|
||||
|
||||
void MainWindow::showDevicePanelIfPreviouslyHiddenByDisallowOtherDevices()
|
||||
{
|
||||
if (Config::self()->hideDeviceDockWidgetByCmdArgs()) {
|
||||
m_DockDevices->setVisible(true);
|
||||
Config::self()->setHideDeviceDockWidgetByCmdArgs(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::init()
|
||||
{
|
||||
treeLog().init();
|
||||
|
||||
connect(GlobalLog::instance(), &GlobalLog::newMessage, &treeLog(), &TreeLog::onNewLogMessage);
|
||||
|
||||
setupActions();
|
||||
setupStatusBar();
|
||||
setupConnections();
|
||||
|
@ -129,10 +156,67 @@ void MainWindow::init()
|
|||
|
||||
loadConfig();
|
||||
|
||||
// this is done in order to hide the title bar of MessageWidget dock
|
||||
findChild<QDockWidget*>(QStringLiteral("MessageWidgetDock"))->setTitleBarWidget(new QWidget());
|
||||
|
||||
MessageWidget().hide();
|
||||
MessageWidget().setText(
|
||||
i18nc("@info", "Partition Manager requires privileges in order to work. Please refresh the devices and authenticate when prompted."));
|
||||
|
||||
show();
|
||||
pmWidget().init(&operationStack());
|
||||
|
||||
scanDevices();
|
||||
scanProgressDialog().cancel();
|
||||
setEnabled(false);
|
||||
guiFactory()->container(QStringLiteral("selectedDevice"), this)->setEnabled(false);
|
||||
|
||||
askForPermissions();
|
||||
|
||||
if (m_permissionGranted) {
|
||||
FileSystemFactory::init();
|
||||
scanDevices();
|
||||
} else
|
||||
Q_EMIT showMessageWidget();
|
||||
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::askForPermissions()
|
||||
{
|
||||
PolkitQt1::UnixProcessSubject subject(QApplication::applicationPid());
|
||||
PolkitQt1::Authority *authority = PolkitQt1::Authority::instance();
|
||||
|
||||
PolkitQt1::Authority::Result result;
|
||||
QEventLoop e;
|
||||
connect(authority, &PolkitQt1::Authority::checkAuthorizationFinished, &e,
|
||||
[&e, &result](PolkitQt1::Authority::Result _result) {
|
||||
result = _result;
|
||||
e.quit();
|
||||
});
|
||||
|
||||
authority->checkAuthorization(QStringLiteral("org.kde.kpmcore.externalcommand.init"), subject, PolkitQt1::Authority::AllowUserInteraction);
|
||||
e.exec();
|
||||
|
||||
if (authority->hasError()) {
|
||||
qDebug() << "Encountered error while checking authorization, error code:"
|
||||
<< authority->lastError() << authority->errorDetails();
|
||||
authority->clearError();
|
||||
}
|
||||
|
||||
m_permissionGranted = result == PolkitQt1::Authority::Yes;
|
||||
}
|
||||
|
||||
QMenu *MainWindow::createPopupMenu()
|
||||
{
|
||||
auto menu = QMainWindow::createPopupMenu();
|
||||
auto actions = menu->actions();
|
||||
QAction *toRemove =
|
||||
*std::find_if(actions.begin(), actions.end(),
|
||||
[](QAction *x) { return x->text().isEmpty(); });
|
||||
// this is done in order to hide the entry for the MessageWidget dock
|
||||
menu->removeAction(toRemove);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
|
@ -192,7 +276,7 @@ void MainWindow::setupActions()
|
|||
undoOperation->setText(xi18nc("@action:inmenu", "Undo"));
|
||||
undoOperation->setToolTip(xi18nc("@info:tooltip", "Undo the last operation"));
|
||||
undoOperation->setStatusTip(xi18nc("@info:status", "Remove the last operation from the list."));
|
||||
actionCollection()->setDefaultShortcut(undoOperation, QKeySequence(Qt::CTRL + Qt::Key_Z));
|
||||
actionCollection()->setDefaultShortcut(undoOperation, QKeySequence(Qt::CTRL | Qt::Key_Z));
|
||||
undoOperation->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
|
||||
|
||||
QAction* clearAllOperations = actionCollection()->addAction(QStringLiteral("clearAllOperations"));
|
||||
|
@ -218,7 +302,7 @@ void MainWindow::setupActions()
|
|||
createNewPartitionTable->setText(xi18nc("@action:inmenu", "New Partition Table"));
|
||||
createNewPartitionTable->setToolTip(xi18nc("@info:tooltip", "Create a new partition table"));
|
||||
createNewPartitionTable->setStatusTip(xi18nc("@info:status", "Create a new and empty partition table on a device."));
|
||||
actionCollection()->setDefaultShortcut(createNewPartitionTable, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N));
|
||||
actionCollection()->setDefaultShortcut(createNewPartitionTable, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
|
||||
createNewPartitionTable->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear")));
|
||||
|
||||
QAction* exportPartitionTable = actionCollection()->addAction(QStringLiteral("exportPartitionTable"));
|
||||
|
@ -288,7 +372,7 @@ void MainWindow::setupActions()
|
|||
newPartition->setText(xi18nc("@action:inmenu create a new partition", "New"));
|
||||
newPartition->setToolTip(xi18nc("@info:tooltip", "New partition"));
|
||||
newPartition->setStatusTip(xi18nc("@info:status", "Create a new partition."));
|
||||
actionCollection()->setDefaultShortcut(newPartition, QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||
actionCollection()->setDefaultShortcut(newPartition, QKeySequence(Qt::CTRL | Qt::Key_N));
|
||||
newPartition->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
|
||||
|
||||
QAction* resizePartition = actionCollection()->addAction(QStringLiteral("resizePartition"));
|
||||
|
@ -297,7 +381,7 @@ void MainWindow::setupActions()
|
|||
resizePartition->setText(xi18nc("@action:inmenu", "Resize/Move"));
|
||||
resizePartition->setToolTip(xi18nc("@info:tooltip", "Resize or move partition"));
|
||||
resizePartition->setStatusTip(xi18nc("@info:status", "Shrink, grow or move an existing partition."));
|
||||
actionCollection()->setDefaultShortcut(resizePartition, QKeySequence(Qt::CTRL + Qt::Key_R));
|
||||
actionCollection()->setDefaultShortcut(resizePartition, QKeySequence(Qt::CTRL | Qt::Key_R));
|
||||
resizePartition->setIcon(QIcon::fromTheme(QStringLiteral("arrow-right-double")));
|
||||
|
||||
QAction* deletePartition = actionCollection()->addAction(QStringLiteral("deletePartition"));
|
||||
|
@ -315,7 +399,7 @@ void MainWindow::setupActions()
|
|||
shredPartition->setText(xi18nc("@action:inmenu", "Shred"));
|
||||
shredPartition->setToolTip(xi18nc("@info:tooltip", "Shred partition"));
|
||||
shredPartition->setStatusTip(xi18nc("@info:status", "Shred a partition so that its contents cannot be restored."));
|
||||
actionCollection()->setDefaultShortcut(shredPartition, QKeySequence(Qt::SHIFT + Qt::Key_Delete));
|
||||
actionCollection()->setDefaultShortcut(shredPartition, QKeySequence(Qt::SHIFT | Qt::Key_Delete));
|
||||
shredPartition->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete-shred")));
|
||||
|
||||
QAction* copyPartition = actionCollection()->addAction(QStringLiteral("copyPartition"));
|
||||
|
@ -324,7 +408,7 @@ void MainWindow::setupActions()
|
|||
copyPartition->setText(xi18nc("@action:inmenu", "Copy"));
|
||||
copyPartition->setToolTip(xi18nc("@info:tooltip", "Copy partition"));
|
||||
copyPartition->setStatusTip(xi18nc("@info:status", "Copy an existing partition."));
|
||||
actionCollection()->setDefaultShortcut(copyPartition, QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
actionCollection()->setDefaultShortcut(copyPartition, QKeySequence(Qt::CTRL | Qt::Key_C));
|
||||
copyPartition->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
|
||||
|
||||
QAction* pastePartition = actionCollection()->addAction(QStringLiteral("pastePartition"));
|
||||
|
@ -333,7 +417,7 @@ void MainWindow::setupActions()
|
|||
pastePartition->setText(xi18nc("@action:inmenu", "Paste"));
|
||||
pastePartition->setToolTip(xi18nc("@info:tooltip", "Paste partition"));
|
||||
pastePartition->setStatusTip(xi18nc("@info:status", "Paste a copied partition."));
|
||||
actionCollection()->setDefaultShortcut(pastePartition, QKeySequence(Qt::CTRL + Qt::Key_V));
|
||||
actionCollection()->setDefaultShortcut(pastePartition, QKeySequence(Qt::CTRL | Qt::Key_V));
|
||||
pastePartition->setIcon(QIcon::fromTheme(QStringLiteral("edit-paste")));
|
||||
|
||||
QAction* editMountPoint = actionCollection()->addAction(QStringLiteral("editMountPoint"));
|
||||
|
@ -396,7 +480,7 @@ void MainWindow::setupActions()
|
|||
createVolumeGroup->setText(i18nc("@action:inmenu", "New Volume Group"));
|
||||
createVolumeGroup->setToolTip(i18nc("@info:tooltip", "Create a new LVM Volume Group"));
|
||||
createVolumeGroup->setStatusTip(i18nc("@info:status", "Create a new LVM Volume Group as a device."));
|
||||
actionCollection()->setDefaultShortcut(createVolumeGroup, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_L));
|
||||
actionCollection()->setDefaultShortcut(createVolumeGroup, QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_L));
|
||||
createVolumeGroup->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
|
||||
|
||||
QAction* fileSystemSupport = actionCollection()->addAction(QStringLiteral("fileSystemSupport"));
|
||||
|
@ -412,6 +496,7 @@ void MainWindow::setupActions()
|
|||
refreshDevices->setStatusTip(xi18nc("@info:status", "Renew the devices list."));
|
||||
actionCollection()->setDefaultShortcut(refreshDevices, Qt::Key_F5);
|
||||
refreshDevices->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
|
||||
MessageWidget().addAction(refreshDevices);
|
||||
|
||||
// Settings Actions
|
||||
actionCollection()->addAction(QStringLiteral("toggleDockDevices"), dockDevices().toggleViewAction());
|
||||
|
@ -447,8 +532,26 @@ void MainWindow::setupActions()
|
|||
|
||||
void MainWindow::setupConnections()
|
||||
{
|
||||
connect(&listDevices(), &ListDevices::selectionChanged, &pmWidget(), qOverload<const QString&>(&PartitionManagerWidget::setSelectedDevice));
|
||||
connect(&listDevices(), &ListDevices::deviceDoubleClicked, this, &MainWindow::onPropertiesDevice);
|
||||
connect(&listDevices(), &ListDevices::selectionChanged,
|
||||
&pmWidget(), qOverload<const QString&>(&PartitionManagerWidget::setSelectedDevice));
|
||||
|
||||
connect(&listDevices(), &ListDevices::deviceDoubleClicked,
|
||||
this, &MainWindow::onPropertiesDevice);
|
||||
|
||||
connect(&m_ListDevices->listDevices(), &QListWidget::customContextMenuRequested,
|
||||
this, &MainWindow::listDevicesContextMenuRequested);
|
||||
connect(&m_TreeLog->treeLog(), &QTreeWidget::customContextMenuRequested,
|
||||
this, &MainWindow::treeLogContextMenuRequested);
|
||||
connect(&m_ListOperations->listOperations(), &QListWidget::customContextMenuRequested,
|
||||
this, &MainWindow::listOperationsContextMenuRequested);
|
||||
|
||||
connect(GlobalLog::instance(), &GlobalLog::newMessage,
|
||||
&treeLog(), &TreeLog::onNewLogMessage);
|
||||
|
||||
connect(this, &MainWindow::showMessageWidget, &MessageWidget(),
|
||||
&KMessageWidget::animatedShow);
|
||||
connect(this, &MainWindow::hideMessageWidget, &MessageWidget(),
|
||||
&KMessageWidget::animatedHide);
|
||||
}
|
||||
|
||||
void MainWindow::setupStatusBar()
|
||||
|
@ -731,7 +834,13 @@ void MainWindow::on_m_DeviceScanner_finished()
|
|||
|
||||
scanProgressDialog().setProgress(100);
|
||||
|
||||
if (!operationStack().previewDevices().isEmpty())
|
||||
bool foundDevices = !operationStack().previewDevices().isEmpty();
|
||||
|
||||
guiFactory()
|
||||
->container(QStringLiteral("selectedDevice"), this)
|
||||
->setEnabled(foundDevices);
|
||||
|
||||
if (foundDevices)
|
||||
pmWidget().setSelectedDevice(operationStack().previewDevices()[0]);
|
||||
|
||||
pmWidget().updatePartitions();
|
||||
|
@ -741,11 +850,12 @@ void MainWindow::on_m_DeviceScanner_finished()
|
|||
|
||||
// try to set the seleted device, either from the saved one or just select the
|
||||
// first device
|
||||
if (!listDevices().setSelectedDevice(savedSelectedDeviceNode()) && !operationStack().previewDevices().isEmpty())
|
||||
if (!listDevices().setSelectedDevice(savedSelectedDeviceNode()) && foundDevices)
|
||||
listDevices().setSelectedDevice(operationStack().previewDevices()[0]->deviceNode());
|
||||
|
||||
updateSeletedDeviceMenu();
|
||||
checkFileSystemSupport();
|
||||
Q_EMIT scanFinished();
|
||||
}
|
||||
|
||||
void MainWindow::updateSeletedDeviceMenu()
|
||||
|
@ -804,7 +914,17 @@ void MainWindow::onRefreshDevices()
|
|||
xi18nc("@title:window", "Really Rescan the Devices?"),
|
||||
KGuiItem(xi18nc("@action:button", "Rescan Devices"), QStringLiteral("arrow-right")),
|
||||
KStandardGuiItem::cancel(), QStringLiteral("reallyRescanDevices")) == KMessageBox::Continue) {
|
||||
scanDevices();
|
||||
|
||||
if (m_permissionGranted) {
|
||||
scanDevices();
|
||||
} else {
|
||||
askForPermissions();
|
||||
if (m_permissionGranted) {
|
||||
Q_EMIT hideMessageWidget();
|
||||
FileSystemFactory::init();
|
||||
scanDevices();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,6 +1017,8 @@ void MainWindow::onImportPartitionTable()
|
|||
{
|
||||
Q_ASSERT(pmWidget().selectedDevice());
|
||||
|
||||
// TODO: This method looks like should live somewhere completely different.
|
||||
// It's importing the partition table, why it's not on the partition table source?
|
||||
const QUrl url = QFileDialog::getOpenFileUrl(this, QStringLiteral("Import Partition Table"));
|
||||
|
||||
if (url.isEmpty())
|
||||
|
@ -1257,6 +1379,7 @@ static KLocalizedString checkSupportInNode(const PartitionNode* parent)
|
|||
else
|
||||
rval = checkSupportInNode(node);
|
||||
|
||||
// TODO: Don't create HTML tables manually.
|
||||
if ((!p->fileSystem().supportToolFound() && !p->fileSystem().supportToolName().name.isEmpty()) && !rval.isEmpty())
|
||||
rval = kxi18n("%1%2").subs(rval).subs(kxi18n("<tr>"
|
||||
"<td>%1</td>"
|
||||
|
@ -1303,6 +1426,7 @@ void MainWindow::checkFileSystemSupport()
|
|||
}
|
||||
|
||||
if (missingSupportTools)
|
||||
// TODO: Don't create HTML manually.
|
||||
KMessageBox::information(this,
|
||||
xi18nc("@info",
|
||||
"<para>No support tools were found for file systems currently present on hard disks in this computer:</para>"
|
||||
|
@ -1321,3 +1445,24 @@ void MainWindow::checkFileSystemSupport()
|
|||
xi18nc("@title:window", "Missing File System Support Packages"),
|
||||
QStringLiteral("showInformationOnMissingFileSystemSupport"), KMessageBox::Notify | KMessageBox::AllowLink);
|
||||
}
|
||||
|
||||
void MainWindow::setCurrentDeviceByName(const QString& name)
|
||||
{
|
||||
// TODO: Port KPartitionManager away from KMessageBox into KMessageWidget.
|
||||
// TODO: setSelectedDevice from m_ListDevices is not using a device name, but
|
||||
// just issuing a match query on a string list, this will produce false results.
|
||||
if (!m_ListDevices->setSelectedDevice(name)) {
|
||||
KMessageBox::error(this,
|
||||
xi18nc("@info device should be inside of /dev", "Unrecognized device \"%1\" ", name),
|
||||
xi18nc("@title:window", "Error While Importing Partition Table"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setCurrentPartitionByName(const QString& partitionName)
|
||||
{
|
||||
if (!pmWidget().setCurrentPartitionByName(partitionName)) {
|
||||
KMessageBox::error(this,
|
||||
xi18nc("@info device should be inside of /dev", "Unrecognized partition \"%1\" ", partitionName),
|
||||
xi18nc("@title:window", "Error opening partition"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "ui_mainwindowbase.h"
|
||||
|
||||
#include <KMessageWidget>
|
||||
#include <KXmlGuiWindow>
|
||||
|
||||
class ApplyProgressDialog;
|
||||
|
@ -44,8 +45,28 @@ class MainWindow : public KXmlGuiWindow, public Ui::MainWindowBase
|
|||
public:
|
||||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
|
||||
// for instance `/dev/sda`
|
||||
void setCurrentDeviceByName(const QString& name);
|
||||
|
||||
void setCurrentPartitionByName(const QString& partitionNumber);
|
||||
|
||||
// forbids the user to select another device.
|
||||
// this is used in conjunction with --device
|
||||
// rationale is that if the user specifies a device,
|
||||
// we can't allow him to select another one by mistake while
|
||||
// clicking in the UI.
|
||||
void setDisallowOtherDevices();
|
||||
|
||||
// disallowOtherDevices hides the DockWidget, but unfortunately
|
||||
// this is saved by the Window State when restored, even if we
|
||||
// are not disallowing it this time. At the same time the user
|
||||
// could have hidden it, so we need to restore only if hidden
|
||||
// just by the call to disallowOtherDevices().
|
||||
void showDevicePanelIfPreviouslyHiddenByDisallowOtherDevices();
|
||||
|
||||
Q_SIGNALS:
|
||||
void settingsChanged();
|
||||
void scanFinished();
|
||||
|
||||
protected:
|
||||
void init();
|
||||
|
@ -202,6 +223,15 @@ protected:
|
|||
return *m_ScanProgressDialog;
|
||||
}
|
||||
|
||||
KMessageWidget &MessageWidget() {
|
||||
Q_ASSERT(m_MessageWidget);
|
||||
return *m_MessageWidget;
|
||||
}
|
||||
const KMessageWidget &MessageWidget() const {
|
||||
Q_ASSERT(m_MessageWidget);
|
||||
return *m_MessageWidget;
|
||||
}
|
||||
|
||||
void onSelectedDeviceMenuTriggered(bool);
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
@ -251,6 +281,15 @@ protected:
|
|||
void onSmartStatusDevice();
|
||||
void onPropertiesDevice(const QString& deviceNode = {});
|
||||
|
||||
private:
|
||||
QMenu* createPopupMenu() override;
|
||||
|
||||
void askForPermissions();
|
||||
|
||||
Q_SIGNALS:
|
||||
void showMessageWidget();
|
||||
void hideMessageWidget();
|
||||
|
||||
private:
|
||||
OperationStack* m_OperationStack;
|
||||
OperationRunner* m_OperationRunner;
|
||||
|
@ -259,6 +298,8 @@ private:
|
|||
ScanProgressDialog* m_ScanProgressDialog;
|
||||
QLabel* m_StatusText;
|
||||
QString m_SavedSelectedDeviceNode;
|
||||
|
||||
bool m_permissionGranted;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<property name="windowTitle">
|
||||
<string comment="@title:window">KDE Partition Manager</string>
|
||||
</property>
|
||||
<widget class="PartitionManagerWidget" name="m_PartitionManagerWidget">
|
||||
</widget>
|
||||
<widget class="PartitionManagerWidget" name="m_PartitionManagerWidget"/>
|
||||
<widget class="QDockWidget" name="m_DockDevices">
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
|
@ -29,8 +28,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="ListDevices" name="m_ListDevices">
|
||||
</widget>
|
||||
<widget class="ListDevices" name="m_ListDevices"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="m_DockOperations">
|
||||
<property name="allowedAreas">
|
||||
|
@ -42,8 +40,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="ListOperations" name="m_ListOperations">
|
||||
</widget>
|
||||
<widget class="ListOperations" name="m_ListOperations"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="m_DockInformation">
|
||||
<property name="windowTitle">
|
||||
|
@ -52,8 +49,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="InfoPane" name="m_InfoPane">
|
||||
</widget>
|
||||
<widget class="InfoPane" name="m_InfoPane"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="m_DockLog">
|
||||
<property name="allowedAreas">
|
||||
|
@ -65,11 +61,34 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
<widget class="TreeLog" name="m_TreeLog">
|
||||
<widget class="TreeLog" name="m_TreeLog"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="MessageWidgetDock">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>4</number>
|
||||
</attribute>
|
||||
<widget class="KMessageWidget" name="m_MessageWidget">
|
||||
<property name="messageType">
|
||||
<enum>KMessageWidget::Warning</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KMessageWidget</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>kmessagewidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PartitionManagerWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <QtGlobal>
|
||||
#include <QFontDatabase>
|
||||
#include <QPalette>
|
||||
|
||||
#include <KColorScheme>
|
||||
#include <KConfigGroup>
|
||||
|
@ -112,6 +113,34 @@ void NewDialog::setupDialog()
|
|||
// run there is a valid partition set in the part resizer widget and they will need that.
|
||||
onRoleChanged(false);
|
||||
onFilesystemChanged(dialogWidget().comboFileSystem().currentIndex());
|
||||
|
||||
auto showPermissionsGroup = [this] {
|
||||
const QString currText = dialogWidget().comboFileSystem().currentText();
|
||||
const bool enablePosixPermission = QList<QString>({
|
||||
QStringLiteral("btrfs"),
|
||||
QStringLiteral("ext2"),
|
||||
QStringLiteral("ext3"),
|
||||
QStringLiteral("ext4"),
|
||||
QStringLiteral("f2fs"),
|
||||
QStringLiteral("hfsplus"),
|
||||
QStringLiteral("jfs"),
|
||||
QStringLiteral("minix"),
|
||||
QStringLiteral("ocfs2"),
|
||||
QStringLiteral("reiserfs"),
|
||||
QStringLiteral("reiser4"),
|
||||
QStringLiteral("udf"),
|
||||
QStringLiteral("xfs"),
|
||||
QStringLiteral("zfs"),}
|
||||
).contains(currText);
|
||||
if (enablePosixPermission) {
|
||||
dialogWidget().showPosixPermissions();
|
||||
} else {
|
||||
dialogWidget().hidePosixPermissions();
|
||||
}
|
||||
};
|
||||
connect(&dialogWidget().comboFileSystem(), QOverload<int>::of(&QComboBox::currentIndexChanged), this, showPermissionsGroup);
|
||||
showPermissionsGroup();
|
||||
dialogWidget().radioRootPermissions().setChecked(true);
|
||||
}
|
||||
|
||||
void NewDialog::setupConnections()
|
||||
|
@ -252,9 +281,9 @@ void NewDialog::updateHideAndShow()
|
|||
dialogWidget().noSetLabel().setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
|
||||
|
||||
QPalette palette = dialogWidget().noSetLabel().palette();
|
||||
QColor f = palette.color(QPalette::Foreground);
|
||||
QColor f = palette.color(QPalette::WindowText);
|
||||
f.setAlpha(128);
|
||||
palette.setColor(QPalette::Foreground, f);
|
||||
palette.setColor(QPalette::WindowText, f);
|
||||
dialogWidget().noSetLabel().setPalette(palette);
|
||||
dialogWidget().checkBoxEncrypt().hide();
|
||||
dialogWidget().editPassphrase().hide();
|
||||
|
@ -283,3 +312,8 @@ void NewDialog::updateOkButtonStatus()
|
|||
{
|
||||
okButton->setEnabled(isValidPassword() && isValidLVName());
|
||||
}
|
||||
|
||||
bool NewDialog::useUnsecuredPartition() const
|
||||
{
|
||||
return !dialogWidget().isPermissionOnlyRoot();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,9 @@ public:
|
|||
NewDialog(QWidget* parent, Device& device, Partition& unallocatedPartition, PartitionRole::Roles r);
|
||||
~NewDialog();
|
||||
|
||||
// returns true if any user can write on the partition.
|
||||
// has the same effect as running `chmod 777` on it.
|
||||
bool useUnsecuredPartition() const;
|
||||
protected:
|
||||
void accept() override;
|
||||
void onRoleChanged(bool);
|
||||
|
|
|
@ -94,9 +94,6 @@ void PartitionManagerWidget::init(OperationStack* ostack)
|
|||
{
|
||||
m_OperationStack = ostack;
|
||||
|
||||
// TODO: shouldn't this also go to the main window class?
|
||||
FileSystemFactory::init();
|
||||
|
||||
loadConfig();
|
||||
setupConnections();
|
||||
}
|
||||
|
@ -244,7 +241,7 @@ void PartitionManagerWidget::updatePartitions()
|
|||
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
font.setWeight(75);
|
||||
font.setWeight(QFont::Bold);
|
||||
deviceItem->setFont(0, font);
|
||||
|
||||
deviceItem->setText(0, selectedDevice()->prettyName());
|
||||
|
@ -285,6 +282,25 @@ void PartitionManagerWidget::on_m_TreePartitions_currentItemChanged(QTreeWidgetI
|
|||
partTableWidget().setActiveWidget(nullptr);
|
||||
}
|
||||
|
||||
bool PartitionManagerWidget::setCurrentPartitionByName(const QString& name)
|
||||
{
|
||||
auto rootNode = treePartitions().invisibleRootItem();
|
||||
for (int i = 0; i < rootNode->childCount(); i++) {
|
||||
auto driveNode = rootNode->child(i);
|
||||
for (int e = 0; e < driveNode->childCount(); e++) {
|
||||
auto partitionNode = driveNode->child(e);
|
||||
const QString text = partitionNode->data(0, Qt::DisplayRole).toString();
|
||||
if (text.endsWith(name)) {
|
||||
partitionNode->setSelected(true);
|
||||
treePartitions().setCurrentItem(partitionNode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void PartitionManagerWidget::on_m_TreePartitions_itemDoubleClicked(QTreeWidgetItem* item, int)
|
||||
{
|
||||
if (item == treePartitions().topLevelItem(0)) {
|
||||
|
@ -507,10 +523,14 @@ void PartitionManagerWidget::onNewPartition()
|
|||
Partition* newPartition = NewOperation::createNew(*selectedPartition(), static_cast<FileSystem::Type>(Config::defaultFileSystem()));
|
||||
|
||||
QPointer<NewDialog> dlg = new NewDialog(this, *selectedDevice(), *newPartition, selectedDevice()->partitionTable()->childRoles(*selectedPartition()));
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
if (dlg->useUnsecuredPartition()) {
|
||||
newPartition->fileSystem().setPosixPermissions(QStringLiteral("777"));
|
||||
}
|
||||
operationStack().push(new NewOperation(*selectedDevice(), newPartition));
|
||||
else
|
||||
} else {
|
||||
delete newPartition;
|
||||
}
|
||||
|
||||
delete dlg;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@ public:
|
|||
|
||||
void updatePartitions();
|
||||
|
||||
// here we expect the full "sda1" or "nvme1n1p1"
|
||||
bool setCurrentPartitionByName(const QString& partitionName);
|
||||
|
||||
protected:
|
||||
OperationStack& operationStack() {
|
||||
return *m_OperationStack;
|
||||
|
@ -125,6 +128,7 @@ protected:
|
|||
return *m_TreePartitions;
|
||||
}
|
||||
|
||||
|
||||
void onHeaderContextMenu(const QPoint& p);
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <QtGlobal>
|
||||
#include <QLineEdit>
|
||||
#include <QLocale>
|
||||
#include <QPalette>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <KConfigGroup>
|
||||
|
@ -202,9 +203,9 @@ void PartPropsDialog::updateHideAndShow()
|
|||
dialogWidget().noSetLabel().setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
|
||||
|
||||
QPalette palette = dialogWidget().noSetLabel().palette();
|
||||
QColor f = palette.color(QPalette::Foreground);
|
||||
QColor f = palette.color(QPalette::WindowText);
|
||||
f.setAlpha(128);
|
||||
palette.setColor(QPalette::Foreground, f);
|
||||
palette.setColor(QPalette::WindowText, f);
|
||||
dialogWidget().noSetLabel().setPalette(palette);
|
||||
} else {
|
||||
dialogWidget().label().setReadOnly(isReadOnly() && !partition().fileSystem().supportSetLabelOnline());
|
||||
|
|
|
@ -26,12 +26,13 @@ void ScanProgressDialog::closeEvent(QCloseEvent* e)
|
|||
e->ignore();
|
||||
}
|
||||
|
||||
void ScanProgressDialog::setDeviceName(const QString& d)
|
||||
void ScanProgressDialog::setDeviceName(const QString& device)
|
||||
{
|
||||
if (d.isEmpty())
|
||||
if (device.isEmpty()) {
|
||||
setLabelText(xi18nc("@label", "Scanning..."));
|
||||
else
|
||||
setLabelText(xi18nc("@label", "Scanning device: <filename>%1</filename>", d));
|
||||
} else {
|
||||
setLabelText(xi18nc("@label", "Scanning device: <filename>%1</filename>", device));
|
||||
}
|
||||
}
|
||||
|
||||
void ScanProgressDialog::showEvent(QShowEvent* e)
|
||||
|
|
|
@ -19,7 +19,8 @@ public:
|
|||
void setProgress(int p) {
|
||||
setValue(p);
|
||||
}
|
||||
void setDeviceName(const QString& d);
|
||||
|
||||
void setDeviceName(const QString& device);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* e) override;
|
||||
|
|
|
@ -162,6 +162,7 @@ void SizeDialogBase::setupConnections()
|
|||
connect(&dialogWidget().partResizerWidget(), &PartResizerWidget::firstSectorChanged, this, &SizeDialogBase::onResizerWidgetFirstSectorChanged);
|
||||
connect(&dialogWidget().partResizerWidget(), &PartResizerWidget::lastSectorChanged, this, &SizeDialogBase::onResizerWidgetLastSectorChanged);
|
||||
|
||||
// TODO: Qt6 remove qOverload
|
||||
connect(&dialogWidget().spinFreeBefore(), qOverload<double>(&QDoubleSpinBox::valueChanged), this, &SizeDialogBase::onSpinFreeBeforeChanged);
|
||||
connect(&dialogWidget().spinFreeAfter(), qOverload<double>(&QDoubleSpinBox::valueChanged), this, &SizeDialogBase::onSpinFreeAfterChanged);
|
||||
connect(&dialogWidget().spinCapacity(), qOverload<double>(&QDoubleSpinBox::valueChanged), this, &SizeDialogBase::onSpinCapacityChanged);
|
||||
|
@ -305,7 +306,7 @@ void SizeDialogBase::onSpinFreeAfterChanged(double newAfter)
|
|||
updateSpinFreeAfter(dialogUnitToSectors(device(), oldAfter));
|
||||
}
|
||||
|
||||
void SizeDialogBase::onSpinFirstSectorChanged(qint64 newFirst)
|
||||
void SizeDialogBase::onSpinFirstSectorChanged(double newFirst)
|
||||
{
|
||||
if (newFirst >= minimumFirstSector() && dialogWidget().partResizerWidget().updateFirstSector(newFirst))
|
||||
setDirty();
|
||||
|
@ -315,7 +316,7 @@ void SizeDialogBase::onSpinFirstSectorChanged(qint64 newFirst)
|
|||
updateSpinFirstSector(partition().firstSector());
|
||||
}
|
||||
|
||||
void SizeDialogBase::onSpinLastSectorChanged(qint64 newLast)
|
||||
void SizeDialogBase::onSpinLastSectorChanged(double newLast)
|
||||
{
|
||||
if (newLast <= maximumLastSector() && dialogWidget().partResizerWidget().updateLastSector(newLast))
|
||||
setDirty();
|
||||
|
|
|
@ -117,8 +117,8 @@ protected:
|
|||
void onSpinFreeBeforeChanged(double newBefore);
|
||||
void onSpinFreeAfterChanged(double newAfter);
|
||||
|
||||
void onSpinFirstSectorChanged(qint64 newFirst);
|
||||
void onSpinLastSectorChanged(qint64 newLast);
|
||||
void onSpinFirstSectorChanged(double newFirst);
|
||||
void onSpinLastSectorChanged(double newLast);
|
||||
void onAlignToggled(bool);
|
||||
|
||||
void onLVNameChanged(const QString& newName);
|
||||
|
|
|
@ -22,6 +22,7 @@ class SizeDialogWidget : public QWidget, public Ui::SizeDialogWidgetBase
|
|||
public:
|
||||
SizeDialogWidget(QWidget* parent) : QWidget(parent), Ui::SizeDialogWidgetBase() {
|
||||
setupUi(this);
|
||||
hidePosixPermissions();
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -73,6 +74,11 @@ public:
|
|||
return *m_RadioLogical;
|
||||
}
|
||||
|
||||
QRadioButton& radioRootPermissions() {
|
||||
Q_ASSERT(m_permissionOnlyRoot);
|
||||
return *m_permissionOnlyRoot;
|
||||
}
|
||||
|
||||
QComboBox& comboFileSystem() {
|
||||
Q_ASSERT(m_ComboFileSystem);
|
||||
return *m_ComboFileSystem;
|
||||
|
@ -141,6 +147,21 @@ public:
|
|||
delete m_LabelTextNoSetLabel;
|
||||
m_LabelTextNoSetLabel = nullptr;
|
||||
}
|
||||
|
||||
void hidePosixPermissions() {
|
||||
m_groupBox_permissions->hide();
|
||||
m_labelPermission->hide();
|
||||
}
|
||||
|
||||
void showPosixPermissions() {
|
||||
m_groupBox_permissions->show();
|
||||
m_labelPermission->show();
|
||||
}
|
||||
|
||||
bool isPermissionOnlyRoot() const {
|
||||
return !m_permissionEveryone->isChecked();
|
||||
}
|
||||
|
||||
void hideBeforeAndAfter() {
|
||||
labelFreeBefore().hide();
|
||||
spinFreeBefore().hide();
|
||||
|
|
|
@ -18,22 +18,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="m_LabelFreeBefore">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>3</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="PartResizerWidget" name="m_PartResizerWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string comment="@label:listbox">F&ree space before:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_SpinFreeBefore</cstring>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -53,13 +50,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="FormattedSpinBox" name="m_SpinCapacity">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_LabelRole">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
<property name="text">
|
||||
<string comment="@label:listbox">Partition type:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -82,6 +85,13 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_ComboFileSystem"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="m_CheckBoxEncrypt">
|
||||
<property name="toolTip">
|
||||
|
@ -92,55 +102,40 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="KNewPasswordWidget" name="m_EditPassphrase"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextLVName">
|
||||
<property name="text">
|
||||
<string comment="@label">Maximum size:</string>
|
||||
<string>Logical Volume Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="m_LabelMaxSize">
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="m_EditLVName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioPrimary">
|
||||
<property name="text">
|
||||
<string>Primar&y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioExtended">
|
||||
<property name="text">
|
||||
<string>E&xtended</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioLogical">
|
||||
<property name="text">
|
||||
<string>&Logical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextLabel">
|
||||
<property name="text">
|
||||
<string comment="@label">Label:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_EditLabel</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="7" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_EditLabel"/>
|
||||
|
@ -157,62 +152,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="PartResizerWidget" name="m_PartResizerWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="m_ComboFileSystem"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_LabelRole">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string comment="@label:listbox">Partition &type:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_RadioPrimary</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextLabel">
|
||||
<property name="text">
|
||||
<string comment="@label">Label:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_EditLabel</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
|
@ -228,7 +168,56 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="m_LabelMinSize">
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string comment="@label">Maximum size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="m_LabelMaxSize">
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="m_LabelFreeBefore">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>3</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string comment="@label:listbox">F&ree space before:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_SpinFreeBefore</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="FormattedSpinBox" name="m_SpinFreeBefore">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
|
@ -244,7 +233,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
|
@ -263,7 +252,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="11" column="1">
|
||||
<widget class="FormattedSpinBox" name="m_SpinCapacity">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="m_LabelFreeAfter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
|
@ -282,7 +281,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="FormattedSpinBox" name="m_SpinFreeAfter">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
|
@ -292,6 +291,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="m_labelPermission">
|
||||
<property name="text">
|
||||
<string>Permissions</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
|
@ -308,36 +317,67 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="KNewPasswordWidget" name="m_EditPassphrase"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="m_LabelMinSize">
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
<item row="13" column="1">
|
||||
<widget class="QGroupBox" name="m_groupBox_permissions">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_permissionEveryone">
|
||||
<property name="toolTip">
|
||||
<string>Allow everyone to write and read on this device</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Everyone</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_permissionOnlyRoot">
|
||||
<property name="toolTip">
|
||||
<string>Allow only root to write and read on this device, you will need to setup per-folder permissions</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Only Root</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="m_LabelTextLVName">
|
||||
<property name="text">
|
||||
<string>Logical Volume Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="m_EditLVName">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item row="2" column="1">
|
||||
<widget class="QGroupBox" name="m_groupBox_type">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioPrimary">
|
||||
<property name="text">
|
||||
<string>Primar&y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioExtended">
|
||||
<property name="text">
|
||||
<string>E&xtended</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_RadioLogical">
|
||||
<property name="text">
|
||||
<string>&Logical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KNewPasswordWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>knewpasswordwidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>PartResizerWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
|
@ -349,16 +389,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<extends>QDoubleSpinBox</extends>
|
||||
<header>gui/formattedspinbox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KNewPasswordWidget</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>KNewPasswordWidget</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_RadioPrimary</tabstop>
|
||||
<tabstop>m_RadioExtended</tabstop>
|
||||
<tabstop>m_RadioLogical</tabstop>
|
||||
<tabstop>m_ComboFileSystem</tabstop>
|
||||
<tabstop>m_CheckBoxEncrypt</tabstop>
|
||||
<tabstop>m_EditLVName</tabstop>
|
||||
<tabstop>m_EditLabel</tabstop>
|
||||
<tabstop>m_SpinFreeBefore</tabstop>
|
||||
<tabstop>m_SpinCapacity</tabstop>
|
||||
|
|
67
src/main.cpp
67
src/main.cpp
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
|
||||
#include <KAboutData>
|
||||
#include <KCrash>
|
||||
|
@ -24,6 +25,45 @@
|
|||
#include <KLocalizedString>
|
||||
|
||||
#include <config.h>
|
||||
#include <utility>
|
||||
|
||||
std::pair<QString, QString> parseDevice(const QString& selectedDevice)
|
||||
{
|
||||
QString device;
|
||||
QString partitionNr;
|
||||
if (selectedDevice.length()) {
|
||||
const bool isNvme = selectedDevice.startsWith(QStringLiteral("nvme"));
|
||||
// calculate the number of numbers on the last part of the info.
|
||||
int numSize = 0;
|
||||
for (int i = selectedDevice.length() - 1; i > 0; i--) {
|
||||
if (selectedDevice[i].isNumber()) {
|
||||
numSize += 1;
|
||||
} else {
|
||||
if (isNvme) {
|
||||
// the entry is just an nvme without a partition.
|
||||
if (selectedDevice[i] != QLatin1Char('p')) {
|
||||
numSize = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
partitionNr = selectedDevice.mid(selectedDevice.length() - numSize);
|
||||
|
||||
if (numSize != 0) {
|
||||
// nvme has a `p` that also needs to be removed.
|
||||
if (isNvme) {
|
||||
numSize += 1;
|
||||
}
|
||||
|
||||
device = selectedDevice.mid(0, selectedDevice.length() - numSize);
|
||||
} else {
|
||||
device = selectedDevice;
|
||||
}
|
||||
}
|
||||
return {device, partitionNr};
|
||||
}
|
||||
|
||||
int Q_DECL_IMPORT main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -52,12 +92,16 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
aboutData.setHomepage(QStringLiteral("https://www.kde.org/applications/system/partitionmanager"));
|
||||
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||
#endif
|
||||
KCrash::initialize();
|
||||
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
// FIXME parser.addPositionalArgument(QStringLiteral("device"), xi18nc("@info:shell", "Device(s) to manage"), QStringLiteral("[device...]"));
|
||||
|
||||
QCommandLineOption deviceOption({QStringLiteral("device")}, xi18nc("@info:shell", "Device to manage"), QStringLiteral("device"));
|
||||
parser.addOption(deviceOption);
|
||||
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
|
@ -71,8 +115,27 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
|
|||
if (!loadBackend())
|
||||
return 0;
|
||||
|
||||
// device is the selected device minus the partition number.
|
||||
// we need all of them to select properly the things on screen.
|
||||
|
||||
QString selectedDevice = parser.value(deviceOption);
|
||||
if (selectedDevice.startsWith(QStringLiteral("/dev/"))) {
|
||||
selectedDevice.remove(QStringLiteral("/dev/"));
|
||||
}
|
||||
auto [device, partitionNr] = parseDevice(selectedDevice);
|
||||
|
||||
MainWindow* mainWindow = new MainWindow();
|
||||
Q_UNUSED(mainWindow)
|
||||
QObject::connect(mainWindow, &MainWindow::scanFinished, mainWindow, [mainWindow, device = device, selectedDevice, partitionNr = partitionNr] {
|
||||
if (device.length()) {
|
||||
mainWindow->setCurrentDeviceByName(device);
|
||||
if (partitionNr.length()) {
|
||||
mainWindow->setCurrentPartitionByName(selectedDevice);
|
||||
}
|
||||
mainWindow->setDisallowOtherDevices();
|
||||
} else {
|
||||
mainWindow->showDevicePanelIfPreviouslyHiddenByDisallowOtherDevices();
|
||||
}
|
||||
});
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
[Desktop Entry]
|
||||
X-KDE-Solid-Predicate=[ StorageVolume.ignored == false AND StorageVolume.usage == 'FileSystem' ]
|
||||
Type=Service
|
||||
Actions=open;
|
||||
|
||||
[Desktop Action open]
|
||||
# %f gives StorageAccess.filePath, %d gives Block.device, %i gives UDI
|
||||
Exec=partitionmanager "--device=%d"
|
||||
Icon=partitionmanager
|
||||
Name=Reformat or Edit with Partition Manager
|
||||
Name[az]=Bölmələr Meneceri ilə yenidən formatlayın və ya düzəliş edin
|
||||
Name[ca]=Reformatació i edició amb el gestor de particions
|
||||
Name[ca@valencia]=Reformatació i edició amb el gestor de particions
|
||||
Name[cs]=Přeformátovat nebo upravit pomocí Správce diskových oddílů
|
||||
Name[es]=Volver a formatear o editar con el gestor de particiones
|
||||
Name[fr]=Reformater ou modifier avec le gestionnaire de partitions de KDE
|
||||
Name[hu]=Újraformázás vagy szerkesztés a Partíciókezelővel
|
||||
Name[ia]=Reformatta o modifica con Partition Manager (gerente de partition)
|
||||
Name[it]=Riformatta o modifica con il gestore delle partizioni
|
||||
Name[nl]=Met Partitiebeheerder opnieuw formatteren of bewerken
|
||||
Name[pl]=Przeformatuj lub zmień w Zarządzaniu Partycjami
|
||||
Name[pt_BR]=Reformatar ou editar com o gerenciador de partições
|
||||
Name[sl]=Ponovno formatiraj ali uredi z Upravljalnikom razdelkov
|
||||
Name[sv]=Omformatering eller redigering med partitionshanterare
|
||||
Name[uk]=Переформатувати або редагувати за допомогою «Керування розділами»
|
||||
Name[x-test]=xxReformat or Edit with Partition Managerxx
|
|
@ -27,6 +27,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<name xml:lang="fr">Gestionnaire de partitions de KDE</name>
|
||||
<name xml:lang="gl">Xestor de particións de KDE</name>
|
||||
<name xml:lang="hu">KDE partíciókezelő</name>
|
||||
<name xml:lang="ia">KDE Partition Manager (gerente de partition de KDE)</name>
|
||||
<name xml:lang="id">KDE Partition Manager</name>
|
||||
<name xml:lang="it">Gestore delle partizioni di KDE</name>
|
||||
<name xml:lang="ko">KDE 파티션 관리자</name>
|
||||
|
@ -51,6 +52,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<name xml:lang="zh-CN">KDE 分区管理器</name>
|
||||
<name xml:lang="zh-TW">KDE 磁碟分割區管理員</name>
|
||||
<summary>Manage disk devices, partitions and file systems on your computer</summary>
|
||||
<summary xml:lang="ast">Xestiona preseos d'almacenamientu, particiones y sistemes de ficheros del ordenador</summary>
|
||||
<summary xml:lang="az">Kompyuterinizdəki disk qurğularının, bölmələrin və fayl sistemlərinin idarə edilməsi</summary>
|
||||
<summary xml:lang="ca">Gestiona dispositius de disc, particions i sistemes de fitxers de l'ordinador</summary>
|
||||
<summary xml:lang="ca-valencia">Gestiona dispositius de disc, particions i sistemes de fitxers de l'ordinador</summary>
|
||||
|
@ -65,10 +67,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<summary xml:lang="fi">Hallitse tietokoneen levyjä, osioita ja tiedostojärjestelmiä</summary>
|
||||
<summary xml:lang="fr">Gérez vos disques, partitions et systèmes de fichiers de votre ordinateur</summary>
|
||||
<summary xml:lang="hu">A számítógépe háttértárainak, partícióinak és fájlrendszereinek kezelése</summary>
|
||||
<summary xml:lang="ia">Gere dispositivos de disco, partitiones e systemas de file sur tu computator</summary>
|
||||
<summary xml:lang="id">Kelola perangkat disk, partisi, dan sistem file di komputermu</summary>
|
||||
<summary xml:lang="it">Gestisci dispositivi a disco, partizioni e file system sul tuo computer</summary>
|
||||
<summary xml:lang="ko">컴퓨터의 디스크 장치, 파티션, 파일 시스템 관리</summary>
|
||||
<summary xml:lang="nl">Schijfapparaten, partities en bestandssystemen op uw computer beheren</summary>
|
||||
<summary xml:lang="pa">ਆਪਣੇ ਕੰਪਿਊਟਰ ਲਈ ਡਿਸਕ ਡਿਵਾਈਸ, ਪਾਰਟੀਸ਼ਨ ਤੇ ਫਾਇਲ ਸਿਸਟਮਾਂ ਦਾ ਇੰਤਜ਼ਾਮ ਕਰੋ</summary>
|
||||
<summary xml:lang="pl">Zarządzaj urządzeniami dyskowymi, partycjami oraz systemami plików na twoim komputerze</summary>
|
||||
<summary xml:lang="pt">Faz a gestão de dispositivos, partições e sistemas de ficheiros dos discos no seu computador</summary>
|
||||
<summary xml:lang="pt-BR">Gerencie dispositivos de disco, partições e sistemas de arquivos no seu computador</summary>
|
||||
|
@ -140,6 +144,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<p xml:lang="fr">Fonctionnalités :</p>
|
||||
<p xml:lang="gl">Funcionalidades:</p>
|
||||
<p xml:lang="hu">Szolgáltatások:</p>
|
||||
<p xml:lang="ia">Characteristicas:</p>
|
||||
<p xml:lang="id">Fitur:</p>
|
||||
<p xml:lang="it">Funzionalità:</p>
|
||||
<p xml:lang="ko">기능:</p>
|
||||
|
@ -221,6 +226,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<li xml:lang="fr">Utilise des programmes externes existants pour faire le travail</li>
|
||||
<li xml:lang="gl">Usa programas externos para realizar as tarefas.</li>
|
||||
<li xml:lang="hu">A meglévő külső programokat használja a feladatok elvégzésére</li>
|
||||
<li xml:lang="ia">Face uso de programmas externe jam disponibile pro obtener que su carga es facite</li>
|
||||
<li xml:lang="id">Membuat penggunaan program eksternal yang sudah ada untuk menyelesaikan pekerjaannya</li>
|
||||
<li xml:lang="it">Utilizza programmi esterni già disponibili per fare il suo lavoro</li>
|
||||
<li xml:lang="ko">외부 프로그램을 사용한 작업 관리</li>
|
||||
|
@ -246,7 +252,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<li xml:lang="zh-TW">利用已有的外部程式來完成其工作</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url type="homepage">https://www.kde.org/applications/system/kdepartitionmanager/</url>
|
||||
<url type="homepage">https://apps.kde.org/partitionmanager//</url>
|
||||
<url type="bugtracker">https://bugs.kde.org/enter_bug.cgi?format=guided&product=partitionmanager</url>
|
||||
<url type="help">https://docs.kde.org/?application=partitionmanager</url>
|
||||
<screenshots>
|
||||
|
@ -259,8 +265,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<binary>partitionmanager</binary>
|
||||
</provides>
|
||||
<releases>
|
||||
<release version="20.12.2" date="2021-02-04"/>
|
||||
<release version="20.12.1" date="2021-01-07"/>
|
||||
<release version="20.12.0" date="2020-12-10"/>
|
||||
<release version="21.12.2" date="2022-02-03"/>
|
||||
<release version="21.12.1" date="2022-01-06"/>
|
||||
<release version="21.12.0" date="2021-12-09"/>
|
||||
<release version="21.08.3" date="2021-11-04"/>
|
||||
</releases>
|
||||
</component>
|
||||
|
|
|
@ -21,6 +21,7 @@ Name[fr]=Gestionnaire de partitions de KDE
|
|||
Name[ga]=Bainisteoir Deighiltí KDE
|
||||
Name[gl]=Xestor de particións de KDE
|
||||
Name[hu]=KDE partíciókezelő
|
||||
Name[ia]=KDE Partition Manager (gerente de partition de KDE)
|
||||
Name[id]=KDE Partition Manager
|
||||
Name[it]=Gestore delle partizioni di KDE
|
||||
Name[ja]=KDE パーティションマネージャ
|
||||
|
@ -75,6 +76,7 @@ GenericName[fr]=Éditeur de partitions
|
|||
GenericName[ga]=Eagarthóir Deighiltí
|
||||
GenericName[gl]=Editor de particións
|
||||
GenericName[hu]=Partíciószerkesztő
|
||||
GenericName[ia]=Partition Editor (Editor de Partition)
|
||||
GenericName[id]=Pengedit Partisi
|
||||
GenericName[it]=Editor delle partizioni
|
||||
GenericName[ja]=パーティション編集ツール
|
||||
|
@ -128,6 +130,7 @@ Comment[fr]=Gère les disques, partitions et systèmes de fichiers
|
|||
Comment[ga]=Bainistigh dioscaí, deighiltí agus córais comhad
|
||||
Comment[gl]=Xestiona os discos, particións e o sistemas de ficheiros
|
||||
Comment[hu]=Lemezek, partíciók, és fájlrendszerek kezelése
|
||||
Comment[ia]=Gere discos, partitiones e systemas de file
|
||||
Comment[id]=Kelola disk, partisi dan sistem file
|
||||
Comment[it]=Gestisci dischi, partizioni e filesystem
|
||||
Comment[ja]=ディスク、パーティション、ファイルシステムを管理します
|
||||
|
@ -166,13 +169,14 @@ Icon=partitionmanager
|
|||
Categories=System;Filesystem;KDE;Qt;
|
||||
X-KDE-StartupNotify=true
|
||||
Keywords=partition;disk;
|
||||
Keywords[ar]=أقسام;قرص;
|
||||
Keywords[ast]=partición;particionar;discu;
|
||||
Keywords[az]=partition;disk;bölmə;
|
||||
Keywords[ca]=partició;disc;
|
||||
Keywords[ca@valencia]=partició;disc;
|
||||
Keywords[cs]=oddíl;disk;
|
||||
Keywords[da]=partition;disk;
|
||||
Keywords[de]=partition;disk;festplatte
|
||||
Keywords[de]=partition;disk;festplatte;
|
||||
Keywords[el]=κατάτμηση;δίσκος;
|
||||
Keywords[en_GB]=partition;disk;
|
||||
Keywords[es]=partición;disco;
|
||||
|
@ -182,6 +186,7 @@ Keywords[fi]=osio;levy;
|
|||
Keywords[fr]=partition;disque;
|
||||
Keywords[gl]=partition;disk;partición;disco;
|
||||
Keywords[hu]=partíció;lemez;
|
||||
Keywords[ia]=partition;disk;
|
||||
Keywords[id]=partisi;disk;
|
||||
Keywords[it]=partizione;disco;
|
||||
Keywords[ko]=partition;disk;파티션;디스크;
|
||||
|
|
|
@ -145,7 +145,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
<label context="@label">Backend plugin</label>
|
||||
</entry>
|
||||
<entry key="defaultFileSystem" type="Int">
|
||||
<default>static_cast<int>(FileSystem::Type::Ext4)</default>
|
||||
<default>static_cast<int>(FileSystem::Type::Btrfs)</default>
|
||||
</entry>
|
||||
<entry key="preferredUnit" type="Enum">
|
||||
<label context="@label">Preferred unit:</label>
|
||||
|
@ -167,5 +167,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||
</choices>
|
||||
<default>random</default>
|
||||
</entry>
|
||||
<entry key="hideDeviceDockWidgetByCmdArgs" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
||||
|
|
Loading…
Reference in New Issue