Author: kmachalkova Date: Tue Apr 21 13:42:01 2009 New Revision: 56876 URL: http://svn.opensuse.org/viewcvs/yast?rev=56876&view=rev Log: Function buttons for loops Modified: trunk/storage/storage/src/include/ep-loop.ycp Modified: trunk/storage/storage/src/include/ep-loop.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/ep-loop.ycp?rev=56876&r1=56875&r2=56876&view=diff ============================================================================== --- trunk/storage/storage/src/include/ep-loop.ycp (original) +++ trunk/storage/storage/src/include/ep-loop.ycp Tue Apr 21 13:42:01 2009 @@ -12,6 +12,33 @@ include "partitioning/ep-loop-dialogs.ycp"; include "partitioning/ep-loop-lib.ycp"; + term LoopButtonBox() + { + return `HBox( + // push button text + `PushButton(`id(`edit), `opt(`key_F4), _("Edit...")), + // push button text + `PushButton(`id(`delete), `opt(`key_F5), _("Delete...")) + ); + } + + void HandleLoopButtons( string part_device, map event ) + { + switch (Event::IsWidgetActivated(event)) + { + case `add: + EpCreateLoop(); + break; + + case `edit: + EpEditLoop(part_device); + break; + + case `delete: + EpDeleteLoop(part_device); + break; + } + } void CreateLoopMainPanel(any user_data) { @@ -37,7 +64,8 @@ table_header, table_contents), `HBox( // push button text - `Left(`PushButton(`id(`add), `opt(`key_F3), _("Add Crypt File..."))), + `PushButton(`id(`add), `opt(`key_F3), _("Add Crypt File...")), + LoopButtonBox(), `HStretch() ) ) @@ -53,12 +81,10 @@ void HandleLoopMainPanel(any user_data, map event) { - switch (Event::IsWidgetActivated(event)) - { - case `add: - EpCreateLoop(); - break; - } + string device = (string) UI::QueryWidget(`id(`table), `CurrentItem); + + HandleLoopButtons(device, event); + UI::SetFocus(`id(`table)); } @@ -80,10 +106,7 @@ `HStretch(), StorageFields::Overview(fields, target_map, part_device), `HBox( - // push button text - `PushButton(`id(`edit), `opt(`key_F4), _("Edit...")), - // push button text - `PushButton(`id(`delete), `opt(`key_F5), _("Delete...")), + LoopButtonBox(), `HStretch() ) )) @@ -101,16 +124,7 @@ { string part_device = (string) user_data; - switch (Event::IsWidgetActivated(event)) - { - case `edit: - EpEditLoop(part_device); - break; - - case `delete: - EpDeleteLoop(part_device); - break; - } + HandleLoopButtons( part_device, event ); UI::SetFocus(`id(`text)); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org