Compare commits

...

46 Commits
master ... 1.0

Author SHA1 Message Date
Volker Lanz 731f5bfec5 backport r1278089 and r1278090:
Workaround broken kdesu backward compatibility.

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1278091
2012-02-04 10:42:38 +00:00
Volker Lanz ffea238a78 Backport r1249904 to 1.0 branch.
CCBUG:275657

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1249905
2011-08-28 14:04:27 +00:00
Volker Lanz bcd3cb4bf5 prepare for 1.0.3 release
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1170528
2010-09-01 10:36:13 +00:00
Volker Lanz 3c49632ac6 backport r1145986: explicitly link the executable against the KDE libs it uses
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1145987
2010-07-04 21:13:15 +00:00
Volker Lanz 6b6fd2e8d7 backport r1129877: clear the clipboard if undo deleted the partition that's in
it

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1129878
2010-05-24 01:58:22 +00:00
Volker Lanz 20f20b4b25 backport part of r1128926: actually make use of the length param in
linuxswap::resize()

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1128929
2010-05-20 17:32:48 +00:00
Volker Lanz a469fdfe0a backport r1128909: keep UUID when resizing swap (i.e. recreating it)
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1128928
2010-05-20 17:29:49 +00:00
Volker Lanz e0ec34893d backport r1128813: revert r1128585 and implement this as an additional check in
CopyOperation::canPaste() instead.

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1128814
2010-05-20 11:05:58 +00:00
Volker Lanz a824ccdf58 backport r1128581: prevent the user from pasting a partition on another that is
too big for the source partition's file system

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1128585
2010-05-19 17:48:47 +00:00
Volker Lanz a1e98abaab backport r1128576: warn if user tries to overwrite an existing partition with
another or an image file

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1128582
2010-05-19 17:41:56 +00:00
Volker Lanz 6e72d417ba backport r1128535: use -n option of fsck.msdos to keep it from modifying the
file system when reading usage

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1128536
2010-05-19 15:17:53 +00:00
Volker Lanz 0a7fe99a9e backport r1127356: make sure avail and used capacity aren't printed if not
known

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1127358
2010-05-16 11:51:08 +00:00
Volker Lanz 6d2be0b718 bump version
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1118061
2010-04-23 19:35:27 +00:00
Volker Lanz 6816a13c76 update changelog
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1118058
2010-04-23 19:27:29 +00:00
Volker Lanz 4f4712f52f backport r1115229 to branches/1.0
CCBUG:232092

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1115230
2010-04-15 17:38:22 +00:00
Volker Lanz bde6a18f68 backport r1113772: use the icons the kstandardguiitem would use in all
kguiitems we create


svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1113777
2010-04-11 18:29:53 +00:00
Volker Lanz a873af141c backport: Update the partition's file system if the role changes and then
update the constraints. 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.

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1103950
2010-03-16 11:23:00 +00:00
Volker Lanz 5d2c3f172e print the values we actually meant to print in kWarning()
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1102414
2010-03-12 13:24:20 +00:00
Volker Lanz 1355007dfc formatting is plaintext for error message to report
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1096699
2010-02-27 13:03:49 +00:00
Volker Lanz 655656cbae backport r1092788: workaround a libparted commit_to_os bug.
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1092791
2010-02-19 14:46:25 +00:00
Volker Lanz 867027eeb8 backport r1091925: copy file system's uuid when creating a file system from an
existing one

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1091931
2010-02-17 22:12:11 +00:00
Volker Lanz 6f13a0b34e don't require cmake 2.6.2 *sigh*
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071874
2010-01-08 23:06:34 +00:00
Volker Lanz e3c6be0446 turns out docs still don't build on obs, so no need for the kde 4.2 requirement
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071859
2010-01-08 22:43:28 +00:00
Volker Lanz 31a122a9ab Preparing for release
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071806
2010-01-08 20:04:51 +00:00
Volker Lanz a6d621086c import docs to 1.0 branch
svn path=/branches/partitionmanager/1.0/doc/en_US/; revision=1071805
2010-01-08 19:55:16 +00:00
Volker Lanz a12d711ec2 require KDE 4.2 and cmake 2.6.2 (the latter is the KDE wide minimum right now)
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071800
2010-01-08 19:36:24 +00:00
Volker Lanz c7d6c0a51c preparing release, updating change log
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071798
2010-01-08 19:28:31 +00:00
Volker Lanz 9709ad52d8 backport r1071252: set listview item size for devices to 32 pixels
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071255
2010-01-07 19:26:15 +00:00
Volker Lanz 40d40c35c5 backport r1071251: set item height in tree view to 32 pixels
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1071253
2010-01-07 19:25:33 +00:00
Volker Lanz 8f67e3e22c backport r1070840: work around libparted segfaults and problems
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1070842
2010-01-06 22:00:34 +00:00
Volker Lanz e7fcc10b4c new year
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1070731
2010-01-06 16:15:48 +00:00
Volker Lanz a103406e4a backport 1062710:
Don't disable updates for the partition widget while applying operations. This
leads to corrupted graphics unter Qt4.6 and should not be necessary anymore as
executing operations will not delete any partition objects.


svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1062711
2009-12-15 18:46:19 +00:00
Volker Lanz df47e8dc50 backport 1062443:
sort devices by name after scanning.


svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1062445
2009-12-14 20:07:39 +00:00
Volker Lanz 10ecd7c11c backport r1062049: Don't static_cast a child to a partition widget, use
qobject_cast to make sure we don't get unintended side effects.


svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1062052
2009-12-13 16:51:14 +00:00
Volker Lanz a0d27b40d0 backport r1062035: don't delete all of info pane's children on clear or newer
oxygen versions (KDE SC 4.4) make us crash.

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1062038
2009-12-13 16:07:44 +00:00
Volker Lanz a46c65d132 no release today :-((
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1056280
2009-11-29 18:53:13 +00:00
Volker Lanz a93feaf27f set version to 1.0.1
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1056243
2009-11-29 17:54:36 +00:00
Volker Lanz fc4c7e9120 add changes for 1.0.1
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1056242
2009-11-29 17:50:11 +00:00
Volker Lanz 5c1f14495a backport r1056190: use blkid as an alternative to vol_id if available
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1056197
2009-11-29 16:12:26 +00:00
Volker Lanz a34141a688 backport 1053337: improve "ask for root pwd ourselves"
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1053339
2009-11-23 21:26:04 +00:00
Volker Lanz 4eee943be9 backport r1053205: ask for root pwd ourselves
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1053265
2009-11-23 18:30:09 +00:00
Volker Lanz bbfc3d474c backport r1050114: make partition manager recognise swap fs again with newer
parted versions

svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1050115
2009-11-16 17:05:33 +00:00
Volker Lanz b48da5c7a0 backport r1050111: fix unmounting swap
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1050112
2009-11-16 17:03:55 +00:00
Volker Lanz 36e6a319ca backport: don't build the KCM by default
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1014084
2009-08-21 12:11:02 +00:00
Volker Lanz ca66189f2d create 1.0 branch from 1.0.0 tag
svn path=/branches/partitionmanager/1.0/partitionmanager/; revision=1012275
2009-08-17 10:08:54 +00:00
Volker Lanz f6f867d305 Tag 1.0.0
svn path=/tags/partitionmanager/1.0.0/partitionmanager/; revision=1012266
2009-08-17 09:46:59 +00:00
66 changed files with 472 additions and 189 deletions

77
CHANGES
View File

@ -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)
==================

View File

@ -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}"')

View File

@ -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 ..

View File

@ -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)

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

@ -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 &copy; 2008 Volker Lanz.
Documentation Copyright &copy; 2008, 2009, 2010 Volker Lanz.
<email>vl@fidra.de</email>
</para>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -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"/>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

@ -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:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -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>

View File

@ -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>

View File

@ -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)

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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();
}
}

View File

@ -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;

View File

@ -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");
}

View File

@ -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;

View File

@ -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 */

View File

@ -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();

View File

@ -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);

View File

@ -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; }

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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);
}

View File

@ -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>

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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>

View File

@ -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();

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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();

View File

@ -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:

View File

@ -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;
}

View File

@ -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");