[yast-commit] r63223 - in /trunk/printer: ./ package/ src/
Author: jsmeix Date: Wed Jan 19 14:40:55 2011 New Revision: 63223 URL: http://svn.opensuse.org/viewcvs/yast?rev=63223&view=rev Log: - Rework the "Autoconfig Settings" dialog and drop the support for cups-autoconfig which is no longer available since openSUSE 11.2 (see Novell/openSUSE Bugzilla bnc#665445). - Avoid leftover buttons with WidgetID "`abort" when other YaST modules have been run from yast2-printer. E.g. when the YaST package installer is run via Package::Install(package_name) it leaves a misused "abort" button which is labeled "Skip Autorefresh". Clicking this leftover button in yast2-printer would cause a sudden abort of the whole yast2-printer module. - 2.20.5 Modified: trunk/printer/VERSION trunk/printer/package/yast2-printer.changes trunk/printer/src/Printer.ycp trunk/printer/src/autoconfig.ycp trunk/printer/src/connectionwizard.ycp trunk/printer/src/driveradd.ycp trunk/printer/src/helps.ycp trunk/printer/src/policies.ycp trunk/printer/src/printingvianetwork.ycp trunk/printer/src/sharing.ycp Modified: trunk/printer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/VERSION (original) +++ trunk/printer/VERSION Wed Jan 19 14:40:55 2011 @@ -1 +1 @@ -2.20.4 +2.20.5 Modified: trunk/printer/package/yast2-printer.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/package/yast2-printer.changes (original) +++ trunk/printer/package/yast2-printer.changes Wed Jan 19 14:40:55 2011 @@ -1,4 +1,19 @@ ------------------------------------------------------------------- +Wed Jan 19 13:28:09 CET 2011 - jsmeix@suse.de + +- Rework the "Autoconfig Settings" dialog and drop the support for + cups-autoconfig which is no longer available since openSUSE 11.2 + (see Novell/openSUSE Bugzilla bnc#665445). +- Avoid leftover buttons with WidgetID "`abort" when + other YaST modules have been run from yast2-printer. + E.g. when the YaST package installer is run via + Package::Install(package_name) it leaves a misused + "abort" button which is labeled "Skip Autorefresh". + Clicking this leftover button in yast2-printer would + cause a sudden abort of the whole yast2-printer module. +- 2.20.5 + +------------------------------------------------------------------- Tue Jan 11 16:44:44 CET 2011 - jsmeix@suse.de - Added support for samba-krb-printing to set up printing Modified: trunk/printer/src/Printer.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/Printer.ycp (original) +++ trunk/printer/src/Printer.ycp Wed Jan 19 14:40:55 2011 @@ -39,6 +39,7 @@ import "Summary"; import "Popup"; import "Printerlib"; +import "Wizard"; /** * Prototypes @@ -746,7 +747,12 @@ // for accessing remote CUPS servers via a "client-only" config. // Therefore abort (return false) if cups-client is not installed: if( ! Printerlib::TestAndInstallPackage( "cups-client", "install" ) ) - { return false; + { // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); + return false; } // The cups RPM ist the default requirement // for accessing remote CUPS servers via CUPS Browsing @@ -754,6 +760,11 @@ // Therefore try to install cups but because for a "client-only" config // only cups-client is required, proceed even if cups is not installed: Printerlib::TestAndInstallPackage( "cups", "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); // Progress last stage (progress finished): if( Abort() ) return false; Progress::NextStage(); Modified: trunk/printer/src/autoconfig.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/autoconfig.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/autoconfig.ycp (original) +++ trunk/printer/src/autoconfig.ycp Wed Jan 19 14:40:55 2011 @@ -33,122 +33,35 @@ import "Printerlib"; import "Popup"; +import "Wizard"; include "printer/helps.ycp"; -boolean udev_configure_printer_installed = false; -boolean cups_autoconfig_installed = false; -// By default the ConfigureNewPrinters value in /etc/cups-autoconfig.conf is set to "yes": -boolean initial_cups_autoconfig_ConfigureNewPrinters = true; -// By default the DisablePrintersOnRemoval value in /etc/cups-autoconfig.conf is set to "no": -boolean initial_cups_autoconfig_DisablePrintersOnRemoval = false; -// By default the DefaultCUPSPolicy value in /etc/cups-autoconfig.conf is set to the empty string: -string initial_cups_autoconfig_DefaultCUPSPolicy = ""; - term widgetAutoconfig = `VBox - ( `VStretch(), + ( // Have space between the top of the dialog and the content: + `VStretch(), `Left ( `Label ( `id("autoconfig_label"), // Header for a dialog section where the user can - // specify in which way USB printers are configured automatically: - _("Specify how USB printers are configured automatically") + // specify if USB printers are configured automatically: + _("Specify if USB printers are configured automatically") ) ), - // Have space between the header and the choices: - `VStretch(), `Left ( `CheckBox - ( // Use a CheckBox to remove cups-autoconfig and udev-configure-printer - // instead of a RadioButton because this would be the only RadioButton because - // there is no RadioButton to install cups-autoconfig or udev-configure-printer - // because initAutoconfig checks if cups-autoconfig or udev-configure-printer - // is installed and if not it tries to install one of them - // where udev-configure-printer is preferred (if available to be installed) - // because cups-autoconfig is deperecated, + ( // CheckBox to install or remove udev-configure-printer. + // Since openSUSE 11.2 cups-autoconfig is no longer available, // see https://bugzilla.novell.com/show_bug.cgi?id=526657 - `id("autoconfig_packages_remove"), + `id("udev_configure_printer_check_box"), `opt(`notify), - // CheckBox to have no automatic configuration of USB printers at all - // by removing the RPM packages cups-autoconfig and udev-configure-printer. - // Do not change or translate "cups-autoconfig", it is a RPM package name. + // CheckBox for automatic configuration of USB printers + // by installing or removing the RPM package udev-configure-printer. // Do not change or translate "udev-configure-printer", it is a RPM package name. - _("No Automatic Configuration\n&Remove the packages cups-autoconfig and udev-configure-printer.") + _("Use the package udev-configure-printer for automated USB printer configuration") ) ), - // Have space between the choice "No Automatic Configuration at all" - // and the settings when automatic configuration is used: - `VStretch(), - `Left - ( `Frame - ( `id("udev_configure_printer_frame"), - // A caption for a Frame when udev-configure-printer is used - // to configure USB printers automatically. - // Do not change or translate "udev-configure-printer", it is a RPM package name. - _("udev-configure-printer is used for automatic configuration"), - `Label - ( `id("udev_configure_printer_label"), - // Label when udev-configure-printer is used to configure USB printers automatically. - // Do not change or translate "udev-configure-printer", it is a RPM package name. - _("There are no settings when udev-configure-printer is used.") - ) - ) - ), - // Have space between the case when udev-configure-printer is used - // and the frame with settings only for cups-autoconfig: - `VStretch(), - `Frame - ( `id("cups_autoconfig_frame"), - // A caption for a Frame with settings only for cups-autoconfig - // when cups-autoconfig is used to configure USB printers automatically. - // Do not change or translate "cups-autoconfig", it is a RPM package name. - _("Settings for automatic configuration with cups-autoconfig"), - `VBox - ( `Left - ( `CheckBox - ( `id("cups_autoconfig_configure_new_attached"), - `opt(`notify), - // CheckBox to enable that a print queue is automatically created - // when a USB printer is connected for the first time to the USB: - _("Enable &Automatic Configuration of New Attachend USB Printers") - ) - ), - `HBox - ( `HSpacing( 4 ), - `Left - ( `ComboBox - ( `id("cups_autoconfig_operation_policy"), - // Header for a ComboBox to specify the CUPS operation policy - // for print queues which are automatically created - // when a USB printer is connected for the first time to the USB: - _("Operation &Policy for Automatically Configured USB Printers"), - [""] - ) - ) - ), - `Left - ( `CheckBox - ( `id("cups_autoconfig_disable_on_removal"), - // CheckBox to disable the print queue - // when a USB printer is disconnected from the USB: - _("&Disable Printout when Disconnecting an USB Printer") - ) - ), - // Have space between the settings for automatic configuration - // and the choice to "Trigger Automatic Configuration": - `VSpacing( 1 ), - `Left - ( `CheckBox - ( `id("cups_autoconfig_trigger"), - `opt(`notify), - // CheckBox to trigger that print queues are automatically created right now: - _("&Trigger Automatic Configuration to Run Now") - ) - ) - ) - ), - // Have space between the frame with settings only for cups-autoconfig - // and the bottom of the dialog: + // Have space between the content and the bottom of the dialog: `VStretch() ); @@ -183,7 +96,7 @@ Printerlib::result["stderr"]:"" + "\n" + Printerlib::result["stdout"]:"" ); autoconfig_settings_dialog_is_useless = true; - y2milestone( "putoconfig_settings_dialog_is_useless because it failed to disable client-only CUPS server '%1'", + y2milestone( "autoconfig_settings_dialog_is_useless because it failed to disable client-only CUPS server '%1'", Printerlib::client_conf_server_name ); } @@ -200,300 +113,87 @@ } } } - // When it is no "client-only" config and when a local cupsd is accessible, - // the whole dialog is still useless without having - // either cups-autoconfig or udev-configure-printer installed. - // Therefore check if cups-autoconfig or udev-configure-printer is installed - // and if not try to install one of them where udev-configure-printer is preferred - // because cups-autoconfig is deprecated, see https://bugzilla.novell.com/show_bug.cgi?id=526657 - // It is perfectly o.k. when the user rejects cups-autoconfig or udev-configure-printer - // to be installed (perhaps he selected it to be removed before in this dialog - // and re-launched this dialog by accident or to check the current setting). - // Therefore there is no additional message shown here when the dialog is useless - // because there was a Popup request that cups-autoconfig or udev-configure-printer must be installed. - if( ! autoconfig_settings_dialog_is_useless ) - { if( ! ( Printerlib::TestAndInstallPackage( "udev-configure-printer", "installed" ) - || Printerlib::TestAndInstallPackage( "cups-autoconfig", "installed" ) - ) - ) - { Printerlib::TestAndInstallPackage( "udev-configure-printer", "install" ); - if( ! Printerlib::TestAndInstallPackage( "udev-configure-printer", "installed" ) ) - { Printerlib::TestAndInstallPackage( "cups-autoconfig", "install" ); - } - } - } - // Determine if cups-autoconfig or udev-configure-printer is now finally installed. - // It does not make much sense to have both installed but this is no error. - // In contrast, if none of them is installed, the whole dialog is useless: - udev_configure_printer_installed = Printerlib::TestAndInstallPackage( "udev-configure-printer", "installed" ); - cups_autoconfig_installed = Printerlib::TestAndInstallPackage( "cups-autoconfig", "installed" ); - if( ! ( udev_configure_printer_installed - || cups_autoconfig_installed - ) - ) - { autoconfig_settings_dialog_is_useless = true; - } - // In any case have the CheckBox to remove the cups-autoconfig RPM package initially not activated. - // If it was activated if autoconfig_settings_dialog_is_useless, it would remove the RPM - // even when this CheckBox is disabled because autoconfig_settings_dialog_is_useless: - UI::ChangeWidget( `id("autoconfig_packages_remove"), `Value, false ); - if( ! udev_configure_printer_installed ) - { // Disable all widgets for udev-configure-printer if udev-configure-printer is not installed: - UI::ChangeWidget( `id("udev_configure_printer_frame"), `Enabled, false ); - UI::ChangeWidget( `id("udev_configure_printer_label"), `Enabled, false ); - } - if( ! cups_autoconfig_installed ) - { // Disable all widgets for cups-autoconfig if cups-autoconfig is not installed: - UI::ChangeWidget( `id("cups_autoconfig_frame"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_configure_new_attached"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_disable_on_removal"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_operation_policy"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_trigger"), `Enabled, false ); + // Determine if udev-configure-printer is installed. + boolean udev_configure_printer_installed = Printerlib::TestAndInstallPackage( "udev-configure-printer", "installed" ); + // Avoid a flickering change of the udev_configure_printer_check_box value + // by explicite if...else statements which do only one single UI::ChangeWidget + // instead of a blind default setting which is changed afterwards: + if( udev_configure_printer_installed ) + { UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Value, true ); } else - { // Read cups-autoconfig settings. - // Ignore errors when the bash commands fail because the default values are used as - // fallback values in particular when the cups-autoconfig RPM is not installed. - // By default the ConfigureNewPrinters value in /etc/cups-autoconfig.conf is set to "yes": - initial_cups_autoconfig_ConfigureNewPrinters = true; - Printerlib::ExecuteBashCommand( "grep -i '^[[:space:]]*ConfigureNewPrinters' /etc/cups-autoconfig.conf | cut -s -d '=' -f2 | tr -d -c '[:alnum:]'" ); - if( "no" == tolower( Printerlib::result["stdout"]:"yes" ) ) - { initial_cups_autoconfig_ConfigureNewPrinters = false; - } - // By default the DisablePrintersOnRemoval value in /etc/cups-autoconfig.conf is set to "no": - initial_cups_autoconfig_DisablePrintersOnRemoval = false; - Printerlib::ExecuteBashCommand( "grep -i '^[[:space:]]*DisablePrintersOnRemoval' /etc/cups-autoconfig.conf | cut -s -d '=' -f2 | tr -d -c '[:alnum:]'" ); - if( "yes" == tolower( Printerlib::result["stdout"]:"no" ) ) - { initial_cups_autoconfig_DisablePrintersOnRemoval = true; - } - // By default the DefaultCUPSPolicy value in /etc/cups-autoconfig.conf is set to the empty string: - Printerlib::ExecuteBashCommand( "grep -i '^[[:space:]]*DefaultCUPSPolicy' /etc/cups-autoconfig.conf | cut -s -d '=' -f2 | tr -d -c '[:alnum:]'" ); - initial_cups_autoconfig_DefaultCUPSPolicy = tolower( Printerlib::result["stdout"]:"" ); - // By default the DefaultCUPSPolicy value in /etc/cups-autoconfig.conf is set to the empty string. - // Therefore an empty policy name could be added as additional possible value - // but an empty policy name would be meningless for the user - // so that the more verbose string "not set" is used for this case. - // Therefore "not set" in the cups_autoconfig_operation_policy ComboBox means actually - // an empty value for DefaultCUPSPolicy in /etc/cups-autoconfig.conf which - // means to use the DefaultPolicy value in /etc/cups/cupsd.conf also for cups_autoconfig. - if( "" == initial_cups_autoconfig_DefaultCUPSPolicy ) - { initial_cups_autoconfig_DefaultCUPSPolicy = _("not set"); - } - // Set the different values for the different widgets in the dialog - // and use the default values as fallback values: - UI::ChangeWidget( `id("cups_autoconfig_configure_new_attached"), `Value, initial_cups_autoconfig_ConfigureNewPrinters ); - UI::ChangeWidget( `id("cups_autoconfig_disable_on_removal"), `Value, initial_cups_autoconfig_DisablePrintersOnRemoval ); - // Determine the existing policy names in '<Policy policy-name>' sections in /etc/cups/cupsd.conf: - list< string > operation_policy_names = [ "" ]; - if( Printerlib::ExecuteBashCommand( Printerlib::yast_bin_dir + "modify_cupsd_conf Policies" ) ) - { // The command outputs a line where multiple policy names are separated by space - // but possible duplicate policy names are not removed in the command output: - operation_policy_names = toset( splitstring( Printerlib::result["stdout"]:"", " " ) ); - } - else - { // Use fallback value when the command above failed. - operation_policy_names = [ "default" ]; - } - // Add the special case "not set" (see above) to the available operation_policy_names: - operation_policy_names = prepend( operation_policy_names, _("not set") ); - // Use only the plain strings in the operation_policy_names list without an id - // for the operation_policy ComboBox: - UI::ChangeWidget( `id("cups_autoconfig_operation_policy"), `Items, operation_policy_names ); - // Have the initial_cups_autoconfig_DefaultCUPSPolicy preselected - // if it is available in operation_policy_names - // otherwise have the special value "not set" preselected: - if( contains( operation_policy_names, initial_cups_autoconfig_DefaultCUPSPolicy ) ) - { UI::ChangeWidget( `id("cups_autoconfig_operation_policy"), `Value, initial_cups_autoconfig_DefaultCUPSPolicy ); - } - else - { UI::ChangeWidget( `id("cups_autoconfig_operation_policy"), `Value, _("not set") ); - } - // The CheckBox to trigger automatic configuration is initially always off: - UI::ChangeWidget( `id("cups_autoconfig_trigger"), `Value, false ); + { UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Value, false ); } // Disable all widgets in the whole dialog if autoconfig_settings_dialog_is_useless: if( autoconfig_settings_dialog_is_useless ) { UI::ChangeWidget( `id("autoconfig_label"), `Enabled, false ); - UI::ChangeWidget( `id("autoconfig_packages_remove"), `Enabled, false ); - UI::ChangeWidget( `id("udev_configure_printer_frame"), `Enabled, false ); - UI::ChangeWidget( `id("udev_configure_printer_label"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_frame"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_configure_new_attached"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_disable_on_removal"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_operation_policy"), `Enabled, false ); - UI::ChangeWidget( `id("cups_autoconfig_trigger"), `Enabled, false ); + UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Enabled, false ); } - y2milestone( "leaving initAutoconfig with\ninitial_cups_autoconfig_ConfigureNewPrinters = '%1'\ninitial_cups_autoconfig_DisablePrintersOnRemoval = '%2'\ninitial_cups_autoconfig_DefaultCUPSPolicy = '%3'", initial_cups_autoconfig_ConfigureNewPrinters, initial_cups_autoconfig_DisablePrintersOnRemoval, initial_cups_autoconfig_DefaultCUPSPolicy ); + y2milestone( "leaving initAutoconfig with udev_configure_printer_installed = '%1'", udev_configure_printer_installed ); } boolean ApplyAutoconfigSettings() -{ // If the cups-autoconfig and udev-configure-printer RPMs should be removed. - // When one of them is currently installed, try to remove it - // and return in any case because nothing else matters in this case. - // Return even when the user decided to reject the removal because - // it would lead to unexpected results when cups-autoconfig settings - // may change in the system when the user decided to remove cups-autoconfig - // but rejects the removal (i.e. some kind of "cancel/abort" by the user) - // but settings were changed in the system nevertheless. - // It is crucial to test whether cups-autoconfig or udev-configure-printer - // is currently installed because it could have been not installed - // when the dialog was launched e.g. because the user - // may have rejected the installation in initAutoconfig - // so that the vaule of the "autoconfig_packages_remove" CheckBox would - // have been also set to 'true' in initAutoconfig. - if( (boolean)UI::QueryWidget( `id("autoconfig_packages_remove"), `Value ) ) - { if( Printerlib::TestAndInstallPackage( "cups-autoconfig", "installed" ) ) - { Printerlib::TestAndInstallPackage( "cups-autoconfig", "remove" ); +{ // string package_name = "udev-configure-printer"; + string package_name = "cups-autoconfig"; + if( (boolean)UI::QueryWidget( `id("udev_configure_printer_check_box"), `Value ) ) + { // udev-configure-printer should be installed if it is not yet installed: + if( ! Printerlib::TestAndInstallPackage( package_name, "installed" ) ) + { Printerlib::TestAndInstallPackage( package_name, "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); + } + if( ! Printerlib::TestAndInstallPackage( package_name, "installed" ) ) + { // Set the actually correct value for the udev_configure_printer_check_box + UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Value, false ); + Popup::Error( // Popup::Error message when the RPM package udev-configure-printer could not be installed: + _("Failed to install udev-configure-printer.") + ); + y2milestone( "ApplyAutoconfigSettings failed to install '%1'", package_name ); + return false; } - if( Printerlib::TestAndInstallPackage( "udev-configure-printer", "installed" ) ) - { Printerlib::TestAndInstallPackage( "udev-configure-printer", "remove" ); - } - y2milestone( "leaving storeAutoconfig" ); - //return `autoconfig_next; - return true; - } - boolean applied_autoconfig_settings = true; - // Get the actual settings and values from the dialog: - boolean current_cups_autoconfig_ConfigureNewPrinters = (boolean)UI::QueryWidget( `id("cups_autoconfig_configure_new_attached"), `Value ); - boolean current_cups_autoconfig_DisablePrintersOnRemoval = (boolean)UI::QueryWidget( `id("cups_autoconfig_disable_on_removal"), `Value ); - string current_cups_autoconfig_DefaultCUPSPolicy = (string)UI::QueryWidget( `id("cups_autoconfig_operation_policy"), `Value ); - y2milestone( "current_cups_autoconfig_ConfigureNewPrinters = '%1'\ncurrent_cups_autoconfig_DisablePrintersOnRemoval = '%2'\ncurrent_cups_autoconfig_DefaultCUPSPolicy = '%3'", current_cups_autoconfig_ConfigureNewPrinters, current_cups_autoconfig_DisablePrintersOnRemoval, current_cups_autoconfig_DefaultCUPSPolicy ); - boolean cups_autoconfig_triggered = (boolean)UI::QueryWidget( `id("cups_autoconfig_trigger"), `Value ); - if( current_cups_autoconfig_ConfigureNewPrinters == initial_cups_autoconfig_ConfigureNewPrinters - && current_cups_autoconfig_DisablePrintersOnRemoval == initial_cups_autoconfig_DisablePrintersOnRemoval - && current_cups_autoconfig_DefaultCUPSPolicy == initial_cups_autoconfig_DefaultCUPSPolicy - && ! cups_autoconfig_triggered - ) - { y2milestone( "Nothing changed in 'Autoconfig Settings' dialog." ); - y2milestone( "leaving storeAutoconfig" ); - return true; } - if( current_cups_autoconfig_ConfigureNewPrinters != initial_cups_autoconfig_ConfigureNewPrinters ) - { if( current_cups_autoconfig_ConfigureNewPrinters ) - { if( ! Printerlib::ExecuteBashCommand( "sed -i -e '/^[[:space:]]*ConfigureNewPrinters.*/Id' /etc/cups-autoconfig.conf && echo 'ConfigureNewPrinters=yes' >>/etc/cups-autoconfig.conf" ) ) - { Popup::ErrorDetails( // Popup::ErrorDetails message - // Do not change or translate "ConfigureNewPrinters=yes", it is a system settings name. - _("Failed to set 'ConfigureNewPrinters=yes' in /etc/cups-autoconfig.conf"), - Printerlib::result["stderr"]:"" - ); - applied_autoconfig_settings = false; - } - } - else - { if( ! Printerlib::ExecuteBashCommand( "sed -i -e '/^[[:space:]]*ConfigureNewPrinters.*/Id' /etc/cups-autoconfig.conf && echo 'ConfigureNewPrinters=no' >>/etc/cups-autoconfig.conf" ) ) - { Popup::ErrorDetails( // Popup::ErrorDetails message - // Do not change or translate "ConfigureNewPrinters=no", it is a system settings name. - _("Failed to set 'ConfigureNewPrinters=no' in /etc/cups-autoconfig.conf"), - Printerlib::result["stderr"]:"" - ); - applied_autoconfig_settings = false; - } - } - } - if( current_cups_autoconfig_DisablePrintersOnRemoval != initial_cups_autoconfig_DisablePrintersOnRemoval ) - { if( current_cups_autoconfig_DisablePrintersOnRemoval ) - { if( ! Printerlib::ExecuteBashCommand( "sed -i -e '/^[[:space:]]*DisablePrintersOnRemoval.*/Id' /etc/cups-autoconfig.conf && echo 'DisablePrintersOnRemoval=yes' >>/etc/cups-autoconfig.conf" ) ) - { Popup::ErrorDetails( // Popup::ErrorDetails message - // Do not change or translate "DisablePrintersOnRemoval=yes", it is a system settings name. - _("Failed to set 'DisablePrintersOnRemoval=yes' in /etc/cups-autoconfig.conf"), - Printerlib::result["stderr"]:"" - ); - applied_autoconfig_settings = false; - } - } - else - { if( ! Printerlib::ExecuteBashCommand( "sed -i -e '/^[[:space:]]*DisablePrintersOnRemoval.*/Id' /etc/cups-autoconfig.conf && echo 'DisablePrintersOnRemoval=no' >>/etc/cups-autoconfig.conf" ) ) - { Popup::ErrorDetails( // Popup::ErrorDetails message - // Do not change or translate "DisablePrintersOnRemoval=no", it is a system settings name. - _("Failed to set 'DisablePrintersOnRemoval=no' in /etc/cups-autoconfig.conf"), - Printerlib::result["stderr"]:"" - ); - applied_autoconfig_settings = false; - } - } - } - if( current_cups_autoconfig_DefaultCUPSPolicy != initial_cups_autoconfig_DefaultCUPSPolicy ) - { if( _("not set") == current_cups_autoconfig_DefaultCUPSPolicy ) - { // By default the DefaultCUPSPolicy value in /etc/cups-autoconfig.conf is set to the empty string. - // Such an empty string was replaced in initAutoconfig() by the more verbose string "not set". - // Now this verbose string is re-replaced by the empty string: - current_cups_autoconfig_DefaultCUPSPolicy = ""; - } - if( ! Printerlib::ExecuteBashCommand( "sed -i -e '/^[[:space:]]*DefaultCUPSPolicy.*/Id' /etc/cups-autoconfig.conf && echo 'DefaultCUPSPolicy=" + current_cups_autoconfig_DefaultCUPSPolicy + "' >>/etc/cups-autoconfig.conf" ) ) - { Popup::ErrorDetails( sformat( // Popup::ErrorDetails message - // where %1 will be replaced by the cups-autoconfig error policy value. - // Do not change or translate "DefaultCUPSPolicy", it is a system settings name. - _("Failed to set 'DefaultCUPSPolicy=%1' in /etc/cups-autoconfig.conf"), - current_cups_autoconfig_DefaultCUPSPolicy - ), - Printerlib::result["stderr"]:"" - ); - applied_autoconfig_settings = false; - } - } - if( applied_autoconfig_settings ) - { // After the autoconfig settings have been successfully applied, - // check if cups-autoconfig should run now: - if( cups_autoconfig_triggered ) - { // Depending on the architecture /usr/lib*/cups-autoconfig/cups-autoconfig could actually - // be /usr/lib/cups-autoconfig/cups-autoconfig (in SLE11 on i586, ia64, ppc, s390) - // or /usr/lib64/cups-autoconfig/cups-autoconfig (in SLE11 on ppc64, s390x, x86_64) - // or /usr/lib32/cups-autoconfig/cups-autoconfig (not in SLE11 but possible in a third-party package). - // If several /usr/lib*/cups-autoconfig/cups-autoconfig exist, simply the first one - // in the ls output which is /usr/lib/cups-autoconfig/cups-autoconfig is used here: - if( ! Printerlib::ExecuteBashCommand( "$( ls -1 /usr/lib*/cups-autoconfig/cups-autoconfig | head -n1 ) --add" ) ) - { Popup::ErrorDetails( // Popup::ErrorDetails message. - _("Automatic configuration failed."), - Printerlib::result["stderr"]:"" - ); - applied_autoconfig_settings = false; - } + else + { // udev-configure-printer should be removed if it is installed: + if( Printerlib::TestAndInstallPackage( package_name, "installed" ) ) + { Printerlib::TestAndInstallPackage( package_name, "remove" ); + } + if( Printerlib::TestAndInstallPackage( package_name, "installed" ) ) + { // Set the actually correct value for the udev_configure_printer_check_box + UI::ChangeWidget( `id("udev_configure_printer_check_box"), `Value, true ); + Popup::Error( // Popup::Error message when the RPM package udev-configure-printer could not be removed: + _("Failed to remove udev-configure-printer.") + ); + y2milestone( "ApplyAutoconfigSettings failed to remove '%1'", package_name ); + return false; } } - y2milestone( "leaving storeAutoconfig" ); - return applied_autoconfig_settings; + y2milestone( "leaving ApplyAutoconfigSettings successfully" ); + return true; } symbol handleAutoconfig( string key, map event ) { y2milestone( "entering handleAutoconfig with key '%1'\nand event '%2'", key, event ); if( "ValueChanged" == event["EventReason"]:"" ) - { if( "autoconfig_packages_remove" == event["WidgetID"]:"" ) - { // Enable or disable the other widgets depending on whether or not - // the cups-autoconfig and udev-configure-printer RPMs should be removed: - boolean have_cups_autoconfig = ! (boolean)UI::QueryWidget( `id("autoconfig_packages_remove"), `Value ); - UI::ChangeWidget( `id("cups_autoconfig_configure_new_attached"), `Enabled, have_cups_autoconfig ); - UI::ChangeWidget( `id("cups_autoconfig_disable_on_removal"), `Enabled, have_cups_autoconfig ); - UI::ChangeWidget( `id("cups_autoconfig_operation_policy"), `Enabled, have_cups_autoconfig ); - UI::ChangeWidget( `id("cups_autoconfig_trigger"), `Enabled, have_cups_autoconfig ); - } - if( "cups_autoconfig_configure_new_attached" == event["WidgetID"]:"" ) - { // Set the CheckBox to trigger automatic configuration to "off" - // when cups-autoconfig should not do an automatic configuration - // but do not automatically set the trigger to "on" in the opposite case: - if( ! (boolean)UI::QueryWidget( `id("cups_autoconfig_configure_new_attached"), `Value ) ) - { UI::ChangeWidget( `id("cups_autoconfig_trigger"), `Value, false ); - } - } - if( "cups_autoconfig_trigger" == event["WidgetID"]:"" ) - { // Set the CheckBox to do an automatic configuration to "on" - // when the CheckBox to trigger automatic configuration is set to "on" - // but do not automatically disable automatic configuration in the opposite case: - if( (boolean)UI::QueryWidget( `id("cups_autoconfig_trigger"), `Value ) ) - { UI::ChangeWidget( `id("cups_autoconfig_configure_new_attached"), `Value, true ); - } + { if( "udev_configure_printer_check_box" == event["WidgetID"]:"" ) + { // Ignore its return code because it shows already Popup::Error messages: + ApplyAutoconfigSettings(); } } if( "Activated" == event["EventReason"]:"" ) - { if( `back == event["ID"]:nil ) - { return `autoconfig_back; + { if( `abort == event["ID"]:nil || `cancel == event["ID"]:nil || `back == event["ID"]:nil ) + { // There is no "abort" functionality which does a sudden death of the whole module. + // There is only a "Cancel" functionality (via the "back" button) which goes back one step + // and the button with the "abort" functionality is not shown at all (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this case is mapped to the "Cancel" functionality: + return `autoconfig_back; } if( `next == event["ID"]:nil ) - { if( ! ApplyAutoconfigSettings() ) - { Popup::Error( // Popup::Error message: - _("Failed to apply the settings to the system.") - ); - } - return `autoconfig_next; + { return `autoconfig_next; } } return nil; Modified: trunk/printer/src/connectionwizard.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/connectionwizard.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/connectionwizard.ycp (original) +++ trunk/printer/src/connectionwizard.ycp Wed Jan 19 14:40:55 2011 @@ -970,6 +970,11 @@ if( ! Printerlib::TestAndInstallPackage( "bluez-cups", "installed" ) ) { if( Popup::ContinueCancel( _("To access a bluetooth printer, the RPM package bluez-cups must be installed.") ) ) { Printerlib::TestAndInstallPackage( "bluez-cups", "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); } // The user can also decide during the actual installation not to install it // or the installation may have failed for whatever reason @@ -1243,6 +1248,11 @@ if( ! Printerlib::TestAndInstallPackage( "samba-client", "installed" ) ) { if( Popup::ContinueCancel( _("To access a SMB printer share, the RPM package samba-client must be installed.") ) ) { Printerlib::TestAndInstallPackage( "samba-client", "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); } // The user can also decide during the actual installation not to install it // or the installation may have failed for whatever reason @@ -1590,6 +1600,11 @@ if( ! Printerlib::TestAndInstallPackage( "ncpfs", "installed" ) ) { if( Popup::ContinueCancel( _("To access an IPX print queue, the RPM package ncpfs must be installed.") ) ) { Printerlib::TestAndInstallPackage( "ncpfs", "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); } // The user can also decide during the actual installation not to install it // or the installation may have failed for whatever reason @@ -1752,6 +1767,11 @@ if( ! Printerlib::TestAndInstallPackage( "cups-backends", "installed" ) ) { if( Popup::ContinueCancel( _("To print via 'pipe', the RPM package cups-backends must be installed.") ) ) { Printerlib::TestAndInstallPackage( "cups-backends", "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); } // The user can also decide during the actual installation not to install it // or the installation may have failed for whatever reason @@ -2866,6 +2886,11 @@ { // Install samba-krb-printing when it is not installed: if( Popup::ContinueCancel( _("To support Active Directory (R), the RPM package samba-krb-printing must be installed.") ) ) { Printerlib::TestAndInstallPackage( "samba-krb-printing", "install" ); + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); } } // The user can also decide during the actual installation not to install it Modified: trunk/printer/src/driveradd.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/driveradd.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/driveradd.ycp (original) +++ trunk/printer/src/driveradd.ycp Wed Jan 19 14:40:55 2011 @@ -453,6 +453,11 @@ if( package_changed ) { Printer::ppds = []; Printer::connections = []; + // There is no "abort" functionality which does a sudden death of the whole module (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this leftover "abort" button must be explicitely hidden here: + Wizard::HideAbortButton(); } // Ignore an effectively empty ppd_path_input_value: if( "" != filterchars( ppd_path_input_value, Printer::alnum_chars ) ) Modified: trunk/printer/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/helps.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/helps.ycp (original) +++ trunk/printer/src/helps.ycp Wed Jan 19 14:40:55 2011 @@ -857,49 +857,26 @@ </p>"), "autoconfig" : -// Autoconfig help 1/3: +// Autoconfig help 1/2: _("<p> <b><big>CUPS Autoconfiguration for USB Printers</big></b><br> -Autoconfiguration is provided by two RPM packages:<br> -The new 'udev-configure-printer' since openSUSE 11.2 and -the meanwhile deprecated 'cups-autoconfig' because the latter -uses HAL which is deprecated.<br> -When the autoconfiguration dialog is launched, it checks -if udev-configure-printer or cups-autoconfig is installed. -If none of them is installed, it tries to install one of them -where udev-configure-printer is preferred -but if it fails to install udev-configure-printer, -it tries to install cups-autoconfig.<br> -If none of them is finally installed, the dialog is useless -and all its elements become disabled. +USB Printer autoconfiguration is provided +by the RPM package 'udev-configure-printer'.<br> +When its check box is initially not checked, it is not installed +and then you can select it so that it will be installed.<br> +When its check box is initially checked, it is already installed +and then you can un-select it so that it will be removed. </p>") + -// Autoconfig help 2/3: +// Autoconfig help 2/2: _("<p> -When udev-configure-printer is used, +When udev-configure-printer is installed, automatic USB printer setup happens via the entries -in its udev config file /etc/udev/rules.d/70-printers.rules +in its udev config file /lib/udev/rules.d/70-printers.rules which triggers to run 'udev-configure-printer add' when a USB printer is plugged in and 'udev-configure-printer remove' when it is unplugged. -There are no settings when udev-configure-printer is used +There are no adjustable settings for udev-configure-printer except one changes the 70-printers.rules file manually. -</p>") + -// Autoconfig help 3/3: -_("<p> -When cups-autoconfig is used, -automatic USB printer setup happens via the entries -in its HAL config file 10-cups-autoconfig.fdi -which triggers to run 'hal-cups-autoconfig --add' -when a USB printer is plugged in. -It determines if the printer is already configured. -If it is already configured, printing will be enabled. -If the printer is not configured, cups-autoconfig attempts -to select an appropriate driver for it and, if successful, -cups-autoconfig configures it. -When a USB printer is unplugged, 'hal-cups-autoconfig --disable' -is run which can disable printing depending on the -settings for cups-autoconfig which are stored in its -/etc/cups-autoconfig.conf file. </p>") ]; Modified: trunk/printer/src/policies.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/policies.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/policies.ycp (original) +++ trunk/printer/src/policies.ycp Wed Jan 19 14:40:55 2011 @@ -314,8 +314,14 @@ symbol handlePolicies( string key, map event ) { y2milestone( "entering handlePolicies with key '%1'\nand event '%2'", key, event ); if( "Activated" == event["EventReason"]:"" ) - { if( `back == event["ID"]:nil ) - { return `policies_back; + { if( `abort == event["ID"]:nil || `cancel == event["ID"]:nil || `back == event["ID"]:nil ) + { // There is no "abort" functionality which does a sudden death of the whole module. + // There is only a "Cancel" functionality (via the "back" button) which goes back one step + // and the button with the "abort" functionality is not shown at all (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this case is mapped to the "Cancel" functionality: + return `policies_back; } if( `next == event["ID"]:nil ) { if( ! ApplyPoliciesSettings() ) Modified: trunk/printer/src/printingvianetwork.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/printingvianetwork.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/printingvianetwork.ycp (original) +++ trunk/printer/src/printingvianetwork.ycp Wed Jan 19 14:40:55 2011 @@ -903,8 +903,14 @@ } } if( "Activated" == event["EventReason"]:"" ) - { if( `back == event["ID"]:nil ) - { return `printing_via_network_back; + { if( `abort == event["ID"]:nil || `cancel == event["ID"]:nil || `back == event["ID"]:nil ) + { // There is no "abort" functionality which does a sudden death of the whole module. + // There is only a "Cancel" functionality (via the "back" button) which goes back one step + // and the button with the "abort" functionality is not shown at all (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this case is mapped to the "Cancel" functionality: + return `printing_via_network_back; } if( `next == event["ID"]:nil ) { if( ! ApplyNetworkPrintingSettings() ) Modified: trunk/printer/src/sharing.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=63223&r1=63222&r2=63223&view=diff ============================================================================== --- trunk/printer/src/sharing.ycp (original) +++ trunk/printer/src/sharing.ycp Wed Jan 19 14:40:55 2011 @@ -845,8 +845,14 @@ } } if( "Activated" == event["EventReason"]:"" ) - { if( `back == event["ID"]:nil ) - { return `sharing_back; + { if( `abort == event["ID"]:nil || `cancel == event["ID"]:nil || `back == event["ID"]:nil ) + { // There is no "abort" functionality which does a sudden death of the whole module. + // There is only a "Cancel" functionality (via the "back" button) which goes back one step + // and the button with the "abort" functionality is not shown at all (see dialogs.ycp). + // Unfortunately when the YaST package installer is run via Printerlib::TestAndInstallPackage + // it leaves a misused "abort" button labeled "Skip Autorefresh" with WidgetID "`abort" + // so that this case is mapped to the "Cancel" functionality: + return `sharing_back; } if( `next == event["ID"]:nil ) { if( ! ApplySharingSettings() ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsmeix@svn2.opensuse.org