revert r1128581 and implement this as an additional check in

CopyOperation::canPaste() instead.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1128813
This commit is contained in:
Volker Lanz 2010-05-20 11:02:00 +00:00
parent 696b368463
commit d6417cbbab
2 changed files with 17 additions and 30 deletions

View File

@ -675,36 +675,20 @@ bool PartitionManagerWidget::showInsertDialog(Partition& insertedPartition, qint
if (result != KDialog::Accepted) if (result != KDialog::Accepted)
return false; return false;
} }
else else if (KMessageBox::warningContinueCancel(this,
{ i18nc("@info", "<para><warning>You are about to lose all data on partition "
if (selectedPartition()->capacity() > insertedPartition.fileSystem().maxCapacity()) "<filename>%1</filename>.</warning></para>"
{ "<para>Overwriting one partition with another (or with an image file) will "
KMessageBox::sorry(this, i18nc("@info", "destroy all data on this target partition.</para>"
"<para>The target partition is bigger than the source allows.</para>" "<para>If you continue now and apply the resulting operation in the main "
"<para>You are trying to paste a %2 partition onto an existing partition " "window, all data currently stored on <filename>%1</filename> will "
"that is bigger than %1, the maximum capacity of a %2 file system.</para>", "unrecoverably be overwritten.</para>",
Capacity(insertedPartition.fileSystem().maxCapacity()).toString(Capacity::AppendUnit), selectedPartition()->deviceNode()),
insertedPartition.fileSystem().name() i18nc("@title:window", "Really Overwrite Existing Partition?"),
), KGuiItem(i18nc("@action:button", "Overwrite Partition"), "arrow-right"),
i18nc("@title:window", "Target Partition Too Big")); KStandardGuiItem::cancel(),
return false; "reallyOverwriteExistingPartition") == KMessageBox::Cancel)
} return false;
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 (insertedPartition.length() < sourceLength) if (insertedPartition.length() < sourceLength)
{ {

View File

@ -318,5 +318,8 @@ bool CopyOperation::canPaste(const Partition* p, const Partition* source)
if (source->length() > p->length()) if (source->length() > p->length())
return false; return false;
if (!p->roles().has(PartitionRole::Unallocated) && p->capacity() > source->fileSystem().maxCapacity())
return false;
return true; return true;
} }