[yast-commit] r51765 - /trunk/packager/src/clients/repositories.ycp
Author: lslezak Date: Wed Oct 1 17:17:00 2008 New Revision: 51765 URL: http://svn.opensuse.org/viewcvs/yast?rev=51765&view=rev Log: - fixed multi refresh Modified: trunk/packager/src/clients/repositories.ycp Modified: trunk/packager/src/clients/repositories.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/repositories.ycp?rev=51765&r1=51764&r2=51765&view=diff ============================================================================== --- trunk/packager/src/clients/repositories.ycp (original) +++ trunk/packager/src/clients/repositories.ycp Wed Oct 1 17:17:00 2008 @@ -139,8 +139,6 @@ map generalData = Pkg::SourceGeneralData( id ); y2milestone("generalData(%1): %2", id, generalData); - y2internal("Item: %1", source); - string name = repository_mode ? (haskey(source, "name") ? source["name"]:"" : // unkown name (alias) of the source @@ -214,8 +212,6 @@ if (repo_mode && service_name != "") { itemList = ReposFromService(service_name, itemList); - - y2internal("table items: %1", itemList); } integer numItems = size(itemList); @@ -226,7 +222,7 @@ i = i + 1; } - y2internal("New table content: %1", items); + y2milestone("New table content: %1", items); UI::ChangeWidget( `id( `table ), `Items, items ); } @@ -263,10 +259,8 @@ void fillRepoInfo(integer index, map source, boolean repo_mode, string service_name) { - y2internal(-1, "fillRepoInfo: index: %1, source; %2, repo_mode: %3, service_name: %4", - index, source, repo_mode, service_name); map<string,any> info = repo_mode ? getSourceInfo (index, source) : source; - y2internal("getSourceInfo(%1, %2): %3", index, source, info); + y2milestone("getSourceInfo(%1, %2): %3", index, source, info); // heading - in case repo name not found string name = info["name"]:_("Unknown repository name"); @@ -800,7 +794,7 @@ any current_item = UI::QueryWidget(`id(`tree), `CurrentItem); // rebuild the dialog if needed - y2internal("Current tree item: %1", current_item); + y2milestone("Current tree item: %1", current_item); boolean update_table_widget = false; if (current_item == `repositories) @@ -1016,10 +1010,10 @@ else { // refresh a service - string service_name = (serviceStatesOut[current]:$[])["name"]:""; + string service_alias = (serviceStatesOut[current]:$[])["alias"]:""; - y2milestone("Refreshing service %1...", service_name); - Pkg::ServiceRefresh(service_name); + y2milestone("Refreshing service %1...", service_alias); + Pkg::ServiceRefresh(service_alias); } } else if ( input == `autorefresh_all || input == `refresh_enabled) @@ -1031,13 +1025,19 @@ boolean refresh_autorefresh_only = input == `autorefresh_all; integer to_refresh = 0; -// TODO FIXME list<map<string,any> > data = + list<map<string,any> > data = (repository_view) ? + (displayed_service == "" ? sourceStatesOut : ReposFromService(displayed_service, sourceStatesOut)) + : serviceStatesOut; + + y2internal("data: %1", data); - foreach(map<string,any> src_state, sourceStatesOut, + foreach(map<string,any> src_state, data, { if (src_state["enabled"]:false && (!refresh_autorefresh_only || src_state["autorefresh"]:false)) { - string url = Pkg::SourceGeneralData(src_state["SrcId"]:-1)["url"]:""; + string url = repository_view ? + (Pkg::SourceGeneralData(src_state["SrcId"]:-1)["url"]:"") + : src_state["url"]:""; string schema = tolower(substring(url, 0, 3)); if (schema != "cd:" && schema != "dvd") @@ -1048,45 +1048,60 @@ } ); - y2milestone("%1 repositories will be refreshed", to_refresh); + y2milestone("%1 %2 will be refreshed", to_refresh, repository_view ? "repositories" : "services"); if (to_refresh > 0) { Wizard::CreateDialog (); // TODO: add help text - Progress::New(_("Refreshing Repositories"), "", to_refresh + 1, [ _("Refresh Repositories") ], [], ""); + Progress::New(repository_view ? _("Refreshing Repositories") : _("Refreshing Services"), + "", to_refresh + 1, [ repository_view ? _("Refresh Repositories") : _("Refresh Services") ], + [], ""); - foreach(map<string,any> src_state, sourceStatesOut, + foreach(map<string,any> src_state, data, { if (src_state["enabled"]:false && (!refresh_autorefresh_only || src_state["autorefresh"]:false)) { - integer srcid = src_state["SrcId"]:-1; string name = src_state["name"]:""; + if (repository_view) + { + integer srcid = src_state["SrcId"]:-1; - string url = Pkg::SourceGeneralData(src_state["SrcId"]:-1)["url"]:""; - string schema = tolower(substring(url, 0, 3)); + string url = Pkg::SourceGeneralData(src_state["SrcId"]:-1)["url"]:""; + string schema = tolower(substring(url, 0, 3)); - if (schema != "cd:" && schema != "dvd") - { - y2milestone("Autorefreshing repository %1 (%2)", srcid, name); + if (schema != "cd:" && schema != "dvd") + { + y2milestone("Autorefreshing repository %1 (%2)", srcid, name); - // progress bar label - Progress::Title(sformat(_("Refreshing Repository %1..."), name)); + // progress bar label + Progress::Title(sformat(_("Refreshing Repository %1..."), name)); + + Pkg::SourceRefreshNow(srcid); - Pkg::SourceRefreshNow(srcid); + if (full_mode && src_state["enabled"]:false) + { + // force loading of the resolvables + Pkg::SourceSetEnabled(srcid, false); + Pkg::SourceSetEnabled(srcid, true); + } - if (full_mode && src_state["enabled"]:false) + Progress::NextStep(); + } + else { - // force loading of the resolvables - Pkg::SourceSetEnabled(srcid, false); - Pkg::SourceSetEnabled(srcid, true); + y2milestone("Skipping a CD/DVD repository %1 (%2)", srcid, name); } - - Progress::NextStep(); } else { - y2milestone("Skipping a CD/DVD repository %1 (%2)", srcid, name); + string service_alias = src_state["alias"]:""; + + // refreshing services + // progress bar label + Progress::Title(sformat(_("Refreshing Service %1..."), name)); + y2milestone("Refreshing service %1 (alias: %2)...", name, service_alias); + Pkg::ServiceRefresh(service_alias); } } } @@ -1141,23 +1156,19 @@ } else { - if (displayed_service == "") - { - map<string,any> srv = serviceStatesOut[current]:$[]; - y2internal("Selected service: %1", srv); + map<string,any> srv = serviceStatesOut[current]:$[]; + y2milestone("Selected service: %1", srv); - boolean state = srv["enabled"]:false; - state = !state; + boolean state = srv["enabled"]:false; + state = !state; - // update the table - string newstate = ( state ? UI::Glyph (`CheckMark) : ""); - UI::ChangeWidget( `id( `table ), `Item( current, 0 ), newstate ); - - // store the change - srv["enabled"] = state; - serviceStatesOut[current] = srv; - } - // TODO else... + // update the table + string newstate = ( state ? UI::Glyph (`CheckMark) : ""); + UI::ChangeWidget( `id( `table ), `Item( current, 0 ), newstate ); + + // store the change + srv["enabled"] = state; + serviceStatesOut[current] = srv; } } else if ( input == `autorefresh) -- 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