Author: sh-sh-sh
Date: Thu Nov 1 00:01:26 2007
New Revision: 41698
URL: http://svn.opensuse.org/viewcvs/yast?rev=41698&view=rev
Log:
Ported YTimeField + YDateField
(used only once all over YaST2...)
Added:
branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.cc
branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.h
Modified:
branches/tmp/sh/mod-ui/core/libyui/doc/examples/DateField1.ycp
branches/tmp/sh/mod-ui/core/libyui/doc/examples/TimeField1.ycp
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/YDateField.cc
branches/tmp/sh/mod-ui/core/libyui/src/YDateField.h
branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.cc
branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h
branches/tmp/sh/mod-ui/qt/src/YQDateField.cc
branches/tmp/sh/mod-ui/qt/src/YQDateField.h
branches/tmp/sh/mod-ui/qt/src/YQDialog.h
branches/tmp/sh/mod-ui/qt/src/YQDownloadProgress.h
branches/tmp/sh/mod-ui/qt/src/YQDumbTab.h
branches/tmp/sh/mod-ui/qt/src/YQGenericButton.h
branches/tmp/sh/mod-ui/qt/src/YQInputField.h
branches/tmp/sh/mod-ui/qt/src/YQLayoutBox.h
branches/tmp/sh/mod-ui/qt/src/YQLogView.h
branches/tmp/sh/mod-ui/qt/src/YQMultiProgressMeter.h
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h
branches/tmp/sh/mod-ui/qt/src/YQRadioButtonGroup.h
branches/tmp/sh/mod-ui/qt/src/YQReplacePoint.h
branches/tmp/sh/mod-ui/qt/src/YQSlider.h
branches/tmp/sh/mod-ui/qt/src/YQTimeField.cc
branches/tmp/sh/mod-ui/qt/src/YQTimeField.h
branches/tmp/sh/mod-ui/qt/src/YQUI.h
branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/doc/examples/DateField1.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/doc/examples/DateField1.ycp?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/doc/examples/DateField1.ycp (original)
+++ branches/tmp/sh/mod-ui/core/libyui/doc/examples/DateField1.ycp Thu Nov 1 00:01:26 2007
@@ -2,14 +2,15 @@
{
UI::OpenDialog(
`VBox(
- `Left( `DateField(`id(`date), "Date:", "2004-10-24") ),
- `Left( `TimeField(`id(`time), "Time:", "10:10:00" ) ),
+ `Left( `DateField(`id(`date), `opt(`hstretch), "Date:", "1989-11-09") ),
+ `Left( `TimeField(`id(`time), `opt(`hstretch), "Time:", "20:15:00" ) ),
`PushButton("&OK")
)
);
UI::UserInput();
- y2milestone("Returns %1", UI::QueryWidget(`id(`date), `Value) );
- UI::ChangeWidget(`id(`date),`Value, "2004-01-01");
- UI::UserInput();
+
+ y2milestone( "Date: %1", UI::QueryWidget(`id(`date), `Value) );
+ y2milestone( "Time: %1", UI::QueryWidget(`id(`time), `Value) );
+
UI::CloseDialog();
}
Modified: branches/tmp/sh/mod-ui/core/libyui/doc/examples/TimeField1.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/doc/examples/TimeField1.ycp?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/doc/examples/TimeField1.ycp (original)
+++ branches/tmp/sh/mod-ui/core/libyui/doc/examples/TimeField1.ycp Thu Nov 1 00:01:26 2007
@@ -2,12 +2,10 @@
{
UI::OpenDialog(
`VBox(
- `TimeField(`id(`time), "Time:", "10:10:00"),
+ `TimeField(`id(`time), "Time:", "13:15:00"),
`PushButton("&OK")
)
);
UI::UserInput();
- UI::ChangeWidget(`id(`time),`Value, "10:10:00");
- UI::UserInput();
UI::CloseDialog();
}
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/Makefile.am?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/Makefile.am Thu Nov 1 00:01:26 2007
@@ -79,6 +79,7 @@
YShortcut.cc \
YShortcutManager.cc \
YSimpleEventHandler.cc \
+ YSimpleInputField.cc \
YSingleChildContainerWidget.cc \
YSlider.cc \
YSpacing.cc \
@@ -174,6 +175,7 @@
YShortcutManager.h \
YSimpleEventHandler.h \
YSingleChildContainerWidget.h \
+ YSimpleInputField.h \
YSlider.h \
YSpacing.h \
YSquash.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/YCPDialogParser.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Thu Nov 1 00:01:26 2007
@@ -48,6 +48,7 @@
#include "YCheckBox.h"
#include "YCheckBoxFrame.h"
#include "YComboBox.h"
+#include "YDateField.h"
#include "YDumbTab.h"
#include "YEmpty.h"
#include "YFrame.h"
@@ -55,8 +56,8 @@
#include "YInputField.h"
#include "YIntField.h"
#include "YLabel.h"
-#include "YLogView.h"
#include "YLayoutBox.h"
+#include "YLogView.h"
#include "YMenuButton.h"
#include "YMultiLineEdit.h"
#include "YMultiProgressMeter.h"
@@ -72,6 +73,7 @@
#include "YSpacing.h"
#include "YSquash.h"
#include "YTable.h"
+#include "YTimeField.h"
#include "YTree.h"
#include "YWizard.h"
@@ -2900,6 +2902,7 @@
}
rejectAllOptions( term,optList );
+
return YUI::optionalWidgetFactory()->createMultiProgressMeter( parent, dim, maxValues );
}
@@ -3210,25 +3213,25 @@
|| !term->value(argnr)->isString()
|| (term->size() == argnr+2 && !term->value(argnr+1)->isString()))
{
- y2error( "Invalid arguments for the Date widget: %s",
+ y2error( "Invalid arguments for the DateField widget: %s",
term->toString().c_str() );
return 0;
}
- YCPString initial_date( "2000-01-01" );
- if ( term->size() >= argnr + 2 ) initial_date = term->value( argnr+1 )->asString();
- YWidget *_date;
- if ( YUI::ui()->hasDate() )
- {
- _date = YUI::ui()->createDate( parent, opt, term->value( argnr )->asString(), initial_date );
- }
- else
+
+ rejectAllOptions( term,optList );
+
+ string label = term->value( argnr )->asString()->value();
+
+ YDateField * dateField = YUI::optionalWidgetFactory()->createDateField( parent, label );
+
+ if ( term->size() >= argnr + 2 )
{
- y2error( "This UI does not support the Date widget." );
- return 0;
+ string initialValue = term->value( argnr+1 )->asString()->value();
+ dateField->setValue( initialValue );
}
- return _date;
+ return dateField;
}
@@ -3257,39 +3260,24 @@
|| !term->value(argnr)->isString()
|| (term->size() == argnr+2 && !term->value(argnr+1)->isString()))
{
- y2error( "Invalid arguments for the Time widget: %s",
+ y2error( "Invalid arguments for the TimeField widget: %s",
term->toString().c_str() );
return 0;
}
- YWidget *_time;
- YCPString initial_time( "2000-01-01" );
-
-
- if ( YUI::ui()->hasTime() )
- {
- if ( term->size() >= argnr + 2 ) initial_time = term->value( argnr+1 )->asString();
-
- for ( int o=0; o < optList->size(); o++ )
- {
- if ( optList->value(o)->isSymbol() )
- {
- string sym = optList->value(o)->asSymbol()->symbol();
-
- if ( sym == YUIOpt_autoAdvance ) opt.autoAdvance.setValue( true );
- else logUnknownOption( term, optList->value(o) );
- }
- else logUnknownOption( term, optList->value(o) );
- }
-
- _time = YUI::ui()->createTime( parent, opt, term->value( argnr )->asString(), initial_time );
- }
- else
+
+ rejectAllOptions( term,optList );
+
+ string label = term->value( argnr )->asString()->value();
+
+ YTimeField * timeField = YUI::optionalWidgetFactory()->createTimeField( parent, label );
+
+ if ( term->size() >= argnr + 2 )
{
- y2error( "This UI does not support the Time widget." );
- return 0;
+ string initialValue = term->value( argnr+1 )->asString()->value();
+ timeField->setValue( initialValue );
}
- return _time;
+ return timeField;
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YDateField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YDateField.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YDateField.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YDateField.cc Thu Nov 1 00:01:26 2007
@@ -17,62 +17,42 @@
/-*/
-#include
-#include
#define y2log_component "ui"
#include
-#include "YUISymbols.h"
#include "YDateField.h"
-YDateField::YDateField( const YWidgetOpt & opt,
- const YCPString & label)
- : YWidget( opt )
- , label ( label )
+
+struct YDateFieldPrivate
{
- y2debug( "YDateField( %s )", label->value_cstr() );
-}
+ YDateFieldPrivate()
+ {}
+ bool dummy;
+};
-YCPValue YDateField::changeWidget( const YCPSymbol & property, const YCPValue & newValue )
-{
- string s = property->symbol();
- /**
- * @property string Value the date
- */
- if ( s == YUIProperty_Value )
- {
- if ( newValue->isString() )
- {
- setNewDate( newValue->asString() );
- return YCPBoolean( true );
- }
- else
- {
- y2error( "Label: Invalid parameter %s for Value property. Must be string",
- newValue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
- else return YWidget::changeWidget( property, newValue );
-}
-void YDateField::setLabel( const YCPString & label )
+YDateField::YDateField( YWidget * parent, const string & label )
+ : YSimpleInputField( parent, label )
+ , priv( new YDateFieldPrivate() )
{
- this->label = label;
+ YUI_CHECK_NEW( priv );
}
-
-YCPValue YDateField::queryWidget( const YCPSymbol & property )
+YDateField::~YDateField()
{
- string s = property->symbol();
- if ( s == YUIProperty_Value ) return getDate();
- else return YWidget::queryWidget( property );
+ // NOP
}
+/*
+ * Properties (all handled in YSimpleInputField):
+ *
+ * @property string Value the date (the field's contents) as "YYYY-MM-DD"
+ * @property string Label caption above the input field
+ */
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YDateField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YDateField.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YDateField.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YDateField.h Thu Nov 1 00:01:26 2007
@@ -19,60 +19,44 @@
#ifndef YDateField_h
#define YDateField_h
-#include "YWidget.h"
-#include
+#include "YSimpleInputField.h"
+class YDateFieldPrivate;
-class YDateField : public YWidget
+/**
+ * Input field for entering a date.
+ *
+ * Derived classes are required to implement:
+ * value()
+ * setValue()
+ *
+ * For both methods the date is formatted as "YYYY-MM-DD".
+ * See YSimpleInputField.h for more details.
+ **/
+class YDateField : public YSimpleInputField
{
protected:
/**
* Constructor.
**/
- YDateField( const YWidgetOpt & opt, const YCPString & label );
+ YDateField( YWidget * parent, const string & label );
public:
/**
- * Returns a descriptive name of this widget class for logging,
- * debugging etc.
- **/
- virtual const char * widgetClass() const { return "YDateField"; }
-
- /**
- * Implements the ui command changeWidget.
+ * Destructor.
**/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue );
+ virtual ~YDateField();
/**
- * Implements the ui command queryWidget
- **/
- YCPValue queryWidget( const YCPSymbol & property );
-
-
- /**
- * Set the date in the entry to a new value
- **/
- virtual void setNewDate( const YCPString & text ) = 0;
-
- /**
- * get the date currently entered in the Date entry
- **/
- virtual YCPString getDate() = 0;
-
- /**
- * change the label of the Date entry. Overload this, but call
- * YDateField::setLabel at the end of your own function.
+ * Returns a descriptive name of this widget class for logging,
+ * debugging etc.
**/
- virtual void setLabel( const YCPString & label );
+ virtual const char * widgetClass() const { return "YDateField"; }
-protected:
- /**
- * Current label
- **/
- YCPString label;
-
+private:
+ ImplPtr<YDateFieldPrivate> priv;
};
Added: branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.cc?rev=41698&view=auto
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.cc (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.cc Thu Nov 1 00:01:26 2007
@@ -0,0 +1,124 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YSimpleInputField.cc
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+
+#define y2log_component "ui"
+#include
+
+#include "YUISymbols.h"
+#include "YMacroRecorder.h"
+#include "YSimpleInputField.h"
+
+
+struct YSimpleInputFieldPrivate
+{
+ YSimpleInputFieldPrivate( const string & label )
+ : label( label )
+ {}
+
+ string label;
+};
+
+
+
+
+YSimpleInputField::YSimpleInputField( YWidget * parent, const string & label )
+ : YWidget( parent )
+ , priv( new YSimpleInputFieldPrivate( label ) )
+{
+ YUI_CHECK_NEW( priv );
+
+ setDefaultStretchable( YD_HORIZ, false );
+ setDefaultStretchable( YD_VERT, false );
+}
+
+
+YSimpleInputField::~YSimpleInputField()
+{
+ // NOP
+}
+
+
+string YSimpleInputField::label()
+{
+ return priv->label;
+}
+
+
+void YSimpleInputField::setLabel( const string & label )
+{
+ priv->label = label;
+}
+
+
+
+const YPropertySet &
+YSimpleInputField::propertySet()
+{
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
+ {
+ /*
+ * @property string Value the text the user entered
+ * @property string Label caption above the input field
+ */
+ propSet.add( YProperty( YUIProperty_Value, YStringProperty ) );
+ propSet.add( YProperty( YUIProperty_Label, YStringProperty ) );
+ propSet.add( YWidget::propertySet() );
+ }
+
+ return propSet;
+}
+
+
+bool
+YSimpleInputField::setProperty( const string & propertyName, const YPropertyValue & val )
+{
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
+
+ if ( propertyName == YUIProperty_Value ) setValue( val.stringVal() );
+ else if ( propertyName == YUIProperty_Label ) setLabel( val.stringVal() );
+ else
+ {
+ return YWidget::setProperty( propertyName, val );
+ }
+
+ return true; // success -- no special processing necessary
+}
+
+
+YPropertyValue
+YSimpleInputField::getProperty( const string & propertyName )
+{
+ propertySet().check( propertyName ); // throws exceptions if not found
+
+ if ( propertyName == YUIProperty_Value ) return YPropertyValue( value() );
+ else if ( propertyName == YUIProperty_Label ) return YPropertyValue( label() );
+ else
+ {
+ return YWidget::getProperty( propertyName );
+ }
+}
+
+
+void
+YSimpleInputField::saveUserInput( YMacroRecorder *macroRecorder )
+{
+ macroRecorder->recordWidgetProperty( this, YUIProperty_Value );
+}
Added: branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.h?rev=41698&view=auto
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.h (added)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YSimpleInputField.h Thu Nov 1 00:01:26 2007
@@ -0,0 +1,141 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YSimpleInputField.h
+
+ Author: Stefan Hundhammer
+
+/-*/
+
+#ifndef YSimpleInputField_h
+#define YSimpleInputField_h
+
+#include "YWidget.h"
+
+class YSimpleInputFieldPrivate;
+
+
+/**
+ * Abstract base class for simple input fields with a label above the field and
+ * a text value.
+ **/
+class YSimpleInputField : public YWidget
+{
+protected:
+ /**
+ * Constructor.
+ **/
+ YSimpleInputField( YWidget * parent, const string & label );
+
+public:
+ /**
+ * Destructor.
+ **/
+ virtual ~YSimpleInputField();
+
+ /**
+ * Get the current value (the text entered by the user or set from the
+ * outside) of this input field.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual string value() = 0;
+
+ /**
+ * Set the current value (the text entered by the user or set from the
+ * outside) of this input field.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual void setValue( const string & text ) = 0;
+
+ /**
+ * Get the label (the caption above the input field).
+ **/
+ string label();
+
+ /**
+ * Set the label (the caption above the input field).
+ *
+ * Derived classes are free to reimplement this, but they should call this
+ * base class method at the end of the overloaded function.
+ **/
+ virtual void setLabel( const string & label );
+
+ /**
+ * 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 bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
+
+ /**
+ * Get a property.
+ * Reimplemented from YWidget.
+ *
+ * This method may throw YUIPropertyExceptions.
+ **/
+ 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();
+
+ /**
+ * Get the string of this widget that holds the keyboard shortcut.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual string shortcutString() { return label(); }
+
+ /**
+ * Set the string of this widget that holds the keyboard shortcut.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setShortcutString( const string & str )
+ { setLabel( str ); }
+
+ /**
+ * The name of the widget property that will return user input.
+ * Inherited from YWidget.
+ **/
+ const char * userInputProperty() { return YUIProperty_Value; }
+
+
+protected:
+ /**
+ * Save the widget's user input to a macro recorder.
+ *
+ * This sample implementation saves value(). This can be reimplemented in
+ * derived classes. Typically it does not make sense to call this base
+ * class method in new implementations.
+ **/
+ virtual void saveUserInput( YMacroRecorder *macroRecorder );
+
+private:
+
+ ImplPtr<YSimpleInputFieldPrivate> priv;
+};
+
+
+#endif // YSimpleInputField_h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.cc Thu Nov 1 00:01:26 2007
@@ -17,66 +17,40 @@
/-*/
-#include
-#include
#define y2log_component "ui"
#include
-#include "YUISymbols.h"
#include "YTimeField.h"
-YTimeField::YTimeField( const YWidgetOpt & opt,
- const YCPString & label)
- : YWidget( opt )
- , label ( label )
- , autoAdvance ( false)
+struct YTimeFieldPrivate
{
+ YTimeFieldPrivate()
+ {}
- if ( opt.autoAdvance.value() )
- autoAdvance = true;
- y2debug( "YTimeField( %s )", label->value_cstr() );
-}
-
+ bool dummy;
+};
-YCPValue YTimeField::changeWidget( const YCPSymbol & property, const YCPValue & newValue )
-{
- string s = property->symbol();
- /**
- * @property string Value the date
- */
- if ( s == YUIProperty_Value )
- {
- if ( newValue->isString() )
- {
- setNewTime( newValue->asString() );
- return YCPBoolean( true );
- }
- else
- {
- y2error( "Label: Invalid parameter %s for Value property. Must be string",
- newValue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
- else return YWidget::changeWidget( property, newValue );
-}
-void YTimeField::setLabel( const YCPString & label )
+YTimeField::YTimeField( YWidget * parent, const string & label )
+ : YSimpleInputField( parent, label )
+ , priv( new YTimeFieldPrivate() )
{
- this->label = label;
+ YUI_CHECK_NEW( priv );
}
-
-YCPValue YTimeField::queryWidget( const YCPSymbol & property )
+YTimeField::~YTimeField()
{
- string s = property->symbol();
- if ( s == YUIProperty_Value ) return getTime();
- else return YWidget::queryWidget( property );
+ // NOP
}
-
+/*
+ * Properties (all handled in YSimpleInputField):
+ *
+ * @property string Value the time (the field's contents) as "hh:mm:ss"
+ * @property string Label caption above the input field
+ */
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTimeField.h Thu Nov 1 00:01:26 2007
@@ -19,65 +19,42 @@
#ifndef YTimeField_h
#define YTimeField_h
-#include "YWidget.h"
-#include
+#include "YSimpleInputField.h"
+class YTimeFieldPrivate;
-class YTimeField : public YWidget
+
+/**
+ * Input field for entering a time in "hh:mm:ss" format.
+ *
+ * Derived classes are required to implement:
+ * value()
+ * setValue()
+ * See YSimpleInputField.h for details.
+ **/
+class YTimeField : public YSimpleInputField
{
protected:
/**
- * Creates a new date
- * @param text the initial text of the date
+ * Constructor.
**/
- YTimeField( const YWidgetOpt & opt, const YCPString & label );
+ YTimeField( YWidget * parent, const string & label );
public:
/**
- * Returns a descriptive name of this widget class for logging,
- * debugging etc.
- **/
- virtual const char * widgetClass() const { return "YTimeField"; }
-
- /**
- * Implements the ui command changeWidget.
- **/
- YCPValue changeWidget( const YCPSymbol & property, const YCPValue & newvalue );
-
- /**
- * Implements the ui command queryWidget
- **/
- YCPValue queryWidget( const YCPSymbol & property );
-
-
- /**
- * Set the date in the entry to a new value
+ * Destructor.
**/
- virtual void setNewTime( const YCPString & text ) = 0;
+ virtual ~YTimeField();
/**
- * get the date currently entered in the Time entry
- **/
- virtual YCPString getTime() = 0;
-
- /**
- * change the label of the Time entry. Overload this, but call
- * YTimeField::setLabel at the end of your own function.
+ * Returns a descriptive name of this widget class for logging,
+ * debugging etc.
**/
- virtual void setLabel( const YCPString & label );
-
+ virtual const char * widgetClass() const { return "YTimeField"; }
-protected:
- /**
- * Current label
- **/
- YCPString label;
+private:
- /**
- * Flag: This property holds whether the editor automatically advances to the next section.
- **/
- bool autoAdvance;
-
+ ImplPtr<YTimeFieldPrivate> priv;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Thu Nov 1 00:01:26 2007
@@ -481,27 +481,6 @@
virtual YWidget * createBarGraph( YWidget *parent, YWidgetOpt & opt );
virtual bool hasBarGraph() { return false; }
-
- /**
- * Creates a Date input filed
- **/
- virtual YWidget * createDate( YWidget *parent,
- YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & date );
- virtual bool hasDate() { return false; }
-
-
- /**
- * Creates a Time input filed
- **/
- virtual YWidget * createTime( YWidget *parent,
- YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & time );
- virtual bool hasTime() { return false; }
-
-
/**
* Creates a DumbTab.
*
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h Thu Nov 1 00:01:26 2007
@@ -181,7 +181,6 @@
// Widget and dialog options
#define YUIOpt_animated "animated"
-#define YUIOpt_autoAdvance "autoAdvance"
#define YUIOpt_autoScrollDown "autoScrollDown"
#define YUIOpt_autoShortcut "autoShortcut"
#define YUIOpt_boldFont "boldFont"
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/YUI_builtins.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Thu Nov 1 00:01:26 2007
@@ -94,8 +94,8 @@
else if ( symbol == YUISpecialWidget_PartitionSplitter ) hasWidget = hasPartitionSplitter();
else if ( symbol == YUISpecialWidget_SimplePatchSelector ) hasWidget = fact->hasSimplePatchSelector();
else if ( symbol == YUISpecialWidget_Wizard ) hasWidget = fact->hasWizard();
- else if ( symbol == YUISpecialWidget_Date ) hasWidget = hasDate();
- else if ( symbol == YUISpecialWidget_Time ) hasWidget = hasTime();
+ else if ( symbol == YUISpecialWidget_Date ) hasWidget = fact->hasDateField();
+ else if ( symbol == YUISpecialWidget_Time ) hasWidget = fact->hasTimeField();
else
{
y2error( "HasSpecialWidget(): Unknown special widget: %s", symbol.c_str() );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc Thu Nov 1 00:01:26 2007
@@ -54,30 +54,6 @@
}
-
-YWidget * YUI::createDate( YWidget *parent, YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & date)
-{
- y2error( "Default Date() method called - "
- "forgot to call HasSpecialWidget()?" );
-
- return 0;
-}
-
-
-YWidget * YUI::createTime( YWidget *parent, YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & time)
-{
- y2error( "Default Time() method called - "
- "forgot to call HasSpecialWidget()?" );
-
- return 0;
-}
-
-
-
/**
* Default low level specific UI implementations for optional widgets.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQBarGraph.h Thu Nov 1 00:01:26 2007
@@ -38,11 +38,11 @@
YQBarGraph( QWidget * parent, const YWidgetOpt & opt );
/**
- * Inherited from YWidget: Sets the enabled state of the
- * widget. All new widgets are enabled per definition. Only
- * enabled widgets can take user input.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
+ virtual void setEnabled( bool enabled );
/**
* Preferred width of the widget.
Modified: branches/tmp/sh/mod-ui/qt/src/YQDateField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDateField.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQDateField.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQDateField.cc Thu Nov 1 00:01:26 2007
@@ -20,47 +20,57 @@
#define y2log_component "qt-ui"
#include
+#include
+
#include "utf8.h"
#include "YQUI.h"
#include "YQDateField.h"
#include "YQWidgetCaption.h"
-YQDateField::YQDateField( QWidget * parent,
- const YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & date )
- //: QDateEdit ( parent )
- : QVBox( parent )
- , YDateField( opt, label )
+YQDateField::YQDateField( YWidget * parent, const string & label )
+ : QVBox( (QWidget *) parent->widgetRep() )
+ , YDateField( parent, label )
{
setWidgetRep( this );
setSpacing( YQWidgetSpacing );
- setMargin( YQWidgetMargin );
+ setMargin ( YQWidgetMargin );
- _caption = new YQWidgetCaption( this, label->value() );
+ _caption = new YQWidgetCaption( this, fromUTF8( label ) );
YUI_CHECK_NEW( _caption );
-
- _qt_dateedit = new QDateEdit( this );
- YUI_CHECK_NEW( _qt_dateedit );
-
- _qt_dateedit->setOrder( QDateEdit::DMY );
- _qt_dateedit->setDate( QDate::fromString(date->value(), Qt::ISODate ));
- _caption->setBuddy( _qt_dateedit );
+ _qt_dateEdit = new QDateEdit( this );
+ YUI_CHECK_NEW( _qt_dateEdit );
+
+ _qt_dateEdit->setAutoAdvance( true );
+ _qt_dateEdit->setOrder( QDateEdit::DMY );
+ _caption->setBuddy( _qt_dateEdit );
}
-YCPString YQDateField::getDate()
+YQDateField::~YQDateField()
{
- return YCPString( toUTF8(_qt_dateedit->date().toString(Qt::ISODate) ) );
+ // NOP
}
-void YQDateField::setLabel( const YCPString & label )
+string YQDateField::value()
{
- _caption->setText( label->value() );
- YDateField::setLabel( label );
+ return toUTF8( _qt_dateEdit->date().toString( Qt::ISODate ) );
+}
+
+
+void YQDateField::setValue( const string & newValue )
+{
+ _qt_dateEdit->setDate( QDate::fromString( fromUTF8( newValue ), Qt::ISODate ) );
+
+}
+
+
+void YQDateField::setLabel( const string & newLabel )
+{
+ _caption->setText( fromUTF8( newLabel ) );
+ YDateField::setLabel( newLabel );
}
@@ -89,11 +99,11 @@
}
-
-void YQDateField::setNewDate( const YCPString & date )
+bool YQDateField::setKeyboardFocus()
{
- _qt_dateedit->setDate( QDate::fromString(date->value(), Qt::ISODate ));
-
+ _qt_dateEdit->setFocus();
+
+ return true;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQDateField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDateField.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQDateField.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQDateField.h Thu Nov 1 00:01:26 2007
@@ -20,13 +20,10 @@
#ifndef YQDateField_h
#define YQDateField_h
-#include
#include
-#include
-#include
-
#include "YDateField.h"
+class QDateEdit;
class YQWidgetCaption;
@@ -39,17 +36,43 @@
/**
* Constructor.
**/
- YQDateField( QWidget * parent,
- const YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & initialDate );
+ YQDateField( YWidget * parent,
+ const string & label );
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YQDateField();
+
+ /**
+ * Get the current value (the text entered by the user or set from the
+ * outside) of this input field.
+ *
+ * Implemented from YSimpleInputField.
+ **/
+ virtual string value();
+
+ /**
+ * Set the current value (the text entered by the user or set from the
+ * outside) of this input field.
+ *
+ * Implemented from YSimpleInputField.
+ **/
+ virtual void setValue( const string & newValue );
+
+ /**
+ * Set the label (the caption above the input field).
+ *
+ * Reimplemented from YSimpleInputField.
+ **/
+ virtual void setLabel( 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.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
+ virtual void setEnabled( bool enabled );
/**
* Preferred width of the widget.
@@ -64,7 +87,7 @@
* Reimplemented from YWidget.
**/
virtual int preferredHeight();
-
+
/**
* Set the new size of the widget.
*
@@ -73,29 +96,17 @@
virtual void setSize( int newWidth, int newHeight );
/**
- * Set the date in the entry to a new value
+ * Accept the keyboard focus.
+ *
+ * Reimplemented from YWidget.
**/
- void setNewDate( const YCPString & text );
+ virtual bool setKeyboardFocus();
- /**
- * Gets the date currently entered in the Date entry
- **/
- YCPString getDate();
- /**
- * Changes the label of the date entry.
- **/
- void setLabel( const YCPString & label );
-
- /**
- * Change the label text.
- **/
- //void setDate( const YCPString & label );
-
protected:
-
+
YQWidgetCaption * _caption;
- QDateEdit * _qt_dateedit;
+ QDateEdit * _qt_dateEdit;
};
Modified: branches/tmp/sh/mod-ui/qt/src/YQDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDialog.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQDialog.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQDialog.h Thu Nov 1 00:01:26 2007
@@ -58,6 +58,13 @@
void closeEvent( QCloseEvent * ev );
/**
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual void setEnabled( bool enabled );
+
+ /**
* Preferred width of the widget.
*
* Reimplemented from YWidget.
@@ -90,13 +97,6 @@
YQGenericButton * findDefaultButton();
/**
- * Inherited from YWidget: Sets the enabled state of the
- * widget. All new widgets are enabled per definition. Only
- * enabled widgets can take user input.
- **/
- void setEnabled( bool enabled );
-
- /**
* Returns whether or not the user has resized this dialog.
**/
bool userResized() { return _userResized; }
Modified: branches/tmp/sh/mod-ui/qt/src/YQDownloadProgress.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDownloadProgress.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQDownloadProgress.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQDownloadProgress.h Thu Nov 1 00:01:26 2007
@@ -44,10 +44,11 @@
int expectedSize );
/**
- * Sets the widget's enabled state.
- * Inherited from YWidget.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
+ virtual void setEnabled( bool enabled );
/**
* Preferred width of the widget.
Modified: branches/tmp/sh/mod-ui/qt/src/YQDumbTab.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQDumbTab.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQDumbTab.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQDumbTab.h Thu Nov 1 00:01:26 2007
@@ -41,11 +41,11 @@
const YWidgetOpt & opt );
/**
- * Inherited from YWidget: Sets the enabled state of the
- * widget. All new widgets are enabled per definition. Only
- * enabled widgets can take user input.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
+ virtual void setEnabled( bool enabled );
/**
* Preferred width of the widget.
Modified: branches/tmp/sh/mod-ui/qt/src/YQGenericButton.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQGenericButton.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQGenericButton.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQGenericButton.h Thu Nov 1 00:01:26 2007
@@ -55,7 +55,7 @@
virtual ~YQGenericButton();
/**
- * Set enabled/disabled status.
+ * Set enabled/disabled state.
*
* Reimplemented from YWidget.
**/
Modified: branches/tmp/sh/mod-ui/qt/src/YQInputField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQInputField.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQInputField.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQInputField.h Thu Nov 1 00:01:26 2007
@@ -67,7 +67,7 @@
*
* Reimplemented from YInputField.
**/
- void setLabel( const string & label );
+ virtual void setLabel( const string & label );
/**
* Set the valid input characters. No input validation is performed (i.e.,
@@ -75,14 +75,14 @@
*
* Reimplemented from YInputField.
**/
- void setValidChars( const string & validChars );
+ virtual void setValidChars( const string & validChars );
/**
* Specify the amount of characters which can be inserted.
*
* Reimplemented from YInputField.
**/
- void setInputMaxLength( int numberOfChars );
+ virtual void setInputMaxLength( int numberOfChars );
/**
* Returns 'true' if a given text is valid according to ValidChars.
@@ -90,11 +90,11 @@
bool isValidText( const QString & text ) const;
/**
- * Set enabled/disabled status.
+ * Set enabled/disabled state.
*
* Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
+ virtual void setEnabled( bool enabled );
/**
* Preferred width of the widget.
Modified: branches/tmp/sh/mod-ui/qt/src/YQLayoutBox.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQLayoutBox.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQLayoutBox.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQLayoutBox.h Thu Nov 1 00:01:26 2007
@@ -39,15 +39,11 @@
YQLayoutBox( YWidget * parent, YUIDimension dim );
/**
- * Inherited from YWidget: Sets the enabled state of the
- * widget. All new widgets are enabled per definition. Only
- * enabled widgets can take user input.
- **/
- void setEnabled( bool enabled );
-
- /**
- * Inherited from YWidget. Sets the new size of the widget.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
+ virtual void setEnabled( bool enabled );
/**
* Set the new size of the widget.
@@ -61,7 +57,7 @@
*
* Reimplemented from YLayoutBox.
**/
- void moveChild( YWidget * child, int newX, int newY );
+ virtual void moveChild( YWidget * child, int newX, int newY );
};
Modified: branches/tmp/sh/mod-ui/qt/src/YQLogView.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQLogView.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQLogView.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQLogView.h Thu Nov 1 00:01:26 2007
@@ -68,12 +68,12 @@
virtual void setLabel( 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.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
-
+ virtual void setEnabled( bool enabled );
+
/**
* Preferred width of the widget.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQMultiProgressMeter.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQMultiProgressMeter.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQMultiProgressMeter.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQMultiProgressMeter.h Thu Nov 1 00:01:26 2007
@@ -133,12 +133,12 @@
void setTriangularShaped( bool triangular = true );
/**
- * Handle enabled/disabled state.
+ * Set enabled/disabled state.
*
* Reimplemented from YWidget.
**/
virtual void setEnabled( bool enabled );
-
+
/**
* Preferred width of the widget.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc Thu Nov 1 00:01:26 2007
@@ -97,26 +97,32 @@
bool YQOptionalWidgetFactory::hasDateField()
{
- return false;
+ return true;
}
YQDateField *
YQOptionalWidgetFactory::createDateField( YWidget * parent, const string & label )
{
- THROW_UNSUPPORTED( "YQDateField" );
+ YQDateField * dateField = new YQDateField( parent, label );
+ YUI_CHECK_NEW( dateField );
+
+ return dateField;
}
bool YQOptionalWidgetFactory::hasTimeField()
{
- return false;
+ return true;
}
YQTimeField *
YQOptionalWidgetFactory::createTimeField( YWidget * parent, const string & label )
{
- THROW_UNSUPPORTED( "YQTimeField" );
+ YQTimeField * timeField = new YQTimeField( parent, label );
+ YUI_CHECK_NEW( timeField );
+
+ return timeField;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h Thu Nov 1 00:01:26 2007
@@ -54,11 +54,12 @@
const YCPString & newPartFieldLabel );
/**
- * Sets the widget's enabled state.
- * Inherited from YWidget.
+ * Set enabled/disabled state.
+ *
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
-
+ virtual void setEnabled( bool enabled );
+
/**
* Preferred width of the widget.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQRadioButtonGroup.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQRadioButtonGroup.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQRadioButtonGroup.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQRadioButtonGroup.h Thu Nov 1 00:01:26 2007
@@ -47,12 +47,12 @@
virtual void addRadioButton( YRadioButton * button );
/**
- * Handle enabled/disabled state.
+ * Set enabled/disabled state.
*
* Reimplemented from YWidget.
**/
virtual void setEnabled( bool enabled );
-
+
/**
* Set the new size of the widget.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQReplacePoint.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQReplacePoint.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQReplacePoint.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQReplacePoint.h Thu Nov 1 00:01:26 2007
@@ -45,12 +45,12 @@
virtual void showChild();
/**
- * Handle enabled/disabled state.
+ * Set enabled/disabled state.
*
* Reimplemented from YWidget.
**/
virtual void setEnabled( bool enabled );
-
+
/**
* Set the new size of the widget.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQSlider.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSlider.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSlider.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSlider.h Thu Nov 1 00:01:26 2007
@@ -51,12 +51,12 @@
int initialValue );
/**
- * Sets the widget's enabled state.
+ * Set enabled/disabled state.
*
- * Inherited from YWidget.
+ * Reimplemented from YWidget.
**/
- void setEnabled( bool enabled );
-
+ virtual void setEnabled( bool enabled );
+
/**
* Preferred width of the widget.
*
Modified: branches/tmp/sh/mod-ui/qt/src/YQTimeField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQTimeField.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQTimeField.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQTimeField.cc Thu Nov 1 00:01:26 2007
@@ -20,46 +20,56 @@
#define y2log_component "qt-ui"
#include
+#include
+
#include "utf8.h"
#include "YQUI.h"
#include "YQTimeField.h"
#include "YQWidgetCaption.h"
-YQTimeField::YQTimeField( QWidget * parent,
- const YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & time )
- //: QTimeEdit ( parent )
- : QVBox( parent )
- , YTimeField( opt, label )
+
+YQTimeField::YQTimeField( YWidget * parent, const string & label )
+ : QVBox( (QWidget *) parent->widgetRep() )
+ , YTimeField( parent, label )
{
setWidgetRep( this );
setSpacing( YQWidgetSpacing );
- setMargin( YQWidgetMargin );
+ setMargin ( YQWidgetMargin );
- _caption = new YQWidgetCaption( this, label->value() );
+ _caption = new YQWidgetCaption( this, fromUTF8( label ) );
YUI_CHECK_NEW( _caption );
- _qt_timeedit = new QTimeEdit( this );
- YUI_CHECK_NEW( _qt_timeedit );
+ _qt_timeEdit = new QTimeEdit( this );
+ YUI_CHECK_NEW( _qt_timeEdit );
+
+ _qt_timeEdit->setAutoAdvance( true );
+ _caption->setBuddy( _qt_timeEdit );
+}
+
+
+YQTimeField::~YQTimeField()
+{
+ // NOP
+}
- _qt_timeedit->setTime( QTime::fromString(time->value(), Qt::ISODate ));
- _caption->setBuddy( _qt_timeedit );
+string YQTimeField::value()
+{
+ return toUTF8( _qt_timeEdit->time().toString( Qt::ISODate ) );
}
-YCPString YQTimeField::getTime()
+void YQTimeField::setValue( const string & newValue )
{
- return YCPString( toUTF8(_qt_timeedit->time().toString(Qt::ISODate) ) );
+ _qt_timeEdit->setTime( QTime::fromString( fromUTF8( newValue ), Qt::ISODate ) );
}
-void YQTimeField::setLabel( const YCPString & label )
+void YQTimeField::setLabel( const string & newLabel )
{
- _caption->setText( label->value() );
- YTimeField::setLabel( label );
+ _caption->setText( fromUTF8( newLabel ) );
+ YTimeField::setLabel( newLabel );
}
@@ -88,12 +98,12 @@
}
-void YQTimeField::setNewTime( const YCPString & time )
+bool YQTimeField::setKeyboardFocus()
{
- _qt_timeedit->setTime( QTime::fromString(time->value(), Qt::ISODate ));
+ _qt_timeEdit->setFocus();
+ return true;
}
-
#include "YQTimeField.moc"
Modified: branches/tmp/sh/mod-ui/qt/src/YQTimeField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQTimeField.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQTimeField.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQTimeField.h Thu Nov 1 00:01:26 2007
@@ -20,15 +20,11 @@
#ifndef YQTimeField_h
#define YQTimeField_h
-#include
#include
-#include
-#include
-#include
-
#include "YTimeField.h"
class YQWidgetCaption;
+class QTimeEdit;
class YQTimeField : public QVBox, public YTimeField
@@ -36,67 +32,80 @@
Q_OBJECT
public:
-
/**
* Constructor.
**/
- YQTimeField( QWidget * parent,
- const YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & initialTime );
+ YQTimeField( 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 ~YQTimeField();
/**
- * Preferred width of the widget.
+ * Get the current value (the text entered by the user or set from the
+ * outside) of this input field.
*
- * Reimplemented from YWidget.
+ * Implemented from YSimpleInputField.
**/
- virtual int preferredWidth();
+ virtual string value();
/**
- * Preferred height of the widget.
+ * Set the current value (the text entered by the user or set from the
+ * outside) of this input field.
*
- * Reimplemented from YWidget.
+ * Implemented from YSimpleInputField.
**/
- virtual int preferredHeight();
+ virtual void setValue( const string & newValue );
/**
- * Set the new size of the widget.
+ * Set the label (the caption above the input field).
+ *
+ * Reimplemented from YSimpleInputField.
+ **/
+ virtual void setLabel( const string & label );
+
+ /**
+ * Set enabled/disabled state.
*
* Reimplemented from YWidget.
**/
- virtual void setSize( int newWidth, int newHeight );
+ virtual void setEnabled( bool enabled );
/**
- * Set the time in the entry to a new value
+ * Preferred width of the widget.
+ *
+ * Reimplemented from YWidget.
**/
- void setNewTime( const YCPString & text );
+ virtual int preferredWidth();
/**
- * Gets the time currently entered in the Time entry
+ * Preferred height of the widget.
+ *
+ * Reimplemented from YWidget.
**/
- YCPString getTime();
+ virtual int preferredHeight();
/**
- * Changes the label of the time entry.
+ * Set the new size of the widget.
+ *
+ * Reimplemented from YWidget.
**/
- void setLabel( const YCPString & label );
+ virtual void setSize( int newWidth, int newHeight );
/**
- * Change the label text.
+ * Accept the keyboard focus.
+ *
+ * Reimplemented from YWidget.
**/
- //void setTime( const YCPString & label );
+ virtual bool setKeyboardFocus();
+
protected:
YQWidgetCaption * _caption;
- QTimeEdit * _qt_timeedit;
+ QTimeEdit * _qt_timeEdit;
};
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI.h?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI.h Thu Nov 1 00:01:26 2007
@@ -436,18 +436,6 @@
YWidget * createBarGraph ( YWidget * parent, YWidgetOpt & opt);
- bool hasDate();
- YWidget * createDate ( YWidget * parent,
- YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & date);
-
- bool hasTime();
- YWidget * createTime ( YWidget * parent,
- YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & time);
-
bool hasDownloadProgress();
YWidget * createDownloadProgress ( YWidget * parent,
YWidgetOpt & opt,
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc?rev=41698&r1=41697&r2=41698&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc Thu Nov 1 00:01:26 2007
@@ -155,34 +155,4 @@
-bool YQUI::hasDate()
-{
- return true;
-}
-
-YWidget * YQUI::createDate ( YWidget * parent,
- YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & date )
-{
- return new YQDateField( (QWidget *) ( parent->widgetRep() ), opt, label, date);
-}
-
-
-bool YQUI::hasTime()
-{
- return true;
-}
-
-
-YWidget * YQUI::createTime ( YWidget * parent,
- YWidgetOpt & opt,
- const YCPString & label,
- const YCPString & time )
-{
- return new YQTimeField( (QWidget *) ( parent->widgetRep() ), opt, label, time);
-}
-
-
-
// EOF
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org