[yast-commit] r56559 - /trunk/network/src/services/proxy.ycp
Author: kmachalkova Date: Thu Apr 2 09:54:55 2009 New Revision: 56559 URL: http://svn.opensuse.org/viewcvs/yast?rev=56559&view=rev Log: Show "really abort" pop-up dialog only when there is something to do (#460172) + some rearrangements of widget initialization Modified: trunk/network/src/services/proxy.ycp Modified: trunk/network/src/services/proxy.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/network/src/services/proxy.ycp?rev=56559&r1=56558&r2=56559&view=diff ============================================================================== --- trunk/network/src/services/proxy.ycp (original) +++ trunk/network/src/services/proxy.ycp Thu Apr 2 09:54:55 2009 @@ -29,6 +29,10 @@ string no = ""; string user = ""; string pass = ""; +boolean same_proxy = false; +/* String to pre-filled into the proxy server field */ +string prefill = "http://"; + // from OnlineUpdateDialogs.ycp /** @@ -39,6 +43,14 @@ * @param string message with the short error message * @param string details with all of the error details */ + +boolean modified() { + return !(Proxy::http == http && Proxy::ftp == ftp && Proxy::no == no && + Proxy::https == https && + Proxy::user == user && Proxy::pass == pass && + Proxy::enabled == enabled); +} + define void ErrorPopupGeneric( string message, string details ) { // Informative label if ( size( details ) == 0 ) details = _("No details available."); @@ -258,6 +270,37 @@ } } +void InitSameProxy() { + //We have the same (non-empty) proxy URL for all protocols + if((http != prefill) && (http == https) && (https == ftp )){ + UI::ChangeWidget(`id(`same_proxy), `Value, true); + UI::ChangeWidget(`id(`https), `Enabled, false); + UI::ChangeWidget(`id(`https), `Value, prefill); + UI::ChangeWidget(`id(`ftp), `Enabled, false); + UI::ChangeWidget(`id(`ftp), `Value, prefill); + } +} + +void QueryWidgets() { + same_proxy = (boolean) UI::QueryWidget(`id(`same_proxy), `Value); + http = (string) UI::QueryWidget(`id(`http), `Value); + if (same_proxy) { + https = http; + ftp = http; + } + else { + https = (string) UI::QueryWidget(`id(`https), `Value); + ftp = (string) UI::QueryWidget(`id(`ftp), `Value); + } + + user = (string) UI::QueryWidget(`id(`user), `Value); + pass = (string) UI::QueryWidget(`id(`pass), `Value); + enabled = (boolean) UI::QueryWidget(`id(`enabled), `Value); + + no = (string) UI::QueryWidget(`id(`no), `Value); + +} + /** * Proxy dialog * @param standalone true if not run from another ycp client @@ -275,9 +318,6 @@ ScreenName("proxy"); - /* String to pre-filled into the proxy server field */ - string prefill = "http://"; - if(http == "") http = prefill; if(https == "") https = prefill; if(ftp == "") ftp = prefill; @@ -368,10 +408,10 @@ `Frame(`id(`frame2), _("Proxy Authentication"), `HBox(`HSpacing(2), `VBox( /* Text entry label */ `HBox ( - `TextEntry(`id(`user), _("Proxy &User Name"), user), + `InputField(`id(`user), `opt(`hstretch), _("Proxy &User Name"), user), `HSpacing(0.5), /* Password entry label */ - `Password(`id(`pass), _("Proxy &Password"), pass), + `Password( `id(`pass), `opt(`hstretch), _("Proxy &Password"), pass), (textmode) ? `Empty() : `VSpacing(0.4) )), `HSpacing(2))), `VSpacing(s), @@ -394,13 +434,6 @@ Label::BackButton(), Label::OKButton()); */ - //We have the same (non-empty) proxy URL for all protocols - if((http != prefill) && (http == https) && (https == ftp )){ - UI::ChangeWidget(`id(`same_proxy), `Value, true); - UI::ChangeWidget(`id(`https), `Enabled, false); - UI::ChangeWidget(`id(`ftp), `Enabled, false); - } - // #103841, relaxed. now avoiding only quotes // #337048 allow using space as well // was CAlnum() + ".:_-/\\" @@ -414,6 +447,7 @@ UI::ChangeWidget(`id(`frame2), `Enabled, enabled); if ( !Mode::installation() ) UI::ChangeWidget(`id("test_proxy"), `Enabled, enabled) ; + InitSameProxy(); if(enabled == true) UI::SetFocus(`id(`http)); else UI::SetFocus(`id(`enabled)); @@ -422,47 +456,30 @@ while(true) { ret = UI::UserInput(); + QueryWidgets(); /* abort? */ if(ret == `abort || ret == `cancel || ret == `back) { - if(ReallyAbort()) break; + if(ReallyAbortCond( modified() )) break; else continue; } if(ret == `enabled) { - enabled = (boolean) UI::QueryWidget(`id(`enabled), `Value); UI::ChangeWidget(`id(`frame1), `Enabled, enabled); - UI::ChangeWidget(`id(`frame2), `Enabled, enabled); - UI::ChangeWidget(`id("test_proxy"), `Enabled, enabled); + UI::ChangeWidget(`id(`frame2), `Enabled,enabled); + UI::ChangeWidget(`id("test_proxy"), `Enabled, !enabled); + InitSameProxy(); continue; } else if(ret == `same_proxy) { - enabled = (boolean) UI::QueryWidget(`id(`same_proxy), `Value); - UI::ChangeWidget(`id(`https), `Value, prefill); UI::ChangeWidget(`id(`ftp), `Value, prefill); - UI::ChangeWidget(`id(`https), `Enabled, !enabled); - UI::ChangeWidget(`id(`ftp), `Enabled, !enabled); + UI::ChangeWidget(`id(`https), `Enabled, !same_proxy); + UI::ChangeWidget(`id(`ftp), `Enabled, !same_proxy); continue; } /* next */ else if (ret == `next || ret == "test_proxy") { - boolean same_proxy = (boolean) UI::QueryWidget(`id(`same_proxy), `Value); - http = (string) UI::QueryWidget(`id(`http), `Value); - if (same_proxy) { - https = http; - ftp = http; - } - else { - https = (string) UI::QueryWidget(`id(`https), `Value); - ftp = (string) UI::QueryWidget(`id(`ftp), `Value); - } - - user = (string) UI::QueryWidget(`id(`user), `Value); - pass = (string) UI::QueryWidget(`id(`pass), `Value); - enabled = (boolean) UI::QueryWidget(`id(`enabled), `Value); - - no = (string) UI::QueryWidget(`id(`no), `Value); list<string> no_list = splitstring (no, " ,"); no_list = filter (string no_i, no_list, ``( no_i != "") ); no = mergestring (no_list, ", "); @@ -552,10 +569,7 @@ if(ret == `next) { - if(Proxy::http == http && Proxy::ftp == ftp && Proxy::no == no && - Proxy::https == https && - Proxy::user == user && Proxy::pass == pass && - Proxy::enabled == enabled) { + if (!modified()){ y2debug("not modified"); return ret; @@ -571,9 +585,7 @@ Proxy::pass = pass; } - Proxy::modified = true; -// if (!Mode::config ()) -// ProxyFinishPopup(true); + Proxy::SetModified(); } return ret; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org