Hello community,
here is the log from the commit of package yast2-ncurses for openSUSE:Factory
checked in at Thu May 28 23:16:16 CEST 2009.
--------
--- yast2-ncurses/yast2-ncurses.changes 2009-04-29 12:23:30.000000000 +0200
+++ yast2-ncurses/yast2-ncurses.changes 2009-05-28 11:35:00.000000000 +0200
@@ -1,0 +2,20 @@
+Thu May 28 11:28:12 CEST 2009 - gs@suse.de
+
+- NCTable/NCTablePad: only sort in reverse order if Ctrl 'o'
+ is used for table sorting
+- V 2.18.10
+
+-------------------------------------------------------------------
+Wed May 27 10:56:58 CEST 2009 - gs@suse.de
+
+- NCTablePad: add the possibility to set a dedicated sort strategy
+ for table sorting (required for bnc #437217)
+- V 2.18.9
+
+-------------------------------------------------------------------
+Tue May 12 11:03:04 CEST 2009 - gs@suse.de
+
+- NCAskForFile/NCAskForDirectory: use YUI::widgetFactory() to
+ create the layout
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-ncurses-2.18.8.tar.bz2
New:
----
yast2-ncurses-2.18.10.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-ncurses.spec ++++++
--- /var/tmp/diff_new_pack.zG4796/_old 2009-05-28 23:15:12.000000000 +0200
+++ /var/tmp/diff_new_pack.zG4796/_new 2009-05-28 23:15:12.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-ncurses (Version 2.18.8)
+# spec file for package yast2-ncurses (Version 2.18.10)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-ncurses
-Version: 2.18.8
+Version: 2.18.10
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-ncurses-2.18.8.tar.bz2
+Source0: yast2-ncurses-2.18.10.tar.bz2
Prefix: /usr
BuildRequires: dejagnu doxygen gcc-c++ yast2-devtools
BuildRequires: blocxx-devel libxcrypt-devel ncurses-devel
@@ -56,7 +56,7 @@
%prep
-%setup -n yast2-ncurses-2.18.8
+%setup -n yast2-ncurses-2.18.10
%build
%{prefix}/bin/y2tool y2autoconf
@@ -93,6 +93,17 @@
%{prefix}/include/YaST2/ncurses/
%doc %{prefix}/share/doc/packages/yast2-ncurses
%changelog
+* Thu May 28 2009 gs@suse.de
+- NCTable/NCTablePad: only sort in reverse order if Ctrl 'o'
+ is used for table sorting
+- V 2.18.10
+* Wed May 27 2009 gs@suse.de
+- NCTablePad: add the possibility to set a dedicated sort strategy
+ for table sorting (required for bnc #437217)
+- V 2.18.9
+* Tue May 12 2009 gs@suse.de
+- NCAskForFile/NCAskForDirectory: use YUI::widgetFactory() to
+ create the layout
* Wed Apr 29 2009 gs@suse.de
- NCursesWindow: revert the patch which sets back_color_erase to
FALSE (isn't necessary any longer, see bnc #418613). Except for
++++++ yast2-ncurses-2.18.8.tar.bz2 -> yast2-ncurses-2.18.10.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/configure.in new/yast2-ncurses-2.18.10/configure.in
--- old/yast2-ncurses-2.18.8/configure.in 2009-04-29 11:45:59.000000000 +0200
+++ new/yast2-ncurses-2.18.10/configure.in 2009-05-27 11:00:38.000000000 +0200
@@ -1,6 +1,6 @@
dnl configure.in for yast2-ncurses
dnl
-dnl -- This file is generated by y2autoconf 2.18.3 - DO NOT EDIT! --
+dnl -- This file is generated by y2autoconf 2.18.5 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
AC_INIT(yast2-ncurses, 2.18.8, http://bugs.opensuse.org/, yast2-ncurses)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/src/NCAskForDirectory.cc new/yast2-ncurses-2.18.10/src/NCAskForDirectory.cc
--- old/yast2-ncurses-2.18.8/src/NCAskForDirectory.cc 2009-02-17 11:44:36.000000000 +0100
+++ new/yast2-ncurses-2.18.10/src/NCAskForDirectory.cc 2009-05-12 12:12:00.000000000 +0200
@@ -23,6 +23,8 @@
#include
#include "YDialog.h"
#include "YTypes.h"
+#include "NCWidgetFactory.h"
+#include "NCWidgetFactory.h"
#include "NCLayoutBox.h"
#include "NCSpacing.h"
#include "NCFrame.h"
@@ -65,12 +67,12 @@
setTextdomain( "ncurses" );
// the vertical split is the (only) child of the dialog
- NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
+ YLayoutBox * split = YUI::widgetFactory()->createVBox( this );
// the headline
new NCLabel( split, headline, true, false ); // isHeading = true
- NCFrame * frame = new NCFrame( split, "" );
+ YFrame * frame = YUI::widgetFactory()->createFrame( split, "" );
// label for text field showing the selected dir
dirName = new NCComboBox( frame, _( "Selected Directory:" ), false ); // editable = false
@@ -78,7 +80,7 @@
dirName->setStretchable( YD_HORIZ, true );
// add the checkBox detailed
- NCLayoutBox * hSplit = new NCLayoutBox( split, YD_HORIZ );
+ YLayoutBox * hSplit = YUI::widgetFactory()->createHBox( split );
// label for checkbox
detailed = new NCCheckBox( hSplit, _( "&Detailed View" ), false );
@@ -95,26 +97,26 @@
NCFileTable::T_Overview,
iniDir );
- new NCSpacing( split, YD_VERT, false, 1.0 );
+ YUI::widgetFactory()->createSpacing( split, YD_VERT, false, 1.0 );
// HBox for the buttons
- NCLayoutBox * hSplit1 = new NCLayoutBox( split, YD_HORIZ );
+ YLayoutBox * hSplit1 = YUI::widgetFactory()->createHBox( split );
- new NCSpacing( hSplit1, YD_HORIZ, true, 0.2 ); // stretchable = true
+ YUI::widgetFactory()->createSpacing( hSplit1, YD_HORIZ, true, 0.2 ); // stretchable = true
// add the OK button
okButton = new NCPushButton( hSplit1, _( "&OK" ) );
okButton->setFunctionKey( 10 );
okButton->setStretchable( YD_HORIZ, true );
- new NCSpacing( hSplit1, YD_HORIZ, true, 0.4 );
-
+ YUI::widgetFactory()->createSpacing( hSplit1, YD_HORIZ, true, 0.4 );
+
// add the Cancel button
cancelButton = new NCPushButton( hSplit1, _( "&Cancel" ) );
cancelButton->setFunctionKey( 9 );
cancelButton->setStretchable( YD_HORIZ, true );
- new NCSpacing( hSplit1, YD_HORIZ, true, 0.2 );
+ YUI::widgetFactory()->createSpacing( hSplit1, YD_HORIZ, true, 0.2 );
// restore former text domain
setTextdomain( old_textdomain.c_str() );
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/src/NCAskForFile.cc new/yast2-ncurses-2.18.10/src/NCAskForFile.cc
--- old/yast2-ncurses-2.18.8/src/NCAskForFile.cc 2009-02-17 11:44:16.000000000 +0100
+++ new/yast2-ncurses-2.18.10/src/NCAskForFile.cc 2009-05-12 12:11:38.000000000 +0200
@@ -23,6 +23,7 @@
#include "YDialog.h"
+#include "NCWidgetFactory.h"
#include "NCLayoutBox.h"
#include "NCSpacing.h"
#include "NCFrame.h"
@@ -109,11 +110,11 @@
startDir = checkIniDir( iniDir );
// the vertical split is the (only) child of the dialog
- NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
+ YLayoutBox * split = YUI::widgetFactory()->createVBox( this );
new NCLabel( split, headline, true, false ); // isHeading = true
- NCFrame * frame = new NCFrame( split, "" );
+ YFrame * frame = YUI::widgetFactory()->createFrame( split, "" );
// label for text field showing the selected dir
dirName = new NCComboBox( frame, _( "Selected Directory:" ), false ); // editable = false;
@@ -121,14 +122,14 @@
dirName->setStretchable( YD_HORIZ, true );
// add the checkBox detailed
- NCLayoutBox * hSplit = new NCLayoutBox( split, YD_HORIZ );
+ YLayoutBox * hSplit = YUI::widgetFactory()->createHBox( split );
// label for checkbox
detailed = new NCCheckBox( hSplit, _( "&Detailed View" ), false );
detailed->setNotify( true );
// HBox for the lists
- NCLayoutBox * hSplit1 = new NCLayoutBox( split, YD_HORIZ );
+ YLayoutBox * hSplit1 = YUI::widgetFactory()->createHBox( split );
// create table header for table type T_Overview
YTableHeader * dirHeader = new YTableHeader();
@@ -156,7 +157,7 @@
fileList->setSendKeyEvents( true );
- NCLayoutBox * hSplit2 = new NCLayoutBox( split, YD_HORIZ );
+ YLayoutBox * hSplit2 = YUI::widgetFactory()->createHBox( split );
// opt.isEditable.setValue( edit );
// NCInputField doesn't support mode 'not editable' any longer
@@ -177,26 +178,26 @@
extension->addItem( filter,
true ); // selected
- new NCSpacing( split, YD_VERT, false, 1.0 );
+ YUI::widgetFactory()->createSpacing( split, YD_VERT, false, 1.0 );
// HBox for the buttons
- NCLayoutBox * hSplit3 = new NCLayoutBox( split, YD_HORIZ );
+ YLayoutBox * hSplit3 = YUI::widgetFactory()->createHBox( split );
- new NCSpacing( hSplit3, YD_HORIZ, true, 0.2 ); // stretchable = true
+ YUI::widgetFactory()->createSpacing( hSplit3, YD_HORIZ, true, 0.2 ); // stretchable = true
// add the OK button
okButton = new NCPushButton( hSplit3, _( "&OK" ) );
okButton->setFunctionKey( 10 );
okButton->setStretchable( YD_HORIZ, true );
- new NCSpacing( hSplit3, YD_HORIZ, true, 0.4 );
+ YUI::widgetFactory()->createSpacing( hSplit3, YD_HORIZ, true, 0.4 );
// add the Cancel button
cancelButton = new NCPushButton( hSplit3, _( "&Cancel" ) );
cancelButton->setFunctionKey( 9 );
cancelButton->setStretchable( YD_HORIZ, true );
- new NCSpacing( hSplit3, YD_HORIZ, true, 0.2 );
+ YUI::widgetFactory()->createSpacing( hSplit3, YD_HORIZ, true, 0.2 );
// restore former text domain
setTextdomain( old_textdomain.c_str() );
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/src/NCTable.cc new/yast2-ncurses-2.18.10/src/NCTable.cc
--- old/yast2-ncurses-2.18.8/src/NCTable.cc 2009-04-27 10:06:09.000000000 +0200
+++ new/yast2-ncurses-2.18.10/src/NCTable.cc 2009-05-28 11:26:13.000000000 +0200
@@ -137,6 +137,18 @@
YTable::setTableHeader( th );
}
+//
+// Return table header as string vector (alignment removed)
+//
+void NCTable::getHeader( vector<string> & header )
+{
+ header.assign( _header.size(), "" );
+
+ for ( unsigned int i = 0; i < _header.size(); i++ )
+ {
+ header[ i ] = _header[i].Str().substr( 1 ); // remove alignment
+ }
+}
// Set alignment of i-th table column (left, right, center).
@@ -491,7 +503,7 @@
int column = dialog->post();
if ( column != -1 )
- myPad()->setOrder( column );
+ myPad()->setOrder( column, true ); //enable sorting in reverse order
//remove the popup
YDialog::deleteTopmostDialog();
@@ -517,13 +529,14 @@
}
- if ( notify() && immediateMode() && citem != getCurrentItem() )
+ if ( citem != getCurrentItem() )
{
- ret = NCursesEvent::SelectionChanged;
- }
+ if ( notify() && immediateMode() )
+ ret = NCursesEvent::SelectionChanged;
- if ( !multiselect )
- selectCurrentItem();
+ if ( !multiselect )
+ selectCurrentItem();
+ }
return ret;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/src/NCTable.h new/yast2-ncurses-2.18.10/src/NCTable.h
--- old/yast2-ncurses-2.18.8/src/NCTable.h 2009-01-27 13:20:10.000000000 +0100
+++ new/yast2-ncurses-2.18.10/src/NCTable.h 2009-05-19 14:09:09.000000000 +0200
@@ -37,6 +37,10 @@
bool bigList() const { return biglist; }
void setHeader( vector <string> head );
+ void getHeader( vector <string> & head );
+
+ //vector<NCstring> getHeader( ) const { return _header };
+
virtual void setAlignment( int col, YAlignmentType al );
void setBigList( const bool big ) { biglist = big; }
@@ -82,6 +86,7 @@
void stripHotkeys() { myPad()->stripHotkeys(); }
+ void setSortStrategy( NCTableSortStrategyBase * newStrategy ) { myPad()->setSortStrategy( newStrategy ); }
protected:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/src/NCTablePad.cc new/yast2-ncurses-2.18.10/src/NCTablePad.cc
--- old/yast2-ncurses-2.18.8/src/NCTablePad.cc 2009-04-27 10:06:09.000000000 +0200
+++ new/yast2-ncurses-2.18.10/src/NCTablePad.cc 2009-05-28 11:18:31.000000000 +0200
@@ -33,6 +33,7 @@
, Headline( 0 )
, Items( 0 )
, citem( 0 )
+ , sortStrategy ( new NCTableSortDefault )
{
}
@@ -316,23 +317,25 @@
return false;
}
-static int column = -1;
-
-static bool compare_column( NCTableLine* first, NCTableLine* second )
+//
+// setOrder() sorts the table according to given column by calling
+// the sort startegy. Sorting in reverse order is only done
+// if 'do_reverse' is set to 'true'.
+//
+void NCTablePad::setOrder( int col, bool do_reverse )
{
- return first->GetCol( column )->Label().getText().begin()->str()
- < second->GetCol( column )->Label().getText().begin()->str();
-}
-
-void NCTablePad::setOrder( int col )
-{
- if (column != col)
+ if ( col < 0 )
+ return;
+
+ if ( sortStrategy->getColumn() == col && do_reverse )
{
- column = col;
- std::sort( Items.begin(), Items.end(), compare_column );
+ std::reverse( Items.begin(), Items.end() );
}
else
- std::reverse( Items.begin(), Items.end() );
+ {
+ sortStrategy->setColumn( col );
+ sortStrategy->sort( Items.begin(), Items.end(), col );
+ }
dirty = true;
update();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/src/NCTablePad.h new/yast2-ncurses-2.18.10/src/NCTablePad.h
--- old/yast2-ncurses-2.18.8/src/NCTablePad.h 2008-08-20 14:57:14.000000000 +0200
+++ new/yast2-ncurses-2.18.10/src/NCTablePad.h 2009-05-28 11:01:09.000000000 +0200
@@ -21,6 +21,7 @@
#include <iosfwd>
#include <vector>
+#include <memory> // auto_ptr
#include "NCTableItem.h"
#include "NCPad.h"
@@ -31,6 +32,59 @@
using std::vector;
+class NCTableSortStrategyBase
+{
+public:
+ NCTableSortStrategyBase( ) { _uiColumn = -1; }
+
+ virtual ~NCTableSortStrategyBase() {}
+
+ virtual void sort (
+ vector::iterator itemsBegin,
+ vector::iterator itemsEnd,
+ int uiColumn
+ ) = 0;
+ int getColumn () { return _uiColumn; }
+ void setColumn ( int column) { _uiColumn = column; }
+
+private:
+ int _uiColumn;
+
+};
+
+class NCTableSortDefault : public NCTableSortStrategyBase {
+public:
+ virtual void sort (
+ vector::iterator itemsBegin,
+ vector::iterator itemsEnd,
+ int uiColumn
+ )
+ {
+ std::sort ( itemsBegin, itemsEnd, Compare(uiColumn) );
+ }
+
+private:
+ class Compare
+ {
+ public:
+ Compare ( int uiCol)
+ : _uiCol ( uiCol )
+ {}
+
+ bool operator() ( NCTableLine * first,
+ NCTableLine * second
+ ) const
+ {
+ return first->GetCol( _uiCol )->Label().getText().begin()->str()
+ < second->GetCol( _uiCol )->Label().getText().begin()->str();
+ }
+ private:
+ int _uiCol;
+ };
+
+
+};
+
class NCTableTag : public NCTableCol
{
private:
@@ -93,6 +147,8 @@
vector Items;
wpos citem;
+ std::auto_ptr<NCTableSortStrategyBase> sortStrategy;
+
void assertLine( unsigned idx );
protected:
@@ -127,7 +183,7 @@
: wsze( Lines(), ItemStyle.TableWidth() );
}
- void setOrder( int column );
+ void setOrder( int column, bool do_reverse = false );
public:
@@ -178,6 +234,12 @@
NCTableLine * ModifyLine( unsigned idx );
void stripHotkeys();
+
+ void setSortStrategy ( NCTableSortStrategyBase * newSortStrategy ) // dyn. allocated
+ {
+ if ( newSortStrategy != 0 )
+ sortStrategy.reset ( newSortStrategy );
+ }
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-ncurses-2.18.8/VERSION new/yast2-ncurses-2.18.10/VERSION
--- old/yast2-ncurses-2.18.8/VERSION 2009-04-29 11:41:07.000000000 +0200
+++ new/yast2-ncurses-2.18.10/VERSION 2009-05-28 11:28:03.000000000 +0200
@@ -1 +1 @@
-2.18.8
+2.18.10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org