YaST Commits
Threads by month
- ----- 2025 -----
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2007
- 27 participants
- 490 discussions
[yast-commit] r39101 - in /branches/tmp/sh/mod-ui: core/libyui/src/ qt/src/
by sh-sh-sh@svn.opensuse.org 29 Jun '07
by sh-sh-sh@svn.opensuse.org 29 Jun '07
29 Jun '07
Author: sh-sh-sh
Date: Fri Jun 29 20:31:20 2007
New Revision: 39101
URL: http://svn.opensuse.org/viewcvs/yast?rev=39101&view=rev
Log:
Porting selection widgets
!!! DOES NOT COMPILE YET !!!
(pre-weekend backup checkin)
Added:
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.h
branches/tmp/sh/mod-ui/core/libyui/src/YCP_UI_Exception.h
branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc
branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
branches/tmp/sh/mod-ui/core/libyui/src/YInputField.cc
branches/tmp/sh/mod-ui/core/libyui/src/YInputField.h
branches/tmp/sh/mod-ui/core/libyui/src/YItem.h
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.h
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc
branches/tmp/sh/mod-ui/qt/src/YQComboBox.h
branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Fri Jun 29 20:31:20 2007
@@ -296,3 +296,12 @@
* added modeFlags parameter for PackageSelector etc.
* now calling the YPackagePlugin from the factory create...() functions
+
+2007-06-29 12:00 sh(a)suse.de
+
+* Added YSelectionBox::immediateMode() and setImmediateMode()
+ as a replacement for YWidgetOpt.immediateMode
+
+* Added YSelectionBox::shrinkable() and setShrinkable()
+ as a replacement for YWidgetOpt.shrinkable
+
Modified: branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am Fri Jun 29 20:31:20 2007
@@ -27,6 +27,7 @@
YCPValueWidgetID.cc \
YCPDialogParser.cc \
YCPItemParser.cc \
+ YCPPropertyHandler.cc \
\
YAlignment.cc \
YBarGraph.cc \
@@ -86,6 +87,7 @@
YCPDialogParser.h \
YCPItem.h \
YCPItemParser.h \
+ YCPPropertyHandler.h \
YCPValueWidgetID.h \
YCP_UI_Exception.h \
YChildrenManager.h \
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Fri Jun 29 20:31:20 2007
@@ -32,6 +32,7 @@
#include "YUISymbols.h"
#include "YWidget.h"
#include "YCPValueWidgetID.h"
+#include "YCPItemParser.h"
#include "YDialog.h"
#include "YUI_util.h"
#include "YWidgetFactory.h"
@@ -1781,25 +1782,36 @@
return 0;
}
+ string label = term->value( argnr )->asString()->value();
+
+ bool shrinkable = false;
+ bool immediate = false;
+
for ( int o=0; o < optList->size(); o++ )
{
- if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_shrinkable ) opt.isShrinkable.setValue( true );
- else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_immediate )
- {
- opt.notifyMode.setValue( true );
- opt.immediateMode.setValue( true );
- }
+ if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_shrinkable ) shrinkable = true;
+ else if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_immediate ) immediate = true;
else logUnknownOption( term, optList->value(o) );
}
- YSelectionBox *selbox = dynamic_cast<YSelectionBox *> ( YUI::ui()->createSelectionBox( parent, opt, term->value( argnr )->asString() ) );
+ YSelectionBox *selBox = YUI::widgetFactory()->createSelectionBox( parent, label );
+
+#warning TO DO: shrinkable / immediate
+#if 0
+ if ( shrinkable )
+ selBox->setShrinkable( true );
+
+ if ( immediate )
+ selBox->setImmediate( true ); // includes setNotify()
+#endif
- if ( selbox && numargs >= 2 )
+ if ( numargs >= 2 )
{
- selbox->parseItemList( term->value( argnr+1 )->asList() );
+ YCPList itemList = term->value( argnr+1 )->asList();
+ selBox->addItems( YCPItemParser::parseItemList( itemList );
}
- return selbox;
+ return selBox;
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.cc Fri Jun 29 20:31:20 2007
@@ -26,35 +26,36 @@
#include "YUISymbols.h"
-YItemList
-YCPItemParser::parseItemList( const YCPList & ycpItemList )
+YItemCollection
+YCPItemParser::parseItemList( const YCPList & itemList )
{
- YItemList itemList;
+ YItemCollection itemCollection;
+ itemCollection.reserve( itemList.size() );
try
{
- for ( int i=0; i < ycpItemList->size(); i++ )
+ for ( int i=0; i < itemList->size(); i++ )
{
- YCPItem * item = parseItem( ycpItemList->value(i) );
- itemList.push_back( item );
+ YCPItem * item = parseItem( itemList->value(i) );
+ itemCollection.push_back( item );
}
}
catch ( YUIException & exception )
{
- YItemListIterator it = itemList.begin();
+ YItemIterator it = itemCollection.begin();
- while ( it != itemList.end() )
+ while ( it != itemCollection.end() )
{
YItem * item = *it;
++it;
delete item;
}
- itemList.clear();
+ itemCollection.clear();
YUI_RETHROW( exception );
}
- return itemList;
+ return itemCollection;
}
@@ -74,14 +75,14 @@
else // `item(...)
{
if ( rawItem->isTerm() &&
- rawItem->asTerm()->name() == YUISymbol_item ) // `item
+ rawItem->asTerm()->name() == YUISymbol_item ) // `item(...)
{
item = parseItem( rawItem->asTerm() );
}
else // not `item(...)
{
- YUI_THROW( YCPDialogSyntaxError( "Expected `item(...)", rawItem ) );
+ YUI_THROW( YCPDialogSyntaxErrorException( "Expected `item(...)", rawItem ) );
}
}
@@ -92,17 +93,14 @@
YCPItem *
YCPItemParser::parseItem( const YCPTerm & itemTerm )
{
- YCPValue id = YCPNull();
- YCPString iconName = YCPNull();
- YCPString label = YCPNull();
- YCPBoolean selected = YCPNull();
-
- YCPDialogSyntaxError syntaxError( "Expected "
- "`item(`id(`myID), "
- "`icon(\"MyIcon.png\"),"
- "\"MyItemText\","
- "boolean selected )",
- itemTerm );
+ YCPValue id = YCPNull();
+ YCPString iconName = YCPNull();
+ YCPString label = YCPNull();
+ YCPBoolean selected = YCPNull();
+
+ string usage =
+ "Expected: `item(`id(`myID), `icon(\"MyIcon.png\"), \"MyItemText\", boolean selected )";
+
for ( int i=0; i < itemTerm->size(); i++ )
{
@@ -112,43 +110,43 @@
{
YCPTerm term = arg->asTerm();
- if ( term->size() != 1 )
- YUI_THROW( syntaxError );
+ if ( term->size() != 1 ) // Both `id() and `icon() have 1 argument
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
- if ( term->name() == YUISymbol_id // `id()
+ if ( term->name() == YUISymbol_id // `id(...)
&& id.isNull() ) // and don't have an ID yet
{
id = term->value(0);
}
- else if ( term->name() == YUISymbol_icon // `icon()
- && term->value(0)->isString()
+ else if ( term->name() == YUISymbol_icon // `icon(...)
+ && term->value(0)->isString() // with a string argument
&& iconName.isNull() ) // and don't have an icon name yet
{
iconName = term->value(0)->asString();
}
else
{
- YUI_THROW( syntaxError );
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
}
}
- else if ( arg->isString() // label
- && label.isNull() ) // and don't have a label yet
+ else if ( arg->isString() // label (the user-visible text)
+ && label.isNull() ) // and don't have a label yet
{
label = arg->asString();
}
- else if ( arg->isBoolean() // "selected" flag
- && selected.isNull() ) // and don't have a "selected" flag yet
+ else if ( arg->isBoolean() // "selected" flag
+ && selected.isNull() ) // and don't have a "selected" flag yet
{
selected = arg->asBoolean();
}
else
{
- YUI_THROW( syntaxError );
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
}
}
if ( label.isNull() ) // the label is required
- YUI_THROW( syntaxError );
+ YUI_THROW( YCPDialogSyntaxErrorException( usage, itemTerm ) );
if ( iconName.isNull() )
iconName = YCPString( "" );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPItemParser.h Fri Jun 29 20:31:20 2007
@@ -43,7 +43,7 @@
*
* This function throws exceptions if there are syntax errors.
**/
- static YItemList parseItemList( const YCPList & ycpItemList );
+ static YItemCollection parseItemList( const YCPList & ycpItemList );
/**
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.cc Fri Jun 29 20:31:20 2007
@@ -0,0 +1,298 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPPropertyHandler.h
+
+ Widget property handlers for not-so-trivial properties.
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+
+#include <ycp/YCPVoid.h>
+#include <ycp/YCPString.h>
+#include <ycp/YCPInteger.h>
+#include <ycp/YCPBoolean.h>
+
+#include "YCPPropertyHandler.h"
+
+#include "YCheckBox.h"
+#include "YSelectionBox.h"
+#include "YComboBox.h"
+#include "YCPItem.h"
+#include "YUISymbols.h"
+
+
+
+void
+YCPPropertyHandler::setComplexProperty( YWidget * widget,
+ const string & propertyName,
+ const YCPValue & val )
+{
+ // y2debug( "%s::%s", widget->widgetClass(), propertyName.c_str() );
+
+ if ( propertyName == YUIProperty_Value )
+ {
+ if ( trySetCheckBoxValue ( widget, val ) ) return;
+ if ( trySetSelectionBoxValue ( widget, val ) ) return;
+ if ( trySetComboBoxValue ( widget, val ) ) return;
+ }
+
+ if ( propertyName == YUIProperty_CurrentItem )
+ {
+ if ( trySetSelectionBoxValue ( widget, val ) ) return;
+ }
+
+ if ( propertyName == YUIProperty_Items )
+ {
+ if ( trySetSelectionWidgetItems( widget, val ) ) return;
+ }
+
+ y2error( "Can't handle property %s::%s - not changing anything"
+ widget->widgetClass(), propertyName.c_str() );
+}
+
+
+YCPValue
+YCPPropertyHandler::getComplexProperty( YWidget * widget, const string & propertyName )
+{
+ YCPValue val = YCPNull();
+
+ if ( propertyName == YUIProperty_Value )
+ {
+ val = tryGetCheckBoxValue ( widget ); if ( ! val.isNull() ) return val;
+ val = tryGetComboBoxValue ( widget ); if ( ! val.isNull() ) return val;
+ val = tryGetSelectionBoxValue ( widget ); if ( ! val.isNull() ) return val;
+ }
+
+ if ( propertyName == YUIProperty_CurrentItem )
+ {
+ val = tryGetSelectionBoxValue ( widget ); if ( ! val.isNull() ) return val;
+ val = tryGetComboBoxValue ( widget ); if ( ! val.isNull() ) return val;
+ }
+
+ y2error( "Can't handle property %s::%s - returning 'nil'",
+ widget->widgetClass(), propertyName.c_str() );
+
+ return YCPVoid();
+}
+
+
+
+
+
+
+bool
+YCPPropertyHandler::trySetCheckBoxValue( YWidget * widget, const YCPValue & val )
+{
+ YCheckBox * checkBox = dynamic_cast<YCheckBox *> (widget);
+
+ if ( ! checkBox )
+ return false;
+
+ if ( val->isBoolean() )
+ {
+ checkBox->setChecked( val->asBoolean()->value() );
+ return true;
+ }
+ else if ( val->isVoid() )
+ {
+ checkBox->setDontCare();
+ return true;
+ }
+
+ YUI_THROW( YUIBadPropertyArgException( YProperty( YUIProperty_Value,
+ YOtherProperty ),
+ checkbox ) );
+ return false;
+}
+
+
+bool
+YCPPropertyHandler::trySetSelectionBoxValue( YWidget * widget, const YCPValue & val )
+{
+ YSelectionBox * selBox = dynamic_cast<YSelectionBox *> (widget);
+
+ if ( ! selBox )
+ return false;
+
+ YCPItem * item = findItem( selBox, val );
+
+ if ( item )
+ {
+ selBox->selectItem( item, true );
+ }
+ else
+ {
+ y2error( "%s %s has no item with ID %s",
+ widget->widgetClass(),
+ widget->debugLabel().c_str(),
+ val->toString().c_str() );
+ }
+
+ return true;
+}
+
+
+bool
+YCPPropertyHandler::trySetComboBoxValue( YWidget * widget, const YCPValue & val )
+{
+ YSelectionBox * comboBox = dynamic_cast<YSelectionBox *> (widget);
+
+ if ( ! comboBox )
+ return false;
+
+ YCPItem * item = findItem( comboBox, val );
+
+ if ( item )
+ {
+ comboBox->selectItem( item, true );
+ }
+ else
+ {
+ if ( comboBox->editable() )
+ {
+ if ( val->isString() || val->isInteger() )
+ {
+ comboBox->setText( val->toString() );
+ return true;
+ }
+ }
+
+ y2error( "%s %s has no item with ID %s",
+ widget->widgetClass(),
+ widget->debugLabel().c_str(),
+ val->toString().c_str() );
+ }
+
+ return true;
+}
+
+
+YCPItem *
+YCPPropertyHandler::findItem( YSelectionWidget * selWidget, const YCPValue & val )
+{
+ YCPValue wantedId( val );
+
+ if ( val->isTerm() && val->asTerm()->name() == YUISymbol_id ) // `id(..) ?
+ {
+ wantedId = val->asTerm()->value(0);
+ }
+
+ for ( YItemIterator it = selWidget->itemsBegin();
+ it != selWidget->itemsEnd();
+ ++it )
+ {
+ YCPItem * item = dynamic_cast<YCPItem *> (*it);
+
+ if ( item && item->id() && wantedId )
+ return item;
+ }
+
+ return 0;
+}
+
+
+bool
+YCPPropertyHandler::trySetSelectionWidgetItems( YWidget * widget, const YCPValue & val )
+{
+ YSelectionWidget * selWidget = dynamic_cast<YCheckBox *> (widget );
+
+ if ( ! selWidget )
+ return false;
+
+ if ( val->isList() )
+ {
+ selWidget->setItems( YCPItemParser::parseItemList( val->asList ) );
+ return true;
+ }
+
+ YUI_THROW( YUIBadPropertyArgException( YProperty( propertyName,
+ YOtherProperty ),
+ widget ) );
+ return false;
+}
+
+
+
+
+
+
+
+
+YCPValue
+YPropertyHandler::tryGetCheckBoxValue( YWidget * widget )
+{
+ YCheckBox * checkBox = dynamic_cast<YCheckBox *> (widget);
+
+ if ( ! checkBox )
+ return YCPNull();
+
+ switch ( checkBox->value() )
+ {
+ case YCheckBox_on: return YCPBoolean( true );
+ case YCheckBox_off: return YCPBoolean( false );
+ case YCheckBox_dont_care: return YCPVoid(); // nil
+ }
+
+ return YCPVoid(); // shouldn't happen
+}
+
+
+
+YCPValue
+YPropertyHandler::tryGetComboBoxValue( YWidget * widget )
+{
+ YComboBox * comboBox = dynamic_cast<YComboBox *> (widget);
+
+ if ( ! comboBox )
+ return YCPNull();
+
+
+ YItem * selectedItem = comboBox->selectedItem();
+
+ if ( selectedItem )
+ {
+ YCPItem * item = dynamic_cast<YCPItem *> (selectedItem);
+
+ if ( item )
+ return item->id();
+ }
+
+ return YCPString( comboBox->text() );
+}
+
+
+YCPValue
+YPropertyHandler::tryGetSelectionBoxValue( YWidget * widget )
+{
+ YSelectionBox * selBox = dynamic_cast<YSelectionBox *> (widget);
+
+ if ( ! selBox )
+ return YCPNull();
+
+ YItem * selectedItem = selBox()->selectedItem();
+
+ if ( selectedItem )
+ {
+ YCPItem * item = dynamic_cast<YCPItem *> (selectedItem);
+
+ if ( item )
+ return item->id();
+ else
+ return YCPString( selectedItem->label() );
+ }
+
+ return YCPVoid();
+}
+
Added: branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPPropertyHandler.h Fri Jun 29 20:31:20 2007
@@ -0,0 +1,93 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPPropertyHandler.h
+
+ Widget property handlers for not-so-trivial properties.
+
+ Author: Stefan Hundhammer <sh(a)suse.de>
+
+/-*/
+
+
+#ifndef YCPPropertyHandler_h
+#define YCPPropertyHandler_h
+
+#include <ycp/YCPValue.h>
+#include <string>
+
+using std::string;
+
+
+/**
+ * Get and set complex widget properties.
+ *
+ * Simple properties of types string, bool, int are set with
+ * YWidget::setProperty() and retrieved with YWidget::getProperty().
+ *
+ * The functions here are needed for more complex cases, either because there
+ * is no unambiguous conversion from a C++ data type to a YCPValue (or vice
+ * versa) or for historical reasons to maintain backward compatibility with
+ * existing YCP code.
+ **/
+class YPropertyHandler
+{
+public:
+ /**
+ * Set a complex property.
+ **/
+ static void setComplexProperty( YWidget * widget,
+ const string & propertyName,
+ const YCPValue & val );
+
+
+ /**
+ * Get a complex property.
+ **/
+ static YCPValue getComplexProperty( YWidget * widget,
+ const string & propertyName );
+
+ /**
+ * Find a YSelectionWidget's (YSelectionBox, YComboBox, YMultiSelectionBox)
+ * item by its ID. If the ID is wrapped in `id(...), use the inner part of that.
+ *
+ * Return the item or 0 if there is no item with that ID.
+ **/
+ static YCPItem * findItem( YSelectionWidget * selWidget, const YCPValue & id );
+
+
+protected:
+
+ /**
+ * All trySet..() functions try to dynamic_cast 'widget' to the expected
+ * widget type and then set a property.
+ *
+ * They all return 'true' upon success and 'false' upon failure.
+ **/
+ static bool trySetCheckBoxValue ( YWidget * widget, const YCPValue & val );
+ static bool trySetSelectionBoxValue ( YWidget * widget, const YCPValue & val );
+ static bool trySetComboBoxValue ( YWidget * widget, const YCPValue & val );
+ static bool trySetSelectionWidgetItems ( YWidget * widget, const YCPValue & val );
+
+ /**
+ * All trySet..() functions try to dynamic_cast 'widget' to the expected
+ * widget type and then retrieve a property.
+ *
+ * They all return YCPNull upon failure and a non-null YCPValue upon success.
+ **/
+ static YCPValue tryGetCheckBoxValue ( YWidget * widget );
+ static YCPValue tryGetComboBoxValue ( YWidget * widget );
+ static YCPValue tryGetSelectionBoxValue ( YWidget * widget );
+};
+
+
+#endif // YCPPropertyHandler_h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCP_UI_Exception.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCP_UI_Exception.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCP_UI_Exception.h Fri Jun 29 20:31:20 2007
@@ -27,22 +27,22 @@
/**
* Exception class for "YCP dialog term syntax error"
**/
-class YCPDialogSyntaxError: public YUIException
+class YCPDialogSyntaxErrorException: public YUIException
{
public:
- YCPDialogSyntaxError( const string & msg )
+ YCPDialogSyntaxErrorException( const string & msg )
: YUIException( string( "Syntax Error:" ) + msg )
{}
- YCPDialogSyntaxError( const string & expected,
- const YCPValue & seen )
+ YCPDialogSyntaxErrorException( const string & expected,
+ const YCPValue & seen )
: YUIException( string( "Syntax Error: " )
+ expected
+ string( ", seen: " ) +
seen->toString() )
{}
- virtual ~YCPDialogSyntaxError() throw()
+ virtual ~YCPDialogSyntaxErrorException() throw()
{}
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.cc Fri Jun 29 20:31:20 2007
@@ -17,191 +17,216 @@
/-*/
-#include <ycp/YCPSymbol.h>
-#include <ycp/YCPBoolean.h>
-#include <ycp/YCPVoid.h>
-#include <ycp/YCPInteger.h>
#define y2log_component "ui"
#include <ycp/y2log.h>
#include "YUISymbols.h"
#include "YMacroRecorder.h"
#include "YComboBox.h"
+#include "YUIException.h"
-YComboBox::YComboBox( const YWidgetOpt & opt, YCPString label )
- : YSelectionWidget( opt, label )
- , validChars( "" )
+struct YComboBoxPrivate
+{
+ YComboBoxPrivate( bool editable )
+ , editable( editable )
+ , inputMaxLength( -1 );
+ {}
+
+ bool editable;
+ string validChars;
+ int inputMaxLength;
+};
+
+
+
+
+YComboBox::YComboBox( YWidget * parent, const string & label, bool editable )
+ : YSelectionWidget( parent, label )
+ , priv( new YComboBoxPrivate( editable )
{
- // y2debug( "YComboBox( %s )", label->value_cstr() );
- _editable = opt.isEditable.value();
}
-YCPValue YComboBox::changeWidget( const YCPSymbol & property, const YCPValue & newvalue )
+YComboBox::~YComboBox()
{
- string s = property->symbol();
+ // NOP
+}
- /**
- * @property string Label
- * The label above the ComboBox describing what it is all about
- */
- if ( s == YUIProperty_Label )
- {
- return changeLabel ( newvalue );
- }
- /**
- * @property string Value
- * The current value of the ComboBox. If this is a list item which
- * has an ID, the ID will be used rather than the corresponding text.
- * For editable ComboBox widgets it is OK to set <em>any</em> value - even
- * if it doesn't exist in the list.
- */
- else if ( s == YUIProperty_Value ) // Select item with that id
- {
- int index = itemWithId( newvalue, ! editable() ); // true: log error
+bool YComboBox::editable() const
+{
+ return priv->editable;
+}
- if ( index >= 0 ) // Item already exists in list
- {
- setCurrentItem( index );
- return YCPBoolean( true ); // OK
- }
- else // Item not in list
- {
- if ( editable() && newvalue->isString() )
- {
- setValue( newvalue->asString() );
- return YCPBoolean( true ); // OK
- }
- else // ! editable()
- {
- return YCPBoolean( false ); // Error
- }
- }
- }
- /**
- * @property id_list Items
- * The items that are displayed
- */
- else if ( s == YUIProperty_Items )
- {
- return changeItems( newvalue );
- }
+string YComboBox::validChars()
+{
+ return priv->validChars;
+}
+
- /**
- * @property string ValidChars valid input characters
- */
- else if ( s == YUIProperty_ValidChars )
+void YComboBox::setValidChars( const string & newValidChars )
+{
+ priv->validChars= newValidChars;
+}
+
+
+int YComboBox::inputMaxLength() const
+{
+ return priv->inputMaxLength;
+}
+
+
+void YComboBox::setInputMaxLength( int len )
+{
+ priv->inputMaxLength = len;
+}
+
+
+string YComboBox::value()
+{
+ return text();
+}
+
+
+void YComboBox::setValue( const string & newText )
+{
+ YItem * item = findItem( newText );
+
+ if ( item )
{
- if ( editable() )
- {
- if ( newvalue->isString() )
- {
- setValidChars( newvalue->asString() );
- return YCPBoolean( true );
- }
- else
- {
- y2error( "ComboBox: Invalid parameter %s for ValidChars property. Must be string.",
- newvalue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
- else
- {
- y2error( "ComboBox: Setting the ValidChars property doesn't make sense "
- "for a non-editable ComboBox!" );
- return YCPBoolean( false );
- }
+ YSelectionWidget::deselectAllItems();
+ item->setSelected();
+ setText( item->label() );
}
- /**
- * @property integer InputMaxLength limit the number of characters which
- * can be inserted. A value of -1 means unlimited input.
- */
- else if ( s == YUIProperty_InputMaxLength )
+ else
{
- if ( newvalue->isInteger() )
- {
- setInputMaxLength( newvalue->asInteger()->value() );
- return YCPBoolean( true );
- }
+ if ( editable() )
+ setText( newText );
else
{
- y2error( "ComboBox: Invalid parameter %s for InputMaxLength property. Must be integer.",
- newvalue->toString().c_str() );
- return YCPBoolean( false );
+ YUI_THROW( YUIException( "Invalid value" ) );
}
}
- else return YWidget::changeWidget( property, newvalue ); // handle default properties
}
-YCPValue YComboBox::queryWidget( const YCPSymbol & property )
+void YComboBox::selectItem( YItem * item, bool selected )
{
- string s = property->symbol();
- if ( s == YUIProperty_Label ) return getLabel();
- else if ( s == YUIProperty_Value )
+ // Check against null pointer and if the item actually belongs to this
+ // widget, deselect any previously selected item and select the new one
+ YSelectionWidget::selectItem( item, selected );
+ setText( item->label() );
+}
+
+
+const YItem *
+YComboBox::selectedItem()
+{
+ string currentText = text();
+
+ if ( ! currentText.empty() )
{
- int current = getCurrentItem();
+ // Try to find an item with this text
- YCPString origLabel = current >= 0 && current < item_labels->size() ?
- item_labels->value( current )->asString() : YCPString( "" );
+ YItem * item = findItem( currentText );
- if ( _editable )
+ if ( item )
{
- YCPString val = getValue();
-
- if ( current < 0 || val->value() != origLabel->value() )
- {
- // If the user edited the text (if he can do that),
- // return the user's input.
-
- return val;
- }
- }
+ // Make sure exactly this item is selected (and no other)
- if ( current < 0 )
- return YCPVoid();
-
- if ( current < item_ids->size() )
- {
- // Try to find the corresponding ID.
-
- YCPValue id = item_ids->value( current );
-
- if ( ! id.isNull() && ! id->isVoid() )
- return id;
- }
+ YSelectionWidget::deselectAllItems();
+ item->setSelected( true );
- // As a last resort, fall back to the item's label text.
-
- return origLabel;
+ return item;
+ }
+ }
+ else
+ {
+ YSelectionWidget::deselectAllItems();
+ return 0;
}
- else if ( s == YUIProperty_ValidChars ) return getValidChars();
- else return YWidget::queryWidget( property );
}
-void YComboBox::setValidChars( const YCPString & newValidChars )
+YConstItemCollection
+YComboBox::selectedItems()
+{
+ YConstItemCollection selectedItems;
+
+ // There can be no more than one selected item
+ const YItem * item = selectedItem();
+
+ if ( item )
+ selectedItems.push_back( item );
+
+ return selectedItems;
+}
+
+
+const YPropertySet &
+YComboBox::propertySet()
{
- this->validChars= newValidChars;
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
+ {
+ /*
+ * @property itemID | string Value ID of the selected item or the text the user entered
+ * @property string Label caption above the combo box
+ * @property string ValidChars set of valid input characters
+ * @property integer InputMaxLength maximum number of input characters
+ */
+ propSet.add( YProperty( YUIProperty_Value, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Label, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_ValidChars, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_InputMaxLength, YIntegerProperty ) );
+ propSet.add( YWidget::propertySet() );
+ }
+
+ return propSet;
}
-YCPString YComboBox::getValidChars()
+bool
+YComboBox::setProperty( const string & propertyName, const YPropertyValue & val )
{
- return validChars;
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
+
+ if ( propertyName == YUIProperty_Value ) return false; // Need special handling
+ else if ( propertyName == YUIProperty_Label ) setLabel( val.stringVal() );
+ else if ( propertyName == YUIProperty_ValidChars ) setValidChars( val.stringVal() );
+ else if ( propertyName == YUIProperty_InputMaxLength ) setInputMaxLength( val.integerVal() );
+ else
+ {
+ YWidget::setProperty( propertyName, val );
+ }
+
+ return true; // success -- no special processing necessary
}
-void YComboBox::saveUserInput( YMacroRecorder *macroRecorder )
+
+YPropertyValue
+YComboBox::getProperty( const string & propertyName )
{
- macroRecorder->recordWidgetProperty( this, YUIProperty_Value );
+ propertySet().check( propertyName ); // throws exceptions if not found
+
+ if ( propertyName == YUIProperty_Value ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_Label ) return YPropertyValue( label() );
+ else if ( propertyName == YUIProperty_ValidChars ) return YPropertyValue( validChars() );
+ else if ( propertyName == YUIProperty_InputMaxLength ) return YPropertyValue( inputMaxLength() );
+ else
+ {
+ return YWidget::getProperty( propertyName );
+ }
}
-void YComboBox::setInputMaxLength( const YCPInteger & numberOfChars )
+
+void YComboBox::saveUserInput( YMacroRecorder *macroRecorder )
{
+ macroRecorder->recordWidgetProperty( this, YUIProperty_Value );
}
+
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YComboBox.h Fri Jun 29 20:31:20 2007
@@ -20,27 +20,27 @@
#define YComboBox_h
#include "YSelectionWidget.h"
-#include <ycp/YCPString.h>
-#include <ycp/YCPList.h>
class YMacroRecorder;
-/**
- * @short Implementation of the ComboBox widget
- **/
+class YComboBoxPrivate;
+
class YComboBox : public YSelectionWidget
{
-public:
+protected:
/**
- * Constructor
+ * Constructor.
+ *
+ * 'editable' means the user can freely enter any value without being
+ * restricted to the items of the ComboBox's list.
**/
- YComboBox( const YWidgetOpt & opt, YCPString label );
+ YComboBox( YWidget * parent, const string * label, bool editable );
+public:
/**
- * Returns whether or not any value ( not only from the list ) can be
- * entered.
+ * Destructor.
**/
- bool editable() const { return _editable; }
+ virtual ~YComboBox();
/**
* Returns a descriptive name of this widget class for logging,
@@ -49,67 +49,130 @@
virtual const char * widgetClass() { return "YComboBox"; }
/**
- * Implements the ui command changeWidget.
+ * Return 'true' if this ComboBox is editable, i.e. if the user can freely
+ * enter any value without being restricted to the items of the ComboBox's
+ * list.
+ *
+ * Notice that this can only be set in the constructor.
+ **/
+ bool editable() const;
+
+ /**
+ * Return the value of this combo box:
+ *
+ * The text of a list item if the user (or the appplication) selected a
+ * list item or the content of the combo box's input field if the combo box
+ * is editable and the user (or the application) entered text there.
+ *
+ * Notice that YSelectionBox::selectedItem() might not be very reliable for
+ * combo boxes. Better use this function instead.
**/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue );
+ string value();
/**
- * Implements the ui command queryWidget
+ * Set the value of this combo box by string.
+ * For editable combo boxes, set the content of the combo box's input
+ * field.
**/
- YCPValue queryWidget( const YCPSymbol & property );
+ void setValue( const string & newText );
/**
- * Change the valid input characters.
+ * Return the (first) selected item or 0 if none is selected.
*
- * Overload this, but call YComboBox::setValidChars at the end of your own
- * method.
+ * Reimplemented from YSelectionWidget for better reliability: This will
+ * compare an editable combo box's user input against the text labels of
+ * all items and try to return an item if there is any match.
**/
- virtual void setValidChars( const YCPString & validChars );
-
+ virtual const YItem * selectedItem();
+
/**
- * Get the valid input characters.
+ * Return all selected items.
+ *
+ * This function does not transfer ownership of those items to the caller,
+ * so don't try to delete them!
+ *
+ * Reimplemented from YSelectionWidget for better reliability.
**/
- YCPString getValidChars();
+ virtual YCosntItemCollection selectedItems();
/**
- * Specify the amount of characters which can be inserted.
+ * Select or deselect an item.
*
- * Overload this to limit the input.
+ * Reimplemented from YSelectionWidget.
**/
- virtual void setInputMaxLength( const YCPInteger & numberOfChars );
+ virtual void selectItem( YItem * item, bool selected = true );
/**
- * The name of the widget property that will return user input.
- * Inherited from YWidget.
+ * Get the valid input characters. No input validation is performed (i.e.,
+ * the user can enter anything) if this is empty.
+ *
+ * This is only meaningful for if the ComboBox is editable.
**/
- const char *userInputProperty() { return YUIProperty_Value; }
+ string validChars();
+ /**
+ * Set the valid input characters. No input validation is performed (i.e.,
+ * the user can enter anything) if this is empty.
+ *
+ * This is only meaningful for if the ComboBox is editable.
+ *
+ * Derived classes are free to reimplement this, but they should call this
+ * base class method at the end of the overloaded function.
+ **/
+ virtual void setValidChars( const string & validChars );
-protected:
/**
- * Returns the ComboBox value.
+ * The maximum input length, i.e., the maximum number of characters the
+ * user can enter. -1 means no limit.
+ *
+ * This is only meaningful for if the ComboBox is editable.
+ **/
+ int inputMaxLength() const;
+
+ /**
+ * Set the maximum input length, i.e., the maximum number of characters the
+ * user can enter. -1 means no limit.
+ *
+ * This is only meaningful for if the ComboBox is editable.
+ *
+ * Derived classes are free to reimplement this, but they should call this
+ * base class method at the end of the overloaded function.
**/
- virtual YCPString getValue() const = 0;
+ virtual void setInputMaxLength( int numberOfChars );
/**
- * Sets the ComboBox value to a random value that is not already in
- * the item list. Will be called for editable ComboBox widgets only.
+ * The name of the widget property that will return user input.
+ * Inherited from YWidget.
**/
- virtual void setValue( const YCPString & new_value ) = 0;
+ const char *userInputProperty() { return YUIProperty_Value; }
+
+
+protected:
/**
- * Returns the index of the currently selected item (from 0 on)
- * or -1 if no item is selected.
+ * Return this combo box's current value as text.
+ *
+ * Called internally from value(), selectedItem() and related.
+ *
+ * Derived classes are required to implement this function.
**/
- virtual int getCurrentItem() const = 0;
+ virtual string text() = 0;
/**
- * Selects an item from the list. Notice there intentionally is no
- * corresponding getCurrentItem() method - use getValue() instead.
+ *
+ * Set this combo box's current value as text.
+ *
+ * Called internally whenever the content is to change
+ * programmatically. Don't call setValue() or selectItem() from here.
+ *
+ *
+ * Derived classes are required to implement this function.
**/
- virtual void setCurrentItem( int index ) = 0;
+ virtual void setText( const string & newText ) = 0;
+
private:
+
/**
* Save the widget's user input to a macro recorder.
* Intentionally declared as "private" so all macro recording internals are
@@ -117,15 +180,8 @@
**/
virtual void saveUserInput( YMacroRecorder *macroRecorder );
- /**
- * Valid input characters
- **/
- YCPString validChars;
- /**
- * Any input ( not only from the list ) permitted?
- **/
- bool _editable;
+ ImplPtr<YComboBoxPrivate> priv;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YInputField.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YInputField.cc Fri Jun 29 20:31:20 2007
@@ -46,7 +46,6 @@
: label( label )
, passwordMode( passwordMode )
, shrinkable( false )
- , validChars( "" )
, inputMaxLength( -1 )
{}
};
@@ -82,33 +81,33 @@
}
-string YInputField::validChars()
+bool YInputField::passwordMode() const
{
- return priv->validChars;
+ return priv->passwordMode;
}
-void YInputField::setValidChars( const string & newValidChars )
+bool YInputField::shrinkable() const
{
- priv->validChars= newValidChars;
+ return priv->shrinkable;
}
-bool YInputField::passwordMode() const
+void YInputField::setShrinkable( bool shrinkable )
{
- return priv->passwordMode;
+ priv->shrinkable = shrinkable;
}
-bool YInputField::shrinkable() const
+string YInputField::validChars()
{
- return priv->shrinkable;
+ return priv->validChars;
}
-void YInputField::setShrinkable( bool shrinkable )
+void YInputField::setValidChars( const string & newValidChars )
{
- priv->shrinkable = shrinkable;
+ priv->validChars= newValidChars;
}
@@ -182,14 +181,13 @@
}
-// FIXME
-// FIXME
-#include "YCPValueWidgetID.h"
-// FIXME
-// FIXME
-
void YInputField::saveUserInput( YMacroRecorder *macroRecorder )
{
+#if 0
+ // FIXME
+ // FIXME
+ // FIXME
+
if ( passwordMode() )
{
if ( hasId() )
@@ -209,5 +207,10 @@
{
macroRecorder->recordWidgetProperty( this, YUIProperty_Value );
}
+
+ // FIXME
+ // FIXME
+ // FIXME
+#endif
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YInputField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YInputField.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YInputField.h Fri Jun 29 20:31:20 2007
@@ -82,8 +82,8 @@
virtual void setLabel( const string & label );
/**
- * Returns 'true' if this input field is in password mode, i.e. if there should
- * be no on-screen echo or only a '*' for each character typed.
+ * Returns 'true' if this input field is in password mode, i.e. if there
+ * should be no on-screen echo or only a '*' for each character typed.
*
* Notice that this can only be set in the constructor.
**/
@@ -105,7 +105,7 @@
virtual void setValidChars( const string & validChars );
/**
- * Gthe maximum input length, i.e., the maximum number of characters the
+ * The maximum input length, i.e., the maximum number of characters the
* user can enter. -1 means no limit.
**/
int inputMaxLength() const;
@@ -161,7 +161,7 @@
* Reimplemented from YWidget.
**/
virtual const YPropertySet & propertySet();
-
+
/**
* Get the string of this widget that holds the keyboard shortcut.
*
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YItem.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YItem.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YItem.h Fri Jun 29 20:31:20 2007
@@ -23,7 +23,7 @@
#include <list>
using std::string;
-using std::list;
+using std::vector;
/**
* Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc. items.
@@ -38,6 +38,7 @@
YItem( const string & label, bool sel = false )
: _label( label )
, _selected( sel )
+ , _index( -1 )
{}
/**
@@ -47,6 +48,7 @@
: _label( label )
, _iconName( iconName )
, _selected( sel )
+ , _index( -1 )
{}
/**
@@ -68,11 +70,16 @@
void setLabel( const string & newLabel ) { _label = newLabel; }
/**
- * Return this icon's icon name.
+ * Return this item's icon name.
**/
string iconName() const { return _iconName; }
/**
+ * Return 'true' if this item has an icon name.
+ **/
+ bool hasIconName() const { return ! _iconName.empty(); }
+
+ /**
* Set this icon's icon name.
**/
void setIconName( const string & newIconName ) { _iconName = newIconName; }
@@ -89,17 +96,32 @@
**/
void setSelected( bool sel = true ) { _selected = sel; }
+ /**
+ * Set this item's index.
+ **/
+ void setIndex( int index ) { _index = index; }
+
+ /**
+ * Return the index of this item (as set with setIndex() ).
+ **/
+ int index() const { return _index; }
+
private:
string _label;
string _iconName;
bool _selected;
+ int _index;
};
-typedef list<YItem *> YItemList;
-typedef YItemList::iterator YItemListIterator;
-typedef YItemList::const_iterator YItemListConstIterator;
+typedef vector<YItem *> YItemCollection;
+typedef YItemCollection::iterator YItemIterator;
+typedef YItemCollection::const_iterator YItemConstIterator;
+
+typedef vector<const YItem *> YConstItemCollection;
+typedef YConstItemCollection::iterator YConstItemIterator;
+typedef YConstItemCollection::const_iterator YConstItemConstIterator;
#endif // YItem_h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.cc Fri Jun 29 20:31:20 2007
@@ -17,92 +17,131 @@
/-*/
-#include <ycp/YCPSymbol.h>
-#include <ycp/YCPBoolean.h>
-#include <ycp/YCPVoid.h>
#define y2log_component "ui"
#include <ycp/y2log.h>
+#include "YSelectionBox.h"
#include "YUISymbols.h"
+#include "YUIException.h"
#include "YMacroRecorder.h"
-#include "YSelectionBox.h"
-YSelectionBox::YSelectionBox( const YWidgetOpt & opt, YCPString label )
- : YSelectionWidget( opt,label )
+struct YSelectionBoxPrivate
{
- // y2debug( "YSelectionBox( %s )", label->value_cstr() );
+ YSelectionBoxPrivate()
+ : shrinkable( false )
+ , immediate( false )
+ {}
+
+ bool shrinkable;
+ bool immediate;
+};
+
+
+
- // Derived classes need to check opt.shrinkable!
+YSelectionBox::YSelectionBox( YWidget * parent, const string & label )
+ : YSelectionWidget( parent,label,
+ true ) // enforceSingleSelection
+ , priv( new YSelectionBoxPrivate() )
+{
+ YUI_CHECK_NEW( priv );
setDefaultStretchable( YD_HORIZ, true );
setDefaultStretchable( YD_VERT, true );
}
-YCPValue YSelectionBox::changeWidget( const YCPSymbol & property, const YCPValue & newValue )
+
+YSelectionBox::~YSelectionBox
{
- string s = property->symbol();
+ // NOP
+}
- /**
- * @property string Label
- * The label above the list describing what it is all about
- */
- if ( s == YUIProperty_Label )
- {
- return changeLabel ( newValue );
- }
-
- /**
- * @property string CurrentItem
- * The currently selected item or its ID, if it has one.
- * Alias: Value
- */
- else if ( s == YUIProperty_CurrentItem ||
- s == YUIProperty_Value ) // Select item with that id
- {
- int index = itemWithId( newValue, true ); // true: log error
- if ( index < 0 ) return YCPBoolean( false );
- else
- {
- setCurrentItem( index );
- return YCPBoolean( true );
- }
- }
-
- /**
- * @property id_list Items
- * The items that are displayed
- */
- else if ( s == YUIProperty_Items )
+
+bool YSelectionBox::shrinkable() const
+{
+ return priv->shrinkable();
+}
+
+
+void YSelectionBox::setShrinkable( bool shrinkable )
+{
+ priv->shrinkable = shrinkable;
+}
+
+
+bool YSelectionBox::immediateMode() const
+{
+ return priv->immediateMode;
+}
+
+
+void YSelectionBox::setImmediateMode( bool immediateMode )
+{
+ priv->immediateMode = immediateMode;
+
+ if ( immediateMode )
+ setNotify( true );
+}
+
+
+const YPropertySet &
+YSelectionBox::propertySet()
+{
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
{
- return changeItems( newValue );
+ /*
+ * @property itemID CurrentItem The currently selected item
+ * @property itemID Value The currently selected item
+ * @property itemList Items All items
+ * @property string Label caption above the input field
+ */
+ propSet.add( YProperty( YUIProperty_CurrentItem, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Value, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Items, YOtherProperty ) );
+ propSet.add( YProperty( YUIProperty_Label, YStringProperty ) );
+ propSet.add( YWidget::propertySet() );
}
- else return YWidget::changeWidget( property, newValue );
-}
+ return propSet;
+}
-YCPValue YSelectionBox::queryWidget( const YCPSymbol & property )
+bool
+YSelectionBox::setProperty( const string & propertyName, const YPropertyValue & val )
{
- string s = property->symbol();
- if ( s == YUIProperty_Label ) return getLabel();
- else if ( s == YUIProperty_CurrentItem ||
- s == YUIProperty_Value )
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
+
+ if ( propertyName == YUIProperty_Value ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_CurrentItem ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_Items ) return false; // Needs special handling
+ else if ( propertyName == YUIProperty_Label ) setLabel( val.stringVal() );
+ else
{
- int index = getCurrentItem();
- // y2debug( "current item: %d", index );
- if ( index >= 0 )
- {
- if ( item_ids->value( index ).isNull() ) return item_labels->value( index );
- else return item_ids->value( index );
- }
- else return YCPVoid();
+ YWidget::setProperty( propertyName, val );
}
- else return YWidget::queryWidget( property );
+
+ return true; // success -- no special processing necessary
}
+YPropertyValue
+YSelectionBox::getProperty( const string & propertyName )
+{
+ propertySet().check( propertyName ); // throws exceptions if not found
+
+ if ( propertyName == YUIProperty_Value ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_CurrentItem ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_Items ) return YPropertyValue( YOtherProperty );
+ else if ( propertyName == YUIProperty_Label ) return YPropertyValue( label() );
+ else
+ {
+ return YWidget::getProperty( propertyName );
+ }
+}
void YSelectionBox::saveUserInput( YMacroRecorder *macroRecorder )
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionBox.h Fri Jun 29 20:31:20 2007
@@ -20,25 +20,23 @@
#define YSelectionBox_h
#include "YSelectionWidget.h"
-#include "YCPItem.h"
-#include <ycp/YCPString.h>
-#include <ycp/YCPList.h>
class YMacroRecorder;
+class YSelectionBoxPrivate;
-/**
- * @short Implementation of the SelectionBox widget.
- **/
class YSelectionBox : public YSelectionWidget
{
public:
/**
- * Constructor
- * @param text the initial text of the SelectionBox label
- * @param opt the widget options
+ * Constructor.
**/
- YSelectionBox( const YWidgetOpt & opt, YCPString label );
+ YSelectionBox( YWidget * parent, const string & label );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YSelectionBox();
/**
* Returns a descriptive name of this widget class for logging,
@@ -47,34 +45,79 @@
virtual const char * widgetClass() { return "YSelectionBox"; }
/**
- * Implements the ui command changeWidget.
+ * Return 'true' if this SelectionBox should be very small.
**/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue );
+ bool shrinkable() const;
/**
- * Implements the ui command queryWidget
+ * Make this SelectionBox very small. This will take effect only upon the
+ * next geometry management run.
+ *
+ * Derived classes can overwrite this, but should call this base class
+ * function in the new function.
**/
- YCPValue queryWidget( const YCPSymbol & property );
-
+ virtual void setShrinkable( bool shrinkable = true );
+
/**
- * The name of the widget property that will return user input.
- * Inherited from YWidget.
+ * Deliver even more events than with notify() set.
+ *
+ * For YSelectionBox, this is relevant mostly for the NCurses UI:
+ *
+ * In graphical UIs like the Qt UI, the user can use the mouse to select an
+ * item in a selection box. With notify() set, this will send an event
+ * right away (i.e., it will make UserInput and related return, while
+ * normally it would only return when the user clicks a PushButton).
+ *
+ * In the NCurses UI, there is no mouse, so the user has to use the cursor
+ * keys to move to the item he wants to select. In immediateMode(), every
+ * cursor key press will make the selection box send an event. Without
+ * immediateMode(), the NCSelectionBox will wait until the user hits the
+ * [Return] key until an event is sent. Depending on what the application
+ * does upon each selection box event, immediateMode() might make the
+ * application more sluggish.
**/
- const char *userInputProperty() { return YUIProperty_CurrentItem; }
-
+ bool immediateMode() const;
-protected:
/**
- * Returns the index of the currently
- * selected item or -1 if no item is selected.
+ * Set immediateMode() on or off.
+ **/
+ void setImmediateMode( bool on = true );
+
+ /**
+ * Set a property.
+ * Reimplemented from YWidget.
+ *
+ * This function may throw YUIPropertyExceptions.
+ *
+ * This function returns 'true' if the value was successfully set and
+ * 'false' if that value requires special handling (not in error cases:
+ * those are covered by exceptions).
**/
- virtual int getCurrentItem() = 0;
+ virtual bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
- /**
- * Selects an item from the list.
+ /**
+ * Get a property.
+ * Reimplemented from YWidget.
+ *
+ * This method may throw YUIPropertyExceptions.
**/
- virtual void setCurrentItem( int index ) = 0;
+ virtual YPropertyValue getProperty( const string & propertyName );
+ /**
+ * Return this class's property set.
+ * This also initializes the property upon the first call.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual const YPropertySet & propertySet();
+
+ /**
+ * The name of the widget property that will return user input.
+ * Inherited from YWidget.
+ **/
+ const char *userInputProperty() { return YUIProperty_CurrentItem; }
+
private:
/**
@@ -83,6 +126,8 @@
* handled by the abstract libyui level, not by a specific UI.
**/
virtual void saveUserInput( YMacroRecorder *macroRecorder );
+
+ ImplPtr<YSelectionBoxPrivate> priv;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.cc Fri Jun 29 20:31:20 2007
@@ -12,254 +12,335 @@
File: YSelectionWidget.cc
- Author: Holger Macht <hmacht(a)suse.de>
+ Author: Stefan Hundhammer <sh(a)suse.de>
/-*/
-#include <ycp/YCPSymbol.h>
-#include <ycp/YCPBoolean.h>
-#include <ycp/YCPVoid.h>
#define y2log_component "ui"
#include <ycp/y2log.h>
-#include "YUISymbols.h"
-#include "YMacroRecorder.h"
-#include "YSelectionBox.h"
-#include "YUI.h"
+#include <algorithm>
+#include "YSelectionWidget.h"
+#include "YUIException.h"
-YSelectionWidget::YSelectionWidget( const YWidgetOpt & opt, YCPString label )
- : YWidget( opt )
- , label( label )
- , _hasIcons( false )
+struct YSelectionWidgetPrivate
{
- // y2debug( "YSelectionWidget( %s )", label->value_cstr() );
+ YSelectionWidgetPrivate( const string & label,
+ bool enforceSingleSelection )
+ : label( label )
+ , enforceSingleSelection( enforceSingleSelection )
+ , hasIcons( false )
+ {}
+
+ string label;
+ bool enforceSingleSelection;
+ bool hasIcons;
+ string iconBasePath;
+ YItemCollection itemCollection;
+};
+
+
+
+
+YSelectionWidget::YSelectionWidget( YWidget * parent,
+ const string & label,
+ bool enforceSingleSelection )
+ : YWidget( parent )
+ , priv( new YSelectionWidgetPrivate( label, enforceSingleSelection ) )
+{
+ YUI_CHECK_NEW( priv );
+}
+
+
+YSelectionWidget::~YSelectionWidget()
+{
+ deleteAllItems();
+}
+
+
+YSelectionWidget::deleteAllItems()
+{
+ YItemIterator it = priv->itemCollection.begin();
+
+ while ( it != priv->itemCollection.end() )
+ {
+ YItem * item = *it;
+ ++it;
+ delete item;
+ }
+
+ priv->itemCollection.clear();
+ priv->hasIcons = false;
+}
+
+
+string YSelectionWidget::label() const
+{
+ return priv->label;
+}
+
+
+void YSelectionWidget::setLabel( const string & newLabel )
+{
+ priv->label = newLabel;
+}
+
+
+bool YSelectionWidget::enforceSingleSelection() const
+{
+ return priv->enforceSingleSelection;
}
-void YSelectionWidget::setLabel( const YCPString & label )
+void YSelectionWidget::setEnforceSingleSelection( bool enforceSingleSelection )
{
- this->label = label;
+ priv->enforceSingleSelection = enforceSingleSelection;
}
-YCPString YSelectionWidget::getLabel()
+
+void YSelectionWidget::setIconBasePath( const string & basePath )
{
- return label;
+ priv->iconBasePath = basePath;
}
-int YSelectionWidget::numItems() const
+string YSelectionWidget::iconBasePath() const
{
- return item_ids->size();
+ return priv->iconBasePath;
}
-int YSelectionWidget::itemWithId( const YCPValue & id, bool report_error )
+string YSelectionWidget::iconFullPath( YItem * item ) const
{
- for ( int i=0; i < numItems(); i++ )
+ string fullPath;
+
+ if ( item && ! icon->iconName().empty() )
{
- if ( ! item_ids->value(i).isNull() && item_ids->value(i)->equal( id ) ) return i;
- else if ( item_labels->value(i)->equal( id ) ) return i;
+ // FIXME
+ // FIXME
+ // FIXME
+#if 0
+ if ( priv->iconBasePath.empty() ||
+ priv->iconBasePath[0] != '/' )
+ {
+ fullPath = YUI::qApp()->iconBasePath();
+ }
+#endif
+ // FIXME
+ // FIXME
+ // FIXME
+
+ fullPath += priv->iconBasePath + "/" + icon->iconName();
}
- if ( report_error )
- y2error( "SelectionWidget: No item %s existing", id->toString().c_str() );
- return -1;
+ return fullPath;
}
-void YSelectionWidget::parseItemList( const YCPList & item_list )
+void YSelectionWidget::addItem( YItem * item )
{
- _hasIcons = false;
+ YUI_CHECK_NULL( item );
+
+ // Add the new item to the item list
+
+ priv->itemCollection.push_back( item );
+ item->setIndex( itemCollection.size() - 1 );
- for ( int i=0; i < item_list->size(); i++ )
+ if ( item->hasIconName() )
+ priv->hasIcons = true;
+
+ //
+ // Enforce single selection (if applicable)
+ //
+
+ if ( priv->enforceSingleSelection && selected )
{
- YCPValue item = item_list->value(i);
+ YItem * oldSelectedItem = selectedItem();
+
+ // This looks expensive, but it is not: Even though selectedItem()
+ // searches the complete item list until it finds a selected item, this
+ // happens only if a new item is to be inserted that has the "selected"
+ // flag on. In the normal case, this will only be one item.
+ //
+ // Only if the calling application does this systematically wrong and
+ // sets the "selected" flag for ALL items it inserts this will be more
+ // expensive. But then, this is a bug in that application that needs to
+ // be fixed.
- if ( item->isString() ) // item is just a label
- {
- addItem( YCPNull(), item->asString(), YCPNull(), false );
- }
- else if ( item->isTerm() // `item(...)
- && item->asTerm()->name() == YUISymbol_item )
+ if ( oldSelectedItem )
{
- YCPValue id = YCPNull();
- YCPString label = YCPNull();
- YCPString icon = YCPNull();
- YCPBoolean selected = YCPNull();
- YCPList subItemList = YCPNull();
-
- if ( parseItem( item->asTerm(), // in
- id, label, icon, selected, subItemList ) ) // out
- {
- if ( selected.isNull() )
- selected = YCPBoolean( false );
-
- if ( ! subItemList.isNull() )
- {
- y2error( "No sub item list permitted for %s - rejecting %s",
- widgetClass(), subItemList->toString().c_str() );
- }
-
- if ( ! icon.isNull() )
- _hasIcons = true;
-
- addItem( id, label, icon, selected->value() );
- }
- else
- {
- y2error( "%s: Invalid item arguments: %s",
- widgetClass(), item->toString().c_str() );
- }
- }
- else
- {
- y2error( "Invalid item %s: %s items must be strings or specified with `"
- YUISymbol_item "()", widgetClass(), item->toString().c_str() );
+ oldSelectedItem->setSelected( false );
+ y2warning( "Enforcing single selection: Deselecting %s",
+ oldSelectedItem->label().c_str() );
}
}
}
-bool YSelectionWidget::parseItem( const YCPTerm & itemTerm,
- YCPValue & item_id,
- YCPString & item_label,
- YCPString & item_icon,
- YCPBoolean & item_selected,
- YCPList & sub_item_list )
+void YSelectionWidget::addItem( const string & itemLabel,
+ const string & iconName,
+ bool selected )
+{
+ YItem * item = new YItem( itemLabel, iconName, selected );
+ YUI_CHECK_NEW( item );
+ additem( item );
+}
+
+
+void YSelectionWidget::addItem( const string & itemLabel, bool selected )
{
- bool ok = true;
+ addItem( itemLabel, "", selected );
+}
+
- if ( itemTerm->size() < 1 || itemTerm->size() > 4 )
+void YSelectionWidget::addItems( const YItemCollection & itemCollection )
+{
+ OptimizeChanges below( *this ); // Delay screen updates until this block is left
+ priv->itemCollection.reserve( priv->itemCollection.size() + itemCollection.size() );
+
+ for ( YItemConstIterator it = itemCollection.begin();
+ it != itemCollection.end();
+ ++it )
{
- y2error( "Invalid argument number in %s", itemTerm->toString().c_str() );
+ addItem( *it );
}
+}
- item_id = YCPNull();
- item_label = YCPNull();
- item_icon = YCPNull();
- item_selected = YCPNull();
- sub_item_list = YCPNull();
- for ( int n=0; n < itemTerm->size() && ok; n++ )
- {
- YCPValue arg = itemTerm->value( n );
+YItemConstIterator
+YSelectionWidget::itemsBegin() const
+{
+ return priv->itemCollection.begin();
+}
- if ( arg->isTerm() ) // `id(), `icon()
- {
- ok = arg->asTerm()->size() == 1;
- if ( ok )
- {
- if ( arg->asTerm()->name() == YUISymbol_id ) // `id()
- {
- item_id = arg->asTerm()->value(0);
- }
- else if ( arg->asTerm()->name() == YUISymbol_icon ) // `icon()
- {
- ok = arg->asTerm()->value(0)->isString();
-
- if ( ok )
- item_icon = arg->asTerm()->value(0)->asString();
- }
- else
- {
- ok = false;
- }
- }
- }
- else if ( arg->isString() ) // label
- {
- ok = item_label.isNull();
+YItemConstIterator
+YSelectionWidget::itemsEnd() const
+{
+ return priv->itemCollection.end();
+}
- if ( ok )
- item_label = arg->asString();
- }
- else if ( arg->isBoolean() ) // "selected" flag
- {
- ok = item_selected.isNull();
- if ( ok )
- item_selected = arg->asBoolean();
- }
- else if ( arg->isList() ) // sub item list (for tree only)
- {
- sub_item_list = arg->asList();
- }
- else
- {
- ok = false;
- }
- }
+bool YSelectionWidget::hasItems() const
+{
+ return ! priv->itemCollection.empty();
+}
- if ( ok )
- ok = ! item_label.isNull(); // the label is mandatory
- return ok;
+int YSelectionWidget::itemsCount() const
+{
+ return priv->itemCollection.size();
}
-void YSelectionWidget::addItem( const YCPValue & id,
- const YCPString & text,
- const YCPString & icon,
- bool selected )
+YItem *
+YSelectionWidget::itemAt( int index ) const
{
- item_ids->add( id );
- item_labels->add( text );
- item_icons->add( icon );
+ if ( index < 0 || index >= priv->itemCollection.size() )
+ return 0;
- itemAdded( text, numItems()-1, selected );
+ return priv->itemCollection( index );
}
-void YSelectionWidget::deleteAllItems()
+bool YSelectionWidget::hasIcons() const
{
- item_labels = YCPList();
- item_ids = YCPList();
+ return priv->hasIcons;
}
-YCPString YSelectionWidget::itemIcon( int item_no ) const
+const YItem *
+YSelectionWidget::selectedItem()
{
- if ( item_no < 0 || item_no >= item_icons.size() )
- return YCPString( "" );
+ for ( YItemConstIterator it = itemsBegin();
+ it != itemsEnd();
+ ++it )
+ {
+ if ( (*it)->selected() )
+ return *it;
+ }
- YCPString icon = item_icons->value( item_no )->asString();
+ return 0;
+}
- if ( icon.isNull() || icon->isVoid() )
- return YCPString( "" );
- return icon;
+YItemConstList
+YSelectionWidget::selectedItems()
+{
+ YItemConstList selectedItems;
+
+ for ( YItemConstIterator it = itemsBegin();
+ it != itemsEnd();
+ ++it )
+ {
+ if ( (*it)->selected() )
+ selectedItems.push_back( *it );
+ }
+
+ return selectedItems;
}
+bool YSelectionWidget::hasSelectedItems()
+{
+ return selectedItem() != 0;
+}
+
-YCPValue YSelectionWidget::changeLabel( const YCPValue & newValue )
+void YSelectionWidget::selectItem( YItem * item, bool selected )
{
- if ( newValue->isString() )
+ YUI_CHECK_NULL( item );
+
+ if ( ! itemsContain( item ) )
+ YUI_THROW( YUIException( "Item does not belong to this widget" ) );
+
+ if ( priv->enforceSingleSelection && selected )
{
- setLabel( newValue->asString() );
+ YItem * oldSelectedItem = selectedItem();
- return YCPBoolean( true );
+ if ( oldSelectedItem )
+ {
+ // Don't complain in the log etc. -- this is a perfectly legal case!
+ oldSelectedItem->setSelected( false );
+ }
}
- else
- {
- y2error( "%s: Invalid parameter %s for Label property. Must be string",
- widgetClass(), newValue->toString().c_str() );
- return YCPBoolean( false );
+ item->setSelected( selected );
+}
+
+
+bool YSelectionWidget::itemsContain( YItem * item ) const
+{
+ return ( find( priv->itemCollection.begin(), priv->itemCollection.end(), item )
+ != priv->itemCollection.end() );
+}
+
+
+void YSelectionWidget::deselectAllItems()
+{
+ for ( YItemIterator it = priv->itemCollection.begin();
+ it != priv->itemCollection.end();
+ ++it )
+ {
+ (*it)->setSelected( false );
}
}
-YCPValue YSelectionWidget::changeItems ( const YCPValue & newValue )
+
+YItem *
+YSelectionWidget::findItem( const string & wantedItemLabel )
{
- if ( newValue->isList() )
+ for ( YItemIterator it = priv->itemCollection.begin();
+ it != priv->itemCollection.end();
+ ++it )
{
- deleteAllItems();
- parseItemList( newValue->asList() );
+ if ( (*it)->label() == wantedItemLabel )
+ return *it;
}
- return YCPBoolean( true );
+ return 0;
}
+
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSelectionWidget.h Fri Jun 29 20:31:20 2007
@@ -20,24 +20,39 @@
#define YSelectionWidget_h
#include "YWidget.h"
-#include <ycp/YCPString.h>
-#include <ycp/YCPList.h>
+#include "YItem.h"
+#include "ImplPtr.h"
+using std::string;
+class YSelectionWidgetPrivate;
/**
- * @Base class for all selection widgets like SelectionBox, Combobox and
- * MultiselectionBox
+ * Base class for selection widgets:
+ * - YSelectionBox
+ * - MultiselectionBox
+ * - YCombobox
**/
class YSelectionWidget : public YWidget
{
-public:
+protected:
/**
- * Constructor
- * @param text the initial text of the SelectionWidget label
- * @param opt the widget options
+ * Constructor.
+ *
+ * 'singleSelectionMode' indicates if this base class should enforce single
+ * selection when items are added or when items are selected from the
+ * application. Note that single selection can also mean that no item is
+ * selected.
+ **/
+ YSelectionWidget( YWidget * parent,
+ const string & label,
+ bool enforceSingleSelection );
+
+public:
+ /**
+ * Destructor.
**/
- YSelectionWidget( const YWidgetOpt & opt, YCPString label );
+ virtual ~YSelectionWidget();
/**
* Returns a descriptive name of this widget class for logging,
@@ -46,156 +61,216 @@
virtual const char * widgetClass() { return "YSelectionWidget"; }
/**
- * Get the string of this widget that holds the keyboard shortcut.
+ * Return this widget's label (the caption above the item list).
+ **/
+ string label() const;
+
+ /**
+ * Change this widget's label (the caption above the item list).
*
- * Reimplemented from YWidget.
+ * Derived classes should overwrite this function, but they should call
+ * this base class function in the new implementation.
**/
- virtual string shortcutString() { return getLabel()->value(); }
+ virtual void setLabel( const string & newLabel );
/**
- * Set the string of this widget that holds the keyboard shortcut.
+ * Add one item. This widget assumes ownership of the item object and will
+ * delete it in its destructor.
*
- * Reimplemented from YWidget.
+ * Derived classes can overwrite this function, but they should call this
+ * base class function in the new implementation.
**/
- virtual void setShortcutString( const string & str )
- { setLabel( YCPString( str ) ); }
+ virtual void addItem( YItem * item );
/**
- * Parses a given itemlist and calls addItem(...) to insert entries.
+ * Overloaded for convenience: Add an item by string.
**/
- void parseItemList( const YCPList & itemlist );
+ void addItem( const string & itemLabel, bool selected = false );
+ /**
+ * Overloaded for convenience: Add an item with a text and an icon.
+ * Note that not all UIs can display icons.
+ **/
+ void addItem( const string & itemLabel,
+ const string & iconName,
+ bool selected = false );
/**
- * Parse one `item() term with
- * `id() [optional]
- * `icon() [optional]
- * string label [MANDATORY]
- * bool selected [optional]
- * list subItemList [optional]
+ * Add multiple items. For some UIs, this can be more efficient than
+ * calling addItem() multiple times.
*
- * Example:
- *
- * `item( `id(`my_id), `icon( "colorful.png" ), "My Label", true )
+ * Derived classes can overwrite this function, but they should call this
+ * base class function in the new implementation.
+ **/
+ virtual void addItems( const YItemCollection & itemCollection );
+
+ /**
+ * Delete all items.
*
- * The order of those parameters within `item() is arbitrary.
- * The _ret Parameters are are return parameters that will be changed by
- * this function.
+ * Derived classes can overwrite this function, but they should call this
+ * base class function in the new implementation.
+ **/
+ virtual void deleteAllItems();
+
+ /**
+ * Delete all items and add new items.
+ **/
+ void setItems( const YItemCollection & itemCollection )
+ { deleteAllItems(); addItems( itemCollection ) }
+
+ /**
+ * Return an iterator that points to the first item.
*
- * If the subItemList is not desired, rejecting it is the caller's
- * responsibility (check if ! .isNull() and issue error).
+ * For YSelectionWidgets that can have tree structures, this iterator will
+ * iterate over the toplevel items.
*
- * Returns 'true' on success, 'false' on error.
+ * Important: Don't use this iterator to iterate over all items and check
+ * their "selected" state; that information might not always be up to
+ * date. Use the dedicated functions for that.
**/
- static bool parseItem( const YCPTerm & itemTerm,
- YCPValue & item_id_ret,
- YCPString & item_label_ret,
- YCPString & item_icon_ret,
- YCPBoolean & item_selected_ret,
- YCPList & sub_item_list_ret );
-
+ YItemConstIterator itemsBegin() const;
-protected:
+ /**
+ * Return an iterator that points behind the last item.
+ **/
+ YItemConstIterator itemsEnd() const;
/**
- * Called when an item has been added. Overload this to
- * fill the ui specific widget with items.
- * @param string text of the new item
- * @param index index of the new item.
- * @param selected true if the item should be selected.
+ * Return 'true' if this widget has any items.
**/
- virtual void itemAdded( const YCPString & string, int index, bool selected ) = 0;
+ bool hasItems() const;
/**
- * Searches for an item with a certain id or a certain label.
- * Returns the index of the found item or -1 if none was found
- * @param report_error set this to true, if you want me to
- * report an error if non item can be found.
+ * Return the number of items.
+ *
+ * For YSelectionWidgets that can have tree structures, this returns the
+ * number of toplevel items.
**/
- int itemWithId( const YCPValue & id, bool report_error );
+ int itemsCount() const;
/**
- * The current label of the SelectionWidget
+ * Return 'true' if any of the items has an icon.
**/
- YCPString label;
+ bool hasIcons() const;
/**
- * The current list of item ids
+ * Return the (first) selected item or 0 if none is selected.
**/
- YCPList item_ids;
+ virtual const YItem * selectedItem();
/**
- * The current list of item labels
+ * Return all selected items. This is mostly useful for derived classes
+ * that allow selecting multiple items.
+ *
+ * This function does not transfer ownership of those items to the caller,
+ * so don't try to delete them!
**/
- YCPList item_labels;
+ virtual YConstItemCollection selectedItems();
/**
- * Returns the current number of items
+ * Return 'true' if any item is selected.
**/
- int numItems() const;
+ bool hasSelectedItems();
/**
- * Change the label text. Overload this, but call
- * YSelectionWidget::setLabel at the end of your own function.
+ * Select or deselect an item.
+ *
+ * Notice that this is different from YItem::setSelected() because unlike
+ * the latter function, this function informs the parent widget of the
+ * selection change.
+ *
+ * If only one item can be selected at any time (single selection), the
+ * derived class will make sure to deselect any previous selection, if
+ * applicable.
+ *
+ * Derived classes should overwrite this function, but they should call
+ * this base class function at the new function's start (this will also
+ * check if the item really belongs to this widget and throw an exception
+ * if not).
**/
- virtual void setLabel( const YCPString & label );
+ virtual void selectItem( YItem * item, bool selected = true );
/**
- * Get the current label text. This method cannot be overidden. The value
- * of the label cannot be changed other than by calling setLabel, i.e. not
- * by the ui. Therefore setLabel stores the current label in #label.
+ * Deselect all items.
+ *
+ * Derived classes can overwrite this function, but they should call this
+ * base class function in the new implementation.
**/
- YCPString getLabel();
+ virtual void deselectAllItems();
/**
- * Adds one item
+ * Set this widget's base path where to look up icons.
+ * If this is a relative path, YUI::qApp()->iconBasePath() is prepended.
**/
- virtual void addItem( const YCPValue & id,
- const YCPString & text,
- const YCPString & icon,
- bool selected );
+ void setIconBasePath( const string & basePath );
/**
- * Cleares the two lists item_ids and item_labels. This function is
- * calles out of the corresponding YQ classes.
+ * Return this widget's base path where to look up icons
+ * as set with setIconBasePath().
**/
- virtual void deleteAllItems();
+ string iconBasePath() const;
/**
- * Changes the widgets label. Is used in every changeWidget(...)
- * function in derived classes.
+ * Return the full path + file name for the icon of the specified item.
+ *
+ * If 'item' does not have an iconName specified, this will return an empty
+ * string.
**/
- virtual YCPValue changeLabel( const YCPValue & newValue );
+ string iconFullPath( YItem * item ) const;
/**
- * Changes the widgets displayed items. Is used in every
- * changeWidget(...) function in derived classes.
+ * Return 'true' if this widget's items contain the specified item.
**/
- virtual YCPValue changeItems ( const YCPValue & newValue );
+ bool itemsContain( YItem * item ) const;
+ /**
+ * Find the (first) item with the specified label.
+ * Return 0 if there is no item with that label.
+ **/
+ YItem * findItem( const string & itemLabel );
/**
- * Returns the full path name for the icon that corresponds with item
- * number item_no or YCPVoid() if there is none.
+ * Get the string of this widget that holds the keyboard shortcut.
+ *
+ * Reimplemented from YWidget.
**/
- YCPString itemIcon( int item_no ) const;
+ virtual string shortcutString() { return label(); }
/**
- * Returns 'true' if any item of this widget has an icon
+ * Set the string of this widget that holds the keyboard shortcut.
+ *
+ * Reimplemented from YWidget.
**/
- bool hasIcons() const { return _hasIcons; }
+ virtual void setShortcutString( const string & str )
+ { setLabel( str ); }
+protected:
-private:
+ /**
+ * Set single selection mode on or off. In single selection mode, only one
+ * item can be selected at any time.
+ *
+ * If set, this base class enforces this when items are added or when items
+ * are selected from the application. Note that single selection can also
+ * mean that no item is selected.
+ **/
+ void setEnforceSingleSelection( bool on );
/**
- * The curent list of item icons. We make destructive changes to
- * this variable, so make sure only one reference to it exists!
+ * Return 'true' if this base class should enforce single selection.
**/
- YCPList item_icons;
+ bool enforceSingleSelection() const;
+
+ /**
+ * Return the item at index 'index' (from 0)
+ * or 0 if there is no such item.
+ **/
+ YItem * itemAt( int index ) const;
- bool _hasIcons;
+
+private:
+ ImplPtr<YSelectionWidgetPrivate> priv;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Fri Jun 29 20:31:20 2007
@@ -52,6 +52,7 @@
#include "YWizard.h"
#include "YCPValueWidgetID.h"
#include "YCPDialogParser.h"
+#include "YCPItemParser.h"
#include "YOptionalWidgetFactory.h"
#include "YCheckBox.h"
@@ -892,7 +893,7 @@
if ( newValue->isString() ) val = YPropertyValue( newValue->asString()->value() );
else if ( newValue->isInteger() ) val = YPropertyValue( newValue->asInteger()->value() );
else if ( newValue->isBoolean() ) val = YPropertyValue( newValue->asBoolean()->value() );
- else if ( newValue->isVoid() ) changeWidgetComplexTypes( widget, propertyName, newValue );
+ else if ( newValue->isVoid() ) YCPPropertyHandler::setComplexProperty( widget, propertyName, newValue );
else
{
y2error( "Unknown type for property %s::%s: %s",
@@ -904,10 +905,10 @@
try
{
- bool success = widget->setProperty( propertyName, val );
+ bool success = widget->setProperty( propertyName, val );
if ( ! success )
- changeWidgetComplexTypes( widget, propertyName, newValue );
+ YCPPropertyHandler::setComplexProperty( widget, propertyName, newValue );
ret = YCPBoolean( true );
}
@@ -1018,7 +1019,7 @@
case YStringProperty: return YCPString ( val.stringVal() );
case YBoolProperty: return YCPBoolean( val.boolVal() );
case YIntegerProperty: return YCPInteger( val.integerVal() );
- case YOtherProperty: return queryWidgetComplexTypes( widget, propertyName );
+ case YOtherProperty: return YCPPropertyHandler::getComplexProperty( widget, propertyName );
case YWidgetPtrProperty:
{
YWidget * widget = val.widgetPtrVal();
@@ -1057,67 +1058,6 @@
/**
- * This is the messy part of UI::QueryWidget(): Here all special cases
- * (property type YOtherProperty) are handled. It's not pretty, but at some
- * place a mapping from C++ types to YCPValues has to be done.
- **/
-YCPValue
-YUI::queryWidgetComplexTypes( YWidget * widget, const string & propertyName )
-{
- if ( propertyName == YUIProperty_Value )
- {
- YCheckBox * checkBox = dynamic_cast<YCheckBox *> (widget);
-
- if ( checkBox )
- {
- switch ( checkBox->value() )
- {
- case YCheckBox_on: return YCPBoolean( true );
- case YCheckBox_off: return YCPBoolean( false );
- case YCheckBox_dont_care: return YCPVoid(); // nil
- }
- }
- }
-
- y2warning( "Can't handle property %s::%s - returning 'nil'",
- widget->widgetClass(), propertyName.c_str() );
-
- return YCPVoid();
-}
-
-
-void
-YUI::changeWidgetComplexTypes( YWidget * widget, const string & propertyName, const YCPValue & val )
-{
- // y2debug( "%s::%s", widget->widgetClass(), propertyName.c_str() );
-
- if ( propertyName == YUIProperty_Value )
- {
- YCheckBox * checkBox = dynamic_cast<YCheckBox *> (widget);
-
- if ( checkBox )
- {
- if ( val->isBoolean() )
- {
- checkBox->setChecked( val->asBoolean()->value() );
- return;
- }
- else if ( val->isVoid() )
- {
- checkBox->setDontCare();
- return;
- }
-
- YUI_THROW( YUIBadPropertyArgException( YProperty( propertyName, YOtherProperty ), widget ) );
- }
- }
-
- y2warning( "Can't handle property %s::%s - returning 'nil'",
- widget->widgetClass(), propertyName.c_str() );
-}
-
-
-/**
* @builtin ReplaceWidget
*
* @description
Modified: branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQComboB…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQComboBox.cc Fri Jun 29 20:31:20 2007
@@ -34,24 +34,24 @@
-YQComboBox::YQComboBox( QWidget * parent,
- const YWidgetOpt & opt,
- const YCPString & label )
- : QVBox( parent )
- , YComboBox( opt, label )
+YQComboBox::YQComboBox( YWidget * parent,
+ const string & label,
+ bool editable )
+ : QVBox( (QWidget *) parent->widgetRep() )
+ , YComboBox( parent, label, editable )
, _validator(0)
{
setWidgetRep( this );
setSpacing( YQWidgetSpacing );
- setMargin( YQWidgetMargin );
+ setMargin ( YQWidgetMargin );
- _qt_label = new QLabel( fromUTF8(label->value() ), this );
+ _qt_label = new QLabel( fromUTF8( label ), this );
_qt_label->setTextFormat( QLabel::PlainText );
if ( _qt_label->text().isEmpty() )
_qt_label->hide();
- _qt_combo_box = new QComboBox( opt.isEditable.value(), this );
+ _qt_combo_box = new QComboBox( editable, this );
_qt_label->setBuddy( _qt_combo_box );
#if SEND_SELECTION_CHANGED_EVENT
@@ -61,16 +61,22 @@
connect( _qt_combo_box, SIGNAL( activated ( const QString & ) ),
this, SLOT ( textChanged( const QString & ) ) );
-
+
connect( _qt_combo_box, SIGNAL( textChanged( const QString & ) ),
this, SLOT ( textChanged( const QString & ) ) );
}
-void YQComboBox::setLabel( const YCPString & label )
+YQComboBox::~YQComboBox()
+{
+ // NOP
+}
+
+
+void YQComboBox::setLabel( const string & label )
{
_qt_label->setText( fromUTF8(label->value() ) );
-
+
if ( _qt_label->text().isEmpty() )
{
if ( _qt_label->isVisible() )
@@ -81,12 +87,12 @@
if ( _qt_label->isHidden() )
_qt_label->show();
}
-
+
YComboBox::setLabel( label );
}
-void YQComboBox::setValidChars( const YCPString & newValidChars )
+void YQComboBox::setValidChars( const string & newValidChars )
{
if ( ! _qt_combo_box->editable() )
{
@@ -94,26 +100,26 @@
debugLabel().c_str() );
return;
}
-
+
if ( _validator )
{
- _validator->setValidChars( fromUTF8( newValidChars->value() ) );
+ _validator->setValidChars( fromUTF8( newValidChars ) );
}
else
{
- _validator = new QY2CharValidator( fromUTF8( newValidChars->value() ), this );
+ _validator = new QY2CharValidator( fromUTF8( newValidChars ), this );
_qt_combo_box->setValidator( _validator );
// No need to delete the validator in the destructor - Qt will take
// care of that since it's a QObject with a parent!
}
-
+
if ( ! isValidText( _qt_combo_box->currentText() ) )
{
y2error( "Old value \"%s\" of %s \"%s\" invalid according to ValidChars \"%s\" - deleting",
(const char *) _qt_combo_box->currentText(),
widgetClass(), debugLabel().c_str(),
- newValidChars->value().c_str() );
+ newValidChars.c_str() );
_qt_combo_box->setCurrentText( "" );
}
@@ -147,24 +153,24 @@
}
-void YQComboBox::itemAdded( const YCPString & string, int index, bool selected )
+void YQComboBox::itemAdded( const string & label, int index, bool selected )
{
- _qt_combo_box->insertItem( fromUTF8(string->value() ) );
+ _qt_combo_box->insertItem( fromUTF8( label ) );
if ( selected )
- setValue( string );
+ setValue( label );
}
-int YQComboBox::getCurrentItem() const
+int YQComboBox::currentItem() const
{
return _qt_combo_box->currentItem();
}
-YCPString YQComboBox::getValue() const
+string YQComboBox::value() const
{
- return YCPString( toUTF8( _qt_combo_box->currentText() ) );
+ return toUTF8( _qt_combo_box->currentText() );
}
@@ -175,15 +181,15 @@
int pos = 0;
QString text( txt ); // need a non-const QString &
-
+
return _validator->validate( text, pos ) == QValidator::Acceptable;
}
-void YQComboBox::setValue( const YCPString & ytext )
+void YQComboBox::setValue( const string & ytext )
{
QString text = fromUTF8( ytext->value() );
-
+
if ( isValidText( text ) )
{
_qt_combo_box->blockSignals( true );
Modified: branches/tmp/sh/mod-ui/qt/src/YQComboBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQComboB…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQComboBox.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQComboBox.h Fri Jun 29 20:31:20 2007
@@ -21,7 +21,6 @@
#define YQComboBox_h
#include <qvbox.h>
-#include <ycp/YCPString.h>
#include "YComboBox.h"
@@ -37,7 +36,15 @@
public:
- YQComboBox( QWidget * parent, const YWidgetOpt & opt, const YCPString & label );
+ /**
+ * Constructor.
+ **/
+ YQComboBox( YWidget * parent, const string & label, bool editable );
+
+ /**
+ * Destructor.
+ **/
+ ~YQComboBox();
/**
* Inherited from YWidget: Sets the enabled state of the
@@ -70,14 +77,14 @@
/**
* Change the label text.
**/
- void setLabel( const YCPString & label );
+ void setLabel( const string & label );
/**
* Change the valid input characters.
*
* Reimplemented from @ref YComboBox
**/
- void setValidChars( const YCPString & validChars );
+ void setValidChars( const string & validChars );
/**
* Returns 'true' if the given text is valid according to the current
@@ -90,27 +97,27 @@
*
* Reimplemented from YComboBox.
**/
- void itemAdded( const YCPString & itemText, int itemIndex, bool selected );
+ void itemAdded( const string & itemText, int itemIndex, bool selected );
/**
* Inherited from YComboBox:
* Returns the ComboBox value.
**/
- YCPString getValue() const;
+ string value() const;
/**
* Inherited from YComboBox:
* Sets the ComboBox value to a random value that is not already in
* the item list. Will be called for editable ComboBox widgets only.
**/
- void setValue( const YCPString & new_value );
+ void setValue( const string & newValue );
/**
* Inherited from YComboBox:
* Returns the index of the currently selected item (from 0 on)
* or -1 if no item is selected.
**/
- int getCurrentItem() const;
+ int currentItem() const;
/**
* Inherited from YComboBox:
@@ -127,7 +134,7 @@
/**
* Delete all items.
*
- * Reimplemented from YSelectionWidget
+ * Reimplemented from YSelectionWidget.
**/
virtual void deleteAllItems();
Modified: branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSelect…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc Fri Jun 29 20:31:20 2007
@@ -31,6 +31,7 @@
#include "YQUI.h"
#include "YQSelectionBox.h"
#include "YQDialog.h"
+#include "YUIException.h"
#define DEFAULT_VISIBLE_LINES 5
@@ -39,39 +40,35 @@
#define ICON_DIR ICONDIR "/icons/22x22/apps/"
-YQSelectionBox::YQSelectionBox( QWidget * parent,
- const YWidgetOpt & opt,
- const YCPString & label )
- : QVBox( parent )
+YQSelectionBox::YQSelectionBox( YWidget * parent, const string & label )
+ : QVBox( (QWidget *) parent->widgetRep() )
, YSelectionBox( opt, label )
{
setWidgetRep( this );
setSpacing( YQWidgetSpacing );
- setMargin( YQWidgetMargin );
+ setMargin ( YQWidgetMargin );
- _qt_label = new QLabel( fromUTF8(label->value() ), this );
+ _qt_label = new QLabel( fromUTF8( label ), this );
_qt_label->setTextFormat( QLabel::PlainText );
if ( _qt_label->text().isEmpty() )
_qt_label->hide();
- _qt_listbox = new QListBox( this );
- _qt_listbox->installEventFilter( this );
- _qt_listbox->setVariableHeight( false );
- _qt_listbox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- _qt_listbox->setTopItem(0);
- _qt_label->setBuddy( _qt_listbox );
-
- _shrinkable = opt.isShrinkable.value();
- _immediateMode = opt.immediateMode.value();
+ _qt_listBox = new QListBox( this );
+ _qt_listBox->installEventFilter( this );
+ _qt_listBox->setVariableHeight( false );
+ _qt_listBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,
+ QSizePolicy::Expanding ) );
+ _qt_listBox->setTopItem(0);
+ _qt_label->setBuddy( _qt_listBox );
if ( notify() )
{
- connect( _qt_listbox, SIGNAL( highlighted ( int ) ),
+ connect( _qt_listBox, SIGNAL( highlighted ( int ) ),
this, SLOT ( slotSelected( int ) ) );
- connect( _qt_listbox, SIGNAL( doubleClicked( QListBoxItem * ) ),
+ connect( _qt_listBox, SIGNAL( doubleClicked( QListBoxItem * ) ),
this, SLOT ( slotActivated( QListBoxItem * ) ) );
connect( &_timer, SIGNAL( timeout() ),
@@ -80,9 +77,11 @@
}
-void YQSelectionBox::setLabel( const YCPString & label )
+void YQSelectionBox::setLabel( const string & label )
{
- _qt_label->setText( fromUTF8(label->value() ) );
+ YSelectionBox::setLabel( label );
+
+ _qt_label->setText( fromUTF8( label ) );
if ( _qt_label->text().isEmpty() )
{
@@ -94,52 +93,17 @@
if ( _qt_label->isHidden() )
_qt_label->show();
}
-
- YSelectionBox::setLabel( label );
-}
-
-
-int YQSelectionBox::preferredWidth()
-{
- int hintWidth = _qt_label->sizeHint().width() + frameWidth();
-
- return max( 80, hintWidth );
}
-int YQSelectionBox::preferredHeight()
-{
- int hintHeight = _qt_label->sizeHint().height();
- int visibleLines = _shrinkable ? SHRINKABLE_VISIBLE_LINES : DEFAULT_VISIBLE_LINES;
- hintHeight += visibleLines * _qt_listbox->fontMetrics().lineSpacing();
- hintHeight += _qt_listbox->frameWidth() * 2;
-
- return max( 80, hintHeight );
-}
-
-
-void YQSelectionBox::setSize( int newWidth, int newHeight )
-{
- resize( newWidth, newHeight );
-}
-
-
-void YQSelectionBox::setEnabled( bool enabled )
-{
- _qt_label->setEnabled( enabled );
- _qt_listbox->setEnabled( enabled );
- _qt_listbox->triggerUpdate( true );
- YWidget::setEnabled( enabled );
-}
-
-
-void YQSelectionBox::itemAdded( const YCPString & string, int index, bool selected )
+void YQSelectionBox::addItem( YItem * item )
{
+ YSelectionWidget::addItem( item );
QPixmap icon;
-
- if ( hasIcons() )
+
+ if ( hasIcons() && ! item->iconName().empty() )
{
- QString iconName( itemIcon( index )->value().c_str() );
+ QString iconName( fromUTF8( item->iconName() ) );
iconName.stripWhiteSpace();
if ( ! iconName.isEmpty() )
@@ -152,40 +116,117 @@
if ( icon.isNull() )
y2error( "Can't load icon %s", (const char *) iconName );
}
-
+
}
if ( icon.isNull() )
{
- _qt_listbox->insertItem( fromUTF8(string->value() ) );
+ _qt_listBox->insertItem( fromUTF8( item->label() ) );
}
else
{
- _qt_listbox->insertItem( icon, fromUTF8(string->value() ) );
+ _qt_listBox->insertItem( icon, fromUTF8( item->label() ) );
}
-
+
if ( selected )
- setCurrentItem( index );
+ {
+ _qt_listBox->blockSignals( true );
+ _qt_listBox->setCurrentItem( item->index() );
+ _qt_listBox->blockSignals( false );
+ }
}
-int YQSelectionBox::getCurrentItem()
+void YQSelectionBox::selectItem( YItem * item, bool selected )
{
- return _qt_listbox->currentItem();
+ YSelectionWidget::selectItem( item, selected );
+
+ _qt_listBox->blockSignals( true );
+ _qt_listBox->setCurrentItem( selected ? item->index() : -1 );
+ _qt_listBox->blockSignals( false );
}
-void YQSelectionBox::setCurrentItem( int index )
+void YQSelectionBox::selectItem( int index )
{
- _qt_listbox->blockSignals( true );
- _qt_listbox->setCurrentItem( index );
- _qt_listbox->blockSignals( false );
+ YSelectionWidget::deselectAllItems();
+
+ YItem * item = YSelectionWidget::itemAt( index );
+
+ if ( item )
+ item->setSelected( true );
+ else
+ YUI_THROW( YUIException( "Can't find selected item" ) );
+}
+
+
+void YQSelectionBox::deselectAllItems()
+{
+ YSelectionWidget::deselectAllItems();
+ _qt_listBox->clearSelection();
+
+ if ( _qt_listBox->currentItem() > -1 )
+ {
+ // Some item is selected after all; the Qt documtation says this
+ // happens if the QListBox is in single selection mode (which it is)
+ // and has the keyboard focus.
+
+ // Synchronize internal "selected" flags with what the QListBox
+ // displays. This has a small performance penalty because it calls
+ // YSelectionWidget::deselectAllItems() again which again iterates over
+ // all items.
+ selectItem( _qt_listBox->currentItem() );
+ }
+}
+
+
+void YQSelectionBox::deleteAllItems()
+{
+ _qt_listBox->blockSignals( true );
+ _qt_listBox->clear();
+ YSelectionWidget::deleteAllItems();
+ _qt_listBox->blockSignals( false );
+}
+
+
+
+int YQSelectionBox::preferredWidth()
+{
+ int hintWidth = _qt_label->sizeHint().width() + frameWidth();
+
+ return max( 80, hintWidth );
+}
+
+
+int YQSelectionBox::preferredHeight()
+{
+ int hintHeight = _qt_label->sizeHint().height();
+ int visibleLines = shrinkable() ? SHRINKABLE_VISIBLE_LINES : DEFAULT_VISIBLE_LINES;
+ hintHeight += visibleLines * _qt_listBox->fontMetrics().lineSpacing();
+ hintHeight += _qt_listBox->frameWidth() * 2;
+
+ return max( 80, hintHeight );
+}
+
+
+void YQSelectionBox::setSize( int newWidth, int newHeight )
+{
+ resize( newWidth, newHeight );
+}
+
+
+void YQSelectionBox::setEnabled( bool enabled )
+{
+ _qt_label->setEnabled( enabled );
+ _qt_listBox->setEnabled( enabled );
+ _qt_listBox->triggerUpdate( true );
+ YWidget::setEnabled( enabled );
}
bool YQSelectionBox::setKeyboardFocus()
{
- _qt_listbox->setFocus();
+ _qt_listBox->setFocus();
return true;
}
@@ -226,13 +267,16 @@
void YQSelectionBox::slotSelected( int index )
{
- if ( _immediateMode )
+ selectItem( index );
+
+ if ( immediateMode() )
returnImmediately();
else
{
if ( ! YQUI::ui()->eventsBlocked() )
{
- // Delayed event delivery - only if events are to be delivered right now.
+ // Delayed event delivery - only if events are to be delivered
+ // right now.
//
// An event block that is in effect right now may or may not affect
// events after the timer delay is expired.
@@ -248,8 +292,10 @@
}
-void YQSelectionBox::slotActivated( QListBoxItem * )
+void YQSelectionBox::slotActivated( QListBoxItem * item )
{
+ selectItem( QListBox::index( item ) );
+
YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::Activated ) );
}
@@ -258,7 +304,8 @@
{
if ( ! YQUI::ui()->eventPendingFor( this ) )
{
- // Avoid overwriting a (more important) Activated event with a SelectionChanged event
+ // Avoid overwriting a (more important) Activated event with a
+ // SelectionChanged event
y2milestone( "sending selbox event" );
YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::SelectionChanged ) );
@@ -273,15 +320,6 @@
}
-void YQSelectionBox::deleteAllItems()
-{
- _qt_listbox->blockSignals( true );
- _qt_listbox->clear();
- YSelectionWidget::deleteAllItems();
- _qt_listbox->blockSignals( false );
-}
-
-
#include "YQSelectionBox.moc"
Modified: branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSelect…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.h Fri Jun 29 20:31:20 2007
@@ -22,76 +22,97 @@
#include <qvbox.h>
#include <qtimer.h>
-#include <ycp/YCPString.h>
#include "YSelectionBox.h"
-
class QLabel;
class QListBox;
class QListBoxItem;
+
class YQSelectionBox : public QVBox, public YSelectionBox
{
Q_OBJECT
public:
- YQSelectionBox( QWidget * parent, const YWidgetOpt & opt, const YCPString & label );
+ /**
+ * Constructor.
+ **/
+ YQSelectionBox( YWidget * parent, const string & label );
/**
- * Inherited from YWidget: Sets the enabled state of the
- * widget. All new widgets are enabled per definition. Only
- * enabled widgets can take user input.
+ * Destructor.
**/
- void setEnabled( bool enabled );
+ virtual ~YQSelectionBox();
/**
- * Preferred width of the widget.
+ * Change the label text.
*
- * Reimplemented from YWidget.
+ * Reimplemented from YSelectionWidget.
**/
- virtual int preferredWidth();
+ virtual void setLabel( const string & label );
/**
- * Preferred height of the widget.
+ * Add an item.
*
- * Reimplemented from YWidget.
+ * Reimplemented from YSelectionWidget.
**/
- virtual int preferredHeight();
+ virtual void addItem( YItem * item );
/**
- * Set the new size of the widget.
+ * Select or deselect an item.
*
- * Reimplemented from YWidget.
+ * Reimplemented from YSelectionWidget.
**/
- virtual void setSize( int newWidth, int newHeight );
+ virtual void selectItem( YItem * item, bool selected = true );
/**
- * Change the label text.
+ * Deselect all items.
+ *
+ * Reimplemented from YSelectionWidget.
**/
- void setLabel( const YCPString & label );
+ virtual void deselectAllItems();
/**
- * Notification that a new item has been added.
+ * Delete all items.
*
- * Reimplemented from YSelectionBox.
+ * Reimplemented from YSelectionWidget.
**/
- void itemAdded( const YCPString & itemText, int itemIndex, bool selected );
+ virtual void deleteAllItems();
+
+ /**
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setEnabled( bool enabled );
/**
- * Inherited from YSelectionBox. Returns the index of the currently
- * selected item or -1 if no item is selected.
+ * Preferred width of the widget.
+ *
+ * Reimplemented from YWidget.
**/
- int getCurrentItem();
+ virtual int preferredWidth();
/**
- * Inherited from YSelectionBox. Makes another item selected.
+ * Preferred height of the widget.
+ *
+ * Reimplemented from YWidget.
**/
- void setCurrentItem( int index );
+ virtual int preferredHeight();
+
+ /**
+ * Set the new size of the widget.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setSize( int newWidth, int newHeight );
/**
* Accept the keyboard focus.
+ *
+ * Reimplemented from YWidget.
**/
virtual bool setKeyboardFocus();
@@ -100,12 +121,6 @@
**/
bool eventFilter( QObject * obj, QEvent * ev );
- /**
- * Delete all items.
- *
- * Reimplemented from YSelectionWidget
- **/
- virtual void deleteAllItems();
protected slots:
@@ -135,24 +150,18 @@
protected:
+ /**
+ * Select an item by index.
+ **/
+ void selectItem( int index );
+
//
// Data members
//
- // Widgets
-
- QLabel * _qt_label;
- QListBox * _qt_listbox;
-
-
- // Very small default size if specified
- bool _shrinkable;
-
- // Don't use a timer to collect events
- bool _immediateMode;
-
- // Timer to collect multiple events before returning
- QTimer _timer;
+ QLabel * _qt_label;
+ QListBox * _qt_listBox;
+ QTimer _timer;
};
#endif // YQLabel_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39100 - in /trunk/gtk: ChangeLog src/YGImage.cc src/YGRichText.cc src/YGUtils.cc src/ygtksteps.c src/ygtkwizard.c
by rpmcruz@svn.opensuse.org 29 Jun '07
by rpmcruz@svn.opensuse.org 29 Jun '07
29 Jun '07
Author: rpmcruz
Date: Fri Jun 29 19:45:31 2007
New Revision: 39100
URL: http://svn.opensuse.org/viewcvs/yast?rev=39100&view=rev
Log:
* src/ygtkwizard.c: bug fix: rolled out «let the selection event be
fired, when yast programatically selects a tree view item» (was
breaking sudo and firewall tools).
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGImage.cc
trunk/gtk/src/YGRichText.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/ygtksteps.c
trunk/gtk/src/ygtkwizard.c
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=39100&r1=39099…
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Fri Jun 29 19:45:31 2007
@@ -1,3 +1,9 @@
+2007-06-29 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
+
+ * src/ygtkwizard.c: bug fix: rolled out «let the selection event be
+ fired, when yast programatically selects a tree view item» (was
+ breaking sudo and firewall tools).
+
2007-06-21 Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
* src/YGWidget.h/cc (YGScrolledWidget): Because SelectionBox and others don't
Modified: trunk/gtk/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGImage.cc?rev=39100&r1=…
==============================================================================
--- trunk/gtk/src/YGImage.cc (original)
+++ trunk/gtk/src/YGImage.cc Fri Jun 29 19:45:31 2007
@@ -255,15 +255,6 @@
}
YGWIDGET_IMPL_COMMON
-/*
- virtual bool stretchable (YUIDimension dim) const
- {
- IMPL
- if (m_isScaled)
- return true;
- return (dim == YD_HORIZ) ? m_hasZeroWidth : m_hasZeroHeight;
- }
-*/
};
YWidget *
Modified: trunk/gtk/src/YGRichText.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGRichText.cc?rev=39100&…
==============================================================================
--- trunk/gtk/src/YGRichText.cc (original)
+++ trunk/gtk/src/YGRichText.cc Fri Jun 29 19:45:31 2007
@@ -12,7 +12,6 @@
class YGRichText : public YRichText, public YGScrolledWidget
{
- bool m_shrinkable;
bool m_plainText;
public:
Modified: trunk/gtk/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=39100&r1=…
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Fri Jun 29 19:45:31 2007
@@ -278,25 +278,7 @@
}
continue;
}
-#if 0
- // ignore comments
- char *comment = "<!--";
- for (j = 0; j < instr[i+j] != '\0' && j < (signed) sizeof (comment); j++)
- if (instr[i+j] != comment[j])
- break;
- if (j == sizeof (comment)) {
- comment = "-->";
- for (i = 0; instr[i] != '\0'; i++) {
- for (j = 0; j < (signed) sizeof (comment); j++) {
- if (instr[i+j] != comment[j])
- break;
- }
- if (j == sizeof (comment))
- break;
- }
- continue;
- }
-#endif
+
i++;
skipSpace (instr, i);
Modified: trunk/gtk/src/ygtksteps.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.c?rev=39100&r1…
==============================================================================
--- trunk/gtk/src/ygtksteps.c (original)
+++ trunk/gtk/src/ygtksteps.c Fri Jun 29 19:45:31 2007
@@ -51,7 +51,6 @@
steps->current_mark_layout = NULL;
ygtk_steps_clear (steps);
-
GTK_OBJECT_CLASS (ygtk_steps_parent_class)->destroy (object);
}
Modified: trunk/gtk/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkwizard.c?rev=39100&r…
==============================================================================
--- trunk/gtk/src/ygtkwizard.c (original)
+++ trunk/gtk/src/ygtkwizard.c Fri Jun 29 19:45:31 2007
@@ -564,12 +564,18 @@
if (path == NULL)
return FALSE;
+ g_signal_handlers_block_by_func (wizard->m_navigation_widget,
+ (gpointer) tree_item_selected_cb, wizard);
+
GtkWidget *widget = wizard->m_navigation_widget;
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (widget), path);
gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path,
NULL, FALSE);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget), path, NULL,
TRUE, 0.5, 0.5);
+
+ g_signal_handlers_unblock_by_func (wizard->m_navigation_widget,
+ (gpointer) tree_item_selected_cb, wizard);
return TRUE;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
Author: rpmcruz
Date: Fri Jun 29 18:28:59 2007
New Revision: 39099
URL: http://svn.opensuse.org/viewcvs/yast?rev=39099&view=rev
Log:
Written MAINTAINER.
Modified:
trunk/gtk/MAINTAINER
Modified: trunk/gtk/MAINTAINER
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/MAINTAINER?rev=39099&r1=3909…
==============================================================================
--- trunk/gtk/MAINTAINER (original)
+++ trunk/gtk/MAINTAINER Fri Jun 29 18:28:59 2007
@@ -1 +1,2 @@
-Wild Mongoose <wild.mongoose(a)mongoose.com>
\ No newline at end of file
+Ricardo Cruz <rpmcruz(a)alunos.dcc.fc.up.pt>
+Michael Meeks <michael.meeks(a)novell.com>
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
29 Jun '07
Author: rpmcruz
Date: Fri Jun 29 18:08:29 2007
New Revision: 39098
URL: http://svn.opensuse.org/viewcvs/yast?rev=39098&view=rev
Log:
Check image reference to see if it was well loaded to avoid warnings.
Modified:
trunk/gtk/src/ygtkrichtext.c
Modified: trunk/gtk/src/ygtkrichtext.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkrichtext.c?rev=39098…
==============================================================================
--- trunk/gtk/src/ygtkrichtext.c (original)
+++ trunk/gtk/src/ygtkrichtext.c Fri Jun 29 18:08:29 2007
@@ -349,8 +349,10 @@
else if (!g_ascii_strcasecmp (element_name, "img")) {
if (!g_ascii_strcasecmp (attribute_names[0], "src")) {
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (attribute_values[0], NULL);
- gtk_text_buffer_insert_pixbuf (state->buffer, &iter, pixbuf);
- g_object_unref (G_OBJECT (pixbuf));
+ if (pixbuf) {
+ gtk_text_buffer_insert_pixbuf (state->buffer, &iter, pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
}
else
g_warning ("Unknown img attribute: '%s'", attribute_names[0]);
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39097 - in /trunk/live-installer: ./ src/ src/control/
by jsrain@svn.opensuse.org 29 Jun '07
by jsrain@svn.opensuse.org 29 Jun '07
29 Jun '07
Author: jsrain
Date: Fri Jun 29 14:57:28 2007
New Revision: 39097
URL: http://svn.opensuse.org/viewcvs/yast?rev=39097&view=rev
Log:
some polishing, now works correctly, 2nd stage workflow is still to be
discussed
Modified:
trunk/live-installer/configure.in.in
trunk/live-installer/src/control/live-install.xml
trunk/live-installer/src/inst_live_add_base_repo.ycp
trunk/live-installer/src/inst_live_doit.ycp
trunk/live-installer/src/inst_live_sw_select.ycp
trunk/live-installer/src/live-installer.ycp
trunk/live-installer/src/live_copy_files_finish.ycp
trunk/live-installer/src/live_runme_at_boot_finish.ycp
Modified: trunk/live-installer/configure.in.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/configure.in.in?r…
==============================================================================
--- trunk/live-installer/configure.in.in (original)
+++ trunk/live-installer/configure.in.in Fri Jun 29 14:57:28 2007
@@ -7,9 +7,11 @@
## some common checks
@YAST2-CHECKS-COMMON@
@YAST2-CHECKS-YCP@
+@YAST2-CHECKS-TESTSUITE@
## Nasty hack: xgettext doesn't work for XML files, so let's symlink it
-( cd src/control; ln -sf firstboot.xml firstboot.glade )
+( cd src/control; ln -sf live-install.xml live-install.glade )
+find src/control -name \*.glade | LC_ALL=C sort > POTFILES
## and generate the output...
@YAST2-OUTPUT@
Modified: trunk/live-installer/src/control/live-install.xml
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/control/live-…
==============================================================================
--- trunk/live-installer/src/control/live-install.xml (original)
+++ trunk/live-installer/src/control/live-install.xml Fri Jun 29 14:57:28 2007
@@ -7,7 +7,7 @@
textdomain="live-installer"
-->
- <textdomain>control</textdomain>
+ <textdomain>live-installer</textdomain>
<globals>
<additional_kernel_parameters></additional_kernel_parameters>
<enable_autologin config:type="boolean">true</enable_autologin>
@@ -114,7 +114,7 @@
<proposals config:type="list">
<proposal>
<label>Live Installation Settings</label>
- <mode>installation</mode>
+ <mode>live_installation</mode>
<stage>initial</stage>
<name>initial</name>
<enable_skip>no</enable_skip>
@@ -124,6 +124,63 @@
<proposal_module>bootloader</proposal_module>
</proposal_modules>
</proposal>
+ <proposal>
+ <label>Network Configuration</label>
+ <name>network</name>
+ <stage>continue,normal</stage>
+ <enable_skip>yes</enable_skip>
+ <proposal_modules config:type="list">
+ <proposal_module>
+ <name>lan</name>
+ <presentation_order>20</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>networkmanager</name>
+ <presentation_order>5</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>ipv6</name>
+ <presentation_order>15</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>dsl</name>
+ <presentation_order>30</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>isdn</name>
+ <presentation_order>40</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>modem</name>
+ <presentation_order>50</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>remote</name>
+ <presentation_order>60</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>firewall</name>
+ <presentation_order>10</presentation_order>
+ </proposal_module>
+ <proposal_module>
+ <name>proxy</name>
+ <presentation_order>70</presentation_order>
+ </proposal_module>
+ </proposal_modules>
+ </proposal>
+ <proposal>
+ <label>Hardware Configuration</label>
+ <name>hardware</name>
+ <stage>continue</stage>
+ <enable_skip>yes</enable_skip>
+ <proposal_modules config:type="list">
+ <proposal_module>x11</proposal_module>
+ <proposal_module>printer</proposal_module>
+ <proposal_module>sound</proposal_module>
+ <proposal_module>tv</proposal_module>
+ <proposal_module>bluetooth</proposal_module>
+ </proposal_modules>
+ </proposal>
</proposals>
<!-- Stage: Initial, Mode: Installation -->
@@ -135,7 +192,7 @@
<enable_next>yes</enable_next>
</defaults>
<label>Installation</label>
- <mode>installation</mode>
+ <mode>live_installation</mode>
<stage>initial</stage>
<modules config:type="list">
<module>
@@ -177,66 +234,95 @@
<enable_next>yes</enable_next>
</defaults>
<label>Configuration</label>
- <mode>installation</mode>
+ <mode>live_installation</mode>
<stage>continue</stage>
<modules config:type="list">
<module>
- <label>Perform Installation</label>
- <name>inst_netsetup</name>
+ <label>root Password</label>
+ <name>inst_root</name>
</module>
<module>
- <label>Perform Installation</label>
- <name>inst_netprobe</name>
+ <label>Hostname</label>
+ <name>inst_hostname</name>
</module>
<module>
- <label>root Password</label>
- <name>inst_root</name>
+ <label>Network</label>
+ <name>inst_proposal</name>
+ <proposal>network</proposal>
+ </module>
+ <module>
+ <label>Network</label>
+ <name>inst_fam</name>
+ </module>
+ <module>
+ <label>Network</label>
+ <name>inst_ask_net_test</name>
</module>
<module>
- <label>Hostname</label>
- <name>hostname</name>
+ <label>Network</label>
+ <name>inst_do_net_test</name>
</module>
<module>
- <label>Software Selection</label>
+ <label>Configure Software Management</label>
<name>inst_live_add_base_repo</name>
</module>
<module>
- <label>Software Selection</label>
+ <label>Online Update</label>
+ <name>ask_online_update</name>
+ <enable_back>yes</enable_back>
+ <enable_next>yes</enable_next>
+ </module>
+ <module>
+ <label>Online Update</label>
+ <name>you</name>
+ </module>
+ <module>
+ <label>Online Update</label>
+ <name>restore_settings</name>
+ </module>
+<!-- FIXME use appropriate client once it exists
+ <module>
+ <label>Software Installation</label>
+ <name>inst_additional_repos</name>
+ </module>
+-->
+ <module>
+ <label>Software Installation</label>
<name>inst_live_sw_select</name>
</module>
<module>
- <label>Software Selection</label>
+ <label>Software Installation</label>
<name>inst_rpmcopy</name>
</module>
-<!--
<module>
- <label>Perform Installation</label>
- <name>inst_do_resize</name>
- <update config:type="boolean">false</update>
- <archs>i386,x86_64,ia64</archs>
+ <label>Users</label>
+ <name>auth</name>
+ <enable_back>no</enable_back>
</module>
<module>
- <label>Perform Installation</label>
- <name>inst_prepdisk</name>
+ <label>Users</label>
+ <name>user</name>
</module>
<module>
- <label>Perform Installation</label>
- <name>inst_kickoff</name>
+ <label>Clean Up</label>
+ <name>suseconfig</name>
+ <enable_back>no</enable_back>
+ <enable_next>no</enable_next>
</module>
<module>
- <label>Perform Installation</label>
- <name>live_doit</name>
- <enable_next>no</enable_next>
- <enable_back>no</enable_back>
+ <label>Release Notes</label>
+ <name>release_notes</name>
</module>
<module>
- <label>Perform Installation</label>
- <name>inst_finish</name>
- <enable_back>no</enable_back>
+ <label>Hardware Configuration</label>
+ <name>proposal</name>
+ <proposal>hardware</proposal>
</module>
--->
+ <module>
+ <label>Hardware Configuration</label>
+ <name>save_hardware_status</name>
+ </module>
</modules>
</workflow>
-
</workflows>
</productDefines>
Modified: trunk/live-installer/src/inst_live_add_base_repo.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/inst_live_add…
==============================================================================
--- trunk/live-installer/src/inst_live_add_base_repo.ycp (original)
+++ trunk/live-installer/src/inst_live_add_base_repo.ycp Fri Jun 29 14:57:28 2007
@@ -9,6 +9,12 @@
import "ProductControl";
import "ProductFeatures";
import "PackageCallbacksInit";
+import "GetInstArgs";
+import "Wizard";
+
+/* Called backwards */
+if(GetInstArgs::going_back())
+ return `auto;
PackageCallbacksInit::InitPackageCallbacks ();
@@ -16,11 +22,14 @@
Pkg::TargetInit ("/", false);
Pkg::SourceStartCache (true);
+Wizard::SetContents (_("Software Installation"), `VBox (), "",
+ GetInstArgs::enable_back(), GetInstArgs::enable_next());
+
// add initial source
string url = ProductFeatures::GetStringFeature ("software", "base_repo_url");
y2milestone ("Base source URL: %1", url);
Pkg::SourceCreate (url, "/");
-return nil;
+return `next;
} // client end
Modified: trunk/live-installer/src/inst_live_doit.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/inst_live_doi…
==============================================================================
--- trunk/live-installer/src/inst_live_doit.ycp (original)
+++ trunk/live-installer/src/inst_live_doit.ycp Fri Jun 29 14:57:28 2007
@@ -7,6 +7,8 @@
textdomain "live-installer";
import "Installation";
+import "Progress";
+import "Wizard";
Installation::destdir = "/mnt";
@@ -92,7 +94,10 @@
* @return boolean true on success
*/
boolean CopySymlinkedImage (map<string,string> symlinks) {
+ integer index = 0;
foreach (string link, string target, symlinks, {
+ index = index + 1;
+ Progress::Title (sformat (_("Copying %1..."), link));
SCR::Execute (.target.remove, sformat ("%1/%2", Installation::destdir, link));
/*
list<string> components = splitstring (link, "/");
@@ -106,6 +111,7 @@
link = mergestring (components, "/");
*/
FileSystemCopy ("/" + target, sformat ("%1/%2", Installation::destdir, link));
+ Progress::Step (10 + (90 * index / size (symlinks)));
});
return true;
}
@@ -122,9 +128,29 @@
return true;
}
+Progress::New(
+ // Headline for last dialog of base installation: Install LILO etc.
+ _("Copying the Live Image to Hard Disk"),
+ "", // Initial progress bar label - not empty (reserve space!)
+ 100,
+ [ _("Copy root filesystem"), _("Evaluate additional filesystems"), _("Copy additional filesystems") ],
+ [],
+ "");
+
+Wizard::DisableBackButton ();
+Wizard::DisableNextButton ();
+
+Progress::NextStage ();
+Progress::Title (_("Copying root filesystem..."));
CopyRootImage ();
+Progress::NextStageStep (5);
+Progress::Title (_("Evaluating additional filesystems..."));
map<string,string> copy_map = LinksMap (LinksToCopyList ());
+Progress::NextStageStep (10);
CopySymlinkedImage (copy_map);
+Progress::Finish();
+Progress::Title (_("Finished."));
+return `next;
} // client end
Modified: trunk/live-installer/src/inst_live_sw_select.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/inst_live_sw_…
==============================================================================
--- trunk/live-installer/src/inst_live_sw_select.ycp (original)
+++ trunk/live-installer/src/inst_live_sw_select.ycp Fri Jun 29 14:57:28 2007
@@ -6,9 +6,17 @@
{
textdomain "live-installer";
+import "GetInstArgs";
+import "Wizard";
+
+/* Called backwards */
+if(GetInstArgs::going_back())
+ return `auto;
+
+Wizard::SetContents (_("Software Installation"), `VBox (), "",
+ GetInstArgs::enable_back(), GetInstArgs::enable_next());
symbol result = (symbol)WFM::CallFunction ("inst_packages", []);
y2milestone ("Result: %1", result);
-return nil;
return result == `accept
? `next
: `back;
Modified: trunk/live-installer/src/live-installer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/live-installe…
==============================================================================
--- trunk/live-installer/src/live-installer.ycp (original)
+++ trunk/live-installer/src/live-installer.ycp Fri Jun 29 14:57:28 2007
@@ -25,9 +25,12 @@
// FIXME hack because of bootloader - libzypp does not contain product database
Product::name = "SUSE Linux";
- list<map> stage_mode = [$["stage": "initial", "mode": "installation" ]];
+ list<map> stage_mode = [
+ $["stage": "initial", "mode": "live_installation" ],
+ $["stage": "continue", "mode": "live_installation" ]
+ ];
y2internal ("SM: %1", stage_mode);
- Mode::SetMode ("installation");
+ Mode::SetMode ("live_installation");
// Stage::initial is required for most of the modules to behave correctly
Stage::Set ("initial");
Storage::InitLibstorage ();
Modified: trunk/live-installer/src/live_copy_files_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/live_copy_fil…
==============================================================================
--- trunk/live-installer/src/live_copy_files_finish.ycp (original)
+++ trunk/live-installer/src/live_copy_files_finish.ycp Fri Jun 29 14:57:28 2007
@@ -14,13 +14,15 @@
{
-textdomain "installation";
+textdomain "live-installer";
import "Installation";
import "Directory";
import "ProductControl";
import "FileUtils";
import "String";
+import "Initrd";
+import "BootCommon";
// FIXME don't know why it fails :-(
// import "SystemFilesCopy";
@@ -79,6 +81,10 @@
{
SCR::Execute (.target.bash, sformat("/bin/cp /info.txt %1", eula_txt));
}
+
+ // FIXME belongs somewhere else
+ Initrd::SetAdditionalParameters (Initrd::AdditionalParameters () + " -d " + BootCommon::RootPartitionDevice);
+
}
else
{
Modified: trunk/live-installer/src/live_runme_at_boot_finish.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/live-installer/src/live_runme_at…
==============================================================================
--- trunk/live-installer/src/live_runme_at_boot_finish.ycp (original)
+++ trunk/live-installer/src/live_runme_at_boot_finish.ycp Fri Jun 29 14:57:28 2007
@@ -14,10 +14,11 @@
{
-textdomain "installation";
+textdomain "live-installer";
import "Mode";
import "Directory";
+import "Misc";
include "installation/misc.ycp";
@@ -57,6 +58,13 @@
{
y2error ("Couldn't create target %1", runme_at_boot );
}
+ if (!SCR::Write (.target.string, Installation::file_live_install_mode, "YES"))
+ {
+ y2error ("Couldn't create target %1", Installation::file_live_install_mode );
+ }
+ // FIXME doesn't belong here
+ Misc::boot_msg = _("Reboot the computer without the Live CD in the drive
+to continue the installation.");
}
else
{
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
29 Jun '07
Author: juhliarik
Date: Fri Jun 29 14:57:17 2007
New Revision: 39096
URL: http://svn.opensuse.org/viewcvs/yast?rev=39096&view=rev
Log:
Created tag stable-2_15_6 for ftp-server
Added:
tags/stable-2_15_6/ftp-server/
- copied from r39095, trunk/ftp-server/
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39095 - in /trunk/ftp-server: VERSION package/yast2-ftp-server.changes src/wid_functions.ycp
by juhliarik@svn.opensuse.org 29 Jun '07
by juhliarik@svn.opensuse.org 29 Jun '07
29 Jun '07
Author: juhliarik
Date: Fri Jun 29 14:55:59 2007
New Revision: 39095
URL: http://svn.opensuse.org/viewcvs/yast?rev=39095&view=rev
Log:
- new version 2.15.6
Modified:
trunk/ftp-server/VERSION
trunk/ftp-server/package/yast2-ftp-server.changes
trunk/ftp-server/src/wid_functions.ycp
Modified: trunk/ftp-server/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/VERSION?rev=39095&r1=…
==============================================================================
--- trunk/ftp-server/VERSION (original)
+++ trunk/ftp-server/VERSION Fri Jun 29 14:55:59 2007
@@ -1 +1 @@
-2.15.5
+2.15.6
Modified: trunk/ftp-server/package/yast2-ftp-server.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/package/yast2-ftp-ser…
==============================================================================
--- trunk/ftp-server/package/yast2-ftp-server.changes (original)
+++ trunk/ftp-server/package/yast2-ftp-server.changes Fri Jun 29 14:55:59 2007
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Jun 29 12:46:15 CEST 2007 - juhliarik(a)suse.cz
+
+- added patch for creating upload dir
+- added patch for position of ftp-server icon in YaST
+- V 2.15.6
+
+-------------------------------------------------------------------
Wed May 30 17:31:06 CEST 2007 - juhliarik(a)suse.cz
- added patch for uploading anonymous users via vsftpd
Modified: trunk/ftp-server/src/wid_functions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/wid_functions.ycp…
==============================================================================
--- trunk/ftp-server/src/wid_functions.ycp (original)
+++ trunk/ftp-server/src/wid_functions.ycp Fri Jun 29 14:55:59 2007
@@ -132,9 +132,9 @@
if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
//FtpServer::start_xinetd = true;
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
else {
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
}
} else {
string command = "rcvsftpd start";
@@ -157,9 +157,9 @@
if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
//FtpServer::start_xinetd = true;
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
else {
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
}
} else {
@@ -183,9 +183,9 @@
if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
//FtpServer::start_xinetd = true;
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
else {
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
/*
if ((Service::Status("xinetd") != 0) &&
(FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) {
@@ -245,9 +245,9 @@
if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
//FtpServer::start_xinetd = true;
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
else {
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
/*
if ((Service::Status("xinetd") != 0) &&
(FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) {
@@ -302,7 +302,7 @@
boolean StopNowPure () {
boolean result = false;
if ((FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") && (Service::Status("xinetd") != 0)) {
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
/*
FtpServer::stop_daemon_xinetd = true;
result = FtpServer::WriteXinetd ();
@@ -327,9 +327,9 @@
if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
//FtpServer::start_xinetd = true;
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
else {
- Popup::Message("This is not supported now!");
+ Popup::Message("This is not supported via xinetd now!");
/*
if ((Service::Status("xinetd") != 0) &&
(FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) {
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39094 - in /trunk/ftp-server/src: FtpServer.ycp dialogs.ycp ftp-server.desktop wid_functions.ycp write_load.ycp
by juhliarik@svn.opensuse.org 29 Jun '07
by juhliarik@svn.opensuse.org 29 Jun '07
29 Jun '07
Author: juhliarik
Date: Fri Jun 29 12:38:00 2007
New Revision: 39094
URL: http://svn.opensuse.org/viewcvs/yast?rev=39094&view=rev
Log:
added pathes for creating upload dir, correct place of ftp-server icon
in YaST etc.
Modified:
trunk/ftp-server/src/FtpServer.ycp
trunk/ftp-server/src/dialogs.ycp
trunk/ftp-server/src/ftp-server.desktop
trunk/ftp-server/src/wid_functions.ycp
trunk/ftp-server/src/write_load.ycp
Modified: trunk/ftp-server/src/FtpServer.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/FtpServer.ycp?rev…
==============================================================================
--- trunk/ftp-server/src/FtpServer.ycp (original)
+++ trunk/ftp-server/src/FtpServer.ycp Fri Jun 29 12:38:00 2007
@@ -37,6 +37,12 @@
global boolean WriteToEditMap (string key, string value);
+global boolean WriteSettings ();
+
+global boolean WriteUpload ();
+
+global boolean WriteXinetd ();
+
/**
* Data was modified?
*/
@@ -96,6 +102,16 @@
global boolean start_xinetd = false;
/**
+ * variable signifies if daemon will be stoped in xinetd
+ *
+ * global boolean variable
+ */
+
+global boolean stop_daemon_xinetd = false;
+
+
+
+/**
* variable signifies if it is create upload dir
* only for vsftpd and anonymous connections with allowed upload
*
@@ -350,6 +366,7 @@
if (result) {
result = InitEDIT_SETTINGS ();
}
+
//read info about anonymous user "ftp"
Users::SetGUI (false);
if ((Users::Read () == "") && (EDIT_SETTINGS["VirtualUser"]:nil == "NO")) {
@@ -446,6 +463,21 @@
return true;
}
+
+/**
+ * Restart daemon apply changes
+ * only if daemon running...
+ *
+ * @return boolean successfull
+*/
+//boolean ApplyChanges () {
+
+
+
+
+//}
+
+
/**
* Write firewall configuration
*
@@ -502,7 +534,7 @@
*
* @return boolean successfull
*/
-boolean WriteSettings () {
+global boolean WriteSettings () {
boolean result = false;
result = WriteToSETTINGS();
if (vsftpd_edit) {
@@ -558,7 +590,7 @@
*
* @return boolean result of function (true/false)
*/
-boolean WriteXinetd () {
+global boolean WriteXinetd () {
boolean result = false;
if (vsftpd_xined_id != -1) {
result = WriteStartViaXinetd (start_xinetd);
@@ -571,26 +603,32 @@
* It is necessary if user want to allow uploading for anonymous
* @return boolean result of function (true/false)
*/
-boolean WriteUpload () {
+global boolean WriteUpload () {
boolean result = true;
string command ="";
+ string upload ="";
integer authentication = tointeger(EDIT_SETTINGS["AnonAuthen"]:nil);
if ((vsftpd_edit) && (authentication == 0) && (create_upload_dir) && (upload_good_permission)) {
boolean write_enable = ((EDIT_SETTINGS["EnableUpload"]:nil == "YES") ? true:false);
boolean anon_upload = ((EDIT_SETTINGS["AnonReadOnly"]:nil == "NO") ? true:false);
boolean anon_create_dirs = ((EDIT_SETTINGS["AnonCreatDirs"]:nil == "YES") ? true:false);
- if ((write_enable) && ((anon_upload) || (anon_create_dirs)))
+ if ((write_enable) && ((anon_upload) || (anon_create_dirs)))
+ if (substring (anon_homedir, (size(anon_homedir)-1)) == "/")
+ upload ="upload";
+ else
+ upload ="/upload";
command = "dir=`ls ";
command = command + anon_homedir;
command = command + " | grep upload`; if [ -z $dir ]; then mkdir ";
- command = command + anon_homedir +"upload; chown ";
+ command = command + anon_homedir +upload + "; chown ";
if (EDIT_SETTINGS["GuestUser"]:nil !="")
- command = command + EDIT_SETTINGS["GuestUser"]:nil +":"+EDIT_SETTINGS["GuestUser"]:nil;
- else if (EDIT_SETTINGS["FTPUser"]:nil !="")
+ command = command + EDIT_SETTINGS["GuestUser"]:nil +":"+EDIT_SETTINGS["GuestUser"]:nil;
+ else if (EDIT_SETTINGS["FTPUser"]:nil !="")
command = command + EDIT_SETTINGS["FTPUser"]:nil +":"+EDIT_SETTINGS["FTPUser"]:nil;
- command = command + " " + anon_homedir +"upload; chmod 766 ";
- command = command + anon_homedir +"upload; else chmod 766 " + anon_homedir +"upload; fi";
+
+ command = command + " " + anon_homedir + upload + "; chmod 766 ";
+ command = command + anon_homedir +upload + "; else chmod 766 " + anon_homedir +"upload; fi";
/*
"dir=`ls /srv/ftp/ | grep upload`; if [ -z $dir ]; then echo $dir; mkdir /srv/ftp/upload;
chown ftp:ftp /srv/ftp/upload/; chmod 755 /srv/ftp/upload; else chmod 766 /srv/ftp/upload/; fi"
Modified: trunk/ftp-server/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/dialogs.ycp?rev=3…
==============================================================================
--- trunk/ftp-server/src/dialogs.ycp (original)
+++ trunk/ftp-server/src/dialogs.ycp Fri Jun 29 12:38:00 2007
@@ -109,7 +109,10 @@
result["service_not_running_label"] = _("FTP is not running");
result["start_now_button"] = _("&Start FTP Now");
result["stop_now_button"] = _("S&top FTP Now");
+ result["save_now_action"] = SaveAndRestartVsftpd;
result["save_now_button"] = _("Sa&ve Settings and Restart FTP Now");
+ result["start_now_action"] = StartNowVsftpd;
+ result["stop_now_action"] = StopNowVsftpd;
result["help"] = sformat (CWMServiceStart::StartStopHelpTemplate (true),
// part of help text - push button label, NO SHORTCUT!!!
_("Start FTP daemon Now"),
@@ -135,7 +138,10 @@
result["service_not_running_label"] = _("FTP is not running");
result["start_now_button"] = _("&Start FTP Now");
result["stop_now_button"] = _("S&top FTP Now");
+ result["save_now_action"] = SaveAndRestartPure;
result["save_now_button"] = _("Sa&ve Settings and Restart FTP Now");
+ result["start_now_action"] = StartNowPure;
+ result["stop_now_action"] = StopNowPure;
result["help"] = sformat (CWMServiceStart::StartStopHelpTemplate (true),
// part of help text - push button label, NO SHORTCUT!!!
_("Start FTP daemon Now"),
Modified: trunk/ftp-server/src/ftp-server.desktop
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/ftp-server.deskto…
==============================================================================
--- trunk/ftp-server/src/ftp-server.desktop (original)
+++ trunk/ftp-server/src/ftp-server.desktop Fri Jun 29 12:38:00 2007
@@ -1,6 +1,6 @@
[Desktop Entry]
Type=Application
-Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Misc;
+Categories=Qt;X-SuSE-YaST;X-SuSE-YaST-Net_advanced;
X-KDE-ModuleType=Library
X-KDE-RootOnly=true
Modified: trunk/ftp-server/src/wid_functions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/wid_functions.ycp…
==============================================================================
--- trunk/ftp-server/src/wid_functions.ycp (original)
+++ trunk/ftp-server/src/wid_functions.ycp Fri Jun 29 12:38:00 2007
@@ -123,6 +123,264 @@
}
}
+
+/**
+ * Function start vsftpd
+ */
+boolean StartNowVsftpd () {
+ boolean result = false;
+ if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
+ if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
+ //FtpServer::start_xinetd = true;
+ Popup::Message("This is not supported now!");
+ else {
+ Popup::Message("This is not supported now!");
+ }
+ } else {
+ string command = "rcvsftpd start";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[ftp-server] (StartNowVsftpd) command for starting vsftpd: %1 output: %2",command, options);
+ if (options["exit"]:nil == 0)
+ result = true;
+ else
+ result = false;
+ }
+ return result;
+}
+
+
+/**
+ * Function stop vsftpd
+ */
+boolean StopNowVsftpd () {
+ boolean result = false;
+if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
+ if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
+ //FtpServer::start_xinetd = true;
+ Popup::Message("This is not supported now!");
+ else {
+ Popup::Message("This is not supported now!");
+ }
+ } else {
+
+ string command = "rcvsftpd stop";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[ftp-server] (StopNowVsftpd) command for stop vsftpd: %1 output: %2",command, options);
+ if (options["exit"]:nil == 0)
+ result = true;
+ else
+ result = false;
+ }
+ return result;
+}
+
+/**
+ * Function saves configuration and restarts vsftpd
+ */
+boolean SaveAndRestartVsftpd () {
+
+ boolean result = false;
+ if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
+ if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
+ //FtpServer::start_xinetd = true;
+ Popup::Message("This is not supported now!");
+ else {
+ Popup::Message("This is not supported now!");
+ /*
+ if ((Service::Status("xinetd") != 0) &&
+ (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) {
+ if (Mode::normal()) {
+ UI::OpenDialog(
+ `VBox(
+ `Label("Xinetd is not started!"),
+ `Label("Do you want to start it?"),
+ `HBox(
+ `PushButton(`id(`accept), "&Start"),
+ `PushButton(`id(`cancel), "Canc&el")
+ )
+ ) // end of `VBox(
+ ); // end of UI::OpenDialog(
+ while (true) {
+ any ret = UI::UserInput();
+ if ( ret == `accept ) {
+ FtpServer::EDIT_SETTINGS["StartXinetd"] = "YES";
+ FtpServer::start_xinetd = true;
+ break;
+ } else if (ret == `cancel) {
+ //FtpServer::EDIT_SETTINGS["StartXinetd"] = "NO";
+ FtpServer::start_xinetd = false;
+ break;
+ }
+ };
+ UI::CloseDialog();
+ } // end of if (Mode::normal()) {
+ } // end of if ((Service::Status("xinetd") != 0)...
+ }
+ FtpServer::WriteSettings ();
+ FtpServer::WriteUpload ();
+ result = FtpServer::WriteXinetd ();
+ */
+ }
+ } else {
+ FtpServer::WriteSettings ();
+ FtpServer::WriteUpload ();
+ string command = "rcvsftpd restart";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[ftp-server] (SaveAndRestartVsftpd) command for save and restart vsftpd: %1 output: %2",command, options);
+ if (options["exit"]:nil == 0)
+ result = true;
+ else
+ result = false;
+ }
+ return result;
+}
+
+
+/**
+ * Function start pure-ftpd
+ */
+
+boolean StartNowPure () {
+ boolean result = false;
+ if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
+ if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
+ //FtpServer::start_xinetd = true;
+ Popup::Message("This is not supported now!");
+ else {
+ Popup::Message("This is not supported now!");
+ /*
+ if ((Service::Status("xinetd") != 0) &&
+ (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) {
+ if (Mode::normal()) {
+ UI::OpenDialog(
+ `VBox(
+ `Label("Xinetd is not started!"),
+ `Label("Do you want to start it?"),
+ `HBox(
+ `PushButton(`id(`accept), "&Start"),
+ `PushButton(`id(`cancel), "Canc&el")
+ )
+ ) // end of `VBox(
+ ); // end of UI::OpenDialog(
+ while (true) {
+ any ret = UI::UserInput();
+ if ( ret == `accept ) {
+ FtpServer::EDIT_SETTINGS["StartXinetd"] = "YES";
+ FtpServer::start_xinetd = true;
+ break;
+ } else if (ret == `cancel) {
+ //FtpServer::EDIT_SETTINGS["StartXinetd"] = "NO";
+ FtpServer::start_xinetd = false;
+ break;
+ }
+ };
+ UI::CloseDialog();
+ } // end of if (Mode::normal()) {
+ } // end of if ((Service::Status("xinetd") != 0)...
+ }
+ //FtpServer::WriteSettings ();
+ result = FtpServer::WriteXinetd ();
+ y2milestone("[ftp-server] (StopNowPure) command for start pure-ftpd via xinetd");
+ */
+ }
+ } else {
+ string command = "rcpure-ftpd start";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[ftp-server] (StartNowPure) command for start pure-ftpd: %1 output: %2",command, options);
+ if (options["exit"]:nil == 0)
+ result = true;
+ else
+ result = false;
+ }
+ return result;
+}
+
+/**
+ * Function stop pure-ftpd
+ */
+
+boolean StopNowPure () {
+ boolean result = false;
+ if ((FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") && (Service::Status("xinetd") != 0)) {
+ Popup::Message("This is not supported now!");
+ /*
+ FtpServer::stop_daemon_xinetd = true;
+ result = FtpServer::WriteXinetd ();
+ */
+ } else {
+ string command = "rcpure-ftpd stop";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[ftp-server] (StopNowPure) command for stop pure-ftpd: %1 output: %2",command, options);
+ if (options["exit"]:nil == 0)
+ result = true;
+ else
+ result = false;
+ }
+ return result;
+}
+
+/**
+ * Function saves configuration and restarts pure-ftpd
+ */
+boolean SaveAndRestartPure () {
+ boolean result = false;
+ if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") {
+ if (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "YES")
+ //FtpServer::start_xinetd = true;
+ Popup::Message("This is not supported now!");
+ else {
+ Popup::Message("This is not supported now!");
+ /*
+ if ((Service::Status("xinetd") != 0) &&
+ (FtpServer::EDIT_SETTINGS["StartXinetd"]:nil == "NO")) {
+ if (Mode::normal()) {
+ UI::OpenDialog(
+ `VBox(
+ `Label("Xinetd is not started!"),
+ `Label("Do you want to start it?"),
+ `HBox(
+ `PushButton(`id(`accept), "&Start"),
+ `PushButton(`id(`cancel), "Canc&el")
+ )
+ ) // end of `VBox(
+ ); // end of UI::OpenDialog(
+ while (true) {
+ any ret = UI::UserInput();
+ if ( ret == `accept ) {
+ FtpServer::EDIT_SETTINGS["StartXinetd"] = "YES";
+ FtpServer::start_xinetd = true;
+ break;
+ } else if (ret == `cancel) {
+ //FtpServer::EDIT_SETTINGS["StartXinetd"] = "NO";
+ FtpServer::start_xinetd = false;
+ break;
+ }
+ };
+ UI::CloseDialog();
+ } // end of if (Mode::normal()) {
+ } // end of if ((Service::Status("xinetd") != 0)...
+
+ }
+ FtpServer::WriteSettings ();
+ result = FtpServer::WriteXinetd ();
+ y2milestone("[ftp-server] (StopNowPure) command for save and restart pure-ftpd via xinetd");
+ */
+ }
+ } else {
+ FtpServer::WriteSettings ();
+ string command = "rcpure-ftpd restart";
+ map options = (map)SCR::Execute (.target.bash_output, command);
+ y2milestone("[ftp-server] (StopNowPure) command for save and restart pure-ftpd: %1 output: %2",command, options);
+ if (options["exit"]:nil == 0)
+ result = true;
+ else
+ result = false;
+ }
+ return result;
+}
+
+
+
/**
* Init function for general settings
* change ValidChars for textentry
Modified: trunk/ftp-server/src/write_load.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ftp-server/src/write_load.ycp?re…
==============================================================================
--- trunk/ftp-server/src/write_load.ycp (original)
+++ trunk/ftp-server/src/write_load.ycp Fri Jun 29 12:38:00 2007
@@ -212,7 +212,7 @@
boolean WriteStartViaXinetd (boolean startxinetd) {
string pure_options = "";
boolean result = false;
- if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2"){
+ if ((FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2") && (!FtpServer::stop_daemon_xinetd)) {
if (FtpServer::vsftpd_edit) {
Inetd::netd_conf[FtpServer::vsftpd_xined_id,"enabled"] = true;
Inetd::netd_conf[FtpServer::pureftpd_xined_id,"enabled"] = false;
@@ -231,6 +231,7 @@
if (startxinetd)
Inetd::netd_status = 0; //start xinetd if not running else reload
} else {
+ Inetd::netd_status = 0;
Inetd::netd_conf[FtpServer::pureftpd_xined_id,"enabled"] = false;
Inetd::netd_conf[FtpServer::vsftpd_xined_id,"enabled"] = false;
} //end of else [ if (FtpServer::EDIT_SETTINGS["StartDaemon"]:nil == "2")]
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r39093 - in /trunk/installation: control/control.openSUSE.xml package/yast2-installation.changes src/clients/inst_productsources.ycp
by locilka@svn.opensuse.org 29 Jun '07
by locilka@svn.opensuse.org 29 Jun '07
29 Jun '07
Author: locilka
Date: Fri Jun 29 11:53:16 2007
New Revision: 39093
URL: http://svn.opensuse.org/viewcvs/yast?rev=39093&view=rev
Log:
- Extended "Suggested Installation Sources" to support two levels
of linking. First link contains list of links to be downloaded
in order to get lists of suggested repositories.
Modified:
trunk/installation/control/control.openSUSE.xml
trunk/installation/package/yast2-installation.changes
trunk/installation/src/clients/inst_productsources.ycp
Modified: trunk/installation/control/control.openSUSE.xml
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/control/control.ope…
==============================================================================
--- trunk/installation/control/control.openSUSE.xml (original)
+++ trunk/installation/control/control.openSUSE.xml Fri Jun 29 11:53:16 2007
@@ -41,7 +41,7 @@
<selection_type config:type="symbol">auto</selection_type>
<!-- FATE #300898, List of external sources accesible during the installaion time -->
- <external_sources_link>http://seven-swords.net/Repos/openSUSE_10.3/testing_list_of_repositories.xml</external_sources_link>
+ <external_sources_link>http://seven-swords.net/Servers/list_of_servers.xml</external_sources_link>
</software>
<partitioning>
Modified: trunk/installation/package/yast2-installation.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-insta…
==============================================================================
--- trunk/installation/package/yast2-installation.changes (original)
+++ trunk/installation/package/yast2-installation.changes Fri Jun 29 11:53:16 2007
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Jun 29 11:50:47 CEST 2007 - locilka(a)suse.cz
+
+- Extended "Suggested Installation Sources" to support two levels
+ of linking. First link contains list of links to be downloaded
+ in order to get lists of suggested repositories.
+
+-------------------------------------------------------------------
Thu Jun 28 21:34:19 CEST 2007 - jsrain(a)suse.cz
- updated for live CD installation
Modified: trunk/installation/src/clients/inst_productsources.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_pr…
==============================================================================
--- trunk/installation/src/clients/inst_productsources.ycp (original)
+++ trunk/installation/src/clients/inst_productsources.ycp Fri Jun 29 11:53:16 2007
@@ -1,4 +1,48 @@
{
+ /***
+ * This is a stand-alone YaST client that allows you to add suggested
+ * installation sources (repositories) to the libzypp.
+ *
+ * How it works:
+ * - First a list of servers/links is extracted from the YaST control file
+ * (/etc/YaST2/control.xml)
+ * - Then servers/links are asked one by one to provide the suggested sources
+ *
+ * Format of the initial list of servers:
+ * <?xml version="1.0"?>
+ * <productDefines xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
+ * <servers config:type="list">
+ * <item>
+ * <link>http://some.server/some_link.xml</link>
+ * </item>
+ * <item>
+ * <link>ftp://some.other.server/some_link.xml</link>
+ * </item>
+ * </servers>
+ * </productDefines>
+ *
+ * Format of Suggested sources:
+ * <?xml version="1.0"?>
+ * <productDefines xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
+ * <servers config:type="list">
+ * <repo>
+ * <name>Some name</name>
+ * <summary>Summary...</summary>
+ * <description>Description...</description>
+ * <recommended config:type="boolean">false</recommended>
+ * <url>http://some.server/some.dir/10.3/</url>
+ * </repo>
+ * <repo>
+ * <name>Another name</name>
+ * <summary>Summary...</summary>
+ * <description>Description...</description>
+ * <recommended config:type="boolean">false</recommended>
+ * <url>http://another.server/another.dir/10.3/</url>
+ * </repo>
+ * </servers>
+ * </productDefines>
+ */
+
textdomain "installation";
import "Wizard";
@@ -30,8 +74,11 @@
map <string, map> list_of_repos = $[];
+ list <map> list_of_servers = [];
+
// List of IDs of URLs to be added
list <string> repos_to_be_used = [];
+
// Map of already used suggested repositories
// $[ "($url|$path)" : src_id ]
map <string, integer> repos_already_used = $[];
@@ -51,7 +98,9 @@
// Network is not running
if (! Popup::AnyQuestion (
+ // TRANSLATORS: popup header
_("Network is not Configured"),
+ // TRANSLATORS: popup question
_("Additional sources defined by product require an Internet connection.
Would you like to configure it?"),
@@ -72,20 +121,66 @@
return ret;
}
+ /**
+ * Returns whether this URL/Path is already added as a source
+ * -1 == not added
+ * 0 or 1 or 2 ... or 'n' means 'added as source $id'
+ */
+ integer IsAddOnAlreadySelected (string s_url, string s_path) {
+ // AddOnProduct::add_on_products, $[
+ // "media" : src_id,
+ // "product" : prod["label"]:prod["productname"]:prod["productversion"]:list_of_repos[url,"name"]:"",
+ // "autoyast_product" : prod["productname"]:"",
+ // "media_url" : url,
+ // "product_dir" : pth,
+ // ];
+
+ integer ret = -1;
+
+ foreach (map one_add_on, AddOnProduct::add_on_products, {
+ if (one_add_on["media_url"]:nil == s_url && one_add_on["product_dir"]:nil == s_path) {
+ ret = one_add_on["media"]:-1;
+ break;
+ }
+ });
+
+ return ret;
+ }
+
boolean InitializeSources () {
- if (Mode::installation()) {
- y2milestone ("Sources already initialized");
- return true;
- }
+// if (Mode::installation()) {
+// y2milestone ("Sources already initialized");
+// return true;
+// }
y2milestone ("Initializing...");
if (!PackageLock::Check()) return false;
-// // FIXME: ... // //
-// Pkg::TargetInitialize (Installation::destdir);
+ Pkg::TargetInitialize (Installation::destdir);
// not necessary
// Pkg::TargetLoad();
-// Pkg::SourceStartManager (true);
+ Pkg::SourceStartManager (true);
+
+ if (! Mode::installation()) {
+ // repos_already_used
+ foreach (integer one_id, Pkg::SourceGetCurrent (true), {
+ map source_data = Pkg::SourceGeneralData (one_id);
+
+ if (IsAddOnAlreadySelected (source_data["url"]:"", source_data["product_dir"]:"") >= -1) {
+ AddOnProduct::add_on_products = add (
+ AddOnProduct::add_on_products,
+ $[
+ "media" : one_id,
+ "media_url" : source_data["url"]:"",
+ "product_dir" : source_data["product_dir"]:"",
+ "product" : "",
+ "autoyast_product" : "",
+ ]
+ );
+ }
+
+ });
+ }
return true;
}
@@ -114,7 +209,7 @@
}
string UseDownloadFile () {
- return sformat ("%1/productsources_download_tmpfile", Directory::tmpdir);
+ return sformat ("%1/list_of_productsources_servers", Directory::tmpdir);
}
boolean RemoveFileIfExists (string file) {
@@ -126,23 +221,22 @@
return true;
}
- boolean DownloadListOfSources () {
- string download_file = UseDownloadFile();
- RemoveFileIfExists (download_file);
+ boolean DownloadFile (string from, string to) {
+ RemoveFileIfExists (to);
map server_response = $[];
- if (regexpmatch (main_link, "^[hH][tT][tT][pP]://")) {
- main_link = regexpsub (main_link, "^[hH][tT][tT][pP]://(.*)", "http://\\1");
+ if (regexpmatch (from, "^[hH][tT][tT][pP]://")) {
+ from = regexpsub (from, "^[hH][tT][tT][pP]://(.*)", "http://\\1");
- server_response = HTTP::Get (main_link, download_file);
+ server_response = HTTP::Get (from, to);
- } else if (regexpmatch (main_link, "^[fF][tT][pP]://")) {
- main_link = regexpsub (main_link, "^[fF][tT][pP]://(.*)", "ftp://\\1");
+ } else if (regexpmatch (from, "^[fF][tT][pP]://")) {
+ from = regexpsub (from, "^[fF][tT][pP]://(.*)", "ftp://\\1");
- server_response = FTP::Get (main_link, download_file);
+ server_response = FTP::Get (from, to);
} else {
- y2error ("Not a supported type: %1", main_link);
+ y2error ("Not a supported type: %1", from);
return false;
}
@@ -151,11 +245,35 @@
return true;
}
- boolean ParseListOfSources () {
- list_of_repos = $[];
+ boolean ParseListOfServers (string download_file) {
+ if (! FileUtils::Exists (download_file)) {
+ y2error ("File %1 does not exist", download_file);
+ return false;
+ }
+
+ map xml_file_content = XML::XMLToYCPFile (download_file);
+
+ if (xml_file_content == nil) {
+ y2error ("Reading file %1 failed", download_file);
+ return false;
+ }
+
+ if (xml_file_content == $[]) {
+ y2milestone ("XML file is empty");
+ return false;
+ }
+
+ if (xml_file_content["servers"]:[] == []) {
+ y2milestone ("List of servers is empty");
+ return false;
+ }
- string download_file = UseDownloadFile();
+ list_of_servers = xml_file_content["servers"]:[];
+ return true;
+ }
+
+ boolean ParseListOfSources (string download_file, string url_from) {
if (! FileUtils::Exists (download_file)) {
y2error ("File %1 does not exist", download_file);
return false;
@@ -177,11 +295,47 @@
y2milestone ("List of repos is empty");
return false;
}
-
- list_of_repos = $[];
+
foreach (map one_repo, (list <map>) xml_file_content["repos"]:[], {
+ one_repo["url_from"] = url_from;
string repo_id = CreateRepoId (one_repo["url"]:"", one_repo["path"]:"/");
- list_of_repos[repo_id] = one_repo;
+
+ // do not redefine already added one
+ if (! haskey (list_of_repos, repo_id)) {
+ list_of_repos[repo_id] = one_repo;
+ }
+ });
+
+ return true;
+ }
+
+ boolean DownloadAndParseSources () {
+ list_of_repos = $[];
+ list_of_servers = [];
+
+ if (! DownloadFile (main_link, UseDownloadFile())) {
+ y2error ("Unable to download list of external sources");
+ return false;
+ }
+
+ if (! ParseListOfServers (UseDownloadFile())) {
+ y2error ("Unable to parse list of servers");
+ return false;
+ }
+
+ foreach (map one_server, list_of_servers, {
+ if (one_server["link"]:"" != "") {
+ y2milestone ("Downloading list of repos from %1", one_server["link"]:"");
+
+ if (! DownloadFile (one_server["link"]:"", UseDownloadFile())) {
+ y2error ("Unable to download list of external sources");
+ return;
+ }
+ if (! ParseListOfSources (UseDownloadFile(), one_server["link"]:"")) {
+ y2error ("Unable to parse list of sources");
+ return;
+ }
+ }
});
return true;
@@ -236,13 +390,8 @@
return `abort;
}
- if (! DownloadListOfSources()) {
- y2error ("Unable to download list of external sources");
- return `abort;
- }
-
- if (! ParseListOfSources()) {
- y2error ("Unable to parse list of sources");
+ if (! DownloadAndParseSources()) {
+ y2error ("Cannot downoload or parse sources");
return `abort;
}
@@ -267,10 +416,20 @@
}
string description = sformat (
- _("<p><b>URL:</b> %1<br>
-<b>Summary:</b> %2<br>
-<b>Description:</b> %3</p>"),
+ // TRANSLATORS: This is a complex HTML-formatted information about selecetd external repository
+ // It contains "key: value" pair, one per line, separated by <br> tags
+ // %1 is replaced with an URL of the selected repository
+ // %2 is replaced with an URL from which we've got this repository information
+ // %3 is replaced with a summary text for the selected repository
+ // %4 is replaced with a description text for the selected repository
+ _("<p>
+<b>URL:</b> %1<br>
+<b>Linked from:</b> %2<br>
+<b>Summary:</b> %3<br>
+<b>Description:</b> %4
+</p>"),
list_of_repos[current_id, "url"]:"",
+ list_of_repos[current_id, "url_from"]:"",
list_of_repos[current_id, "summary"]:list_of_repos[current_id, "name"]:"",
list_of_repos[current_id, "description"]:""
);
@@ -278,31 +437,7 @@
UI::ChangeWidget (`id ("addon_description"), `Value, description);
}
- /**
- * Returns whether this URL/Path is already added as a source
- * -1 == not added
- * 0 or 1 or 2 ... or 'n' means 'added as source $id'
- */
- integer IsAddOnAlreadySelected (string s_url, string s_path) {
- // AddOnProduct::add_on_products, $[
- // "media" : src_id,
- // "product" : prod["label"]:prod["productname"]:prod["productversion"]:list_of_repos[url,"name"]:"",
- // "autoyast_product" : prod["productname"]:"",
- // "media_url" : url,
- // "product_dir" : pth,
- // ];
-
- integer ret = -1;
-
- foreach (map one_add_on, AddOnProduct::add_on_products, {
- if (one_add_on["media_url"]:nil == s_url && one_add_on["product_dir"]:nil == s_path) {
- ret = one_add_on["media"]:-1;
- break;
- }
- });
- return ret;
- }
list <string> repos_visible_now = [];
@@ -496,8 +631,8 @@
),
// TRANSLATORS: dialog help
_("<p>FIXME: help will be added later...</p>"),
- GetInstArgs::enable_back(),
- GetInstArgs::enable_next()
+ (Mode::installation() ? GetInstArgs::enable_back():false),
+ (Mode::installation() ? GetInstArgs::enable_next():true)
);
Wizard::SetTitleIcon ("yast-sw_source");
if (! Stage::initial()) Wizard::DisableBackButton();
@@ -526,7 +661,9 @@
if (Popup::ConfirmAbort (`painless)) break;
} else {
if (Popup::ContinueCancelHeadline (
+ // TRANSLATORS: popup header
_("Aborting Configuration of External Installation Source"),
+ // TRANSLATORS: popup question
_("Are you sure you want to abort the configuration?")
)) break;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
29 Jun '07
Author: locilka
Date: Fri Jun 29 09:44:25 2007
New Revision: 39092
URL: http://svn.opensuse.org/viewcvs/yast?rev=39092&view=rev
Log:
-------------------------------------------------------------------
Thu Jun 21 17:35:48 CEST 2007 - adrian(a)suse.de
- fix changelog entry order
-------------------------------------------------------------------
Modified:
trunk/yast2/package/yast2.changes
Modified: trunk/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=…
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Fri Jun 29 09:44:25 2007
@@ -11,6 +11,11 @@
in Instalaltion Mode dialog.
-------------------------------------------------------------------
+Thu Jun 21 17:35:48 CEST 2007 - adrian(a)suse.de
+
+- fix changelog entry order
+
+-------------------------------------------------------------------
Tue Jun 19 13:02:27 CEST 2007 - kmachalkova(a)suse.cz
- Respect user's choice and never unset LANG (yast2-funcs)
@@ -2028,6 +2033,11 @@
- 2.11.37
-------------------------------------------------------------------
+Fri Feb 25 13:20:17 CET 2005 - visnov(a)suse.cz
+
+- 2.11.35
+
+-------------------------------------------------------------------
Fri Feb 25 13:11:07 CET 2005 - lslezak(a)suse.cz
- commandline - don't check mandatory keys when the command line
@@ -2035,11 +2045,6 @@
- 2.11.36
-------------------------------------------------------------------
-Fri Feb 25 13:20:17 CET 2005 - visnov(a)suse.cz
-
-- 2.11.35
-
--------------------------------------------------------------------
Thu Feb 24 12:00:54 CET 2005 - fehr(a)suse.de
- Add AsciiFile::ReplaceLine
@@ -4897,6 +4902,11 @@
- (#14457) Now date/time is redisplayed on any change in the UI.
-------------------------------------------------------------------
+Tue Mar 5 14:38:01 CET 2002 - schubi(a)suse.de
+
+- Bugfix while changing update-upgrade-status #14473
+
+-------------------------------------------------------------------
Tue Mar 5 14:23:14 CET 2002 - lnussel(a)suse.de
- filter out "\n" in helptexts (#14337)
@@ -4904,11 +4914,6 @@
and recycle this list later when the "All" button is selected (#14472)
-------------------------------------------------------------------
-Tue Mar 5 14:38:01 CET 2002 - schubi(a)suse.de
-
-- Bugfix while changing update-upgrade-status #14473
-
--------------------------------------------------------------------
Tue Mar 5 12:42:31 MET 2002 - tom(a)suse.de
- (#14211) Now executing SuSEconfig.3ddiag instead of switch2mesasoft.
@@ -5032,13 +5037,6 @@
"No" in final installation confirmation (inst_doit)
-------------------------------------------------------------------
-Wed Feb 27 17:31:07 CET 2002 - kkaempf(a)suse.de
-
-- Allow splitted dirs (.../CD1, .../CD2, ...) for all network
- installs (#14009).
-- Sort partitions combo box in bootloader dialogue (#14124).
-
--------------------------------------------------------------------
Fri Mar 1 09:30:25 CET 2002 - kkaempf(a)suse.de
- Fixed YaST2.firstboot to handle pcmcia network correctly (#13993).
@@ -5096,6 +5094,13 @@
common_popups.ycp. Using this function during X11-configuration.
-------------------------------------------------------------------
+Wed Feb 27 17:31:07 CET 2002 - kkaempf(a)suse.de
+
+- Allow splitted dirs (.../CD1, .../CD2, ...) for all network
+ installs (#14009).
+- Sort partitions combo box in bootloader dialogue (#14124).
+
+-------------------------------------------------------------------
Wed Feb 27 17:27:51 CET 2002 - gs(a)suse.de
- proposal dialog: show a warning message, if the software selection is reset
@@ -5190,27 +5195,27 @@
- fix typo ia86 -> ia64 in do_propocal.ycp
-------------------------------------------------------------------
-Tue Feb 26 15:31:39 CET 2002 - kkaempf(a)suse.de
-
-- Fix vnc password setting.
-
--------------------------------------------------------------------
Tue Feb 26 15:43:29 CET 2002 - gs(a)suse.de
- software installation: show the package version in the
description popup (bug #13750)
-------------------------------------------------------------------
+Tue Feb 26 15:36:43 CET 2002 - schubi(a)suse.de
+
+- initialize package agent correctly for update #13838
+ ( grep and locate has not been updated )
+
+-------------------------------------------------------------------
Tue Feb 26 15:35:42 CET 2002 - sh(a)suse.de
- Added notify popup when user wants to change installation mode
and no Linux partitions were found
-------------------------------------------------------------------
-Tue Feb 26 15:36:43 CET 2002 - schubi(a)suse.de
+Tue Feb 26 15:31:39 CET 2002 - kkaempf(a)suse.de
-- initialize package agent correctly for update #13838
- ( grep and locate has not been updated )
+- Fix vnc password setting.
-------------------------------------------------------------------
Tue Feb 26 14:11:46 CET 2002 - kkaempf(a)suse.de
@@ -5367,18 +5372,18 @@
- fix missing "/data<n>" mount point in installed system (#13406)
-------------------------------------------------------------------
-Tue Feb 19 13:46:17 CET 2002 - kkaempf(a)suse.de
-
-- save 'configured' status of devices detected during installation
- in order to get hw-probing at boot time correct.
-
--------------------------------------------------------------------
Tue Feb 19 13:46:34 CET 2002 - fehr(a)suse.de
- fix bug with windows resizing in old installation path
(inst_target_selection.ycp, inst_target_part.ycp) (#13559)
-------------------------------------------------------------------
+Tue Feb 19 13:46:17 CET 2002 - kkaempf(a)suse.de
+
+- save 'configured' status of devices detected during installation
+ in order to get hw-probing at boot time correct.
+
+-------------------------------------------------------------------
Tue Feb 19 09:14:30 CET 2002 - kkaempf(a)suse.de
- Install SMP kernel if "ht" set in cpuinfo:flags (#13532).
@@ -6069,11 +6074,6 @@
properly
-------------------------------------------------------------------
-Fri Sep 21 14:59:31 CEST 2001 - mike(a)suse.de
-
-- lvm_config now works in ncurses
-
--------------------------------------------------------------------
Fri Sep 21 18:55:07 CEST 2001 - sh(a)suse.de
- Fixed bug #10303: Must press 'back' twice in 'choose part. to boot'
@@ -6104,6 +6104,11 @@
- do not create directories for swap partitions
-------------------------------------------------------------------
+Fri Sep 21 14:59:31 CEST 2001 - mike(a)suse.de
+
+- lvm_config now works in ncurses
+
+-------------------------------------------------------------------
Fri Sep 21 13:36:39 CEST 2001 - gs(a)suse.de
- installation startup always (not only in manual mode) checks whether a
@@ -6165,18 +6170,18 @@
- do not create symlink for mountpoint if it would point to itself
-------------------------------------------------------------------
-Thu Sep 20 15:21:01 CEST 2001 - mike(a)suse.de
-
-- bug 11063: YaST2 trys to change fsids of pdisk-label partitions, and
- popups therefore irritating popups
-
--------------------------------------------------------------------
Thu Sep 20 15:55:27 CEST 2001 - lnussel(a)suse.de
- fstab entries for mount flags, passno etc are no longer changed
for existing entries
-------------------------------------------------------------------
+Thu Sep 20 15:21:01 CEST 2001 - mike(a)suse.de
+
+- bug 11063: YaST2 trys to change fsids of pdisk-label partitions, and
+ popups therefore irritating popups
+
+-------------------------------------------------------------------
Thu Sep 20 15:08:24 CEST 2001 - fehr(a)suse.de
- fix problem when root fs is md of personality raid5 (#10747)
@@ -6308,14 +6313,14 @@
- pdisk: size of partition for inst_doit fixed
-------------------------------------------------------------------
-Tue Sep 18 15:14:33 CEST 2001 - lnussel(a)suse.de
+Tue Sep 18 15:37:35 CEST 2001 - fehr(a)suse.de
-- workaround for '&'-character not displayed in ncurses menu
+- shut down LVM VGs and umount /etc/lvmtab.d in inst_finish.ycp
-------------------------------------------------------------------
-Tue Sep 18 15:37:35 CEST 2001 - fehr(a)suse.de
+Tue Sep 18 15:14:33 CEST 2001 - lnussel(a)suse.de
-- shut down LVM VGs and umount /etc/lvmtab.d in inst_finish.ycp
+- workaround for '&'-character not displayed in ncurses menu
-------------------------------------------------------------------
Tue Sep 18 11:58:18 CEST 2001 - lnussel(a)suse.de
@@ -6377,12 +6382,6 @@
- Bugfix #9986: Reduced suggestion refresh to 75 Hz.
-------------------------------------------------------------------
-Fri Sep 14 18:39:10 CEST 2001 - kkaempf(a)suse.de
-
-- fix inst_environment for standalone mode (#10413).
-- respect user choice to NOT install a module (#10665).
-
--------------------------------------------------------------------
Fri Sep 14 18:53:28 CEST 2001 - mike(a)suse.de
- bug 10200: check the proposal for failures
@@ -6391,6 +6390,12 @@
bug 10044: set a message when proposal is discarded
-------------------------------------------------------------------
+Fri Sep 14 18:39:10 CEST 2001 - kkaempf(a)suse.de
+
+- fix inst_environment for standalone mode (#10413).
+- respect user choice to NOT install a module (#10665).
+
+-------------------------------------------------------------------
Fri Sep 14 16:24:31 MEST 2001 - tom(a)suse.de
- Fixed Bug #10651: Autoadjusting refresh/resolution/color-depth now correct.
@@ -7077,11 +7082,6 @@
- doelilo: Adjust elilo config file for gnu-efi 2.5.
-------------------------------------------------------------------
-Tue May 22 15:46:51 CEST 2001 - schwab(a)suse.de
-
-- doelilo: Adjust elilo config file for gnu-efi 2.5.
-
--------------------------------------------------------------------
Mon May 21 15:06:40 CEST 2001 - mike(a)suse.de
- XFS support in custom partitioner and LVM configuration
@@ -7328,11 +7328,6 @@
- fix for LVM configuration at runtime
-------------------------------------------------------------------
-Thu May 10 18:41:56 CEST 2001 - kkaempf(a)suse.de
-
-- dont write /boot/message any more (#8062)
-
--------------------------------------------------------------------
Thu May 10 18:42:39 CEST 2001 - sh(a)suse.de
- Fixed bug #7388: unnecessary OK-buttons
@@ -7340,6 +7335,11 @@
only one popup that contains both messages
-------------------------------------------------------------------
+Thu May 10 18:41:56 CEST 2001 - kkaempf(a)suse.de
+
+- dont write /boot/message any more (#8062)
+
+-------------------------------------------------------------------
Thu May 10 18:02:33 CEST 2001 - fehr(a)suse.de
- add lvm initialisation when doing an update (#7974)
@@ -7504,6 +7504,11 @@
- mk_boot_floppy completely rewritten to use lilo instead of syslinux
-------------------------------------------------------------------
+Tue May 8 10:56:51 CEST 2001 - schwab(a)suse.de
+
+- Fix typo targeroot -> targetroot.
+
+-------------------------------------------------------------------
Tue May 8 10:25:01 CEST 2001 - jbuch(a)suse.de
- added define to change fsid from 5 to 15
@@ -7512,11 +7517,6 @@
- showing progress bars again #7774
-------------------------------------------------------------------
-Tue May 8 10:56:51 CEST 2001 - schwab(a)suse.de
-
-- Fix typo targeroot -> targetroot.
-
--------------------------------------------------------------------
Tue May 8 09:28:29 CEST 2001 - kkaempf(a)suse.de
- set hwclock before starting to change the target (#7833)
@@ -9143,15 +9143,15 @@
- yast2 now starts y2controlcenter
-------------------------------------------------------------------
-Wed Dec 13 15:44:05 CET 2000 - kkaempf(a)suse.de
+Wed Dec 13 17:27:47 MET 2000 - schubi(a)suse.de
-- automatically use free space on disk only if it's enough
- for a default installation (w/o office)
+- rpm-rebuild added
-------------------------------------------------------------------
-Wed Dec 13 17:27:47 MET 2000 - schubi(a)suse.de
+Wed Dec 13 15:44:05 CET 2000 - kkaempf(a)suse.de
-- rpm-rebuild added
+- automatically use free space on disk only if it's enough
+ for a default installation (w/o office)
-------------------------------------------------------------------
Wed Dec 13 12:25:55 CET 2000 - kkaempf(a)suse.de
@@ -9363,6 +9363,12 @@
version 2.0.71
-------------------------------------------------------------------
+Thu Oct 19 09:28:59 CEST 2000 - mike(a)suse.de
+
+- s390 fixes
+ version 2.0.77
+
+-------------------------------------------------------------------
Wed Oct 18 14:57:13 CEST 2000 - choeger(a)suse.de
- added product cd detection
@@ -9386,12 +9392,6 @@
version 2.0.69
-------------------------------------------------------------------
-Thu Oct 19 09:28:59 CEST 2000 - mike(a)suse.de
-
-- s390 fixes
- version 2.0.77
-
--------------------------------------------------------------------
Thu Oct 5 08:59:07 CEST 2000 - mike(a)suse.de
- fixed Makefile
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0