From d6417cbbabec81eff07ca0780e4b2fb40c993e8e Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Thu, 20 May 2010 11:02:00 +0000 Subject: [PATCH] revert r1128581 and implement this as an additional check in CopyOperation::canPaste() instead. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1128813 --- src/gui/partitionmanagerwidget.cpp | 44 ++++++++++-------------------- src/ops/copyoperation.cpp | 3 ++ 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/src/gui/partitionmanagerwidget.cpp b/src/gui/partitionmanagerwidget.cpp index c973870..0f3441f 100644 --- a/src/gui/partitionmanagerwidget.cpp +++ b/src/gui/partitionmanagerwidget.cpp @@ -675,36 +675,20 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertedPartition, qint if (result != KDialog::Accepted) return false; } - else - { - if (selectedPartition()->capacity() > insertedPartition.fileSystem().maxCapacity()) - { - KMessageBox::sorry(this, i18nc("@info", - "The target partition is bigger than the source allows." - "You are trying to paste a %2 partition onto an existing partition " - "that is bigger than %1, the maximum capacity of a %2 file system.", - Capacity(insertedPartition.fileSystem().maxCapacity()).toString(Capacity::AppendUnit), - insertedPartition.fileSystem().name() - ), - i18nc("@title:window", "Target Partition Too Big")); - return false; - } - - if (KMessageBox::warningContinueCancel(this, - i18nc("@info", "You are about to lose all data on partition " - "%1." - "Overwriting one partition with another (or with an image file) will " - "destroy all data on this target partition." - "If you continue now and apply the resulting operation in the main " - "window, all data currently stored on %1 will " - "unrecoverably be overwritten.", - selectedPartition()->deviceNode()), - i18nc("@title:window", "Really Overwrite Existing Partition?"), - KGuiItem(i18nc("@action:button", "Overwrite Partition"), "arrow-right"), - KStandardGuiItem::cancel(), - "reallyOverwriteExistingPartition") == KMessageBox::Cancel) - return false; - } + else if (KMessageBox::warningContinueCancel(this, + i18nc("@info", "You are about to lose all data on partition " + "%1." + "Overwriting one partition with another (or with an image file) will " + "destroy all data on this target partition." + "If you continue now and apply the resulting operation in the main " + "window, all data currently stored on %1 will " + "unrecoverably be overwritten.", + 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 (insertedPartition.length() < sourceLength) { diff --git a/src/ops/copyoperation.cpp b/src/ops/copyoperation.cpp index 0baedce..23a55c9 100644 --- a/src/ops/copyoperation.cpp +++ b/src/ops/copyoperation.cpp @@ -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; }