Author: kmachalkova Date: Mon Jan 26 18:28:37 2009 New Revision: 55055 URL: http://svn.opensuse.org/viewcvs/yast?rev=55055&view=rev Log: On deleting disk device, ask user whether to delete related partitions (if there are some) Modified: trunk/storage/storage/src/include/ep-hd-dialogs.ycp trunk/storage/storage/src/include/ep-hd-lib.ycp Modified: trunk/storage/storage/src/include/ep-hd-dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd-dialogs.ycp?rev=55055&r1=55054&r2=55055&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-hd-dialogs.ycp (original) +++ trunk/storage/storage/src/include/ep-hd-dialogs.ycp Mon Jan 26 18:28:37 2009 @@ -330,4 +330,14 @@ { return DlgResize(data, disk); } + + boolean ConfirmPartitionsDelete( string disk, list<string> pnames ) + { + return ConfirmRecursiveDelete( disk, pnames, + _("Confirm Deleting of All Partitions"), + sformat(_("The disk \"%1\" contains at least one partition. +If you proceed, the following partitions will be deleted:"), disk), + sformat(_("Really delete all partitions on \"%1\"?"), disk) + ); + } } Modified: trunk/storage/storage/src/include/ep-hd-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd-lib.ycp?rev=55055&r1=55054&r2=55055&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-hd-lib.ycp (original) +++ trunk/storage/storage/src/include/ep-hd-lib.ycp Mon Jan 26 18:28:37 2009 @@ -104,8 +104,27 @@ } else { - // error popup - Popup::Error(_("The disk cannot be deleted.")); + list<map> parts = target_map[device, "partitions"]:[]; + //partition names + list<string> pnames = maplist(map part, parts, { return part["device"]:""; }); + integer count = size(pnames); + + if(count == 0) + { + // error ppup + Popup::Error(_("There are no partitions to delete on this disk.")); + return; + } + + else + { + if ( ConfirmPartitionsDelete( device, pnames) && deleteAllDevPartitions(disk, Stage::initial(), false)) + { + UpdateMainStatus(); + UpdateNavigationTree(`hd); + TreePanel::Create(); + } + } } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org