Author: jsmeix Date: Wed May 26 19:05:11 2010 New Revision: 62068 URL: http://svn.opensuse.org/viewcvs/yast?rev=62068&view=rev Log: - In the driver options dialog replaced the awkward way in the DriverOptionItems function how the currently selected value was shown by a more clean way via plain text addendums which has the advantage that now both the current setting in the system and the currently selected value can be shown to the user (see Novell/Suse Bugzilla bnc#603182). - 2.19.12 Modified: trunk/printer/VERSION trunk/printer/package/yast2-printer.changes trunk/printer/src/Printer.ycp trunk/printer/src/driveroptions.ycp Modified: trunk/printer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=62068&r1=62067&r2=62068&view=diff ============================================================================== --- trunk/printer/VERSION (original) +++ trunk/printer/VERSION Wed May 26 19:05:11 2010 @@ -1 +1 @@ -2.19.11 +2.19.12 Modified: trunk/printer/package/yast2-printer.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=62068&r1=62067&r2=62068&view=diff ============================================================================== --- trunk/printer/package/yast2-printer.changes (original) +++ trunk/printer/package/yast2-printer.changes Wed May 26 19:05:11 2010 @@ -1,4 +1,15 @@ ------------------------------------------------------------------- +Wed May 26 18:57:01 CEST 2010 - jsmeix@suse.de + +- In the driver options dialog replaced the awkward way in the + DriverOptionItems function how the currently selected value + was shown by a more clean way via plain text addendums which has + the advantage that now both the current setting in the system + and the currently selected value can be shown to the user + (see Novell/Suse Bugzilla bnc#603182). +- 2.19.12 + +------------------------------------------------------------------- Wed May 19 13:46:43 CEST 2010 - jsmeix@suse.de - Added 'Settings;System' to the Categories in printer.desktop Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=62068&r1=62067&r2=62068&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Wed May 26 19:05:11 2010 @@ -2090,6 +2090,16 @@ return [ _("No driver options available") ]; } } + // Info for a currently selected item: + string currently_selected_info = _("currently selected"); + // Info for the current setting of the print queue: + string current_setting_info = _("current setting of the print queue"); + // It seems to be impossible to preselect the currently selected item in a Tree widget. + // In particular `item( value, true) does not preselect it. + // Therefore an info string is appended to the option value string to mark the currently selected item. + // This addendum is separated by a space and removed in driveroptions.ycp + // because spaces in main keywords or option keywords violate the PPD specification + // so that the first word in such a string can be split as the option value keyword. list driver_options_tree_items_list = []; integer driver_options_index = -1; integer pagesize_option_index = -1; @@ -2112,12 +2122,23 @@ && size( driver_option["values"]:[] ) > 1 && "PageRegion" != keyword ) - { if( "PageSize" == keyword ) + { // Remember the index for the PageSize option to move it topmost at the end: + if( "PageSize" == keyword ) { pagesize_option_index = driver_options_index; } + // Have the value list opened for the currently selected keyword: if( selected_keyword == keyword ) { opened = true; + // If the user had selected a value for this keyword + // store it so that if is know for subsequent DriverOptionItems calls: + if( "" != selected_value ) + { driver_options[driver_options_index] = add( driver_options[driver_options_index]:$[], + "selected", + selected_value + ); + } } + string currently_selected_value = driver_options[driver_options_index,"selected"]:""; string option_name = keyword; if( "" != driver_option["translation"]:"" ) { option_name = option_name + " / " + driver_option["translation"]:""; @@ -2135,54 +2156,29 @@ // Do not show the leading '*' to the user: value = substring( value, 1 ); current_value_setting = value; - } - if( selected_keyword == keyword - && selected_value == value - ) - { // Dummy info for a currently selected item: - string dummy_info = _("currently selected"); - if( current_value_setting == value ) - { // Info when a currently selected item is already set: - dummy_info = _("current setting of the print queue"); - } - // It seems to be impossible to preselect the currently selected item. - // In particular `item( value, true) does not preselect it. - // Therefore a dirty hack is used to mark the currently selected item - // only by means of the user interface because changing the content - // of the string value (e.g. like ">> value <<") is even more evil - // because then the content is no longer a valid option value keyword. - // Therefore a dummy item list is added (an empty list doesn't work) - // which lets the user interface show a '+' before the value - // but because the added item list is meaningless we keep it closed: - value_items_list = add( value_items_list, `item( value, false, [ dummy_info ] ) ); + value = value + " (" + current_setting_info + ")"; } else - { value_items_list = add( value_items_list, `item( value ) ); + { if( currently_selected_value == value ) + { value = value + " (" + currently_selected_info + ")"; + } } + value_items_list = add( value_items_list, `item( value ) ); } } ); - // Have the value list opened for the currently selected keyword: - if( selected_keyword == keyword ) - { opened = true; - // If the user had selected another value for this keyword - // store it so that if is know for subsequent DriverOptionItems calls: - if( "" != selected_value ) - { driver_options[driver_options_index] = add( driver_options[driver_options_index]:$[], - "selected", - selected_value - ); - } - } - // Override the current_value_setting if the user has selected another value: - if( "" != driver_options[driver_options_index,"selected"]:"" ) - { current_value_setting = driver_options[driver_options_index,"selected"]:""; - } - if( "" != current_value_setting ) - { // Show the currently set value at the tree item name of the particular option + + if( "" != currently_selected_value ) + { // Show a currently selected value at the tree item name of the particular option // so that the user can see it even when the respective tree item is not opened. // By default the option items are not opened to provide a concise overview: - option_name = option_name + " : " + current_value_setting; + option_name = option_name + " : " + currently_selected_value; + } + else + { // Otherwise show the current value setting: + if( "" != current_value_setting ) + { option_name = option_name + " : " + current_value_setting; + } } driver_options_tree_items_list = add( driver_options_tree_items_list, `item( `id( keyword ), Modified: trunk/printer/src/driveroptions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/driveroptions.ycp?rev=62068&r1=62067&r2=62068&view=diff ============================================================================== --- trunk/printer/src/driveroptions.ycp (original) +++ trunk/printer/src/driveroptions.ycp Wed May 26 19:05:11 2010 @@ -136,10 +136,14 @@ y2milestone( "Selected driver options tree branch: %1", selected_branch ); // The selected branch list has // either one elemet which is the main keyword when an option is selected e.g. ["PageSize"] - // or it has two elements: main keyword and option value keyword e.g. ["PageSize", "A4"] + // or it has two elements: main keyword and option value e.g. ["PageSize", "A4 (currently selected)"] + // where only the first word in the option value string is the option value keyword + // (spaces in main keywords or option keywords violate the PPD specification). + string selected_main_keyword = selected_branch[0]:""; + string selected_option_value_keyword = splitstring( selected_branch[1]:"", " " )[0]:""; if( 2 == size( selected_branch ) ) - { if( "" != selected_branch[0]:"" - && "" != selected_branch[1]:"" + { if( "" != selected_main_keyword + && "" != selected_option_value_keyword ) { // Sleep a tenth of a second to let the user notice when he selected a value // before the tree is re-built via the UI::ChangeWidget below: @@ -149,7 +153,7 @@ // (in particular when the changes are committed when the dialog finishes): UI::ChangeWidget( `driver_options_tree, `Items, - Printer::DriverOptionItems( selected_branch[0]:"", selected_branch[1]:"" ) + Printer::DriverOptionItems( selected_main_keyword, selected_option_value_keyword ) ); } } @@ -160,7 +164,7 @@ // Open the matching values list in the tree when the option is selected: UI::ChangeWidget( `driver_options_tree, `Items, - Printer::DriverOptionItems( selected_branch[0]:"", "" ) + Printer::DriverOptionItems( selected_main_keyword, "" ) ); } continue; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org