Author: aschnell Date: Tue Feb 3 16:06:37 2009 New Revision: 55210 URL: http://svn.opensuse.org/viewcvs/yast?rev=55210&view=rev Log: - select 'previous' device in tables after deleting devices (bnc #465138) Modified: trunk/storage/VERSION trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/ep-hd-lib.ycp trunk/storage/storage/src/include/ep-hd.ycp trunk/storage/storage/src/include/ep-lib.ycp trunk/storage/storage/src/include/ep-lvm-lib.ycp trunk/storage/storage/src/include/ep-lvm.ycp trunk/storage/storage/src/modules/Storage.ycp Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=55210&r1=... ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Tue Feb 3 16:06:37 2009 @@ -1 +1 @@ -2.18.3 +2.18.4 Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.cha... ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Tue Feb 3 16:06:37 2009 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue Feb 03 16:05:21 CET 2009 - aschnell@suse.de + +- select 'previous' device in tables after deleting devices (bnc + #465138) +- 2.18.4 + +------------------------------------------------------------------- Thu Jan 29 15:22:35 CET 2009 - aschnell@suse.de - changed method to disable automounter (since "overnight" GNOME Modified: trunk/storage/storage/src/include/ep-hd-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd... ============================================================================== --- trunk/storage/storage/src/include/ep-hd-lib.ycp (original) +++ trunk/storage/storage/src/include/ep-hd-lib.ycp Tue Feb 3 16:06:37 2009 @@ -158,7 +158,7 @@ if (size(ret) == 0) { // error popup - Popup::Error(sformat(_("It is not possible to create a partition on %1."), + Popup::Error(sformat(_("It is not possible to create a partition on %1."), disk_device)); } @@ -311,7 +311,7 @@ } - void EpDeletePartition(string device) + void EpDeletePartition(string device, symbol context) { if (device == nil) { @@ -321,12 +321,26 @@ } string parent = ParentDevice(device); + string next = NextDeviceAfterDelete(device); if (EpDeleteDevice(device)) { UpdateMainStatus(); - UpdateNavigationTree(parent); - TreePanel::Create(); + + switch (context) + { + case `table: + UpdateNavigationTree(nil); + TreePanel::Create(); + if (!isempty(next)) + UI::ChangeWidget(`id(`table), `CurrentItem, next); + break; + + case `overview: + UpdateNavigationTree(parent); + TreePanel::Create(); + break; + } } } Modified: trunk/storage/storage/src/include/ep-hd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd... ============================================================================== --- trunk/storage/storage/src/include/ep-hd.ycp (original) +++ trunk/storage/storage/src/include/ep-hd.ycp Tue Feb 3 16:06:37 2009 @@ -344,7 +344,7 @@ break; case `delete: - EpDeletePartition(part_device); + EpDeletePartition(part_device, `table); break; case `create_partition_table: @@ -489,7 +489,7 @@ break; case `delete: - EpDeletePartition(part_device); + EpDeletePartition(part_device, `overview); break; } UI::SetFocus(`id(`text)); Modified: trunk/storage/storage/src/include/ep-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-li... ============================================================================== --- trunk/storage/storage/src/include/ep-lib.ycp (original) +++ trunk/storage/storage/src/include/ep-lib.ycp Tue Feb 3 16:06:37 2009 @@ -20,6 +20,9 @@ } + /** + * Must be called before removing device. + */ string ParentDevice(string device) { map<string, map> target_map = Storage::GetTargetMap(); @@ -42,6 +45,36 @@ } + /** + * Must be called before removing device. + */ + string NextDeviceAfterDelete(string device) + { + map<string, map> target_map = Storage::GetTargetMap(); + + string parent = ParentDevice(device); + + list<string> partitions = maplist(map part, target_map[parent, "partitions"]:[], { + return part["device"]:""; + }); + + integer index = -1; + foreach(integer i, Integer::Range(size(partitions)), { + if (partitions[i]:"" == device) + index = i; + }); + + string ret = ""; + if (index > 0) + ret = partitions[index - 1]:""; + else if (size(partitions) > 1) + ret = partitions[1]:""; + + y2milestone("NextDeviceAfterDelete device:%1 ret:%2", device, ret); + return ret; + } + + boolean EpDeleteDevice(string id) { map<string,map> tg = Storage::GetTargetMap(); Modified: trunk/storage/storage/src/include/ep-lvm-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lv... ============================================================================== --- trunk/storage/storage/src/include/ep-lvm-lib.ycp (original) +++ trunk/storage/storage/src/include/ep-lvm-lib.ycp Tue Feb 3 16:06:37 2009 @@ -143,7 +143,7 @@ //how many of those we have? integer count = size(log_volumes); - boolean proceed = (count > 0) ? + boolean proceed = (count > 0) ? //non-empty VG - make sure user wants to delete all LVs ConfirmVgDelete(vgname, log_volumes) : //empty VG - simple @@ -272,7 +272,7 @@ } - void EpDeleteLogicalVolume(string device) + void EpDeleteLogicalVolume(string device, symbol context) { if (device == nil) { @@ -282,12 +282,26 @@ } string parent = ParentDevice(device); + string next = NextDeviceAfterDelete(device); if (EpDeleteDevice(device)) { UpdateMainStatus(); - UpdateNavigationTree(parent); - TreePanel::Create(); + + switch (context) + { + case `table: + UpdateNavigationTree(nil); + TreePanel::Create(); + if (!isempty(next)) + UI::ChangeWidget(`id(`table), `CurrentItem, next); + break; + + case `overview: + UpdateNavigationTree(parent); + TreePanel::Create(); + break; + } } } } Modified: trunk/storage/storage/src/include/ep-lvm.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lv... ============================================================================== --- trunk/storage/storage/src/include/ep-lvm.ycp (original) +++ trunk/storage/storage/src/include/ep-lvm.ycp Tue Feb 3 16:06:37 2009 @@ -177,7 +177,7 @@ break; case `delete: - EpDeleteLogicalVolume(lv_device); + EpDeleteLogicalVolume(lv_device, `table); break; } UI::SetFocus(`id(`table)); @@ -305,7 +305,7 @@ break; case `delete: - EpDeleteLogicalVolume(device); + EpDeleteLogicalVolume(device, `overview); break; } } Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Stora... ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Tue Feb 3 16:06:37 2009 @@ -4127,26 +4127,6 @@ return mountPoints; } -global define string -GetIdSmaller( string disk, integer delim ) - ``{ - string ret = disk; - map<string,map> tg = GetTargetMap(); - if( haskey( tg[disk,"partitions",0]:$[], "nr" )) - { - list<map> ps = filter( map p, tg[disk,"partitions"]:[], ``(p["nr"]:0<delim)); - if( size(ps)>1 ) - ps = sort( map a, map b, ps, ``(a["nr"]:0>b["nr"]:0)); - if( size(ps)>0 ) - ret = ps[0,"device"]:""; - } - else - ret = tg[disk,"partitions",0,"device"]:disk; - y2milestone( "GetIdSmaller disk:%1 delim:%2 ret:%3", - disk, delim, ret ); - return( ret ); - } - /** * Set <key> in partition <device> to the given <value> and return changed map <tg> -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org