Author: aschnell Date: Mon Jun 21 16:57:45 2010 New Revision: 62131 URL: http://svn.opensuse.org/viewcvs/yast?rev=62131&view=rev Log: - avoid unreadable buttons (bnc #615377) Modified: trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/ep-hd.ycp trunk/storage/storage/src/include/ep-lib.ycp Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=62131&r1=62130&r2=62131&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Mon Jun 21 16:57:45 2010 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Mon Jun 21 16:42:34 CEST 2010 - aschnell@suse.de + +- avoid unreadable buttons (bnc #615377) + +------------------------------------------------------------------- Mon May 17 18:54:36 CEST 2010 - fehr@suse.de - prevent asking for crypt password even when nothing has been Modified: trunk/storage/storage/src/include/ep-hd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-hd.ycp?rev=62131&r1=62130&r2=62131&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-hd.ycp (original) +++ trunk/storage/storage/src/include/ep-hd.ycp Mon Jun 21 16:57:45 2010 @@ -59,9 +59,9 @@ } - term HdButtonBox() + list<term> HdButtons() { - return `HBox( + return [ // push button text `PushButton(`id(`edit),`opt(`key_F4), _("Edit...")), // push button text @@ -70,7 +70,7 @@ `PushButton(`id(`resize), `opt(`key_F6), _("Resize...")), // push button text `PushButton(`id(`delete), `opt(`key_F5), _("Delete...")) - ); + ]; } @@ -159,12 +159,12 @@ `IconAndHeading(_("Hard Disks"), StorageIcons::hd_icon), `Table(`id(`table), `opt(`keepSorting, `notify, `notifyContextMenu), table_header, table_contents), - `HBox( - // push button text - `PushButton(`id(`add),`opt(`key_F3), _("Add Partition...")), - HdButtonBox(), - `HStretch() - ) + ArrangeButtons(flatten([ + [ // push button text + `PushButton(`id(`add),`opt(`key_F3), _("Add Partition...")) ], + HdButtons(), + [ `HStretch() ] + ])) ) ) ); @@ -317,13 +317,14 @@ `Table(`id(`table), `opt(`keepSorting, `notify, `notifyContextMenu), table_header, table_contents), `HBox( - // push button text - `PushButton(`id(`add),`opt(`key_F3), _("Add...")), - HdButtonBox(), - `HStretch(), - // menu button text - `MenuButton(`opt(`key_F7), _("Expert..."), expert_cmds) - ) + ArrangeButtons(flatten([ + [ // push button text + `PushButton(`id(`add),`opt(`key_F3), _("Add...")) ], + HdButtons(), + [ `HStretch(), + // menu button text + `MenuButton(`opt(`key_F7), _("Expert..."), expert_cmds)] + ]))) )); // helptext @@ -470,11 +471,11 @@ // heading `IconAndHeading(sformat(_("Partition: %1"), device), StorageIcons::hd_part_icon), StorageFields::Overview(fields, target_map, device), - `HBox( - HdButtonBox(), - `HStretch() - ) - ) + ArrangeButtons(flatten([ + HdButtons(), + [ `HStretch() ] + ])) + ) ) ); Modified: trunk/storage/storage/src/include/ep-lib.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-lib.ycp?rev=62131&r1=62130&r2=62131&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-lib.ycp (original) +++ trunk/storage/storage/src/include/ep-lib.ycp Mon Jun 21 16:57:45 2010 @@ -407,4 +407,55 @@ return part_summary + config_summary; } + + term ArrangeButtons(list<term> buttons) + { + // Unfortunately the UI does not provide functionality to rearrange + // buttons in two lines if the available space is limited. This + // implementation in YCP has several drawbacks, e.g. it does not know + // anything about the font size or the actually available space nor is + // it run when the dialog is resized. + + integer max_buttons = 6; + + if (Mode::installation()) + { + map display_info = UI::GetDisplayInfo(); + if (display_info["DefaultWidth"]:1024 <= 800) + max_buttons = 3; + } + + term ret = `VBox(); + + term line = `HBox(); + + integer i = 0; + integer j = 0; + + foreach(term button, buttons, { + + line = add(line, button); + i = i + 1; + + if (contains([ `PushButton, `MenuButton ], symbolof(button))) + { + j = j + 1; + + if (j == max_buttons) + { + if (i != size(buttons)) + line = add(line, `HStretch()); + + ret = add(ret, line); + line = `HBox(); + j = 0; + } + } + }); + + ret = add(ret, line); + + return ret; + } + } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org