Compare commits
46 Commits
Author | SHA1 | Date |
---|---|---|
Volker Lanz | 731f5bfec5 | |
Volker Lanz | ffea238a78 | |
Volker Lanz | bcd3cb4bf5 | |
Volker Lanz | 3c49632ac6 | |
Volker Lanz | 6b6fd2e8d7 | |
Volker Lanz | 20f20b4b25 | |
Volker Lanz | a469fdfe0a | |
Volker Lanz | e0ec34893d | |
Volker Lanz | a824ccdf58 | |
Volker Lanz | a1e98abaab | |
Volker Lanz | 6e72d417ba | |
Volker Lanz | 0a7fe99a9e | |
Volker Lanz | 6d2be0b718 | |
Volker Lanz | 6816a13c76 | |
Volker Lanz | 4f4712f52f | |
Volker Lanz | bde6a18f68 | |
Volker Lanz | a873af141c | |
Volker Lanz | 5d2c3f172e | |
Volker Lanz | 1355007dfc | |
Volker Lanz | 655656cbae | |
Volker Lanz | 867027eeb8 | |
Volker Lanz | 6f13a0b34e | |
Volker Lanz | e3c6be0446 | |
Volker Lanz | 31a122a9ab | |
Volker Lanz | a6d621086c | |
Volker Lanz | a12d711ec2 | |
Volker Lanz | c7d6c0a51c | |
Volker Lanz | 9709ad52d8 | |
Volker Lanz | 40d40c35c5 | |
Volker Lanz | 8f67e3e22c | |
Volker Lanz | e7fcc10b4c | |
Volker Lanz | a103406e4a | |
Volker Lanz | df47e8dc50 | |
Volker Lanz | 10ecd7c11c | |
Volker Lanz | a0d27b40d0 | |
Volker Lanz | a46c65d132 | |
Volker Lanz | a93feaf27f | |
Volker Lanz | fc4c7e9120 | |
Volker Lanz | 5c1f14495a | |
Volker Lanz | a34141a688 | |
Volker Lanz | 4eee943be9 | |
Volker Lanz | bbfc3d474c | |
Volker Lanz | b48da5c7a0 | |
Volker Lanz | 36e6a319ca | |
Volker Lanz | ca66189f2d | |
Volker Lanz | f6f867d305 |
77
CHANGES
|
@ -1,3 +1,80 @@
|
|||
1.0.3 (2010-09-01)
|
||||
==================
|
||||
|
||||
* Make sure available and used capacity are not printed in a partition's
|
||||
properties dialog if they are not known
|
||||
|
||||
* Make sure fsck.msdos does not want to modify a file system when it is being
|
||||
called to read the file system usage
|
||||
|
||||
* Warn the user when trying to overwrite an existing partition with another or
|
||||
an image file
|
||||
|
||||
* Clear the clipboard if undoing an operation deleted the partition that was in it
|
||||
|
||||
* Keep the current UUID when resizing a swap partition
|
||||
|
||||
* Fix the build by explicitly linking the partition manager executable against
|
||||
the KDE libs it uses
|
||||
|
||||
* Do not allow pasting a source partition on a bigger target partition when the
|
||||
source partition's file system cannot be grown to fill the target partition
|
||||
|
||||
|
||||
1.0.2 (2010-04-23)
|
||||
==================
|
||||
|
||||
* Copy a file system's UUID to the copied file system when creating a file
|
||||
system from another one.
|
||||
|
||||
* Implement a workaround for a libparted bug that makes it sometimes fail to
|
||||
commit changes to the OS in versions earlier than 2.2.
|
||||
|
||||
* Update the partition's file system and re-check for constraints if the
|
||||
partition's role is changed in the "Create New Partition" dialog. This fixes
|
||||
a bug where the user was not able to grow an extended partition if he'd
|
||||
previously selected a file system that cannot grow beyond a certain size.
|
||||
|
||||
* Always use the correct icons in modified ok/cancel buttons in dialogs and
|
||||
message boxes
|
||||
|
||||
* Fix a crash when operations to create, resize and delete an extended
|
||||
partitions where incorrectly merged into one (bug 232092)
|
||||
|
||||
|
||||
1.0.1 (2010-01-09)
|
||||
==================
|
||||
|
||||
* Fix a bug that made it impossible to activate or deactivate a swap file
|
||||
system.
|
||||
|
||||
* Correctly handle linux swap even with newer parted versions.
|
||||
|
||||
* Ask for an administrator's password on startup so that non-KDE users can run
|
||||
the application from their launcher.
|
||||
|
||||
* Use the "blkid" command as an alternative to "vol_id" if the latter is
|
||||
unavailable.
|
||||
|
||||
* Do not crash when using the Oxygen style under KDE SC 4.4.
|
||||
|
||||
* Do not crash when the user clicks in the partition widget with newer
|
||||
g++ versions.
|
||||
|
||||
* Sort devices by name after scanning.
|
||||
|
||||
* Don't disable updates for the partition widget while applying operations.
|
||||
This leads to corrupted graphics unter Qt4.6.
|
||||
|
||||
* Work around a LibParted segmentation fault when the Linux Device Mapper is
|
||||
used and /dev/mapper has non-existing entries.
|
||||
|
||||
* The above also works around a LibParted problem when the BIOS has a floppy
|
||||
drive configured but none is actually present.
|
||||
|
||||
* Set item height in the partition and devices lists to 32 pixel to make them
|
||||
look less condensed.
|
||||
|
||||
1.0.0 (2009-08-17)
|
||||
==================
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
|
|||
|
||||
set(VERSION_MAJOR "1")
|
||||
set(VERSION_MINOR "0")
|
||||
set(VERSION_RELEASE "0")
|
||||
set(VERSION_RELEASE "3")
|
||||
set(VERSION_SUFFIX "")
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}${VERSION_SUFFIX})
|
||||
add_definitions(-D'VERSION="${VERSION}"')
|
||||
|
|
9
INSTALL
|
@ -13,9 +13,10 @@ anyway. Get the source and build it from
|
|||
http://sourceforge.net/project/showfiles.php?group_id=2406 or, preferably,
|
||||
install your distribution's packages (again, don't forget the dev-package).
|
||||
|
||||
libblkid: Also part of e2fsprogs. See libuuid.
|
||||
libblkid: Part of the util-linux-ng project available at
|
||||
http://userweb.kernel.org/~kzak/util-linux-ng/.
|
||||
|
||||
KDE4: KDE 4.0 will not work. The minimum required version is 4.1.0.
|
||||
KDE4: KDE 4.0 or earlier will not work. The minimum required version is 4.1.0.
|
||||
|
||||
|
||||
2. Configure
|
||||
|
@ -24,8 +25,8 @@ KDE Partition Manager is built with cmake, like most of KDE4 today. It is
|
|||
recommended to build out of tree: After unpacking the source, create a separate
|
||||
build directory and run cmake there:
|
||||
|
||||
$ tar xfj partitionmanager-1.0.0.tar.bz2
|
||||
$ cd partitionmanager-1.0.0
|
||||
$ tar xfj partitionmanager-1.0.3.tar.bz2
|
||||
$ cd partitionmanager-1.0.3
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
|
|
|
@ -1 +1 @@
|
|||
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en)
|
||||
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en_US/ SUBDIR partitionmanager)
|
||||
|
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 72 KiB |
|
@ -4,11 +4,11 @@
|
|||
&partman;
|
||||
</para>
|
||||
<para>
|
||||
Program copyright 2008 Volker Lanz
|
||||
Program copyright 2008, 2009, 2010 Volker Lanz
|
||||
<email>vl@fidra.de</email>
|
||||
</para>
|
||||
<para>
|
||||
Documentation Copyright © 2008 Volker Lanz.
|
||||
Documentation Copyright © 2008, 2009, 2010 Volker Lanz.
|
||||
<email>vl@fidra.de</email>
|
||||
</para>
|
||||
|
||||
|
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
@ -87,7 +87,7 @@
|
|||
<glossterm>File System Label</glossterm>
|
||||
<glossdef>
|
||||
<para>
|
||||
A title of a file system. Some file systems (among them ext2/3, FAT16/32 and NTFS) support setting a label for the file system so it can be identified in tools like &partman; or other applications.
|
||||
A title of a file system. Some file systems (among them ext2/3/4, FAT16/32 and NTFS) support setting a label for the file system so it can be identified in tools like &partman; or other applications.
|
||||
</para>
|
||||
<para>
|
||||
<note>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<glossterm>Partition</glossterm>
|
||||
<glossdef>
|
||||
<para>
|
||||
A section of a <link linkend="glossary-device">hard disk device</link> that can hold a <link linkend="glossary-filesystem">file system</link> or other partitions. Without at least one valid partition, a device can not be used.
|
||||
A section of a <link linkend="glossary-device">hard disk device</link> that can hold a <link linkend="glossary-filesystem">file system</link> or other partitions. Without at least one valid partition, a disk can not be used.
|
||||
</para>
|
||||
<glossseealso otherterm="glossary-device"/>
|
||||
<glossseealso otherterm="glossary-partitiontable"/>
|
||||
|
|
|
@ -47,14 +47,14 @@
|
|||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2008</year>
|
||||
<year>2008, 2009, 2010</year>
|
||||
<holder>Volker Lanz</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>&FDLNotice;</legalnotice>
|
||||
|
||||
<date>2009-06-19</date>
|
||||
<releaseinfo>0.80.11</releaseinfo>
|
||||
<date>2010-01-08</date>
|
||||
<releaseinfo>1.00.00</releaseinfo>
|
||||
|
||||
<abstract>
|
||||
<para>Manage your disks, partitions and file systems.</para>
|
||||
|
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 92 KiB |
|
@ -83,11 +83,11 @@
|
|||
</para>
|
||||
|
||||
<para>
|
||||
This already looks mostly okay but you already know that you will not need that much free space after the home partition because you will later create a swap partition there. And a swap partition of more than 3 GiB is a little large.
|
||||
This already looks mostly okay but you already know that you will not need that much free space after the home partition because you will later create a swap partition there.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
So grab the right resize handle in the dialog's resizer widget and move it to the right until the free space after the pasted partition is only about 1.5 GiB in size:
|
||||
So grab the right resize handle in the dialog's resizer widget and move it to the right until the free space after the pasted partition has a size more suitable for a swap partition:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 90 KiB |
|
@ -164,7 +164,7 @@
|
|||
</screenshot>
|
||||
</para>
|
||||
<para>
|
||||
The blue check marks mean <quote>supported</quote>, the red crosses mean <quote>not supported</quote>. Some combinations are never supported, for example checking a linuxswap file system, because they are inherently impossible. Others cannot be supported because the external tools lack the functionality. This is for instance the case with reading or writing labels for FAT file systems.
|
||||
The blue check marks mean <quote>supported</quote>, the red crosses mean <quote>not supported</quote>. Some combinations are never supported, for example checking a linuxswap file system, because they are inherently impossible. Others cannot be supported because the external tools lack the functionality. This is for instance the case with writing labels for FAT file systems.
|
||||
</para>
|
||||
<para>
|
||||
If you have installed new tools while &partman; is running click on <guibutton>Rescan Support</guibutton> to force a recheck of installed file system support tools.
|
||||
|
@ -273,7 +273,7 @@
|
|||
<action>Deletes a partition</action>: This command deletes the currently selected partition.
|
||||
</para>
|
||||
<para>
|
||||
This command is only enabled if a partition is selected that is not currently mounted. For an extended partition, it is only enabled if none of the logicals in the extended partition are mounted.
|
||||
This command is only enabled if a partition is selected that is not currently mounted. For an extended partition, it is only enabled if it does not contain any logical partitions.
|
||||
</para>
|
||||
<warning>
|
||||
<title>Warning: Possible loss of data</title>
|
||||
|
@ -408,7 +408,7 @@
|
|||
What is displayed and what can be modified in this dialog depends on the type of partition, the type of the file system on the partition and on the partition being currently mounted or not.
|
||||
</para>
|
||||
<para>
|
||||
Not all file systems, for example, support setting a label (and while the FAT file systems do, &partman; currently has no support for setting the label on FAT file systems). It is also generally not possible to modify any properties if the partition is mounted.
|
||||
Not all file systems, for example, support setting a label. It is also generally not possible to modify any properties if the partition is mounted.
|
||||
</para>
|
||||
<para>
|
||||
This is a list of all partition and file system properties that can in general be modified in this dialog:
|
||||
|
|
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 102 KiB |
|
@ -24,7 +24,7 @@
|
|||
</note>
|
||||
|
||||
<para>
|
||||
The first step is to make more room for the partition to grow, so start by shrinking <quote>sdb1</quote> from its current size of 7.21 GiB to a more fittingly 5.00 GiB. Click on the partition and choose <xref linkend="menu-partition-resize"/>. The following dialog comes up:
|
||||
The first step is to make more room for the partition to grow, so start by shrinking <quote>sdb1</quote>. Click on the partition and choose <xref linkend="menu-partition-resize"/>. The following dialog comes up:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -162,7 +162,7 @@
|
|||
|
||||
<tip>
|
||||
<para>
|
||||
Always save the detailed report as <acronym>HTML</acronym> when executing the operations fails with errors or warnings for later reference. You might also want to include it in a bug report you submit to &partman;'s authors.
|
||||
Always save the detailed report as <acronym>HTML</acronym> when executing the operations fails with errors or warnings for later reference. You might also want to include it in a bug report you submit to the &kde; bug tracking system at <ulink url="https://bugs.kde.org">bugs.kde.org</ulink>.
|
||||
</para>
|
||||
</tip>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<listitem>
|
||||
<para>
|
||||
Graphical Device View: In this view &partman; shows a graphical representation of the currently selected device. Each of the device's <glossterm linkend="glossary-partition">partitions</glossterm> has its own box with device node name (<quote>sda1</quote> for the first partition in the screenshot above) and usage information (the dark violet area and <quote>7.61 GiB</quote> in the screenshot).
|
||||
Graphical Device View: In this view &partman; shows a graphical representation of the currently selected device. Each of the device's <glossterm linkend="glossary-partition">partitions</glossterm> has its own box with device node name (<quote>sda1</quote> for the first partition in the screenshot above) and usage information (the dark violet area in the screenshot).
|
||||
</para>
|
||||
<para>
|
||||
<glossterm linkend="glossary-extendedpartition">Extended partitions</glossterm> are visually distinct by their extra border (light green in the screenshot above) around them.
|
||||
|
@ -60,7 +60,7 @@
|
|||
Pending Operations Panel: This panel lists all operations that will be executed once you choose <xref linkend="menu-edit-apply"/>.
|
||||
</para>
|
||||
<para>
|
||||
In the screenshot above, one operation is pending: If the user applies the operations now, the ext2 <glossterm linkend="glossary-filesystem">file system</glossterm> on /dev/sdb7 (which is 1.99 GiB in size) will be checked for errors and, if required, repaired.
|
||||
In the screenshot above, one operation is pending: If the user applies the operations now, the <glossterm linkend="glossary-filesystem">file system</glossterm> on /dev/sdb3 will be checked for errors and, if required, repaired.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ kde4_add_app_icon(partitionmanager-bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../icon
|
|||
|
||||
kde4_add_executable(partitionmanager-bin ${partitionmanager-bin_SRCS})
|
||||
|
||||
target_link_libraries(partitionmanager-bin partitionmanagerprivate)
|
||||
target_link_libraries(partitionmanager-bin partitionmanagerprivate ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
|
||||
|
||||
if(UNIX)
|
||||
add_custom_target(partitionmanager ALL
|
||||
|
@ -87,7 +87,7 @@ endif(PARTMAN_KPART)
|
|||
|
||||
############################################
|
||||
|
||||
option(PARTMAN_KCM "Build a kcm for KDE Partition Manager" ON)
|
||||
option(PARTMAN_KCM "Build a kcm for KDE Partition Manager" OFF)
|
||||
|
||||
if(PARTMAN_KCM)
|
||||
file(GLOB partitionmanagerkcm_SRCS kcm/partitionmanagerkcm.cpp)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <QList>
|
||||
#include <QFile>
|
||||
#include <QMap>
|
||||
#include <QRegExp>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
|
@ -266,7 +267,35 @@ void LibParted::scanDevices(OperationStack& ostack)
|
|||
ostack.clearOperations();
|
||||
ostack.clearDevices();
|
||||
|
||||
ped_device_probe_all();
|
||||
// LibParted's ped_device_probe_all()
|
||||
// 1) segfaults when it finds "illegal" entries in /dev/mapper
|
||||
// 2) takes several minutes to time out if the BIOS says there's a floppy drive present
|
||||
// when in fact there is none.
|
||||
// For that reason we scan devices on our own if possible, using what the kernel knows and
|
||||
// tells us about in /proc/partitions.
|
||||
QFile partitions("/proc/partitions");
|
||||
if (partitions.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QRegExp rxLine("\\s*(\\d+)\\s+(\\d+)\\s+(\\d+)\\s([^0-9]+)\\s+");
|
||||
QByteArray line;
|
||||
|
||||
while (!(line = partitions.readLine()).isEmpty())
|
||||
{
|
||||
if (rxLine.indexIn(line) != -1)
|
||||
{
|
||||
const QString device = "/dev/" + rxLine.cap(4);
|
||||
// kDebug() << "device:" << device;
|
||||
ped_device_get(device.toLocal8Bit());
|
||||
}
|
||||
}
|
||||
|
||||
partitions.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
log(log::information) << i18nc("@info/plain", "Probing for devices using LibParted. This may crash or take a very long time. Read the manual's FAQ section for details.");
|
||||
ped_device_probe_all();
|
||||
}
|
||||
|
||||
PedDevice* pedDevice = ped_device_get_next(NULL);
|
||||
|
||||
|
@ -294,4 +323,6 @@ void LibParted::scanDevices(OperationStack& ostack)
|
|||
|
||||
pedDevice = ped_device_get_next(pedDevice);
|
||||
}
|
||||
|
||||
ostack.sortDevices();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
||||
* Copyright (C) 2008,2011 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
@ -31,6 +31,7 @@
|
|||
#include "ops/createfilesystemoperation.h"
|
||||
#include "ops/setpartflagsoperation.h"
|
||||
#include "ops/setfilesystemlabeloperation.h"
|
||||
#include "ops/checkoperation.h"
|
||||
|
||||
#include "jobs/setfilesystemlabeljob.h"
|
||||
|
||||
|
@ -63,11 +64,13 @@ OperationStack::~OperationStack()
|
|||
<ol>
|
||||
<!-- 1 -->
|
||||
<li>An existing operation created a Partition that is now being deleted: In this case, just remove
|
||||
the corresponding NewOperation from the OperationStack.</li>
|
||||
the corresponding NewOperation from the OperationStack.<br/>This does not work for
|
||||
extended partitions.(#232092)</li>
|
||||
<!-- 2 -->
|
||||
<li>An existing Operation created a Partition that is now being moved or resized. In this case,
|
||||
remove the original NewOperation and create a new NewOperation with updated start and end
|
||||
sectors. This new NewOperation is appended to the OperationStack.</li>
|
||||
sectors. This new NewOperation is appended to the OperationStack.<br/>This does not work for
|
||||
extended partitions.(#232092)</li>
|
||||
<!-- 3 -->
|
||||
<li>An existing NewOperation created a Partition that is now being copied. We're not copying
|
||||
but instead creating another new Partition in its place.</li>
|
||||
|
@ -75,6 +78,9 @@ OperationStack::~OperationStack()
|
|||
<li>The label for a new Partition's FileSystem is modified: Modify in NewOperation and forget it.</li>
|
||||
<!-- 5 -->
|
||||
<li>File system is changed for a new Partition: Modify in NewOperation and forget it.</li>
|
||||
<!-- 6 -->
|
||||
<li>A file system on a new Partition is about to be checked: Just delete the CheckOperation, because
|
||||
file systems are checked anyway when they're created. This fixes #275657.</li>
|
||||
</ol>
|
||||
|
||||
@param currentOp the Operation already on the stack to try to merge with
|
||||
|
@ -93,9 +99,10 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
|
|||
CopyOperation* pushedCopyOp = dynamic_cast<CopyOperation*>(pushedOp);
|
||||
SetFileSystemLabelOperation* pushedLabelOp = dynamic_cast<SetFileSystemLabelOperation*>(pushedOp);
|
||||
CreateFileSystemOperation* pushedCreateFileSystemOp = dynamic_cast<CreateFileSystemOperation*>(pushedOp);
|
||||
|
||||
CheckOperation* pushedCheckOp = dynamic_cast<CheckOperation*>(pushedOp);
|
||||
|
||||
// -- 1 --
|
||||
if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition())
|
||||
if (pushedDeleteOp && &newOp->newPartition() == &pushedDeleteOp->deletedPartition() && !pushedDeleteOp->deletedPartition().roles().has(PartitionRole::Extended))
|
||||
{
|
||||
log() << i18nc("@info/plain", "Deleting a partition just created: Undoing the operation to create the partition.");
|
||||
|
||||
|
@ -109,8 +116,13 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
|
|||
}
|
||||
|
||||
// -- 2 --
|
||||
if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition())
|
||||
if (pushedResizeOp && &newOp->newPartition() == &pushedResizeOp->partition() && !pushedResizeOp->partition().roles().has(PartitionRole::Extended))
|
||||
{
|
||||
// NOTE: In theory it would be possible to merge resizing an extended as long as it has no children.
|
||||
// But that still doesn't save us: If we're not merging a resize on an extended that has children,
|
||||
// a resizeop is added to the stack. Next, the user deletes the child. Then he resizes the
|
||||
// extended again (a second resize): The ResizeOp still has the pointer to the original extended that
|
||||
// will now be deleted.
|
||||
log() << i18nc("@info/plain", "Resizing a partition just created: Updating start and end in existing operation.");
|
||||
|
||||
Partition* newPartition = new Partition(newOp->newPartition());
|
||||
|
@ -179,6 +191,17 @@ bool OperationStack::mergeNewOperation(Operation*& currentOp, Operation*& pushed
|
|||
return true;
|
||||
}
|
||||
|
||||
// -- 6 --
|
||||
if (pushedCheckOp && &newOp->newPartition() == &pushedCheckOp->checkedPartition())
|
||||
{
|
||||
log() << i18nc("@info/plain", "Checking file systems is automatically done when creating them: No new operation required.");
|
||||
|
||||
delete pushedOp;
|
||||
pushedOp = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -458,3 +481,13 @@ void OperationStack::addDevice(Device* d)
|
|||
|
||||
m_PreviewDevices.append(d);
|
||||
}
|
||||
|
||||
static bool deviceLessThan(const Device* d1, const Device* d2)
|
||||
{
|
||||
return d1->deviceNode() <= d2->deviceNode();
|
||||
}
|
||||
|
||||
void OperationStack::sortDevices()
|
||||
{
|
||||
qSort(m_PreviewDevices.begin(), m_PreviewDevices.end(), deviceLessThan);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class OperationStack
|
|||
public:
|
||||
typedef QList<Device*> Devices;
|
||||
typedef QList<Operation*> Operations;
|
||||
|
||||
|
||||
public:
|
||||
OperationStack();
|
||||
~OperationStack();
|
||||
|
@ -55,10 +55,10 @@ class OperationStack
|
|||
void pop();
|
||||
void clearOperations();
|
||||
int size() const { return operations().size(); } /**< @return number of operations */
|
||||
|
||||
|
||||
Devices& previewDevices() { return m_PreviewDevices; } /**< @return the list of Devices */
|
||||
const Devices& previewDevices() const { return m_PreviewDevices; } /**< @return the list of Devices */
|
||||
|
||||
|
||||
Operations& operations() { return m_Operations; } /**< @return the list of operations */
|
||||
const Operations& operations() const { return m_Operations; } /**< @return the list of operations */
|
||||
|
||||
|
@ -67,7 +67,8 @@ class OperationStack
|
|||
protected:
|
||||
void clearDevices();
|
||||
void addDevice(Device* d);
|
||||
|
||||
void sortDevices();
|
||||
|
||||
bool mergeNewOperation(Operation*& currentOp, Operation*& pushedOp);
|
||||
bool mergeCopyOperation(Operation*& currentOp, Operation*& pushedOp);
|
||||
bool mergeRestoreOperation(Operation*& currentOp, Operation*& pushedOp);
|
||||
|
|
|
@ -296,7 +296,7 @@ bool Partition::mount(Report& report)
|
|||
*/
|
||||
bool Partition::unmount(Report& report)
|
||||
{
|
||||
if (!isMounted() || mountPoints().size() == 0)
|
||||
if (!isMounted())
|
||||
return false;
|
||||
|
||||
bool success = true;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace FS
|
|||
m_Copy = (m_Check != SupportNone) ? SupportInternal : SupportNone;
|
||||
m_Move = (m_Check != SupportNone) ? SupportInternal : SupportNone;
|
||||
m_Backup = SupportInternal;
|
||||
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findIdUtil() ? SupportExternal : SupportNone;
|
||||
}
|
||||
|
||||
qint64 ext2::maxCapacity() const
|
||||
|
|
|
@ -58,14 +58,14 @@ namespace FS
|
|||
|
||||
m_Create = findExternal("mkfs.msdos") ? SupportExternal : SupportNone;
|
||||
m_GetUsed = m_Check = findExternal("fsck.msdos", QStringList(), 2) ? SupportExternal : SupportNone;
|
||||
m_GetLabel = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetLabel = findIdUtil() ? SupportExternal : SupportNone;
|
||||
m_Grow = SupportLibParted;
|
||||
m_Shrink = SupportLibParted;
|
||||
m_Move = SupportInternal;
|
||||
m_Copy = SupportInternal;
|
||||
m_Backup = SupportInternal;
|
||||
m_UpdateUUID = findExternal("dd") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findIdUtil() ? SupportExternal : SupportNone;
|
||||
}
|
||||
|
||||
qint64 fat16::minCapacity() const
|
||||
|
@ -80,7 +80,7 @@ namespace FS
|
|||
|
||||
qint64 fat16::readUsedCapacity(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("fsck.msdos", QStringList() << "-v" << deviceNode);
|
||||
ExternalCommand cmd("fsck.msdos", QStringList() << "-n" << "-v" << deviceNode);
|
||||
|
||||
if (cmd.run())
|
||||
{
|
||||
|
@ -134,19 +134,4 @@ namespace FS
|
|||
|
||||
return cmd.waitFor(-1);
|
||||
}
|
||||
|
||||
QString fat16::readLabel(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("vol_id", QStringList() << deviceNode);
|
||||
|
||||
if (cmd.run())
|
||||
{
|
||||
QRegExp rxLabel("ID_FS_LABEL=(\\w+)");
|
||||
|
||||
if (rxLabel.indexIn(cmd.output()) != -1)
|
||||
return rxLabel.cap(1).simplified();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ namespace FS
|
|||
static void init();
|
||||
|
||||
virtual qint64 readUsedCapacity(const QString& deviceNode) const;
|
||||
virtual QString readLabel(const QString& deviceNode) const;
|
||||
virtual bool check(Report& report, const QString& deviceNode) const;
|
||||
virtual bool create(Report& report, const QString& deviceNode) const;
|
||||
virtual bool updateUUID(Report& report, const QString& deviceNode) const;
|
||||
|
|
|
@ -53,15 +53,33 @@ qint64 FileSystem::readUsedCapacity(const QString& deviceNode) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
static QString invokeIdUtil(const QString& util, const QString& deviceNode, const QString& rx)
|
||||
{
|
||||
ExternalCommand cmd(util, QStringList() << deviceNode);
|
||||
|
||||
if (cmd.run())
|
||||
{
|
||||
QRegExp rxLabel(rx);
|
||||
|
||||
if (rxLabel.indexIn(cmd.output()) != -1)
|
||||
return rxLabel.cap(1).simplified();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
/** Reads the label for this FileSystem
|
||||
@param deviceNode the device node for the Partition the FileSystem is on
|
||||
@return the FileSystem label or an empty string in case of error
|
||||
*/
|
||||
QString FileSystem::readLabel(const QString& deviceNode) const
|
||||
{
|
||||
Q_UNUSED(deviceNode);
|
||||
QString rval = invokeIdUtil("vol_id", deviceNode, "ID_FS_LABEL=(\\w+)");
|
||||
|
||||
return QString();
|
||||
if (rval.isEmpty())
|
||||
rval = invokeIdUtil("blkid", deviceNode, "LABEL=\"(\\w+)\"");
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/** Creates a new FileSystem
|
||||
|
@ -171,18 +189,12 @@ bool FileSystem::updateUUID(Report& report, const QString& deviceNode) const
|
|||
*/
|
||||
QString FileSystem::readUUID(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("vol_id", QStringList() << deviceNode);
|
||||
QString rval = invokeIdUtil("vol_id", deviceNode, "ID_FS_UUID=([^\\s]+)");
|
||||
|
||||
if (cmd.run())
|
||||
{
|
||||
QRegExp rxUuid("ID_FS_UUID=([^\\s]+)");
|
||||
|
||||
if (rxUuid.indexIn(cmd.output()) != -1)
|
||||
return rxUuid.cap(1).simplified();
|
||||
}
|
||||
|
||||
return QString();
|
||||
if (rval.isEmpty())
|
||||
rval = invokeIdUtil("blkid", deviceNode, "UUID=\"([^\"]+)\"");
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/** Give implementations of FileSystem a chance to update the boot sector after the
|
||||
|
@ -335,3 +347,9 @@ bool FileSystem::findExternal(const QString& cmdName, const QStringList& args, i
|
|||
|
||||
return cmd.exitCode() == 0 || cmd.exitCode() == expectedCode;
|
||||
}
|
||||
|
||||
bool FileSystem::findIdUtil()
|
||||
{
|
||||
return findExternal("vol_id") || findExternal("blkid");
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ class FileSystem
|
|||
|
||||
protected:
|
||||
static bool findExternal(const QString& cmdName, const QStringList& args = QStringList(), int exptectedCode = 1);
|
||||
static bool findIdUtil();
|
||||
|
||||
protected:
|
||||
FileSystem::Type m_Type;
|
||||
|
|
|
@ -91,33 +91,36 @@ void FileSystemFactory::init()
|
|||
@param label the FileSystem's label
|
||||
@return pointer to the newly created FileSystem object or NULL if FileSystem could not be created
|
||||
*/
|
||||
FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label)
|
||||
FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label, const QString& uuid)
|
||||
{
|
||||
FileSystem* fs = NULL;
|
||||
|
||||
switch(t)
|
||||
{
|
||||
case FileSystem::Ext2: return new FS::ext2(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Ext3: return new FS::ext3(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Ext4: return new FS::ext4(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Extended: return new FS::extended(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Fat16: return new FS::fat16(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Fat32: return new FS::fat32(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Hfs: return new FS::hfs(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::HfsPlus: return new FS::hfsplus(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Jfs: return new FS::jfs(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::LinuxSwap: return new FS::linuxswap(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Ntfs: return new FS::ntfs(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::ReiserFS: return new FS::reiserfs(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Reiser4: return new FS::reiser4(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Ufs: return new FS::ufs(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Unformatted: return new FS::unformatted(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Unknown: return new FS::unknown(firstsector, lastsector, sectorsused, label);
|
||||
case FileSystem::Xfs: return new FS::xfs(firstsector, lastsector, sectorsused, label);
|
||||
|
||||
default:
|
||||
break;
|
||||
case FileSystem::Ext2: fs = new FS::ext2(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Ext3: fs = new FS::ext3(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Ext4: fs = new FS::ext4(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Extended: fs = new FS::extended(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Fat16: fs = new FS::fat16(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Fat32: fs = new FS::fat32(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Hfs: fs = new FS::hfs(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::HfsPlus: fs = new FS::hfsplus(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::ReiserFS: fs = new FS::reiserfs(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Reiser4: fs = new FS::reiser4(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Ufs: fs = new FS::ufs(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Unformatted: fs = new FS::unformatted(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Unknown: fs = new FS::unknown(firstsector, lastsector, sectorsused, label); break;
|
||||
case FileSystem::Xfs: fs = new FS::xfs(firstsector, lastsector, sectorsused, label); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (fs != NULL)
|
||||
fs->setUUID(uuid);
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,7 +128,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
|
|||
*/
|
||||
FileSystem* FileSystemFactory::create(const FileSystem& other)
|
||||
{
|
||||
return create(other.type(), other.firstSector(), other.lastSector(), other.sectorsUsed(), other.label());
|
||||
return create(other.type(), other.firstSector(), other.lastSector(), other.sectorsUsed(), other.label(), other.uuid());
|
||||
}
|
||||
|
||||
/** @return the map of FileSystems */
|
||||
|
|
|
@ -42,7 +42,7 @@ class FileSystemFactory
|
|||
|
||||
public:
|
||||
static void init();
|
||||
static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused = -1, const QString& label = QString());
|
||||
static FileSystem* create(FileSystem::Type t, qint64 firstsector, qint64 lastsector, qint64 sectorsused = -1, const QString& label = QString(), const QString& uuid = QString());
|
||||
static FileSystem* create(const FileSystem& other);
|
||||
static FileSystem* cloneWithNewType(FileSystem::Type newType, const FileSystem& other);
|
||||
static const FileSystems& map();
|
||||
|
|
|
@ -42,10 +42,10 @@ namespace FS
|
|||
void linuxswap::init()
|
||||
{
|
||||
m_SetLabel = m_Shrink = m_Grow = m_Create = (findExternal("mkswap")) ? SupportExternal : SupportNone;
|
||||
m_GetLabel = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetLabel = findIdUtil() ? SupportExternal : SupportNone;
|
||||
m_Copy = SupportInternal;
|
||||
m_Move = SupportInternal;
|
||||
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findIdUtil() ? SupportExternal : SupportNone;
|
||||
}
|
||||
|
||||
bool linuxswap::create(Report& report, const QString& deviceNode) const
|
||||
|
@ -53,33 +53,22 @@ namespace FS
|
|||
return ExternalCommand(report, "mkswap", QStringList() << deviceNode).run(-1);
|
||||
}
|
||||
|
||||
bool linuxswap::resize(Report& report, const QString& deviceNode, qint64) const
|
||||
bool linuxswap::resize(Report& report, const QString& deviceNode, qint64 length) const
|
||||
{
|
||||
const QString label = readLabel(deviceNode);
|
||||
const QString uuid = readUUID(deviceNode);
|
||||
|
||||
QStringList args;
|
||||
if (!label.isEmpty())
|
||||
args << "-L" << label;
|
||||
args << deviceNode;
|
||||
if (!uuid.isEmpty())
|
||||
args << "-U" << uuid;
|
||||
|
||||
args << deviceNode << QString::number(length / 1024);
|
||||
|
||||
return ExternalCommand(report, "mkswap", args).run(-1);
|
||||
}
|
||||
|
||||
QString linuxswap::readLabel(const QString& deviceNode) const
|
||||
{
|
||||
ExternalCommand cmd("vol_id", QStringList() << deviceNode);
|
||||
|
||||
if (cmd.run())
|
||||
{
|
||||
QRegExp rxLabel("ID_FS_LABEL=(\\w+)");
|
||||
|
||||
if (rxLabel.indexIn(cmd.output()) != -1)
|
||||
return rxLabel.cap(1).simplified();
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool linuxswap::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
|
||||
{
|
||||
return ExternalCommand(report, "mkswap", QStringList() << "-L" << newLabel << deviceNode).run(-1);
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace FS
|
|||
|
||||
virtual bool create(Report& report, const QString& deviceNode) const;
|
||||
virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const;
|
||||
virtual QString readLabel(const QString& deviceNode) const;
|
||||
virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);
|
||||
|
||||
virtual bool canMount(const QString&) const { return true; }
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace FS
|
|||
m_Backup = SupportInternal;
|
||||
m_UpdateUUID = findExternal("dd") ? SupportExternal : SupportNone;
|
||||
m_Move = (m_Check != SupportNone) ? SupportInternal : SupportNone;
|
||||
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findIdUtil() ? SupportExternal : SupportNone;
|
||||
}
|
||||
|
||||
qint64 ntfs::maxCapacity() const
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace FS
|
|||
m_Shrink = (m_GetUsed != SupportNone && m_Grow != SupportNone) ? SupportExternal : SupportNone;
|
||||
m_Backup = SupportInternal;
|
||||
m_UpdateUUID = findExternal("reiserfstune") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findExternal("vol_id") ? SupportExternal : SupportNone;
|
||||
m_GetUUID = findIdUtil() ? SupportExternal : SupportNone;
|
||||
}
|
||||
|
||||
qint64 reiserfs::minCapacity() const
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <kglobal.h>
|
||||
#include <kglobalsettings.h>
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
/** Creates a new InfoPane instance
|
||||
@param parent the parent widget
|
||||
|
@ -47,7 +48,8 @@ InfoPane::InfoPane(QWidget* parent) :
|
|||
void InfoPane::clear()
|
||||
{
|
||||
parentWidget()->setWindowTitle(i18nc("@title:window", "Information"));
|
||||
qDeleteAll(findChildren<QWidget*>());
|
||||
qDeleteAll(findChildren<QLabel*>());
|
||||
qDeleteAll(findChildren<QFrame*>());
|
||||
}
|
||||
|
||||
int InfoPane::createHeader(const QString& title)
|
||||
|
|
|
@ -51,8 +51,9 @@ void ListDevices::updateDevices()
|
|||
{
|
||||
const QString shortText = d->deviceNode() + " (" + Capacity(*d).toString() + ')';
|
||||
const QString longText = d->deviceNode() + " (" + Capacity(*d).toString() + ", " + d->name() + ')';
|
||||
QListWidgetItem* item = new QListWidgetItem(SmallIcon("drive-harddisk"), shortText);
|
||||
QListWidgetItem* item = new QListWidgetItem(DesktopIcon("drive-harddisk"), shortText);
|
||||
item->setToolTip(longText);
|
||||
item->setSizeHint(QSize(0, 32));
|
||||
listDevices().addItem(item);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ListDevicesBase</class>
|
||||
<widget class="QWidget" name="ListDevicesBase" >
|
||||
<property name="geometry" >
|
||||
<widget class="QWidget" name="ListDevicesBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
|
@ -9,18 +10,24 @@
|
|||
<height>396</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="m_ListDevices" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<widget class="QListWidget" name="m_ListDevices">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
|
@ -91,7 +91,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
i18ncp("@info", "<para>Do you really want to quit the application?</para><para>There is still an operation pending.</para>",
|
||||
"<para>Do you really want to quit the application?</para><para>There are still %1 operations pending.</para>", pmWidget().numPendingOperations()),
|
||||
i18nc("@title:window", "Discard Pending Operations and Quit?"),
|
||||
KGuiItem(i18nc("@action:button", "&Quit <application>%1</application>", KGlobal::mainComponent().aboutData()->programName())),
|
||||
KGuiItem(i18nc("@action:button", "&Quit <application>%1</application>", KGlobal::mainComponent().aboutData()->programName()), "arrow-right"),
|
||||
KStandardGuiItem::cancel(), "reallyQuit") == KMessageBox::Cancel)
|
||||
{
|
||||
event->ignore();
|
||||
|
|
|
@ -121,8 +121,21 @@ void NewDialog::onRoleChanged(bool)
|
|||
else if (dialogWidget().radioLogical().isChecked())
|
||||
r = PartitionRole::Logical;
|
||||
|
||||
partition().deleteFileSystem();
|
||||
if (r == PartitionRole::Extended)
|
||||
partition().setFileSystem(FileSystemFactory::create(FileSystem::Extended, partition().firstSector(), partition().lastSector()));
|
||||
else
|
||||
{
|
||||
FileSystem::Type t = FileSystem::typeForName(dialogWidget().comboFileSystem().currentText());
|
||||
FileSystem* fs = FileSystemFactory::create(t, partition().firstSector(), partition().lastSector());
|
||||
partition().setFileSystem(fs);
|
||||
}
|
||||
|
||||
dialogWidget().comboFileSystem().setEnabled(r != PartitionRole::Extended);
|
||||
partition().setRoles(PartitionRole(r));
|
||||
|
||||
setupConstraints();
|
||||
|
||||
dialogWidget().partResizerWidget().update();
|
||||
updateHideAndShow();
|
||||
}
|
||||
|
|
|
@ -360,6 +360,8 @@ static QTreeWidgetItem* createTreeWidgetItem(const Partition& p)
|
|||
item->setText(5, Capacity(p, Capacity::Used).toString());
|
||||
item->setText(6, PartitionTable::flagNames(p.activeFlags()).join(", "));
|
||||
|
||||
item->setSizeHint(0, QSize(0, 32));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -375,7 +377,9 @@ void PartitionManagerWidget::updatePartitions()
|
|||
|
||||
QTreeWidgetItem* deviceItem = new QTreeWidgetItem();
|
||||
deviceItem->setText(0, selectedDevice()->name());
|
||||
deviceItem->setIcon(0, SmallIcon("drive-harddisk"));
|
||||
deviceItem->setIcon(0, DesktopIcon("drive-harddisk"));
|
||||
deviceItem->setSizeHint(0, QSize(0, 32));
|
||||
|
||||
treePartitions().addTopLevelItem(deviceItem);
|
||||
|
||||
if (selectedDevice()->partitionTable() != NULL)
|
||||
|
@ -673,7 +677,7 @@ void PartitionManagerWidget::onDeletePartition()
|
|||
"Do you really want to delete the partition that is currently in the clipboard? "
|
||||
"It will no longer be available for pasting after it has been deleted."),
|
||||
i18nc("@title:window", "Really Delete Partition in the Clipboard?"),
|
||||
KGuiItem(i18nc("@action:button", "&Delete It")),
|
||||
KGuiItem(i18nc("@action:button", "&Delete It"), "arrow-right"),
|
||||
KStandardGuiItem::cancel(), "reallyDeleteClipboardPartition") == KMessageBox::Cancel)
|
||||
return;
|
||||
|
||||
|
@ -818,6 +822,20 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertPartition, qint64
|
|||
|
||||
PartitionTable::snap(*selectedDevice(), insertPartition, selectedPartition());
|
||||
}
|
||||
else if (KMessageBox::warningContinueCancel(this,
|
||||
i18nc("@info", "<para><warning>You are about to lose all data on partition "
|
||||
"<filename>%1</filename>.</warning></para>"
|
||||
"<para>Overwriting one partition with another (or with an image file) will "
|
||||
"destroy all data on this target partition.</para>"
|
||||
"<para>If you continue now and apply the resulting operation in the main "
|
||||
"window, all data currently stored on <filename>%1</filename> will "
|
||||
"unrecoverably be overwritten.</para>",
|
||||
selectedPartition()->deviceNode()),
|
||||
i18nc("@title:window", "Really Overwrite Existing Partition?"),
|
||||
KGuiItem(i18nc("@action:button", "Overwrite Partition"), "arrow-right"),
|
||||
KStandardGuiItem::cancel(),
|
||||
"reallyOverwriteExistingPartition") == KMessageBox::Cancel)
|
||||
return false;
|
||||
|
||||
if (insertPartition.length() < sourceLength)
|
||||
{
|
||||
|
@ -853,7 +871,7 @@ void PartitionManagerWidget::onCreateNewPartitionTable()
|
|||
"<para><list><item><filename>%1</filename> (%2)</item></list></para>"
|
||||
"<para><warning>This will destroy all data on the device.</warning></para>", selectedDevice()->deviceNode(), selectedDevice()->name()),
|
||||
i18nc("@title:window", "Destroy All Data on Device?"),
|
||||
KGuiItem(i18nc("@action:button", "&Create New Partition Table")),
|
||||
KGuiItem(i18nc("@action:button", "&Create New Partition Table"), "arrow-right"),
|
||||
KStandardGuiItem::cancel()) == KMessageBox::Continue)
|
||||
{
|
||||
operationStack().push(new CreatePartitionTableOperation(*selectedDevice()));
|
||||
|
@ -872,7 +890,7 @@ void PartitionManagerWidget::onRefreshDevices()
|
|||
"<para>Do you really want to rescan the devices?</para>"
|
||||
"<para><warning>This will also clear the list of pending operations.</warning></para>"),
|
||||
i18nc("@title:window", "Really Rescan the Devices?"),
|
||||
KGuiItem(i18nc("@action:button", "&Rescan Devices")),
|
||||
KGuiItem(i18nc("@action:button", "&Rescan Devices"), "arrow-right"),
|
||||
KStandardGuiItem::cancel(), "reallyRescanDevices") == KMessageBox::Continue)
|
||||
{
|
||||
scanDevices();
|
||||
|
@ -884,6 +902,12 @@ void PartitionManagerWidget::onUndoOperation()
|
|||
log() << i18nc("@info/plain", "Undoing operation: %1", operationStack().operations().last()->description());
|
||||
operationStack().pop();
|
||||
|
||||
// it's possible the undo killed the partition in the clipboard. if there's a partition in the clipboard, try
|
||||
// to find a device for it (OperationStack::findDeviceForPartition() only compares pointers, so an invalid
|
||||
// pointer is not a problem). if no device is found, the pointer must be dangling, so clear the clipboard.
|
||||
if (clipboardPartition() != NULL && operationStack().findDeviceForPartition(clipboardPartition()) == NULL)
|
||||
setClipboardPartition(NULL);
|
||||
|
||||
updatePartitions();
|
||||
emit operationsChanged();
|
||||
emit statusChanged();
|
||||
|
@ -895,7 +919,7 @@ void PartitionManagerWidget::onClearAllOperations()
|
|||
if (KMessageBox::warningContinueCancel(this,
|
||||
i18nc("@info", "Do you really want to clear the list of pending operations?"),
|
||||
i18nc("@title:window", "Clear Pending Operations?"),
|
||||
KGuiItem(i18nc("@action:button", "&Clear Pending Operations")),
|
||||
KGuiItem(i18nc("@action:button", "&Clear Pending Operations"), "arrow-right"),
|
||||
KStandardGuiItem::cancel(), "reallyClearPendingOperations") == KMessageBox::Continue)
|
||||
{
|
||||
log() << i18nc("@info/plain", "Clearing the list of pending operations.");
|
||||
|
@ -920,7 +944,7 @@ void PartitionManagerWidget::onApplyAllOperations()
|
|||
"<para>Do you really want to apply the pending operations listed below?</para>"
|
||||
"<para><warning>This will permanently modify your disks.</warning></para>"),
|
||||
opList, i18nc("@title:window", "Apply Pending Operations?"),
|
||||
KGuiItem(i18nc("@action:button", "&Apply Pending Operations")),
|
||||
KGuiItem(i18nc("@action:button", "&Apply Pending Operations"), "arrow-right"),
|
||||
KStandardGuiItem::cancel()) == KMessageBox::Continue)
|
||||
{
|
||||
log() << i18nc("@info/plain", "Applying operations...");
|
||||
|
@ -929,8 +953,6 @@ void PartitionManagerWidget::onApplyAllOperations()
|
|||
|
||||
operationRunner().setReport(&progressDialog().report());
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
|
||||
// Undo all operations so the runner has a defined starting point
|
||||
for (int i = operationStack().operations().size() - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -979,7 +1001,7 @@ void PartitionManagerWidget::onBackupPartition()
|
|||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
if (!QFile::exists(fileName) || KMessageBox::warningContinueCancel(this, i18nc("@info", "Do you want to overwrite the existing file <filename>%1</filename>?", fileName), i18nc("@title:window", "Overwrite Existing File?"), KGuiItem(i18nc("@action:button", "&Overwrite File")), KStandardGuiItem::cancel()) == KMessageBox::Continue)
|
||||
if (!QFile::exists(fileName) || KMessageBox::warningContinueCancel(this, i18nc("@info", "Do you want to overwrite the existing file <filename>%1</filename>?", fileName), i18nc("@title:window", "Overwrite Existing File?"), KGuiItem(i18nc("@action:button", "&Overwrite File"), "arrow-right"), KStandardGuiItem::cancel()) == KMessageBox::Continue)
|
||||
{
|
||||
operationStack().push(new BackupOperation(*selectedDevice(), *selectedPartition(), fileName));
|
||||
updatePartitions();
|
||||
|
@ -1037,7 +1059,6 @@ void PartitionManagerWidget::onFileSystemSupport()
|
|||
|
||||
void PartitionManagerWidget::onFinished()
|
||||
{
|
||||
setUpdatesEnabled(true);
|
||||
scanDevices();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartitionManagerWidgetBase</class>
|
||||
<widget class="QWidget" name="PartitionManagerWidgetBase" >
|
||||
<property name="geometry" >
|
||||
<widget class="QWidget" name="PartitionManagerWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
|
@ -9,81 +10,90 @@
|
|||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string comment="@title:window" >KDE Partition Manager</string>
|
||||
<property name="windowTitle">
|
||||
<string comment="@title:window">KDE Partition Manager</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="PartTableWidget" native="1" name="m_PartTableWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<widget class="PartTableWidget" name="m_PartTableWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="m_TreePartitions" >
|
||||
<property name="contextMenuPolicy" >
|
||||
<widget class="QTreeWidget" name="m_TreePartitions">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated" >
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable" >
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Partition</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Mount Point</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Label</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Used</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>Flags</string>
|
||||
</property>
|
||||
</column>
|
||||
|
|
|
@ -124,14 +124,25 @@ void PartPropsDialog::setupDialog()
|
|||
dialogWidget().label().setText(newLabel().isEmpty() ? partition().fileSystem().label() : newLabel());
|
||||
dialogWidget().capacity().setText(Capacity(partition()).toString(Capacity::AppendUnit | Capacity::AppendBytes));
|
||||
|
||||
const Capacity availableCapacity = Capacity(partition(), Capacity::Available);
|
||||
const QString availString = availableCapacity.isValid() ? QString(" - %1").arg(availableCapacity.toString(Capacity::AppendUnit | Capacity::AppendBytes)) : QString();
|
||||
const qint64 availPercent = (partition().fileSystem().length() - partition().fileSystem().sectorsUsed()) * 100 / partition().fileSystem().length();
|
||||
dialogWidget().available().setText(QString("%1%%2").arg(QString::number(availPercent)).arg(availString));
|
||||
if (Capacity(partition(), Capacity::Available).isValid())
|
||||
{
|
||||
const qint64 availPercent = (partition().fileSystem().length() - partition().fileSystem().sectorsUsed()) * 100 / partition().fileSystem().length();
|
||||
|
||||
const Capacity usedCapacity = Capacity(partition(), Capacity::Used);
|
||||
const QString usedString = usedCapacity.isValid() ? QString(" - %1").arg(usedCapacity.toString(Capacity::AppendUnit | Capacity::AppendBytes)) : QString();
|
||||
dialogWidget().used().setText(QString("%1%%2").arg(QString::number(100 - availPercent)).arg(usedString));
|
||||
const QString availString = QString("%1% - %2")
|
||||
.arg(availPercent)
|
||||
.arg(Capacity(partition(), Capacity::Available).toString(Capacity::AppendUnit | Capacity::AppendBytes));
|
||||
const QString usedString = QString("%1% - %2")
|
||||
.arg(100 - availPercent)
|
||||
.arg(Capacity(partition(), Capacity::Used).toString(Capacity::AppendUnit | Capacity::AppendBytes));
|
||||
|
||||
dialogWidget().available().setText(availString);
|
||||
dialogWidget().used().setText(usedString);
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogWidget().available().setText(Capacity::invalidString());
|
||||
dialogWidget().used().setText(Capacity::invalidString());
|
||||
}
|
||||
|
||||
dialogWidget().firstSector().setText(KGlobal::locale()->formatNumber(partition().firstSector(), 0));
|
||||
dialogWidget().lastSector().setText(KGlobal::locale()->formatNumber(partition().lastSector(), 0));
|
||||
|
@ -302,8 +313,8 @@ void PartPropsDialog::onFilesystemChanged(int)
|
|||
i18nc("@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()),
|
||||
i18nc("@title:window", "Really Recreate <filename>%1</filename> with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()),
|
||||
KGuiItem(i18nc("@action:button", "&Change the File System")),
|
||||
KGuiItem(i18nc("@action:button", "&Do Not Change the File System")), "reallyChangeFileSystem") == KMessageBox::Continue)
|
||||
KGuiItem(i18nc("@action:button", "&Change the File System"), "arrow-right"),
|
||||
KGuiItem(i18nc("@action:button", "&Do Not Change the File System"), "dialog-cancel"), "reallyChangeFileSystem") == KMessageBox::Continue)
|
||||
{
|
||||
setDirty();
|
||||
updateHideAndShow();
|
||||
|
@ -323,8 +334,8 @@ void PartPropsDialog::onRecreate(int state)
|
|||
i18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>"
|
||||
"<para>Recreating a file system 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()),
|
||||
i18nc("@title:window", "Really Recreate File System on <filename>%1</filename>?", partition().deviceNode()),
|
||||
KGuiItem(i18nc("@action:button", "&Recreate the File System")),
|
||||
KGuiItem(i18nc("@action:button", "&Do Not Recreate the File System")), "reallyRecreateFileSystem") == KMessageBox::Continue))
|
||||
KGuiItem(i18nc("@action:button", "&Recreate the File System"), "arrow-right"),
|
||||
KGuiItem(i18nc("@action:button", "&Do Not Recreate the File System"), "dialog-cancel"), "reallyRecreateFileSystem") == KMessageBox::Continue))
|
||||
{
|
||||
setDirty();
|
||||
setWarnFileSystemChange();
|
||||
|
|
|
@ -211,7 +211,7 @@ bool PartResizerWidget::updateSectors(qint64 newSectorsBefore, qint64 newSectors
|
|||
if (newSectorsBefore < 0 || newSectorsAfter < 0)
|
||||
{
|
||||
kWarning() << "new sectors before partition: " << newSectorsBefore;
|
||||
kWarning() << "new sectors after partition: " << newSectorsBefore;
|
||||
kWarning() << "new sectors after partition: " << newSectorsAfter;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ bool PartResizerWidget::updateSectors(qint64 newSectorsBefore, qint64 newSectors
|
|||
{
|
||||
kWarning() << "total sectors: " << totalSectors();
|
||||
kWarning() << "new sectors before partition: " << newSectorsBefore;
|
||||
kWarning() << "new sectors after partition: " << newSectorsBefore;
|
||||
kWarning() << "new sectors after partition: " << newSectorsAfter;
|
||||
kWarning() << "partition length: " << partition().length();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ void PartTableWidget::resizeEvent(QResizeEvent*)
|
|||
void PartTableWidget::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
event->accept();
|
||||
PartWidget* child = static_cast<PartWidget*>(childAt(event->pos()));
|
||||
PartWidget* child = qobject_cast<PartWidget*>(childAt(event->pos()));
|
||||
setActiveWidget(child);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ void ProgressDialog::slotButtonClicked(int button)
|
|||
|
||||
KApplication::restoreOverrideCursor();
|
||||
|
||||
if (KMessageBox::questionYesNo(this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "Cancel Running Operations"), KGuiItem(i18nc("@action:button", "Yes, Cancel Operations")), KStandardGuiItem::no()) == KMessageBox::Yes)
|
||||
if (KMessageBox::questionYesNo(this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "Cancel Running Operations"), KGuiItem(i18nc("@action:button", "Yes, Cancel Operations"), "dialog-ok"), KStandardGuiItem::no()) == KMessageBox::Yes)
|
||||
// in the meantime while we were showing the messagebox, the runner might have finished.
|
||||
if (operationRunner().isRunning())
|
||||
operationRunner().cancel();
|
||||
|
@ -389,7 +389,7 @@ void ProgressDialog::saveReport()
|
|||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
if (!QFile::exists(fileName) || KMessageBox::warningContinueCancel(this, i18nc("@info", "Do you want to overwrite the existing file <filename>%1</filename>?", fileName), i18nc("@title:window", "Overwrite Existing File?"), KGuiItem(i18nc("@action:button", "&Overwrite File")), KStandardGuiItem::cancel()) == KMessageBox::Continue)
|
||||
if (!QFile::exists(fileName) || KMessageBox::warningContinueCancel(this, i18nc("@info", "Do you want to overwrite the existing file <filename>%1</filename>?", fileName), i18nc("@title:window", "Overwrite Existing File?"), KGuiItem(i18nc("@action:button", "&Overwrite File"), "arrow-right"), KStandardGuiItem::cancel()) == KMessageBox::Continue)
|
||||
{
|
||||
QFile file(fileName);
|
||||
|
||||
|
|
|
@ -101,7 +101,21 @@ bool Job::commit(PedDisk* disk, quint32 timeout)
|
|||
|
||||
bool rval = ped_disk_commit_to_dev(disk);
|
||||
|
||||
rval = ped_disk_commit_to_os(disk) && rval;
|
||||
// The GParted authors have found a bug in libparted that causes it to intermittently
|
||||
// not commit changes to the Linux kernel, probably a race. Until this is fixed in
|
||||
// libparted, the following patch should help alleviate the consequences by just re-trying
|
||||
// committing to the OS if it fails the first time after a short pause.
|
||||
// See: http://git.gnome.org/browse/gparted/commit/?id=bf86fd3f9ceb0096dfe87a8c9a38403c13b13f00
|
||||
if (rval)
|
||||
{
|
||||
rval = ped_disk_commit_to_os(disk);
|
||||
|
||||
if (!rval)
|
||||
{
|
||||
sleep(1);
|
||||
rval = ped_disk_commit_to_os(disk);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ExternalCommand("udevadm", QStringList() << "settle" << "--timeout=" + QString::number(timeout)).run() &&
|
||||
!ExternalCommand("udevsettle", QStringList() << "--timeout=" + QString::number(timeout)).run())
|
||||
|
@ -297,7 +311,7 @@ FileSystem::Type Job::detectFileSystem(PedDevice* pedDevice, PedPartition* pedPa
|
|||
else if (s == "ext2") rval = FileSystem::Ext2;
|
||||
else if (s == "ext3") rval = FileSystem::Ext3;
|
||||
else if (s == "ext4") rval = FileSystem::Ext4;
|
||||
else if (s == "linux-swap") rval = FileSystem::LinuxSwap;
|
||||
else if (s.startsWith("linux-swap")) rval = FileSystem::LinuxSwap;
|
||||
else if (s == "fat16") rval = FileSystem::Fat16;
|
||||
else if (s == "fat32") rval = FileSystem::Fat32;
|
||||
else if (s == "ntfs") rval = FileSystem::Ntfs;
|
||||
|
|
|
@ -97,7 +97,7 @@ bool SetPartFlagsJob::run(Report& parent)
|
|||
|
||||
if (!ped_partition_set_flag(pedPartition, flagmap[i].pedFlag, state))
|
||||
{
|
||||
report->line() << i18nc("@info/plain", "There was an error setting flag %1 for partition <filename>%2</filename> to state %3.", PartitionTable::flagName(flagmap[i].flag), partition().deviceNode(), state ? i18nc("@info flag turned on, active", "on") : i18nc("@info flag turned off, inactive", "off"));
|
||||
report->line() << i18nc("@info/plain", "There was an error setting flag %1 for partition <filename>%2</filename> to state %3.", PartitionTable::flagName(flagmap[i].flag), partition().deviceNode(), state ? i18nc("@info/plain flag turned on, active", "on") : i18nc("@info/plain flag turned off, inactive", "off"));
|
||||
|
||||
rval = false;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
KCmdLineArgs::init(argc, argv, createPartitionManagerAboutData());
|
||||
KCmdLineOptions options;
|
||||
options.add("dontsu", ki18nc("@info:shell", "Do not try to gain super user privileges"));
|
||||
KCmdLineArgs::addCmdLineOptions(options);
|
||||
|
||||
// workaround for https://bugs.launchpad.net/kdesudo/+bug/272427
|
||||
unblockSigChild();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
||||
* Copyright (C) 2008,2011 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
@ -35,6 +35,8 @@ class ResizeFileSystemJob;
|
|||
*/
|
||||
class CheckOperation : public Operation
|
||||
{
|
||||
friend class OperationStack;
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
|
|
@ -318,5 +318,8 @@ bool CopyOperation::canPaste(const Partition* p, const Partition* source)
|
|||
if (source->length() > p->length())
|
||||
return false;
|
||||
|
||||
if (!p->roles().has(PartitionRole::Unallocated) && p->capacity() > source->fileSystem().maxCapacity())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
||||
* Copyright (C) 2008, 2009, 2010 by Volker Lanz <vl@fidra.de> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
@ -27,6 +27,13 @@
|
|||
#include <kmessagebox.h>
|
||||
#include <kglobal.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <QProcess>
|
||||
#include <QFileInfo>
|
||||
#include <QApplication>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
@ -45,9 +52,50 @@ void unblockSigChild()
|
|||
sigprocmask(SIG_UNBLOCK, &sset, NULL);
|
||||
}
|
||||
|
||||
static QString suCommand()
|
||||
{
|
||||
KStandardDirs d;
|
||||
const char* candidates[] = { "kdesu", "kdesudo", "gksudo", "gksu" };
|
||||
QString rval;
|
||||
|
||||
for (quint32 i = 0; i < sizeof(candidates) / sizeof(candidates[0]); i++)
|
||||
{
|
||||
rval = d.locate("exe", candidates[i]);
|
||||
if (QFileInfo(rval).isExecutable())
|
||||
return rval;
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool checkPermissions()
|
||||
{
|
||||
if (geteuid() != 0)
|
||||
{
|
||||
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
|
||||
// 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() && !args->isSet("dontsu"))
|
||||
{
|
||||
QStringList 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("kde") != -1)
|
||||
argList << "-c";
|
||||
|
||||
argList << args->allArguments().join(" ") + " --dontsu";
|
||||
|
||||
kDebug() << "command: " << suCmd << ", arguments: " << argList;
|
||||
|
||||
if (QProcess::execute(suCmd, argList) == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return KMessageBox::warningContinueCancel(NULL, i18nc("@info",
|
||||
"<para><warning>You do not have administrative privileges.</warning></para>"
|
||||
"<para>It is possible to run <application>%1</application> without these privileges. "
|
||||
|
@ -55,9 +103,10 @@ bool checkPermissions()
|
|||
"<para>Do you want to continue running <application>%1</application>?</para>",
|
||||
KGlobal::mainComponent().aboutData()->programName()),
|
||||
i18nc("@title:window", "No administrative privileges"),
|
||||
KGuiItem(i18nc("@action:button", "Run without administrative privileges")),
|
||||
KGuiItem(i18nc("@action:button", "Run without administrative privileges"), "arrow-right"),
|
||||
KStandardGuiItem::cancel(),
|
||||
"runWithoutRootPrivileges") == KMessageBox::Continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -71,7 +120,7 @@ KAboutData* createPartitionManagerAboutData()
|
|||
VERSION,
|
||||
ki18nc("@title", "Manage your disks, partitions and file systems"),
|
||||
KAboutData::License_GPL,
|
||||
ki18nc("@info:credit", "(c) 2008, 2009 Volker Lanz")
|
||||
ki18nc("@info:credit", "(c) 2008, 2009, 2010 Volker Lanz")
|
||||
);
|
||||
|
||||
about->addAuthor(ki18nc("@info:credit", "Volker Lanz"), KLocalizedString(), "vl@fidra.de");
|
||||
|
|