[yast-commit] r49134 - in /trunk/ycp-ui-bindings: ./ examples/ package/ src/
Author: sh-sh-sh
Date: Tue Jul 15 19:18:58 2008
New Revision: 49134
URL: http://svn.opensuse.org/viewcvs/yast?rev=49134&view=rev
Log:
multi selection table
Added:
trunk/ycp-ui-bindings/examples/Table6-multiSel.ycp
Modified:
trunk/ycp-ui-bindings/VERSION
trunk/ycp-ui-bindings/examples/Events.ycp
trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes
trunk/ycp-ui-bindings/src/YCPDialogParser.cc
trunk/ycp-ui-bindings/src/YCPPropertyHandler.cc
trunk/ycp-ui-bindings/src/YCPPropertyHandler.h
trunk/ycp-ui-bindings/yast2-ycp-ui-bindings.spec.in
Modified: trunk/ycp-ui-bindings/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/VERSION?rev=49134&r1=49133&r2=49134&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/VERSION (original)
+++ trunk/ycp-ui-bindings/VERSION Tue Jul 15 19:18:58 2008
@@ -1 +1 @@
-2.17.1
+2.17.2
Modified: trunk/ycp-ui-bindings/examples/Events.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/Events.ycp?rev=49134&r1=49133&r2=49134&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/examples/Events.ycp (original)
+++ trunk/ycp-ui-bindings/examples/Events.ycp Tue Jul 15 19:18:58 2008
@@ -102,7 +102,7 @@
]
);
- term drink = `Table(`id(`drink), `opt(`notify, `immediate), `header( "Drink", "Contents" ),
+ term drink = `Table(`id(`drink), `opt(`notify, `immediate, `multiSelection), `header( "Drink", "Contents" ),
[
`item(`id(`coke), "Coca Cola", "Caffeine" ),
`item(`id(`sprite), "Sprite", "" ),
Added: trunk/ycp-ui-bindings/examples/Table6-multiSel.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/Table6-multiSel.ycp?rev=49134&view=auto
==============================================================================
--- trunk/ycp-ui-bindings/examples/Table6-multiSel.ycp (added)
+++ trunk/ycp-ui-bindings/examples/Table6-multiSel.ycp Tue Jul 15 19:18:58 2008
@@ -0,0 +1,27 @@
+{
+ UI::OpenDialog(
+ `VBox(
+ `Heading("Today's menu"),
+ `MinSize( 30, 10,
+ `Table(`id(`menu),
+ `opt(`multiSelection),
+ `header("Name", "Price"),
+ [
+ `item(`id(1), "Chili", 6),
+ `item(`id(2), "Salami Baguette", nil),
+ `item(`id(3), "Spaghetti", 8),
+ `item(`id(4), "Steak Sandwich", 12)
+ ]
+ )
+ ),
+ `PushButton("&OK")
+ )
+ );
+ UI::UserInput();
+
+ any sel = UI::QueryWidget(`menu, `SelectedItems );
+ UI::CloseDialog();
+
+ y2milestone( "Selected: %1", sel );
+}
+
Modified: trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes?rev=49134&r1=49133&r2=49134&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes (original)
+++ trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes Tue Jul 15 19:18:58 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Jul 15 19:13:25 CEST 2008 - sh@suse.de
+
+- Implemented fate #303492: Multi selection for table widget
+- V 2.17.2
+
+-------------------------------------------------------------------
Fri May 16 12:32:24 CEST 2008 - sh@suse.de
- Handle nonexistent widgets in UI::SetFocus() more gracefully
Modified: trunk/ycp-ui-bindings/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/src/YCPDialogParser.cc?rev=49134&r1=49133&r2=49134&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/src/YCPDialogParser.cc (original)
+++ trunk/ycp-ui-bindings/src/YCPDialogParser.cc Tue Jul 15 19:18:58 2008
@@ -1934,7 +1934,6 @@
*
* Note: The Qt version of the Wizard widget also provides a built-in tree with
* an API that is (sometimes) easier to use.
- *
**/
YWidget *
@@ -1989,13 +1988,17 @@
* @optarg list items the items contained in the selection box
* @option immediate make `notify trigger immediately when the selected item changes
* @option keepSorting keep the insertion order - don't let the user sort manually by clicking
+ * @option multiSelection user can select multiple items (rows) at once (shift-click, ctrl-click)
* @usage `Table( `header( "Game", "Highscore" ), [ `item( `id(1), "xkobo", "1708" ) ] )
* @examples Table1.ycp Table2.ycp Table3.ycp Table4.ycp Table5.ycp
*
* @description
*
- * The Table widget is a selection list with multiple columns. The user can
- * select exactly one row (with all its columns) from that list.
+ * The Table widget is a selection list with multiple columns. By default, the user can
+ * select exactly one row (with all its columns) from that list. With
+ * `opt(`multiSelection), the user can select one or more rows (with all their
+ * columns) from that list (In that case, use the `SelectedItems property, not
+ * `Value).
*
* Each cell (each column within each row) has a label text and an optional
* icon.
@@ -2077,17 +2080,19 @@
bool immediate = false;
bool keepSorting = false;
+ bool multiSelection = false;
for ( int o=0; o < optList->size(); o++ )
{
- if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_immediate ) immediate = true;
- else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_keepSorting ) keepSorting = true;
+ if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_immediate ) immediate = true;
+ else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_keepSorting ) keepSorting = true;
+ else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_multiSelection ) multiSelection = true;
else logUnknownOption( term, optList->value(o) );
}
YCPTerm headerTerm = term->value( argnr )->asTerm();
- YTable * table = YUI::widgetFactory()->createTable( parent, parseTableHeader( headerTerm ) );
+ YTable * table = YUI::widgetFactory()->createTable( parent, parseTableHeader( headerTerm ), multiSelection );
if ( keepSorting )
table->setKeepSorting( true );
Modified: trunk/ycp-ui-bindings/src/YCPPropertyHandler.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/src/YCPPropertyHandler.cc?rev=49134&r1=49133&r2=49134&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/src/YCPPropertyHandler.cc (original)
+++ trunk/ycp-ui-bindings/src/YCPPropertyHandler.cc Tue Jul 15 19:18:58 2008
@@ -116,6 +116,7 @@
else if ( propertyName == YUIProperty_SelectedItems )
{
if ( trySetMultiSelectionBoxSelectedItems( widget, val ) ) return true;
+ if ( trySetTableSelectedItems( widget, val ) ) return true;
}
y2error( "Can't handle property %s::%s - not changing anything",
@@ -184,6 +185,7 @@
else if ( propertyName == YUIProperty_SelectedItems )
{
val = tryGetMultiSelectionBoxSelectedItems( widget ); if ( ! val.isNull() ) return val;
+ val = tryGetTableSelectedItems( widget ); if ( ! val.isNull() ) return val;
}
else if ( propertyName == YUIProperty_OpenItems )
{
@@ -604,8 +606,8 @@
}
-bool
-YCPPropertyHandler::trySetMultiSelectionBoxSelectedItems( YWidget * widget, const YCPValue & val )
+template
participants (1)
-
sh-sh-sh@svn.opensuse.org