[yast-commit] r54351 - in /trunk/packager: package/yast2-packager.changes src/clients/repositories.ycp

Author: lslezak Date: Wed Dec 31 14:00:05 2008 New Revision: 54351 URL: http://svn.opensuse.org/viewcvs/yast?rev=54351&view=rev Log: - use a combo box for switching the view (instead of the large tree widget) (bnc#433857) Modified: trunk/packager/package/yast2-packager.changes trunk/packager/src/clients/repositories.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 Dec 31 14:00:05 2008 @@ -2,7 +2,8 @@ Wed Dec 31 11:47:00 CET 2008 - lslezak@suse.cz - repositories.ycp - better layout for too small window size - (bnc#439807) + (bnc#439807), use a combo box for switching the view (instead of + the large tree widget) (bnc#433857) ------------------------------------------------------------------- Tue Dec 30 11:48:28 CET 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 Dec 31 14:00:05 2008 @@ -265,7 +265,14 @@ string url = sformat (_("URL: %1"), raw_url); - return sformat("<P>%1<B><BIG>%2</BIG></B></P><P>%3</P><P>%4</P><P>%5</P>", icon_tag, name, url, category, service); + string ret = sformat("<P>%1<B><BIG>%2</BIG></B></P><P>%3</P><P>%4</P>", icon_tag, name, url, category); + + if (service != "") + { + ret = ret + sformat("<P>%1</P>", service); + } + + return ret; } term repoInfoTerm(string name, string url, string category, string service) @@ -555,28 +562,32 @@ return success; } -list<term> buildTree() +list<term> buildList() { - list<term> ret = []; - - list<term> services_t = []; + list<term> ret = [ + `item(`id(`all_repositories), _("All repositories")), + `item(`id(`all_services), _("All services")) + ]; foreach(map<string,any> srv_state, serviceStatesOut, { - term t = `item(`id(srv_state["alias"]:""), srv_state["name"]:""); - services_t = add(services_t, t); + term t = `item(`id(srv_state["alias"]:""), sformat(_("Service '%1'"), srv_state["name"]:"")); + ret = add(ret, t); } ); - // alphabetically sort the repositories (by "name" key) - // TODO FIXME: use lsort -// repositories_t = sort(term repo1, term repo2, repositories_t, {y2internal("val: %1", repo1[1]:""); return repo1[1]:"" < repo2[1]:"";}); - - return [ - // true = open the node - `item(`id(`services), _("Services"), true, services_t), - `item(`id(`repositories), _("Repositories"), true, []) - ]; + return ret; +} + +term RepoFilterWidget() +{ + // combobox label + return `ComboBox(`id(`service_filter), `opt(`notify), _("View"), buildList()); +} + +void UpdateCombobox() +{ + UI::ReplaceWidget(`id(`filter_rp), RepoFilterWidget()); } // return table widget definition @@ -699,62 +710,59 @@ } term contents = - `HBox( - `Tree(`id(`tree), `opt(`notify), "", buildTree()), - `VBox( - `VWeight(1, `ReplacePoint(`id(`tabrp), TableWidget(repository_view))), - `VBox( - repoInfoTerm("", "", "", ""), - // label - `Left (`Label (_("Properties"))), - // check box - `HBox( - `HSquash( - `VBox( - // check box - `Left (`CheckBox (`id (`enable), `opt(`notify), _("&Enabled"))), - // check box - `Left (`CheckBox (`id (`autorefresh), `opt(`notify), _("Automatically &Refresh"))), - // check box - `Left(`ReplacePoint(`id(`keeppkg_rp), `CheckBox(`id(`keeppackages), `opt(`notify), keeppackages_label))) - ) - ), - `HSpacing(1), - `HSquash(`ReplacePoint(`id(`priorp), `IntField(`id(`priority), `opt(`notify), priority_label, 0, 200, default_priority))), - `HStretch() - ), - `VSpacing (0.4), - - (have_rug) ? - // Checkbox label - `Left (`CheckBox (`id (`zmdsync), _("Synchronize Changes with &ZENworks"), !norug && sync_zmd)) - : `Empty(), - - `HBox( - `PushButton (`id (`add), `opt(`key_F3), - Label::AddButton ()), - `PushButton(`id(`replace), `opt(`key_F4), - Label::EditButton ()), - `PushButton (`id(`delete), `opt(`key_F5), - Label::DeleteButton ()), - `HStretch (), - `PushButton (`id (`key_mgr), _("&GPG Keys...")), - // menu button label - `MenuButton (`id(`menu_button), `opt(`key_F6), _("Refresh"), [ - `item(`id(`refresh), refreshButtonLabel ), - // menu button label - `item(`id(`autorefresh_all), _("Refresh All Autor&efreshed")), - // menu button label - `item(`id(`refresh_enabled), _("Refresh All &Enabled")) - ]) + `VBox( + `Right(`ReplacePoint(`id(`filter_rp), RepoFilterWidget())), + `VWeight(1, `ReplacePoint(`id(`tabrp), TableWidget(repository_view))), + repoInfoTerm("", "", "", ""), + + // label + `Left (`Label (_("Properties"))), + + `HBox( + `HSquash( + `VBox( + // check box + `Left (`CheckBox (`id (`enable), `opt(`notify), _("&Enabled"))), + // check box + `Left (`CheckBox (`id (`autorefresh), `opt(`notify), _("Automatically &Refresh"))), + // check box + `Left(`ReplacePoint(`id(`keeppkg_rp), `CheckBox(`id(`keeppackages), `opt(`notify), keeppackages_label))) ) - ) + ), + `HSpacing(1), + `HSquash(`ReplacePoint(`id(`priorp), `IntField(`id(`priority), `opt(`notify), priority_label, 0, 200, default_priority))), + `HStretch() + ), + `VSpacing (0.4), + + (have_rug) ? + // Checkbox label + `Left (`CheckBox (`id (`zmdsync), _("Synchronize Changes with &ZENworks"), !norug && sync_zmd)) + : `Empty(), + + `HBox( + `PushButton (`id (`add), `opt(`key_F3), + Label::AddButton ()), + `PushButton(`id(`replace), `opt(`key_F4), + Label::EditButton ()), + `PushButton (`id(`delete), `opt(`key_F5), + Label::DeleteButton ()), + `HStretch (), + // push button label + `PushButton (`id (`key_mgr), _("&GPG Keys...")), + // menu button label + `MenuButton (`id(`menu_button), `opt(`key_F6), _("Refresh"), [ + `item(`id(`refresh), refreshButtonLabel ), + // menu button label + `item(`id(`autorefresh_all), _("Refresh All Autor&efreshed")), + // menu button label + `item(`id(`refresh_enabled), _("Refresh All &Enabled")) + ]) ) ); // dialog caption string title = _("Configured Software Repositories"); -// string title = _("Media Containing the Software Repository"); // help string help_text = _("<p> @@ -823,9 +831,6 @@ fillTable(repository_view, displayed_service); fillCurrentRepoInfo(); - // set the current view to repositories - UI::ChangeWidget(`id(`tree), `CurrentItem, `repositories); - symbol input = nil; integer current = -1; @@ -920,23 +925,23 @@ // start the GPG key manager //RunGPGKeyMgmt(); } - else if (input == `tree) + else if (input == `service_filter) { - // handle tree events here... - any current_item = UI::QueryWidget(`id(`tree), `CurrentItem); + // handle the combobox events here... + any current_item = UI::QueryWidget(`id(`service_filter), `Value); // rebuild the dialog if needed - y2milestone("Current tree item: %1", current_item); + y2milestone("Current combobox item: %1", current_item); boolean update_table_widget = false; - if (current_item == `repositories) + if (current_item == `all_repositories) { update_table_widget = !repository_view || displayed_service != ""; y2milestone("Switching to repository view"); repository_view = true; displayed_service = ""; } - else if (current_item == `services) + else if (current_item == `all_services) { update_table_widget = repository_view; y2milestone("Switching to service view"); @@ -1103,8 +1108,8 @@ fillTable(repository_view, displayed_service); fillCurrentRepoInfo(); - // refresh also the tree widget - UI::ChangeWidget(`id(`tree), `Items, buildTree()); + // refresh also the combobox widget + UpdateCombobox(); } } else @@ -1140,8 +1145,8 @@ } ); - // refresh also the tree widget - UI::ChangeWidget(`id(`tree), `Items, buildTree()); + // refresh also the combobox widget + UpdateCombobox(); } } @@ -1290,8 +1295,8 @@ fillTable(repository_view, displayed_service); fillCurrentRepoInfo(); - // refresh also the tree widget - UI::ChangeWidget(`id(`tree), `Items, buildTree()); + // refresh also the combobox widget + UpdateCombobox(); } } } -- 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