[yast-commit] r49132 - in /trunk: libyui/ libyui/package/ libyui/src/ qt/ qt/package/ qt/src/
Author: sh-sh-sh
Date: Tue Jul 15 19:15:37 2008
New Revision: 49132
URL: http://svn.opensuse.org/viewcvs/yast?rev=49132&view=rev
Log:
multi selection table
Modified:
trunk/libyui/VERSION
trunk/libyui/package/yast2-libyui.changes
trunk/libyui/src/YTable.cc
trunk/libyui/src/YTable.h
trunk/libyui/src/YUISymbols.h
trunk/libyui/src/YWidgetFactory.h
trunk/qt/VERSION.cmake
trunk/qt/package/yast2-qt.changes
trunk/qt/src/YQTable.cc
trunk/qt/src/YQTable.h
trunk/qt/src/YQWidgetFactory.cc
trunk/qt/src/YQWidgetFactory.h
trunk/qt/yast2-qt.spec.in
Modified: trunk/libyui/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/VERSION?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/libyui/VERSION (original)
+++ trunk/libyui/VERSION Tue Jul 15 19:15:37 2008
@@ -1 +1 @@
-2.17.4
+2.17.5
Modified: trunk/libyui/package/yast2-libyui.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/package/yast2-libyui.changes?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/libyui/package/yast2-libyui.changes (original)
+++ trunk/libyui/package/yast2-libyui.changes Tue Jul 15 19:15:37 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Jul 15 19:12:22 CEST 2008 - sh@suse.de
+
+- Implemented fate #303492: Multi selection for table widget
+- V 2.17.5
+
+-------------------------------------------------------------------
Fri Jul 11 16:29:47 CEST 2008 - sh@suse.de
- Fixed bnc #367023: Keyboard shortcuts for non-ASCII languages
Modified: trunk/libyui/src/YTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTable.cc?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/libyui/src/YTable.cc (original)
+++ trunk/libyui/src/YTable.cc Tue Jul 15 19:15:37 2008
@@ -41,10 +41,10 @@
-YTable::YTable( YWidget * parent, YTableHeader * header )
+YTable::YTable( YWidget * parent, YTableHeader * header, bool multiSelection )
: YSelectionWidget( parent,
"", // label
- true ) // enforceSingleSelection
+ ! multiSelection ) // enforceSingleSelection
, priv( new YTablePrivate( header ) )
{
YUI_CHECK_PTR( header );
@@ -134,6 +134,12 @@
}
+bool
+YTable::hasMultiSelection() const
+{
+ return ! YSelectionWidget::enforceSingleSelection();
+}
+
const YPropertySet &
YTable::propertySet()
@@ -146,19 +152,23 @@
* @property itemID Value The currently selected item
* @property itemID CurrentItem The currently selected item
* @property itemList Items All items
+ * @property itemList SelectedItems All currently selected items
* @property string Cell One cell (one column of one item)
* @property integer Cell (ChangeWidget only) One cell as integer
* @property `icon(...) Cell Icon for one one cell
* @property string Item Alias for Cell
* @property string Item QueryWidget only: Return one complete item
* @property string IconPath Base path for icons
+ * @property bool MultiSelection Flag: User can select multiple items (read-only)
*/
propSet.add( YProperty( YUIProperty_Value, YOtherProperty ) );
propSet.add( YProperty( YUIProperty_CurrentItem, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_SelectedItems, YOtherProperty ) );
propSet.add( YProperty( YUIProperty_Items, YOtherProperty ) );
propSet.add( YProperty( YUIProperty_Cell, YOtherProperty ) );
propSet.add( YProperty( YUIProperty_Item, YOtherProperty ) );
propSet.add( YProperty( YUIProperty_IconPath, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_MultiSelection, YBoolProperty, true ) ); // read-only
propSet.add( YWidget::propertySet() );
}
@@ -173,6 +183,7 @@
if ( propertyName == YUIProperty_Value ) return false; // Needs special handling
else if ( propertyName == YUIProperty_CurrentItem ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_SelectedItems ) return false; // Needs special handling
else if ( propertyName == YUIProperty_Items ) return false; // Needs special handling
else if ( propertyName == YUIProperty_Cell ) return false; // Needs special handling
else if ( propertyName == YUIProperty_Item ) return false; // Needs special handling
@@ -193,6 +204,7 @@
if ( propertyName == YUIProperty_Value ) return YPropertyValue( YOtherProperty );
else if ( propertyName == YUIProperty_CurrentItem ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_SelectedItems ) return YPropertyValue( YOtherProperty );
else if ( propertyName == YUIProperty_Items ) return YPropertyValue( YOtherProperty );
else if ( propertyName == YUIProperty_Cell ) return YPropertyValue( YOtherProperty );
else if ( propertyName == YUIProperty_Item ) return YPropertyValue( YOtherProperty );
Modified: trunk/libyui/src/YTable.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTable.h?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/libyui/src/YTable.h (original)
+++ trunk/libyui/src/YTable.h Tue Jul 15 19:15:37 2008
@@ -57,8 +57,12 @@
* headings, and column alignment. The widget assumes ownership of this
* object and will delete it when appropriate. The header cannot be changed
* after creating the widget.
+ *
+ * 'multiSelection' indicates whether or not the user can select multiple
+ * items at the same time (e.g., with shift-click or ctrl-click). This can
+ * only be set in the constructor.
**/
- YTable( YWidget * parent, YTableHeader * header );
+ YTable( YWidget * parent, YTableHeader * header, bool multiSelection );
public:
@@ -129,6 +133,12 @@
virtual void setKeepSorting( bool keepSorting );
/**
+ * Return 'true' if the user can select multiple items at the same time
+ * (e.g., with shift-click or ctrl-click).
+ **/
+ bool hasMultiSelection() const;
+
+ /**
* Notification that a cell (its text and/or its icon) was changed from the
* outside. Applications are required to call this whenever a table cell is
* changed after adding the corresponding table item (the row) to the table
Modified: trunk/libyui/src/YUISymbols.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YUISymbols.h?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/libyui/src/YUISymbols.h (original)
+++ trunk/libyui/src/YUISymbols.h Tue Jul 15 19:15:37 2008
@@ -168,6 +168,7 @@
#define YUIProperty_MaxLines "MaxLines"
#define YUIProperty_MaxValue "MaxValue"
#define YUIProperty_MinValue "MinValue"
+#define YUIProperty_MultiSelection "MultiSelection"
#define YUIProperty_Notify "Notify"
#define YUIProperty_OpenItems "OpenItems"
#define YUIProperty_SelectedItems "SelectedItems"
@@ -205,6 +206,7 @@
#define YUIOpt_keepSorting "keepSorting"
#define YUIOpt_keyEvents "keyEvents"
#define YUIOpt_mainDialog "mainDialog"
+#define YUIOpt_multiSelection "multiSelection"
#define YUIOpt_noAutoEnable "noAutoEnable"
#define YUIOpt_notify "notify"
#define YUIOpt_outputField "outputField"
Modified: trunk/libyui/src/YWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWidgetFactory.h?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/libyui/src/YWidgetFactory.h (original)
+++ trunk/libyui/src/YWidgetFactory.h Tue Jul 15 19:15:37 2008
@@ -100,7 +100,7 @@
virtual YComboBox * createComboBox ( YWidget * parent, const string & label, bool editable = false ) = 0;
virtual YSelectionBox * createSelectionBox ( YWidget * parent, const string & label ) = 0;
virtual YTree * createTree ( YWidget * parent, const string & label ) = 0;
- virtual YTable * createTable ( YWidget * parent, YTableHeader * header ) = 0;
+ virtual YTable * createTable ( YWidget * parent, YTableHeader * header, bool multiSelection = false ) = 0;
virtual YProgressBar * createProgressBar ( YWidget * parent, const string & label, int maxValue = 100 ) = 0;
virtual YRichText * createRichText ( YWidget * parent, const string & text = string(), bool plainTextMode = false ) = 0;
virtual YBusyIndicator * createBusyIndicator ( YWidget * parent, const string & label, int timeout = 1000 ) = 0;
Modified: trunk/qt/VERSION.cmake
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION.cmake?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/qt/VERSION.cmake (original)
+++ trunk/qt/VERSION.cmake Tue Jul 15 19:15:37 2008
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "2")
SET(VERSION_MINOR "17")
-SET(VERSION_PATCH "3")
+SET(VERSION_PATCH "4")
Modified: trunk/qt/package/yast2-qt.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/qt/package/yast2-qt.changes (original)
+++ trunk/qt/package/yast2-qt.changes Tue Jul 15 19:15:37 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Jul 15 19:13:57 CEST 2008 - sh@suse.de
+
+- Implemented fate #303492: Multi selection for table widget
+- V 2.17.4
+
+-------------------------------------------------------------------
Fri Jul 11 15:30:23 CEST 2008 - sh@suse.de
- Fixed bnc #403852: MultiLineEdit doesn't take HTML as plain text
Modified: trunk/qt/src/YQTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQTable.cc?rev=49132&r1=49131&r2=49132&view=diff
==============================================================================
--- trunk/qt/src/YQTable.cc (original)
+++ trunk/qt/src/YQTable.cc Tue Jul 15 19:15:37 2008
@@ -32,9 +32,9 @@
#include "YQTable.h"
-YQTable::YQTable( YWidget * parent, YTableHeader * tableHeader )
+YQTable::YQTable( YWidget * parent, YTableHeader * tableHeader, bool multiSelectionMode )
: QFrame( (QWidget *) parent->widgetRep() )
- , YTable( parent, tableHeader )
+ , YTable( parent, tableHeader, multiSelectionMode )
{
setWidgetRep( this );
QVBoxLayout* layout = new QVBoxLayout( this );
@@ -49,6 +49,9 @@
_qt_listView->setAllColumnsShowFocus( true );
_qt_listView->setSortingEnabled( ! keepSorting() );
+ if ( multiSelectionMode )
+ _qt_listView->setSelectionMode( QAbstractItemView::ExtendedSelection );
+
//
// Add columns
@@ -78,6 +81,15 @@
connect( _qt_listView, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ),
this, SLOT ( slotSelected ( QTreeWidgetItem * ) ) );
+
+ if ( multiSelectionMode )
+ {
+ // This is the exceptional case - avoid performance drop in the normal case
+
+ connect( _qt_listView, SIGNAL( itemSelectionChanged() ),
+ this, SLOT ( slotSelectionChanged() ) );
+
+ }
}
@@ -109,7 +121,7 @@
if ( item->selected() )
{
- // YTable enforces single selection
+ // YTable enforces single selection, if appropriate
YQSignalBlocker sigBlocker( _qt_listView );
YQTable::selectItem( YSelectionWidget::selectedItem(), true );
@@ -226,6 +238,42 @@
{
// Avoid overwriting a (more important) Activated event with a SelectionChanged event
+ yuiDebug() << "Sending SelectionChanged event" << endl;
+ YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::SelectionChanged ) );
+ }
+ }
+}
+
+
+void
+YQTable::slotSelectionChanged()
+{
+ YSelectionWidget::deselectAllItems();
+ yuiDebug() << endl;
+
+ QList
participants (1)
-
sh-sh-sh@svn.opensuse.org