Author: kmachalkova
Date: Wed Jul 16 18:56:29 2008
New Revision: 49195
URL: http://svn.opensuse.org/viewcvs/yast?rev=49195&view=rev
Log:
backup check-in: initial work on supporting
multiple searches and storing results in two tabs
Modified:
trunk/packager/src/clients/webpin_package_search.ycp
Modified: trunk/packager/src/clients/webpin_package_search.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/webpin_package_search.ycp?rev=49195&r1=49194&r2=49195&view=diff
==============================================================================
--- trunk/packager/src/clients/webpin_package_search.ycp (original)
+++ trunk/packager/src/clients/webpin_package_search.ycp Wed Jul 16 18:56:29 2008
@@ -25,6 +25,7 @@
import "Report";
list <map> search_results = [];
+ list <map> all_selected = [];
map index = $[];
boolean AbortDialog() {
@@ -78,7 +79,7 @@
UI::ChangeWidget(`id("description"),`Value, ret);
}
- list CreatePackageList( list < map > results ) {
+ list CreatePackageListItems( list < map > results ) {
list pkg_items = [];
integer i = 0;
@@ -95,7 +96,19 @@
i = i+1;
});
return pkg_items;
- }
+ }
+
+ void PopulatePackageList( list <map> which ) {
+ list items = CreatePackageListItems( which );
+
+ if (which != nil) {
+ UI::ChangeWidget(`id("results"), `Items, items);
+ UI::SetFocus(`id("results"));
+ }
+ else
+ UI::SetFocus(`id("search_text"));
+
+ }
list <map> FilterOutSelectedPackages() {
list <string> p = ( list <string> ) UI::QueryWidget(`id("results"), `SelectedItems);
@@ -142,6 +155,12 @@
}
symbol MainDialog() {
+
+ term current_search_box = `MultiSelectionBox(`id ("results"), `opt (`notify, `hstretch),
+ "", [] );
+ term all_pkgs_box = `MultiSelectionBox(`id ("all"), `opt (`notify, `hstretch),
+ "", [] );
+
Wizard::SetContents (
// TRANSLATORS: dialog caption
_("Package Search"),
@@ -180,11 +199,12 @@
//),
`VWeight (
2,
- `MultiSelectionBox(
- `id ("results"), `opt (`notify, `hstretch),
- // TRANSLATORS: multi-selection box
- _("&Found Packages"), []
- )
+ `DumbTab(
+ [ `item(`id("current_tab"), _("&Found Packages")),
+ `item(`id("all_tab"), _("&All Selected Packages"))
+ ],
+ `ReplacePoint(`id(`rp), current_search_box)
+ )
),
//`HBox(
`Left( `Label( _("Package Description")) ),
@@ -214,6 +234,8 @@
UI::SetFocus(`id("search_text"));
+ list <string> cached_selected_items = [];
+
any dialog_ret = nil;
while (true) {
dialog_ret = UI::UserInput();
@@ -235,6 +257,14 @@
break;
}
else if (dialog_ret == "search") {
+
+ // remember packages selected so far
+ if (search_results != nil && search_results != []) {
+ list <map> selected = FilterOutSelectedPackages();
+ all_selected = ( list <map> ) union( all_selected, selected );
+ y2internal("all selected %1", all_selected);
+ }
+
string search_expr = SearchExpression();
if (search_expr != "") {
@@ -247,15 +277,7 @@
search_params
);
Popup::ClearFeedback();
- list items = CreatePackageList( search_results );
-
- if (search_results != nil) {
- UI::ChangeWidget(`id("results"), `Items, items);
- UI::SetFocus(`id("results"));
- }
- else
- UI::SetFocus(`id("search_text"));
-
+ PopulatePackageList( search_results );
CreatePackageDescription();
}
//else
@@ -264,6 +286,17 @@
else if (dialog_ret == "results") {
CreatePackageDescription();
}
+ else if (dialog_ret == "current_tab") {
+ UI::ReplaceWidget(`id(`rp), current_search_box );
+ PopulatePackageList( search_results );
+ UI::ChangeWidget(`id("results"), `SelectedItems, cached_selected_items);
+ CreatePackageDescription();
+ }
+ else if (dialog_ret == "all_tab") {
+ cached_selected_items = (list <string>) UI::QueryWidget(`id("results"), `SelectedItems);
+ UI::ReplaceWidget(`id(`rp), all_pkgs_box );
+ //PopulatePackageList( all_selected );
+ }
else if (dialog_ret == `abort || dialog_ret == `cancel) {
if (AbortDialog()) {
dialog_ret = `abort;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org