Author: jsmeix
Date: Wed Nov 26 16:30:34 2008
New Revision: 53628
URL: http://svn.opensuse.org/viewcvs/yast?rev=53628&view=rev
Log:
- Several fixes for the Connection Wizard but it is still
not very good (see Novell/Suse Bugzilla bnc#440903
and Novell/Suse Bugzilla bnc#442247
and Novell/Suse Bugzilla bnc#446432).
- Better fallback when no model info is available
in basicadd.ycp and basicmodify.ycp
(see Novell/Suse Bugzilla bnc#446432).
- Fixed automatic removal of cups-autoconfig RPM when Autoconfig
dialog is useless (e.g. because of "client only").
- 2.17.46
Modified:
trunk/printer/VERSION
trunk/printer/package/yast2-printer.changes
trunk/printer/src/Printer.ycp
trunk/printer/src/autoconfig.ycp
trunk/printer/src/basicadd.ycp
trunk/printer/src/basicmodify.ycp
trunk/printer/src/connectionwizard.ycp
trunk/printer/src/sharing.ycp
Modified: trunk/printer/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/VERSION?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/VERSION (original)
+++ trunk/printer/VERSION Wed Nov 26 16:30:34 2008
@@ -1 +1 @@
-2.17.45
+2.17.46
Modified: trunk/printer/package/yast2-printer.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/package/yast2-printer.changes?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/package/yast2-printer.changes (original)
+++ trunk/printer/package/yast2-printer.changes Wed Nov 26 16:30:34 2008
@@ -1,4 +1,18 @@
-------------------------------------------------------------------
+Wed Nov 26 16:20:09 CET 2008 - jsmeix@suse.de
+
+- Several fixes for the Connection Wizard but it is still
+ not very good (see Novell/Suse Bugzilla bnc#440903
+ and Novell/Suse Bugzilla bnc#442247
+ and Novell/Suse Bugzilla bnc#446432).
+- Better fallback when no model info is available
+ in basicadd.ycp and basicmodify.ycp
+ (see Novell/Suse Bugzilla bnc#446432).
+ - Fixed automatic removal of cups-autoconfig RPM when Autoconfig
+ dialog is useless (e.g. because of "client only").
+- 2.17.46
+
+-------------------------------------------------------------------
Fri Nov 21 17:43:50 CET 2008 - mzugec@suse.cz
- lpr/lpd setup (bnc#420922)
Modified: trunk/printer/src/Printer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/Printer.ycp?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/src/Printer.ycp (original)
+++ trunk/printer/src/Printer.ycp Wed Nov 26 16:30:34 2008
@@ -954,7 +954,8 @@
|| "hp:/" == substring( uri, 0, 4 )
|| "ConnectionWizardDialog" == class
)
- { // Skip "usb://HP/" DeviceURIs if there is at least one "hp:/usb/" DeviceURI
+ { // Skip "usb://HP/" DeviceURIs if it was not created by the Connection Wizard
+ // and if there is at least one "hp:/usb/" DeviceURI
// so that the "hp:/usb/" DeviceURI is used with preference.
// The "usb://HP/" DeviceURI is still available via "MoreConnections".
// It can happen that a "usb://HP/" DeviceURI is skipped
@@ -977,11 +978,13 @@
// which exact driver he selects manually for his particular model.
if( "usb://hp/" == tolower( substring( uri, 0, 9 ) )
&& hp_usb_uri_exists
+ && class != "ConnectionWizardDialog"
)
{ y2milestone( "skipped 'usb://HP/' DeviceURI '%1'", uri );
}
else
- { // Skip "hp:/par/" DeviceURIs if there is at least one "parallel:/" DeviceURI
+ { // Skip "hp:/par/" DeviceURIs if it was not created by the Connection Wizard
+ // and if there is at least one "parallel:/" DeviceURI
// so that the "parallel:/" DeviceURI is used with preference.
// The reason for this preference is that for my LaserJet 1220
// which is accessible via "parallel:/dev/lp0" and
@@ -996,6 +999,7 @@
// The "hp:/par/" DeviceURI is still available via "MoreConnections".
if( "hp:/par/" == tolower( substring( uri, 0, 8 ) )
&& parallel_uri_exists
+ && class != "ConnectionWizardDialog"
)
{ y2milestone( "skipped 'hp:/par/' DeviceURI '%1'", uri );
}
@@ -1586,11 +1590,27 @@
)
{ // Preselect the first entry and set selected_ppds_index accordingly.
selected_ppds_index = sorted_driver_items[0,0,0]:-1;
- sorted_driver_items[0] = `item( `id( selected_ppds_index ), driver_string, true );
+ // The first entry in a SelectionBox is always preselected in the GUI
+ // (it does not help to have all items in a SelectionBox with 'false' as third argument).
+ // Do not have this entry preselected (i.e. no 'true' as a third argument)
+ // because in the BasicModifyDialog the currently used driver is additionally prepended
+ // and then the currently used driver must be preselected by default because
+ // the currently used driver is then the very first entry in the SelectionBox.
y2milestone( "Preselected driver: '%1'", driver_string );
}
// The specially sorted_driver_items list has a maximum of 20 entries which is o.k. for the log:
y2milestone( "sorted_driver_items: %1", sorted_driver_items );
+ if( selected_ppds_index < 0 )
+ { // When no driver was preselected, prepend a dummy entry
+ // because the first entry in a SelectionBox is always preselected in the GUI
+ // (it does not help to have all items in a SelectionBox with 'false' as third argument).
+ // Do not have this dummy entry preselected (i.e. no 'true' as a third argument)
+ // because in the BasicModifyDialog the currently used driver is additionally prepended
+ // and then the currently used driver must be preselected by default because
+ // the currently used driver is then the very first entry in the SelectionBox.
+ sorted_driver_items = prepend( sorted_driver_items, `item( `id( -1 ), _("Select a driver.") ) );
+ y2milestone( "No driver preselected." );
+ }
Popup::ClearFeedback();
return sorted_driver_items;
}
@@ -1604,18 +1624,18 @@
{ return tolower(one_item[1]:"") < tolower(another_item[1]:"");
}
);
- Popup::ClearFeedback();
if( selected_ppds_index < 0 )
{ // When no driver was preselected, prepend a dummy entry
// because the first entry in a SelectionBox is always preselected in the GUI
// (it does not help to have all items in a SelectionBox with 'false' as third argument).
// Do not have this dummy entry preselected (i.e. no 'true' as a third argument)
- // because in the BasicModifyDialog the currenlty used driver is additionally prepended
- // and then the currenlty used driver must be preselected by default because
- // the currenlty used driver is then the very first entry in the SelectionBox.
+ // because in the BasicModifyDialog the currently used driver is additionally prepended
+ // and then the currently used driver must be preselected by default because
+ // the currently used driver is then the very first entry in the SelectionBox.
sorted_driver_items = prepend( sorted_driver_items, `item( `id( -1 ), _("Select a driver.") ) );
y2milestone( "No driver preselected." );
}
+ Popup::ClearFeedback();
return sorted_driver_items;
}
Modified: trunk/printer/src/autoconfig.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/autoconfig.ycp?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/src/autoconfig.ycp (original)
+++ trunk/printer/src/autoconfig.ycp Wed Nov 26 16:30:34 2008
@@ -181,7 +181,10 @@
}
}
}
- UI::ChangeWidget( `id("cups_autoconfig_remove"), `Value, autoconfig_settings_dialog_is_useless );
+ // 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("cups_autoconfig_remove"), `Value, false );
// 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.
Modified: trunk/printer/src/basicadd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicadd.ycp?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/src/basicadd.ycp (original)
+++ trunk/printer/src/basicadd.ycp Wed Nov 26 16:30:34 2008
@@ -334,11 +334,11 @@
}
}
if( "" == driver_filter_string )
- { // Set a fallback driver_filter_string to avoid that the full list
- // of thousands of PPDs is shown automatically because
- // it can take a very long time until the user can proceed:
- driver_filter_input_text = "Generic";
- driver_filter_string = "^generic";
+ { // Set a fallback driver_filter_string which does not match to anything
+ // to avoid that the full list of thousands of PPDs is shown automatically
+ // because it can take a very long time until the user can proceed:
+ driver_filter_input_text = "Enter your printer model here.";
+ driver_filter_string = "qqqqqqqqqq";
}
UI::ReplaceWidget( `id(`driver_filter_input_replace_point),
`TextEntry( `id(`driver_filter_input),
Modified: trunk/printer/src/basicmodify.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/basicmodify.ycp?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/src/basicmodify.ycp (original)
+++ trunk/printer/src/basicmodify.ycp Wed Nov 26 16:30:34 2008
@@ -662,11 +662,11 @@
}
}
if( "" == driver_filter_string )
- { // Set a fallback driver_filter_string to avoid that the full list
- // of thousands of PPDs is shown automatically because
- // it can take a very long time until the user can proceed:
- driver_filter_input_text = "Generic";
- driver_filter_string = "^generic";
+ { // Set a fallback driver_filter_string which does not match to anything
+ // to avoid that the full list of thousands of PPDs is shown automatically
+ // because it can take a very long time until the user can proceed:
+ driver_filter_input_text = "Enter your printer model here.";
+ driver_filter_string = "qqqqqqqqqq";
}
UI::ReplaceWidget( `id(`driver_filter_input_replace_point),
`TextEntry( `id(`driver_filter_input),
Modified: trunk/printer/src/connectionwizard.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/connectionwizard.ycp?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/src/connectionwizard.ycp (original)
+++ trunk/printer/src/connectionwizard.ycp Wed Nov 26 16:30:34 2008
@@ -1,423 +1,642 @@
+/* ------------------------------------------------------------------------------
+ * Copyright (c) 2006 Novell, Inc. All Rights Reserved.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of version 2 of the GNU General Public License as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may find
+ * current contact information at www.novell.com.
+ * ------------------------------------------------------------------------------
+ */
+
+/**
+ * File: include/printer/connectionwizard.ycp
+ * Package: Configuration of printer
+ * Summary: Connection Wizard
+ * Authors: Michal Zugec
+ * Johannes Meixner
+ *
+ * $Id: connectionwizard.ycp 27914 2006-02-13 14:32:08Z locilka $
+ */
+
{
textdomain "printer";
+
import "Label";
import "Printer";
-
+import "Popup";
import "Wizard";
-include "printer/helps.ycp";
-
-string connectionURI="";
-term getContentFromBackend(string backend){
- list items=[];
- backend=sformat("%1:/", backend);
- foreach(term row, (list<term>)Printer::ConnectionItems( "" ), {
- if(backend==substring(row[2]:"", 0, size(backend))){
- items=add(items, row);
- }
- });
+include "printer/helps.ycp";
- term content = `VBox(
- `Table
- ( `id(`connection_selection),
- // By default there is no UserInput()
- // if only something was selected in the Table
- // (without clicking additionally a button)
- // but the notify and immediate options
- // forces UserInput() in this case:
- `opt(`notify, `immediate, `keepSorting),
- // Headers of a Table with a list of printer connections:
- `header
- ( // Header of a Table column with a list of printer connections.
- // Printer model name:
- _("Model"),
- // Header of a Table column with a list of printer connections.
- // Connection of the printer (e.g. via USB or via parallel port):
- _("Connection"),
- // Header of a Table column with a list of printer connections.
- // Additional description of the printer or its particular connection:
- _("Description")
- ),
- items
- ),
- `HBox(
- //TRANSLATORS: Button to test remote printer machine
- `PushButton(`id(`test), _("&Test Connection")),
- //TRANSLATORS: Button to add not detected printer queue
- `PushButton(`id(`other), _("Other"))
- )
- );
- return content;
+string connection_uri="";
+string connection_model="";
+list< string > known_manufacturers = [ "",
+ "Generic",
+ "Alps",
+ "Anitech",
+ "Apollo",
+ "Apple",
+ "Brother",
+ "Canon",
+ "Citizen",
+ "CItoh",
+ "Compaq",
+ "DEC",
+ "Dell",
+ "Dymo",
+ "Epson",
+ "Fujifilm",
+ "Fujitsu",
+ "Gestetner",
+ "Heidelberg",
+ "Hitachi",
+ "HP",
+ "IBM",
+ "Infotec",
+ "Kodak",
+ "KS",
+ "Kyocera",
+ "Lanier",
+ "Lexmark",
+ "Minolta",
+ "Mitsubishi",
+ "NEC",
+ "NRG",
+ "Oce",
+ "Oki",
+ "Olivetti",
+ "Olympus",
+ "Panasonic",
+ "PCPI",
+ "QMS",
+ "Raven",
+ "Ricoh",
+ "Samsung",
+ "Savin",
+ "Seiko",
+ "Sharp",
+ "Shinko",
+ "Sony",
+ "Star",
+ "Tally",
+ "Tektronix",
+ "Toshiba",
+ "Xerox",
+ "Zebra",
+ "Raw Queue"
+ ];
+
+term getContentFromBackend( string backend )
+{ list items = [];
+ backend = sformat( "%1:/", backend );
+ foreach( term row,
+ (list<term>)Printer::ConnectionItems( "" ),
+ { if( backend == substring( row[2]:"", 0, size(backend) ) )
+ { items = add( items, row );
+ }
+ }
+ );
+ term content = `VBox
+ ( `Table
+ ( `id(`connection_selection),
+ // By default there is no UserInput()
+ // if only something was selected in the Table
+ // (without clicking additionally a button)
+ // but the notify and immediate options
+ // forces UserInput() in this case:
+ `opt(`notify, `immediate, `keepSorting),
+ // Headers of a Table with a list of printer connections:
+ `header
+ ( // Header of a Table column with a list of printer connections.
+ // Printer model name:
+ _("Model"),
+ // Header of a Table column with a list of printer connections.
+ // Connection of the printer (e.g. via USB or via parallel port):
+ _("Connection"),
+ // Header of a Table column with a list of printer connections.
+ // Additional description of the printer or its particular connection:
+ _("Description")
+ ),
+ items
+ )
+ );
+ return content;
}
-term getNetworkContent(list<string>text){
- if (size(text)!=3){
- y2error("To create content for Network dialog it needs 3 strings : %1", text);
- return nil;
- }
- term content=`VBox(
- `HBox(
- //TRANSLATORS: Text entry to fill IP or hostname of remote server
- `ComboBox(`id(`hostname), `opt(`editable), _("IP Address or Host Name")),
- //TRANSLATORS: Label for menu to search for remote servers
- `MenuButton(_("Look Up"),
- [
- `item(`id(`scan), text[0]:""),
- //TRANSLATORS: Buttonto search for remote servers
- `item(`id(`scan_all), _("Look Up for All Hosts"))
- ]
- )
- ),
- `InputField(`id(`port), text[1]:"", text[2]:""),
- //TRANSLATORS: Button to test remote printer machine
- `PushButton(`id(`test), _("&Test Connection"))
- );
- return content;
+term getNetworkContent( list<string>text )
+{ if( size(text) != 3 )
+ { y2error( "To create content for Network dialog it needs 3 strings : %1", text );
+ return nil;
+ }
+ term content = `VBox
+ ( `HBox
+ ( `Left
+ ( `ComboBox
+ ( `id(`hostname),
+ `opt(`editable),
+ // TRANSLATORS: Text entry to fill IP or hostname of remote server
+ _("&IP Address or Host Name")
+ )
+ ),
+ `MenuButton
+ ( // TRANSLATORS: Label for menu to search for remote servers
+ _("Look Up"),
+ [ `item( `id(`scan), text[0]:"" ),
+ // TRANSLATORS: Button to search for remote servers
+ `item( `id(`scan_all), _("Look Up for All Hosts") )
+ ]
+ )
+ ),
+ `Left
+ ( `InputField( `id(`port), text[1]:"", text[2]:"" )
+ ),
+ `Left
+ ( // TRANSLATORS: Button to test remote printer machine
+ `PushButton( `id(`test), _("&Test Connection") )
+ )
+ );
+ return content;
}
-void changeSettingsDialog(symbol selected){
- term content=nil;
- switch(selected){
- // directly connected
- case(`parallel):
- content = getContentFromBackend("parallel");
- break;
- case(`usb):
- content = getContentFromBackend("usb");
- break;
- case(`serial):
- content = getContentFromBackend("serial");
- break;
- case(`infra):
- content = getContentFromBackend("infra");
- break;
- case(`bluetooth):
- content = getContentFromBackend("bluetooth");
- break;
- case(`scsi):
- content = getContentFromBackend("scsi");
- break;
- case(`hplip):
- content = getContentFromBackend("hp");
- break;
- // network printer
- case(`tcp):
- //TRANSLATORS: List of input field labels, first for network scan button
- content = getNetworkContent([_("Scan for Direct Socket Servers"), _("TCP Port Number"), "9100"]);
- break;
- case(`lpd):
- //TRANSLATORS: List of input field labels, first for network scan button, second for name of printer queue
- content = getNetworkContent([_("Scan for LPD Servers"), _("Queue Name (see the printer's manual)"), "LPT1"]);
- break;
- case(`ipp):
- content=`VBox(
- //TRANSLATORS: Input field label
- `InputField(`id(`uri), _("URI (see the printer's manual)"), "ipp://ip-address:port-number/resource")
- );
- break;
+void changeSettingsDialog( symbol selected )
+{ term content=nil;
+ term connection_content = nil;
+ term model_content = `Left
+ ( `ComboBox
+ ( `id("known_manufacturers_combo_box"),
+ // Header for a ComboBox to select the printer manufacturer:
+ _("Select the printer &manufacturer"),
+ known_manufacturers
+ )
+ );
+ switch(selected)
+ { // directly connected
+ case(`parallel):
+ content = getContentFromBackend("parallel");
+ break;
+ case(`usb):
+ content = getContentFromBackend("usb");
+ break;
+ case(`serial):
+ content = getContentFromBackend("serial");
+ break;
+ case(`infra):
+ content = getContentFromBackend("infra");
+ break;
+ case(`bluetooth):
+ content = getContentFromBackend("bluetooth");
+ break;
+ case(`scsi):
+ content = getContentFromBackend("scsi");
+ break;
+ case(`hplip):
+ content = getContentFromBackend("hp");
+ break;
+ // network printer
+ case(`tcp):
+ connection_content = getNetworkContent( [ // TRANSLATORS: List of input field labels,
+ // first for network scan button,
+ // second for the TCP port number:
+ _("Scan for Direct Socket Servers"),
+ _("TCP Port Number"),
+ "9100"
+ ]
+ );
+ content = `VBox( connection_content, model_content );
+ break;
+ case(`lpd):
+ connection_content = getNetworkContent( [ // TRANSLATORS: List of input field labels,
+ // first for network scan button,
+ // second for name of printer queue
+ _("Scan for LPD Servers"),
+ _("Queue Name (see the printer's manual)"),
+ "LPT1"
+ ]
+ );
+ content = `VBox( connection_content, model_content );
+ break;
+ case(`ipp):
+ content = `VBox
+ ( `Left
+ ( `InputField
+ ( `id(`uri),
+ // TRANSLATORS: Input field label
+ _("URI (see the printer's manual)"),
+ "ipp://ip-address:port-number/resource"
+ )
+ ),
+ model_content
+ );
+ break;
// print via
case(`smb):
content=`VBox(
- `HBox(
- //TRANSLATORS: Text entry for remote server name
- `ComboBox(`id(`hostname), `opt(`editable), _("Server (NetBIOS Host Name)")),
- //TRANSLATORS: Label for menu to search for remote servers
- `MenuButton(_("Look Up"),
- [
- `item(`id(`scan), _("Scan for samba printers")),
- //TRANSLATORS: Buttonto search for remote servers
- `item(`id(`scan_all), _("Look Up for All Hosts"))
- ])
- ),
- //TRANSLATORS: Text entry for printer name
+ `HBox(
+ // TRANSLATORS: Text entry for remote server name
+ `ComboBox(`id(`hostname), `opt(`editable), _("Server (NetBIOS Host Name)")),
+ // TRANSLATORS: Label for menu to search for remote servers
+ `MenuButton(_("Look Up"),
+ [
+ `item(`id(`scan), _("Scan for samba printers")),
+ // TRANSLATORS: Buttonto search for remote servers
+ `item(`id(`scan_all), _("Look Up for All Hosts"))
+ ])
+ ),
+ // TRANSLATORS: Text entry for printer name
`InputField(`id(`printer), _("Printer (Share Name)")),
-// `HBox(
- //TRANSLATORS: Text entry for samba domain
- `ComboBox(`id(`domain), `opt(`editable), _("Workgroup (Domain Name)")),
-// PushButton(`id(`scan_domain), _("Scan for Windows Share Domains"))
-// )
- //TRANSLATORS: Frame label for authentication
+// `HBox(
+ // TRANSLATORS: Text entry for samba domain
+ `ComboBox(`id(`domain), `opt(`editable), _("Workgroup (Domain Name)")),
+// PushButton(`id(`scan_domain), _("Scan for Windows Share Domains"))
+// )
+ // TRANSLATORS: Frame label for authentication
`Frame(_("Authenticate As"), `VBox(
- //TRANSLATORS: Text entry for username (authentication)
+ // TRANSLATORS: Text entry for username (authentication)
`InputField(`id(`user), _("User")),
- //TRANSLATORS: Text entry for password (authentication)
+ // TRANSLATORS: Text entry for password (authentication)
`Password(`id(`pass), _("&Password"))
)),
- //TRANSLATORS: Button to test remote printer machine
+ // TRANSLATORS: Button to test remote printer machine
`PushButton(`id(`test), _("&Test Connection"))
);
- break;
+ break;
case(`lpr):
- //TRANSLATORS: List of input field labels, first for network scan button, second for name of printer queue
+ // TRANSLATORS: List of input field labels, first for network scan button, second for name of printer queue
content = getNetworkContent([_("Scan for LPD Servers"), _("Queue Name"), ""]);
break;
case(`cups):
- content=`VBox(
- `HBox(
- //TRANSLATORS: Text entry for IP or hostname of remote server
- `ComboBox(`id(`hostname), `opt(`editable), _("IP Address or Host Name")),
- //TRANSLATORS: Label for menu to search for remote servers
- `MenuButton(_("Look Up"),
- [
- `item(`id(`scan), _("Scan for IPP Servers")),
- `item(`id(`scan_broadcast), _("Scan for IPP Broadcasts")),
- `item(`id(`scan_all), _("Look Up for All Hosts"))
- ]
- )
- ),
- `InputField(`id(`queue), _("Queue Name")),
- //TRANSLATORS: Button to test remote printer machine
- `PushButton(`id(`test), _("&Test Connection"))
- );
- break;
+ content = `VBox
+ ( `Left
+ ( `HBox
+ ( `ComboBox
+ ( `id(`hostname),
+ `opt(`editable),
+ // TRANSLATORS: Text entry for IP or hostname of remote server
+ _("IP Address or Host Name")
+ ),
+ `MenuButton
+ ( // TRANSLATORS: Label for menu to search for remote servers
+ _("Look Up"),
+ [ `item( `id(`scan), _("Scan for IPP Servers") ),
+ `item( `id(`scan_broadcast), _("Scan for IPP Broadcasts") ),
+ `item( `id(`scan_all), _("Look Up for All Hosts") )
+ ]
+ )
+ )
+ ),
+ `Left
+ ( `InputField( `id(`queue), _("Queue Name") )
+ ),
+ `PushButton
+ ( `id(`test),
+ // TRANSLATORS: Button to test remote printer machine
+ _("&Test Connection")
+ )
+ );
+ break;
case(`ipx):
content=`VBox(
- //TRANSLATORS: Text entry for IP or hostname of remote server
+ // TRANSLATORS: Text entry for IP or hostname of remote server
`InputField(`id(`hostname), _("IP Address or Host Name")),
- //TRANSLATORS: Text entry for name of remote printer queue
+ // TRANSLATORS: Text entry for name of remote printer queue
`InputField(`id(`queue), _("Queue Name")),
- //TRANSLATORS: Frame label for authentication
+ // TRANSLATORS: Frame label for authentication
`Frame(_("Authenticate As"), `VBox(
- //TRANSLATORS: Text entry for username (authentication)
+ // TRANSLATORS: Text entry for username (authentication)
`InputField(`id(`user), _("User")),
- //TRANSLATORS: Text entry for password (authentication)
+ // TRANSLATORS: Text entry for password (authentication)
`Password(`id(`pass), _("&Password"))
)),
- //TRANSLATORS: Button to test remote printer machine
+ // TRANSLATORS: Button to test remote printer machine
`PushButton(`id(`test), _("&Test Connection"))
);
- break;
+ break;
// special
case(`uri):
- content=`VBox(
- //TRANSLATORS: Text entry for URI (Uniform Resource Identifier)
- `InputField(`id(`uri), _("URI (Uniform Resource Identifier)"))
- );
- break;
+ content=`VBox(
+ // TRANSLATORS: Text entry for URI (Uniform Resource Identifier)
+ `InputField(`id(`uri), _("URI (Uniform Resource Identifier)"))
+ );
+ break;
case(`pipe):
- content=`VBox(
- //TRANSLATORS: Text entry for program name that will be called via pipe
- `InputField(`id(`program), _("Program Name"))
- );
- break;
+ content=`VBox(
+ // TRANSLATORS: Text entry for program name that will be called via pipe
+ `InputField(`id(`program), _("Program Name"))
+ );
+ break;
case(`beh):
- content=`VBox(
- //TRANSLATORS: Text entry for device URI (Uniform Resource Identifier)
+ content=`VBox(
+ // TRANSLATORS: Text entry for device URI (Uniform Resource Identifier)
`InputField(`id(`queue), _("Device URI (for which 'beh' should be applied)"), Printer::queues[Printer::selected_queues_index,"uri"]:""),
- //TRANSLATORS: Check box
+ // TRANSLATORS: Check box
`CheckBox(`id(`beh_do_not_disable), _("Never Disable the Queue"), true),
- //TRANSLATORS: Text entry
+ // TRANSLATORS: Text entry
`InputField(`id(`beh_attempts), _("Number of Retries ('0' means infinite retries)"), "0"),
- //TRANSLATORS: Text entry
+ // TRANSLATORS: Text entry
`InputField(`id(`beh_delay), _("Delay in Seconds Between Two Retries"), "30")
- );
- break;
+ );
+ break;
case(`directly):
case(`network):
case(`server):
case(`special):
- content=`VBox();
- break;
+ content = `Empty();
+ break;
default:
- y2error("Unknown selected item %1", selected);
- }
- UI::ReplaceWidget(`rp, content);
+ y2error("Unknown selected item %1", selected);
+ }
+ UI::ReplaceWidget( `rp, content );
}
-any ConnectionWizardDialog(){
-term contents =
-`VBox(
- `HBox(
- `VBox(
- //TRANSLATORS: Label for tree widget description
- `Tree(`id(`tree_selection), `opt(`notify), _("&Connection Type"),
- [
- //TRANSLATORS: Tree widget item
- `item(`id(`directly), _("Directly Connected Device"), true,
- [
- //TRANSLATORS: Tree widget item
- `item(`id(`parallel), _("Parallel Port")),
- //TRANSLATORS: Tree widget item
- `item(`id(`usb), _("USB Port")),
- //TRANSLATORS: Tree widget item
- `item(`id(`serial), _("Serial Port")),
-// `item(`id(`infra), _("Infrared Port (IrDA)")),
- //TRANSLATORS: Tree widget item
- `item(`id(`bluetooth), _("Bluetooth")),
- //TRANSLATORS: Tree widget item
- `item(`id(`scsi), _("SCSI")),
- //TRANSLATORS: Tree widget item
- `item(`id(`hplip), _("HP Devices (HPLIP)"))
- ]),
- //TRANSLATORS: Tree widget item
- `item(`id(`network), _("Access Network Printer or Printserver Box via"), true,
- [
- //TRANSLATORS: Tree widget item
- `item(`id(`tcp), _("TCP Port (AppSocket/JetDirect)")),
- //TRANSLATORS: Tree widget item
- `item(`id(`lpd), _("Line Printer Daemon (LPD) Protocol")),
- //TRANSLATORS: Tree widget item
- `item(`id(`ipp), _("Internet Printing Protocol (IPP)"))
- ]),
- //TRANSLATORS: Tree widget item
- `item(`id(`server), _("Print Via Print Server Machine"), true,
- [
- //TRANSLATORS: Tree widget item
- `item(`id(`smb), _("Microsoft Windows/SAMBA (SMB/CIFS)")),
- //TRANSLATORS: Tree widget item
- `item(`id(`lpr), _("Traditional UNIX Server (LPR)")),
-// `item(`id(`iprint), _("iPrint (Novell OES)")),
- //TRANSLATORS: Tree widget item
- `item(`id(`cups), _("CUPS Server")),
- //TRANSLATORS: Tree widget item
- `item(`id(`ipx), _("Novell Netware Print Server (IPX)"))
- ]),
- //TRANSLATORS: Tree widget item
- `item(`id(`special), _("Special"), true,
- [
- //TRANSLATORS: Tree widget item
- `item(`id(`uri), _("Specify Arbitrary Device URI")),
- //TRANSLATORS: Tree widget item
- `item(`id(`pipe), _("Send Print Data to Other Program (pipe)")),
- //TRANSLATORS: Tree widget item
- `item(`id(`beh), _("Daisy-chain Backend Error Handler (beh)"))
- ])
- ]
- )
- ),
- `VBox(
- //TRANSLATORS: Connection details widget
- `Frame(_("Connection Settings"),
- `ReplacePoint(`id(`rp), `VBox())
- )
- )
- )
-);
- //TRANSLATORS: Connection wizard header
- Wizard::SetContentsButtons( _("Connection Wizard"),
+any ConnectionWizardDialog()
+{ term contents = `VBox
+ ( `HBox
+ ( `HWeight
+ ( 1,
+ `Tree
+ ( `id(`tree_selection),
+ `opt(`notify),
+ // TRANSLATORS: Label for tree widget description
+ _("&Connection Type"),
+ [ `item
+ ( `id(`directly),
+ // TRANSLATORS: Tree widget item
+ _("Directly Connected Device"),
+ true,
+ [ // TRANSLATORS: Tree widget item
+ `item( `id(`parallel), _("Parallel Port") ),
+ // TRANSLATORS: Tree widget item
+ `item(`id(`usb), _("USB Port") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`serial), _("Serial Port") ),
+ // `item( `id(`infra), _("Infrared Port (IrDA)") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`bluetooth), _("Bluetooth") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`scsi), _("SCSI") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`hplip), _("HP Devices (HPLIP)") )
+ ]
+ ),
+ `item
+ ( `id(`network),
+ // TRANSLATORS: Tree widget item
+ _("Access Network Printer or Printserver Box via"),
+ true,
+ [ // TRANSLATORS: Tree widget item
+ `item( `id(`tcp), _("TCP Port (AppSocket/JetDirect)") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`lpd), _("Line Printer Daemon (LPD) Protocol") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`ipp), _("Internet Printing Protocol (IPP)") )
+ ]
+ ),
+ `item
+ ( `id(`server),
+ // TRANSLATORS: Tree widget item
+ _("Print Via Print Server Machine"),
+ true,
+ [ // TRANSLATORS: Tree widget item
+ `item( `id(`smb), _("Microsoft Windows/SAMBA (SMB/CIFS)") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`lpr), _("Traditional UNIX Server (LPR)") ),
+ // `item( `id(`iprint), _("iPrint (Novell OES)") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`cups), _("CUPS Server") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`ipx), _("Novell Netware Print Server (IPX)") )
+ ]
+ ),
+ `item
+ ( `id(`special),
+ // TRANSLATORS: Tree widget item
+ _("Special"),
+ true,
+ [ // TRANSLATORS: Tree widget item
+ `item( `id(`uri), _("Specify Arbitrary Device URI") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`pipe), _("Send Print Data to Other Program (pipe)") ),
+ // TRANSLATORS: Tree widget item
+ `item( `id(`beh), _("Daisy-chain Backend Error Handler (beh)") )
+ ]
+ )
+ ]
+ )
+ ),
+ `HWeight
+ ( 1,
+ `VBox
+ ( `VStretch(),
+ `Frame
+ ( // TRANSLATORS: Connection details widget
+ _("Connection Settings"),
+ `ReplacePoint( `id(`rp), `Empty() )
+ ),
+ `VStretch()
+ )
+ )
+ )
+ );
+ // According to http://en.opensuse.org/YaST/Style_Guide#Single_Configuration.2FOverview.2FEd...
+ // there is no longer a "abort" functionality which exits the whole module.
+ // Instead this button is now named "Cancel" and its functionality is
+ // to go back to the Overview dialog (i.e. what the "back" button would do)
+ // because it reads "Cancel - Closes the window and returns to the overview."
+ // In this case the "overview" is not the actual Overview dialog but the dialog
+ // from which this DriverOptionsDialog was called i.e. BasicModifyDialog.
+ // Therefore the button with the "abort" functionality is not shown at all
+ // and the button with the "back" functionality is named "Cancel".
+ // According to http://en.opensuse.org/YaST/Style_Guide#Single_Configuration.2FOverview.2FEd...
+ // the "finish" button in a single (step) configuration dialog must now be named "OK".
+ Wizard::SetContentsButtons( // TRANSLATORS: Connection wizard header
+ _("Connection Wizard"),
contents,
HELPS["connection_wizard_dialog"]:"",
- Label::BackButton(),
- // Set a different label for the "next" button
- // (i.e. the lower right button which results `next as UI::UserInput):
+ // Set a new label for the "back" button, see the comment above:
+ Label::CancelButton(),
+ // Set a new label for the "next" button, see the comment above:
Label::OKButton()
);
+ Wizard::HideAbortButton();
boolean validateSettingsDialog(symbol type){
boolean valid=false;
- connectionURI="";
+ connection_uri="";
+ connection_model="";
switch(type){
+ case(`parallel):
+ case(`usb):
+ case(`serial):
+ case(`infra):
+ case(`bluetooth):
+ case(`scsi):
+ case(`hplip):
+ integer selected_connection_index = (integer)UI::QueryWidget( `id(`connection_selection), `CurrentItem );
+ if( nil == selected_connection_index )
+ { Popup::AnyMessage( // Header of a Popup::AnyMessage when no connection was selected:
+ _("No Connection Selected"),
+ // Body of a Popup::AnyMessage when no connection was selected:
+ _("Select a connection.")
+ );
+ break;
+ }
+ connection_uri = Printer::connections[selected_connection_index,"uri"]:"";
+ connection_model = Printer::connections[selected_connection_index,"model"]:"Unknown";
+ if( "" != connection_uri ) valid = true;
+ break;
case(`uri):
case(`ipp):
- connectionURI=(string) UI::QueryWidget(`uri, `Value);
- if (size(connectionURI)>0) valid=true;
- else Popup::Error(_("Couldn't be empty!"));
- break;
+ connection_uri=(string) UI::QueryWidget(`uri, `Value);
+ if (size(connection_uri)>0) valid=true;
+ else Popup::Error(_("URI couldn't be empty!"));
+ if( valid )
+ { connection_model = (string)UI::QueryWidget( `id("known_manufacturers_combo_box"), `Value );
+ if( "" == connection_model )
+ { valid=false;
+ Popup::Error( _("Select a manufacturer!") );
+ }
+ }
+ break;
case(`smb):
- map smb=$[
- "hostname" : UI::QueryWidget(`hostname, `Value),
- "printer" : UI::QueryWidget(`printer, `Value),
- "domain" : UI::QueryWidget(`domain, `Value),
- "user" : UI::QueryWidget(`user, `Value),
- "pass" : UI::QueryWidget(`pass, `Value)
- ];
- connectionURI="smb://";
- if (size(smb["hostname"]:"")==0 || size(smb["printer"]:"")==0){
- Popup::Error(_("Servername and printer couldn't be empty!"));
- } else {
- if (size(smb["user"]:"")>0 && size(smb["pass"]:"")>0){
- connectionURI=sformat("%1%2:%3@", connectionURI, smb["user"]:"", smb["pass"]:"");
- }
- if(size(smb["domain"]:"")>0) connectionURI=sformat("%1%2/%3/%4", connectionURI, smb["domain"]:"", smb["hostname"]:"", smb["printer"]:"");
- else connectionURI=sformat("%1%2/%3", connectionURI, smb["hostname"]:"", smb["printer"]:"");
- valid=true;
- }
- break;
+ map smb=$[
+ "hostname" : UI::QueryWidget(`hostname, `Value),
+ "printer" : UI::QueryWidget(`printer, `Value),
+ "domain" : UI::QueryWidget(`domain, `Value),
+ "user" : UI::QueryWidget(`user, `Value),
+ "pass" : UI::QueryWidget(`pass, `Value)
+ ];
+ connection_uri="smb://";
+ if (size(smb["hostname"]:"")==0 || size(smb["printer"]:"")==0){
+ Popup::Error(_("Servername and printer couldn't be empty!"));
+ } else {
+ if (size(smb["user"]:"")>0 && size(smb["pass"]:"")>0){
+ connection_uri=sformat("%1%2:%3@", connection_uri, smb["user"]:"", smb["pass"]:"");
+ }
+ if(size(smb["domain"]:"")>0) connection_uri=sformat("%1%2/%3/%4", connection_uri, smb["domain"]:"", smb["hostname"]:"", smb["printer"]:"");
+ else connection_uri=sformat("%1%2/%3", connection_uri, smb["hostname"]:"", smb["printer"]:"");
+ valid=true;
+ }
+ break;
case(`tcp):
- map tcp=$[
- "hostname" : UI::QueryWidget(`hostname, `Value),
- "port" : UI::QueryWidget(`port, `Value)
- ];
- if (size(tcp["hostname"]:"")>0 && size(tcp["port"]:"")>0){
- connectionURI=sformat("socket://%1:%2", tcp["hostname"]:"", tcp["port"]:"");
- valid=true;
- }else{
- Popup::Error(_("Servername and port couldn't be empty!"));
- }
- break;
- case(`lpr):
+ map tcp=$[
+ "hostname" : UI::QueryWidget(`hostname, `Value),
+ "port" : UI::QueryWidget(`port, `Value)
+ ];
+ if (size(tcp["hostname"]:"")>0 && size(tcp["port"]:"")>0){
+ connection_uri=sformat("socket://%1:%2", tcp["hostname"]:"", tcp["port"]:"");
+ valid=true;
+ }else{
+ Popup::Error(_("Servername and port couldn't be empty!"));
+ }
+ if( valid )
+ { connection_model = (string)UI::QueryWidget( `id("known_manufacturers_combo_box"), `Value );
+ if( "" == connection_model )
+ { valid=false;
+ Popup::Error( _("Select a manufacturer!") );
+ }
+ }
+ break;
case(`lpd):
- map lpd=$[
- "hostname" : UI::QueryWidget(`hostname, `Value),
- "queue" : UI::QueryWidget(`port, `Value)
- ];
- if (size(lpd["hostname"]:"")>0 && size(lpd["queue"]:"")>0){
- connectionURI=sformat("lpd://%1/%2", lpd["hostname"]:"", lpd["queue"]:"");
- valid=true;
- }else{
- Popup::Error(_("Servername and queue name couldn't be empty!"));
- }
- break;
+ map lpd=$[
+ "hostname" : UI::QueryWidget(`hostname, `Value),
+ "queue" : UI::QueryWidget(`port, `Value)
+ ];
+ if (size(lpd["hostname"]:"")>0 && size(lpd["queue"]:"")>0){
+ connection_uri=sformat("lpd://%1/%2", lpd["hostname"]:"", lpd["queue"]:"");
+ valid=true;
+ }else{
+ Popup::Error(_("Servername and queue name couldn't be empty!"));
+ }
+ if( valid )
+ { connection_model = (string)UI::QueryWidget( `id("known_manufacturers_combo_box"), `Value );
+ if( "" == connection_model )
+ { valid=false;
+ Popup::Error( _("Select a manufacturer!") );
+ }
+ }
+ break;
+ case(`lpr):
+ map lpr=$[
+ "hostname" : UI::QueryWidget(`hostname, `Value),
+ "queue" : UI::QueryWidget(`port, `Value)
+ ];
+ if (size(lpr["hostname"]:"")>0 && size(lpr["queue"]:"")>0){
+ connection_uri=sformat("lpd://%1/%2", lpr["hostname"]:"", lpr["queue"]:"");
+ valid=true;
+ }else{
+ Popup::Error(_("Servername and queue name couldn't be empty!"));
+ }
+ break;
case(`cups):
- map cups=$[
- "hostname" : UI::QueryWidget(`hostname, `Value),
- "queue" : UI::QueryWidget(`queue, `Value)
- ];
- if (size(cups["hostname"]:"")>0 && size(cups["queue"]:"")>0){
- connectionURI=sformat("ipp://%1/printers/%2", cups["hostname"]:"", cups["queue"]:"");
- valid=true;
- }else{
- Popup::Error(_("Servername and queue name couldn't be empty!"));
- }
- break;
+ map cups=$[
+ "hostname" : UI::QueryWidget(`hostname, `Value),
+ "queue" : UI::QueryWidget(`queue, `Value)
+ ];
+ if (size(cups["hostname"]:"")>0 && size(cups["queue"]:"")>0){
+ connection_uri=sformat("ipp://%1/printers/%2", cups["hostname"]:"", cups["queue"]:"");
+ valid=true;
+ }else{
+ Popup::Error(_("Servername and queue name couldn't be empty!"));
+ }
+ break;
case(`ipx):
- map ipx=$[
- "hostname" : UI::QueryWidget(`hostname, `Value),
- "printer" : UI::QueryWidget(`queue, `Value),
- "user" : UI::QueryWidget(`user, `Value),
- "pass" : UI::QueryWidget(`pass, `Value)
- ];
- y2internal("novell ipx map %1", ipx);
- connectionURI="novell://";
- if (size(ipx["hostname"]:"")==0 || size(ipx["printer"]:"")==0){
- Popup::Error(_("Servername and printer couldn't be empty!"));
- } else {
- if (size(ipx["user"]:"")>0 && size(ipx["pass"]:"")>0){
- connectionURI=sformat("%1%2:%3@", connectionURI, ipx["user"]:"", ipx["pass"]:"");
- }
- connectionURI=sformat("%1%2/%3", connectionURI, ipx["hostname"]:"", ipx["printer"]:"");
- valid=true;
- }
- break;
+ map ipx=$[
+ "hostname" : UI::QueryWidget(`hostname, `Value),
+ "printer" : UI::QueryWidget(`queue, `Value),
+ "user" : UI::QueryWidget(`user, `Value),
+ "pass" : UI::QueryWidget(`pass, `Value)
+ ];
+ y2internal("novell ipx map %1", ipx);
+ connection_uri="novell://";
+ if (size(ipx["hostname"]:"")==0 || size(ipx["printer"]:"")==0){
+ Popup::Error(_("Servername and printer couldn't be empty!"));
+ } else {
+ if (size(ipx["user"]:"")>0 && size(ipx["pass"]:"")>0){
+ connection_uri=sformat("%1%2:%3@", connection_uri, ipx["user"]:"", ipx["pass"]:"");
+ }
+ connection_uri=sformat("%1%2/%3", connection_uri, ipx["hostname"]:"", ipx["printer"]:"");
+ valid=true;
+ }
+ break;
case(`beh):
- map beh=$[
- "uri" : UI::QueryWidget(`queue, `Value),
- "dont_disable" : UI::QueryWidget(`beh_do_not_disable, `Value),
- "attempts" : UI::QueryWidget(`beh_attempts, `Value),
- "delay" : UI::QueryWidget(`beh_delay, `Value)
- ];
- y2internal("novell ipx map %1", beh);
- if (size(beh["uri"]:"")==0 || size(beh["attempts"]:"")==0 || size(beh["delay"]:"")==0){
- Popup::Error("Servername and printer couldn't be empty!");
- } else {
- connectionURI=sformat("beh://%1/%2/%3/%4", (beh["dont_disable"]:false ? "1" : "0"), beh["attempts"]:"0", beh["delay"]:"", beh["uri"]:"0");
- valid=true;
- }
- break;
+ map beh=$[
+ "uri" : UI::QueryWidget(`queue, `Value),
+ "dont_disable" : UI::QueryWidget(`beh_do_not_disable, `Value),
+ "attempts" : UI::QueryWidget(`beh_attempts, `Value),
+ "delay" : UI::QueryWidget(`beh_delay, `Value)
+ ];
+ y2internal("novell ipx map %1", beh);
+ if (size(beh["uri"]:"")==0 || size(beh["attempts"]:"")==0 || size(beh["delay"]:"")==0){
+ Popup::Error("Servername and printer couldn't be empty!");
+ } else {
+ connection_uri=sformat("beh://%1/%2/%3/%4", (beh["dont_disable"]:false ? "1" : "0"), beh["attempts"]:"0", beh["delay"]:"", beh["uri"]:"0");
+ valid=true;
+ }
+ break;
case(`pipe):
- string pipe = (string) UI::QueryWidget(`program, `Value);
- if (size(pipe)>0){
- connectionURI=sformat("program:/%1", pipe);
- valid=true;
- }
- else Popup::Error(_("Couldn't be empty!"));
- break;
+ string pipe = (string) UI::QueryWidget(`program, `Value);
+ if (size(pipe)>0){
+ connection_uri=sformat("program:/%1", pipe);
+ valid=true;
+ }
+ else Popup::Error(_("Couldn't be empty!"));
+ break;
default:
- y2warning("Unknown type %1", type);
- break;
+ y2warning("Unknown type %1", type);
+ break;
}
- if (!valid) connectionURI="";
+ if (!valid) connection_uri="";
return valid;
}
@@ -427,15 +646,15 @@
else
switch (selected){
case (`tcp):
- hosts=(list<string>)SCR::Read (.net.hostnames, 9100);
- break;
+ hosts=(list<string>)SCR::Read (.net.hostnames, 9100);
+ break;
case (`smb):
- hosts=(list<string>)SCR::Read (.net.hostnames.samba);
- break;
+ hosts=(list<string>)SCR::Read (.net.hostnames.samba);
+ break;
case (`lpr):
case (`lpd):
- hosts=(list<string>)SCR::Read (.net.hostnames, 515);
- break;
+ hosts=(list<string>)SCR::Read (.net.hostnames, 515);
+ break;
case (`cups):
case (`ipp):
hosts = (list<string>)SCR::Read (.net.hostnames, 631);
@@ -445,9 +664,9 @@
return size (queues) > 0;
});
*/
- break;
+ break;
default:
- y2warning("Unknown value: %1", selected);
+ y2warning("Unknown value: %1", selected);
}
UI::ChangeWidget(`hostname, `Items, hosts);
y2milestone("scanForServers selected:%1", selected);
@@ -461,34 +680,34 @@
integer ping_res = (integer) SCR::Execute(.target.bash, sformat("ping -c 1 -w 5 %1", host));
y2milestone("ping %1 : %2", host, ping_res);
if(ping_res!=0) {
- Popup::Error(sformat(_("Host %1 unreachable!"), host));
- test=false;
- return false;
- }
+ Popup::Error(sformat(_("Host %1 unreachable!"), host));
+ test=false;
+ return false;
+ }
string port=(string)UI::QueryWidget(`port, `Value);
integer port_test=-1;
integer port_test_res=-1;
switch(selected){
- case (`tcp):
- port_test = (integer) SCR::Execute(.target.bash, sformat("netcat -w 5 -z %1 %2 2>&1", host, port));
- y2internal("Test port result : %1", port_test);
- if (port_test!=0){
- Popup::Error(sformat("%1 %2", _("No connection possible to port"), port));
- test=false;
- return false;
- }
- port_test_res = (integer) SCR::Execute(.target.bash, sformat("echo -en \"\\r\" | netcat -w 5 %1 %2 2>&1", host, port));
- y2internal("Test connection accept result : %1", port_test_res);
- if(port_test_res!=0){
- Popup::Error(sformat("%1 %2 %3 %4 %5", _("Port"), port, _("on host"), host, _("doesn't accepts data")));
- test=false;
- } else Popup::Message(_("Test OK"));
- break;
+ case(`tcp):
+ port_test = (integer) SCR::Execute(.target.bash, sformat("netcat -w 5 -z %1 %2 2>&1", host, port));
+ y2internal("Test port result : %1", port_test);
+ if (port_test!=0){
+ Popup::Error(sformat("%1 %2", _("No connection possible to port"), port));
+ test=false;
+ return false;
+ }
+ port_test_res = (integer) SCR::Execute(.target.bash, sformat("echo -en \"\\r\" | netcat -w 5 %1 %2 2>&1", host, port));
+ y2internal("Test connection accept result : %1", port_test_res);
+ if(port_test_res!=0){
+ Popup::Error(sformat("%1 %2 %3 %4 %5", _("Port"), port, _("on host"), host, _("doesn't accepts data")));
+ test=false;
+ } else Popup::Message(_("Test OK"));
+ break;
case(`lpd):
case(`lpr):
- string queue=port;
- port="515";
+ string queue=port;
+ port="515";
port_test = (integer) SCR::Execute(.target.bash, sformat("netcat -w 5 -z %1 %2 2>&1", host, port));
y2internal("Test port result : %1", port_test);
if (port_test!=0){
@@ -496,9 +715,9 @@
test=false;
return false;
}
- map available_port=(map)SCR::Execute(.target.bash_output, "for I in 721 722 723 724 725 726 727 728 729 730 731; do fuser -n tcp $I &>/dev/null || { echo -n $I ; break ; } done");
- y2milestone("available port %1", available_port);
- map test_lpd = (map)SCR::Execute(.target.bash_output, sformat("
+ map available_port=(map)SCR::Execute(.target.bash_output, "for I in 721 722 723 724 725 726 727 728 729 730 731; do fuser -n tcp $I &>/dev/null || { echo -n $I ; break ; } done");
+ y2milestone("available port %1", available_port);
+ map test_lpd = (map)SCR::Execute(.target.bash_output, sformat("
TMP_IN=$(mktemp -u /tmp/lpd_test.in.XXXXXX)
TMP_OUT=$(mktemp -u /tmp/lpd_test.out.XXXXXX)
mkfifo $TMP_IN
@@ -517,60 +736,69 @@
exit $RESULT
",available_port["stdout"]:"", host, port, queue
));
- if (test_lpd["exit"]:-1==0) Popup::Message(_("Test OK"));
- else{
- Popup::Error(test_lpd["stderr"]:"");
- test=false;
- }
- break;
+ if (test_lpd["exit"]:-1==0) Popup::Message(_("Test OK"));
+ else{
+ Popup::Error(test_lpd["stderr"]:"");
+ test=false;
+ }
+ break;
}
return test;
}
-boolean storeQueue(symbol selected){
- boolean stored=false;
- y2internal("Storing type %1 : %2", selected, connectionURI);
- Printer::connections=add(Printer::connections, $[
- "uri" : connectionURI,
- "class" : "ConnectionWizardDialog"
- ]);
- return stored;
+boolean storeQueue( symbol selected )
+{ if( "" == connection_uri )
+ { return false;
+ }
+ string model = "Unknown";
+ if( "" != connection_model )
+ { model = connection_model;
+ }
+ y2internal( "Storing type '%1' with uri '%2' for model '%3'", selected, connection_uri, model );
+ Printer::connections = add( Printer::connections,
+ $[ "uri" : connection_uri,
+ "model" : model,
+ "deviceID" : "",
+ "info" : "created by the connection wizard",
+ "class" : "ConnectionWizardDialog"
+ ]
+ );
+ return true;
}
//UI::OpenDialog(content);
any ret = nil;
-while(ret!=`abort && ret!=`back && ret!=`next){
- ret = UI::UserInput();
- symbol selected = (symbol)UI::QueryWidget(`tree_selection, `Value);
- switch( (symbol)ret ){
- case(`tree_selection):
- changeSettingsDialog( selected );
- break;
- case(`next):
- if (validateSettingsDialog( selected )) {
- y2milestone("Writing settings");
- storeQueue( selected );
- } else {
- y2error("Couldn't validate %1", selected);
- ret=nil;
- }
- break;
- case(`cancel):
- return `abort;
- break;
- case(`scan_all):
- scanForServers(selected, true);
- break;
- case(`scan):
- scanForServers(selected, false);
- break;
- case(`test):
- if (validateSettingsDialog(selected)) testQueue(selected);
- break;
- y2internal("ret %1", ret);
- }
+while( ret != `back && ret != `next )
+{ ret = UI::UserInput();
+ symbol selected = (symbol)UI::QueryWidget( `tree_selection, `Value );
+ switch( (symbol)ret )
+ { case(`tree_selection):
+ changeSettingsDialog( selected );
+ break;
+ case(`next):
+ if( validateSettingsDialog( selected ) )
+ { y2milestone( "Writing settings" );
+ storeQueue( selected );
+ }
+ else
+ { y2error( "Couldn't validate %1", selected );
+ ret=nil;
+ }
+ break;
+ case(`scan_all):
+ scanForServers( selected, true );
+ break;
+ case(`scan):
+ scanForServers( selected, false );
+ break;
+ case(`test):
+ if( validateSettingsDialog( selected ) ) testQueue( selected ) ;
+ break;
+ y2internal( "ret %1", ret );
+ }
}
- return ret;
+ return ret;
//UI::CloseDialog();
}
}
+
Modified: trunk/printer/src/sharing.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/printer/src/sharing.ycp?rev=53628&r1=53627&r2=53628&view=diff
==============================================================================
--- trunk/printer/src/sharing.ycp (original)
+++ trunk/printer/src/sharing.ycp Wed Nov 26 16:30:34 2008
@@ -110,7 +110,8 @@
)
),
`HBox
- ( `VSquash
+ ( `HSpacing( 2 ),
+ `VSquash
( `MinHeight
( 5,
`Table
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org