[yast-commit] r48082 - in /trunk/packager: package/yast2-packager.changes src/clients/repositories.ycp src/include/repositories_include.ycp src/modules/SourceDialogs.ycp
Author: lslezak Date: Wed Jun 4 17:42:22 2008 New Revision: 48082 URL: http://svn.opensuse.org/viewcvs/yast?rev=48082&view=rev Log: - fixed editing of an invalid repository URL (bnc#386384), set the selected repository type when going back Modified: trunk/packager/package/yast2-packager.changes trunk/packager/src/clients/repositories.ycp trunk/packager/src/include/repositories_include.ycp trunk/packager/src/modules/SourceDialogs.ycp Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.c... ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Wed Jun 4 17:42:22 2008 @@ -2,6 +2,8 @@ Wed Jun 4 17:26:06 CEST 2008 - lslezak@suse.cz - use PackageLock::Connect() - display [Abort] button (bnc#293356) +- fixed editing of an invalid repository URL (bnc#386384), + set the selected repository type when going back ------------------------------------------------------------------- Wed Jun 4 13:19:01 CEST 2008 - lslezak@suse.cz Modified: trunk/packager/src/clients/repositories.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/repositories... ============================================================================== --- trunk/packager/src/clients/repositories.ycp (original) +++ trunk/packager/src/clients/repositories.ycp Wed Jun 4 17:42:22 2008 @@ -814,7 +814,61 @@ // sort the maps by "repos" key (in ascending order) list<map<string,any> > ret = sort(map<string,any> repo1, map<string,any> repo2, repos, {return repo1["priority"]:default_priority < repo2["priority"]:default_priority;}); - y2internal("SortReposByPriority: %1 -> %2", repos, ret); + y2milestone("SortReposByPriority: %1 -> %2", repos, ret); + + return ret; +} + +// remember the original selected URL scheme +string selected_url_scheme = ""; + +symbol StartTypeDialog() +{ + string seturl = selected_url_scheme; + + if (seturl != nil && seturl != "") + { + seturl = selected_url_scheme + "://"; + } + + symbol ret = TypeDialogOpts(true, seturl); + + if (ret == `back) + { + selected_url_scheme = ""; + } + else + { + selected_url_scheme = URL::Parse(SourceDialogs::GetURL())["scheme"]:""; + y2milestone("Selected URL scheme: %1", selected_url_scheme); + + if (selected_url_scheme == nil || selected_url_scheme == "") + { + selected_url_scheme = "url"; + } + } + + return ret; +} + +symbol StartEditDialog() +{ + y2milestone("Edit URL with protocol %1", selected_url_scheme); + symbol ret = SourceDialogs::EditDialogProtocol(selected_url_scheme); + y2milestone("Result: %1", ret); + + return ret; +} + +symbol StartStoreSource() +{ + symbol ret = StoreSource(); + + if (ret == `next || ret == `abort || ret == `close) + { + y2milestone("Resetting selected URL scheme"); + selected_url_scheme = ""; + } return ret; } @@ -872,9 +926,9 @@ map<string,any> aliases = $[ "summary" : ``(SummaryDialog ()), - "type" : ``(TypeDialog()), - "edit" : ``(EditDialog ()), - "store" : ``(StoreSource ()), + "type" : ``(StartTypeDialog()), + "edit" : ``(StartEditDialog ()), + "store" : ``(StartStoreSource ()), "keymgr" : [``(RunGPGKeyMgmt(false)), true] ]; @@ -922,7 +976,7 @@ if (WFM::Args() == [ `sw_single_mode ]) { - y2internal("Started from sw_single, switching the mode"); + y2milestone("Started from sw_single, switching the mode"); full_mode = true; any ret = StartInstSource(); Modified: trunk/packager/src/include/repositories_include.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/include/repositories... ============================================================================== --- trunk/packager/src/include/repositories_include.ycp (original) +++ trunk/packager/src/include/repositories_include.ycp Wed Jun 4 17:42:22 2008 @@ -248,6 +248,11 @@ return `ok; } } + else + { + y2error(-1, "Empty URL! Backtrace:"); + return `again; + } } symbol StoreSource () { @@ -306,11 +311,11 @@ return `next; } -symbol TypeDialog() +symbol TypeDialogOpts(boolean download, string url) { - SourceDialogs::SetDownloadOption(true); - // reset the stored URL - SourceDialogs::SetURL(""); + SourceDialogs::SetDownloadOption(download); + SourceDialogs::SetURL(url); + map<string,any> td = SourceDialogs::TypeDialogDownloadOpt(); symbol ret = td["ui"]:`next; @@ -318,6 +323,12 @@ return ret; } +symbol TypeDialog() +{ + // download metadata, reset the stored URL + return TypeDialogOpts(true, ""); +} + symbol EditDialog() { symbol ret = SourceDialogs::EditDialog (); Modified: trunk/packager/src/modules/SourceDialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/modules/SourceDialog... ============================================================================== --- trunk/packager/src/modules/SourceDialogs.ycp (original) +++ trunk/packager/src/modules/SourceDialogs.ycp Wed Jun 4 17:42:22 2008 @@ -1220,7 +1220,10 @@ else if (type != `ftp) // FTP needs to distinguish absolute and relative path { - directory = Slashed (directory); + // do not add the slash if host and directory is empty + // (avoid e.g. http:// -> http:/// when switching from the parts to the complete view) + if (host != "" || directory != "") + directory = Slashed (directory); } if (UI::WidgetExists (`id (`workgroup))) { @@ -1252,6 +1255,10 @@ _url = (string)UI::QueryWidget(`id(`complete_url), `Value); } +// use selected editing URL part, remember the value in case the URL is wrong +// and the dialog needs to displayed again +boolean editing_parts = true; + /** * Handle function of a widget * @param key string widget key @@ -1377,6 +1384,8 @@ ServerStoreParts(); } + editing_parts = (id == `edit_url_parts); + // reinitialize the dialog (set the current values) ServerInit(nil); } @@ -1387,9 +1396,12 @@ * @param key string widget key */ void ServerInit (string key) { - // check the current edit type - symbol current_type = (symbol)UI::QueryWidget(`id(`edit_type), `Value); + symbol current_type = editing_parts ? `edit_url_parts : `edit_complete_url; + + // set the stored value + UI::ChangeWidget(`id(`edit_type), `Value, current_type); + y2debug("Current edit type: %1", current_type); UI::ReplaceWidget(`id(`edit_content), (current_type == `edit_url_parts) ? details_content : complete_content); @@ -1522,7 +1534,9 @@ symbol current_type = (symbol)UI::QueryWidget(`id(`edit_type), `Value); y2debug("Current edit type: %1", current_type); - if (current_type == `edit_url_parts) + editing_parts = (current_type == `edit_url_parts); + + if (editing_parts) { ServerStoreParts(); } @@ -1532,7 +1546,6 @@ } } - /** * Get widget description map * @return widget description map @@ -1543,9 +1556,9 @@ "custom_widget" : `VBox ( `RadioButtonGroup (`id (`edit_type), `HBox ( - `RadioButton(`id(`edit_url_parts), `opt(`notify), _("Edit Parts of the URL"), true), + `RadioButton(`id(`edit_url_parts), `opt(`notify), _("Edit Parts of the URL"), editing_parts), `HSpacing(2), - `RadioButton(`id(`edit_complete_url), `opt(`notify), _("Edit Complete URL")) + `RadioButton(`id(`edit_complete_url), `opt(`notify), _("Edit Complete URL"), !editing_parts) ) ), `VSpacing(0.3), @@ -1782,7 +1795,7 @@ symbol selected = (symbol)UI::QueryWidget (`id (`type), `CurrentButton); if (contains ([`ftp, `http, `https, `samba, `nfs, `cd, `dvd, `usb, `hd, - `local_dir, `specify__url, `slp, `local_iso, `comm_repos], selected)) + `local_dir, `specify_url, `slp, `local_iso, `comm_repos], selected)) { if ( selected == `ftp ) _url = "ftp://"; else if ( selected == `http ) _url = "http://"; @@ -2030,8 +2043,8 @@ * Sample implementation of URL selection dialog * @return symbol for wizard sequencer */ -global symbol EditDialog () { - string proto = URLScheme (_url); +global symbol EditDialogProtocol(string proto) +{ y2milestone ("Displaying dialog for protocol %1", proto); string caption = _caption[proto]:""; @@ -2045,6 +2058,15 @@ "fallback_functions" : $[] ]); } +/** + * Sample implementation of URL selection dialog + * @return symbol for wizard sequencer + */ +global symbol EditDialog () { + string proto = URLScheme (_url); + + return EditDialogProtocol(proto); +} /** * URL editation popup with the HTTPS option -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org