[yast-commit] r40533 - in /trunk/squid/src: Squid.ycp complex.ycp dialogs.ycp handlers.ycp wizards.ycp
Author: dfiser Date: Tue Aug 28 13:59:33 2007 New Revision: 40533 URL: http://svn.opensuse.org/viewcvs/yast?rev=40533&view=rev Log: Added possibility to enable/disable service (bug #304271). Changed some button labels. Modified: trunk/squid/src/Squid.ycp trunk/squid/src/complex.ycp trunk/squid/src/dialogs.ycp trunk/squid/src/handlers.ycp trunk/squid/src/wizards.ycp Modified: trunk/squid/src/Squid.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/Squid.ycp?rev=40533&r1=40532&r2=40533&view=diff ============================================================================== --- trunk/squid/src/Squid.ycp (original) +++ trunk/squid/src/Squid.ycp Tue Aug 28 13:59:33 2007 @@ -55,6 +55,12 @@ boolean modified = false; /** + * Is service enabled? + */ +boolean service_enabled = false; + + +/** * Map of all configuration settings except consequential. Format: * $[ "parameter name" : [ list of options (rest of line) ] * ... @@ -366,6 +372,18 @@ } +/******* SERVICE *******/ +global boolean IsServiceEnabled() +{ + return service_enabled; +} + +global void SetServiceEnabled(boolean enabled) +{ + service_enabled = enabled; +} +/******* SERVICE END **/ + /******* ACL *******/ global list<map<string,any> > GetACLs() { @@ -953,6 +971,12 @@ return ok; } +boolean readServiceStatus() +{ + service_enabled = Service::Enabled("squid"); + return true; +} + boolean readAllSettings() { boolean ok = true; @@ -972,6 +996,9 @@ if (!readRestSetting()) ok = false; Progress::NextStep(); + if (!readServiceStatus()) ok = false; + Progress::NextStep(); + return ok; } @@ -984,7 +1011,7 @@ Progress::New(_("Initializing squid Configuration"), " ", - 5, + 6, [_("Read the settings.")], [_("Reading the setting ...")], ""); @@ -1000,6 +1027,7 @@ y2debug("Squid::Read - acls: %1", acls); y2debug("Squid::Read - refresh_patterns: %1", refresh_patterns); y2debug("Squid::Read - settings: %1", settings); + y2debug("Squid::Read - enabled: %1", service_enabled); y2milestone("================ Setting END =================="); /* Error message */ @@ -1231,6 +1259,16 @@ return ok; } +global boolean EnableService() +{ + return Service::Enable("squid"); +} + +global boolean DisableService() +{ + return Service::Disable("squid"); +} + /** * Write all squid settings * @return true on success @@ -1268,6 +1306,10 @@ ok = false; } + //enabling / disabling service + if (service_enabled == true) EnableService(); + if (service_enabled == false) DisableService(); + // start Service if(Abort()) return false; Progress::NextStage (); Modified: trunk/squid/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/complex.ycp?rev=40533&r1=40532&r2=40533&view=diff ============================================================================== --- trunk/squid/src/complex.ycp (original) +++ trunk/squid/src/complex.ycp Tue Aug 28 13:59:33 2007 @@ -86,11 +86,20 @@ } - string main_caption = _("Squid"); map<string, map<string, any> > widget_descr = $[ - "start_stop" : CWMServiceStart::CreateStartStopWidget ($[ + "auto_start" : CWMServiceStart::CreateAutoStartWidget($[ + "get_service_auto_start" : Squid::IsServiceEnabled, + "set_service_auto_start" : Squid::SetServiceEnabled, + "start_auto_button" : _("When &Booting"), + "start_manual_button" : _("&Manually"), + "help" : sformat(CWMServiceStart::AutoStartHelpTemplate(), + _("When Booting"), + _("Manually") + ) + ]), + "start_stop" : CWMServiceStart::CreateStartStopWidget($[ "service_id" : "squid", "service_running_label" : _("Squid is running"), "service_not_running_label" : _("Squid is not running"), @@ -108,7 +117,7 @@ // TRANSLATORS: part of help text - push button label, NO SHORTCUT!!! _("Save Settings and Restart Squid Now") ) - ]), + ]), "http_ports_table" : $[ "widget" : `custom, @@ -181,10 +190,13 @@ map<string, map<string, any> > screens = $[ "s1" : $[ - "widget_names" : ["start_stop"], + "widget_names" : ["auto_start", "start_stop"], "contents" : `HBox( `HSpacing(3), - "start_stop", + `VBox( + "auto_start", + "start_stop" + ), `HSpacing(3) ), "caption" : main_caption + ": " + _("Start-Up"), @@ -247,13 +259,8 @@ list<string> ids_order = ["s1", "s2", "s3", "s4", "s5", "s6", "s7"]; string initial_screen = "s1"; -any MainDialog(boolean start_up_dialog) +any MainDialog() { - if (!start_up_dialog){ - ids_order = remove(ids_order, 0); - initial_screen = "s2"; - } - return DialogTree::ShowAndRun($[ "ids_order" : ids_order, "initial_screen" : initial_screen, Modified: trunk/squid/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/dialogs.ycp?rev=40533&r1=40532&r2=40533&view=diff ============================================================================== --- trunk/squid/src/dialogs.ycp (original) +++ trunk/squid/src/dialogs.ycp Tue Aug 28 13:59:33 2007 @@ -82,22 +82,22 @@ `HBox( `HWeight(1,`VBox( `VWeight(1, `HBox( - `IntField(`id("cache_mem"), _("Cache Memory"), 1, 99999, 10), + `IntField(`id("cache_mem"), _("C&ache Memory"), 1, 99999, 10), sizeUnitWidget("cache_mem_units") )), `VSpacing(0.4), `VWeight(1, `HBox( - `IntField(`id("cache_max_object_size"), _("Max Object Size"), 0, 99999, 0), + `IntField(`id("cache_max_object_size"), _("Ma&x Object Size"), 0, 99999, 0), sizeUnitWidget("cache_max_object_size_units") )), `VSpacing(0.4), `VWeight(1, `HBox( - `IntField(`id("cache_swap_low"), _("Swap Low-Water Mark (in percents)"), 0, 100, 0) + `IntField(`id("cache_swap_low"), _("Swap &Low-Water Mark (in percents)"), 0, 100, 0) )), `VSpacing(0.4), `Left(`VWeight(1, `HBox( `ComboBox(`id("cache_replacement_policy"), - _("Cache Replacement Policy"), + _("&Cache Replacement Policy"), [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")]) ))) )), @@ -106,17 +106,17 @@ `VWeight(1, `HBox(`Empty())), `VSpacing(0.4), `VWeight(1, `HBox( - `IntField(`id("cache_min_object_size"), _("Min Object Size"), 0, 99999, 0), + `IntField(`id("cache_min_object_size"), _("M&in Object Size"), 0, 99999, 0), sizeUnitWidget("cache_min_object_size_units") )), `VSpacing(0.4), `VWeight(1, `HBox( - `IntField(`id("cache_swap_high"), _("Swap High-Water Mark (in percents)"), 0, 100, 0) + `IntField(`id("cache_swap_high"), _("Swap &High-Water Mark (in percents)"), 0, 100, 0) )), `VSpacing(0.4), `Left(`VWeight(1, `HBox( `ComboBox(`id("memory_replacement_policy"), - _("Memory Replacement Policy"), + _("&Memory Replacement Policy"), [`item("lru"), `item("heap GDSF"), `item("heap LFUDA"), `item("heap LRU")]) ))) )) @@ -126,15 +126,15 @@ `VWeight(1, `Frame(_("Cache Directory"), `VBox( `VSquash(`HBox( - `TextEntry(`id("cache_dir"), _("Cache Directory"), ""), + `TextEntry(`id("cache_dir"), _("Cache &Directory"), ""), `Bottom(`PushButton(`id(`browse_cache_dir), Label::BrowseButton())) )), `VSpacing(0.4), - `IntField(`id("mbytes"), _("Size (in MB)"), 1, 99999, 1), + `IntField(`id("mbytes"), _("&Size (in MB)"), 1, 99999, 1), `VSpacing(0.4), - `IntField(`id("l1dirs"), _("Level 1 Directories"), 1, 99999, 1), + `IntField(`id("l1dirs"), _("L&evel 1 Directories"), 1, 99999, 1), `VSpacing(0.4), - `IntField(`id("l2dirs"), _("Level 2 Directories"), 1, 99999, 1) + `IntField(`id("l2dirs"), _("Le&vel 2 Directories"), 1, 99999, 1) ) )) ), @@ -186,18 +186,18 @@ `Frame(_("Logging"), `VBox( `VSquash(`HBox( - `TextEntry(`id("access_log"), _("Access Log") , ""), + `TextEntry(`id("access_log"), _("&Access Log") , ""), `Bottom(`PushButton(`id(`access_log_browse), Label::BrowseButton())) )), `VSquash(`HBox( - `TextEntry(`id("cache_log"), _("Cache Log"), ""), + `TextEntry(`id("cache_log"), _("&Cache Log"), ""), `Bottom(`PushButton(`id(`cache_log_browse), Label::BrowseButton())) )), `VSquash(`HBox( - `TextEntry(`id("cache_store_log"), _("Cache Store Log"), ""), + `TextEntry(`id("cache_store_log"), _("Cache &Store Log"), ""), `Bottom(`PushButton(`id(`cache_store_log_browse), Label::BrowseButton())) )), - `Left(`CheckBox(`id("emulate_httpd_log"), _("Emulate Httpd Log?"))) + `Left(`CheckBox(`id("emulate_httpd_log"), _("&Emulate Httpd Log?"))) ) ); } @@ -208,11 +208,11 @@ `Frame(_("Timeouts"), `VBox( `HBox( - `IntField(`id("connect_timeout"), _("Connection timeout"), 0, 99999, 0), + `IntField(`id("connect_timeout"), _("Connection &Timeout"), 0, 99999, 0), timeUnitWidget("connect_timeout_units") ), `HBox( - `IntField(`id("client_lifetime"), _("Client Lifetime"), 0, 99999, 0), + `IntField(`id("client_lifetime"), _("Client &Lifetime"), 0, 99999, 0), timeUnitWidget("client_lifetime_units") ) ) @@ -225,12 +225,12 @@ return `HVCenter(`Frame(_("Miscellaneous Setting"), `VBox( `ComboBox(`id("error_language"), - _("Language of error messages"), + _("&Language of error messages"), []), `VSpacing(), - `TextEntry(`id("cache_mgr"), _("Administrator's e-mail"), ""), + `TextEntry(`id("cache_mgr"), _("&Administrator's e-mail"), ""), `VSpacing(), - `CheckBox(`id("ftp_passive"), _("Use Ftp Pasive Mode")) + `CheckBox(`id("ftp_passive"), _("&Use Ftp Pasive Mode")) ))); } Modified: trunk/squid/src/handlers.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/handlers.ycp?rev=40533&r1=40532&r2=40533&view=diff ============================================================================== --- trunk/squid/src/handlers.ycp (original) +++ trunk/squid/src/handlers.ycp Tue Aug 28 13:59:33 2007 @@ -56,10 +56,7 @@ id_item = DelFromHttpPortsTable((integer)UI::QueryWidget(`id("http_port"), `CurrentItem)); InitHttpPortsTable(""); UI::ChangeWidget(`id("http_port"), `CurrentItem, id_item); - }else{ - return (symbol)ui; } - return nil; } @@ -94,10 +91,7 @@ InitRefreshPatternsTable(""); UI::ChangeWidget(`id("refresh_patterns"), `CurrentItem, id_item); } - }else{ - return (symbol)ui; } - return nil; } @@ -144,10 +138,7 @@ tmp = UI::QueryWidget(`id("cache_swap_high"), `Value); if ((integer)UI::QueryWidget(`id("cache_swap_low"), `Value) > (integer)tmp) UI::ChangeWidget(`id("cache_swap_low"), `Value, tmp); - }else{ - return (symbol)ui; } - return nil; } @@ -196,10 +187,7 @@ InitHttpAccessTable(""); UI::ChangeWidget(`id("http_access"), `CurrentItem, id_item); } - }else{ - return (symbol)ui; } - return nil; } @@ -221,10 +209,7 @@ tmp = UI::AskForExistingFile("/var/log", "*", "Cache Store Log"); if (tmp != nil) UI::ChangeWidget(`id("cache_store_log"), `Value, tmp); - }else{ - return (symbol)ui; } - return nil; } Modified: trunk/squid/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/squid/src/wizards.ycp?rev=40533&r1=40532&r2=40533&view=diff ============================================================================== --- trunk/squid/src/wizards.ycp (original) +++ trunk/squid/src/wizards.ycp Tue Aug 28 13:59:33 2007 @@ -43,8 +43,8 @@ * Main workflow of the squid configuration * @return sequence result */ -any MainSequence(boolean start_up_dialog) { - map aliases = $[ "main" : ``(MainDialog(start_up_dialog))]; +any MainSequence() { + map aliases = $[ "main" : ``(MainDialog())]; map sequence = $[ "ws_start" : "main", "main" : $[ @@ -65,13 +65,11 @@ map aliases = $[ "read" : [ ``( ReadDialog() ), true ], - "main" : ``( MainSequence(true) ), + "main" : ``( MainSequence() ), "write" : [ ``( WriteDialog() ), true ] ]; - map sequence = $[ - "ws_start" : "read", - "read" : $[ + map sequence = $[ "ws_start" : "read", "read" : $[ `abort : `abort, `next : "main" ], @@ -109,7 +107,7 @@ Wizard::SetContentsButtons(caption, contents, "", Label::BackButton(), Label::NextButton()); - any ret = MainSequence(false); + any ret = MainSequence(); UI::CloseDialog(); return ret; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
dfiser@svn.opensuse.org