Author: sh-sh-sh
Date: Thu Apr 10 19:54:22 2008
New Revision: 46374
URL: http://svn.opensuse.org/viewcvs/yast?rev=46374&view=rev
Log:
Added support for docked sub-wizards
Added:
trunk/ycp-ui-bindings/examples/Wizard-SubWizard1.ycp
Modified:
trunk/libyui/VERSION
trunk/libyui/examples/SelectionBox1.cc
trunk/libyui/package/yast2-libyui.changes
trunk/libyui/src/YChildrenManager.h
trunk/libyui/src/YTypes.h
trunk/libyui/src/YWidget.cc
trunk/libyui/src/YWidget.h
trunk/libyui/src/YWizard.cc
trunk/libyui/src/YWizard.h
trunk/qt/package/yast2-qt.changes
trunk/qt/src/YQWizard.cc
trunk/qt/src/YQWizard.h
trunk/qt/yast2-qt.spec.in
trunk/ycp-ui-bindings/VERSION
trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes
trunk/ycp-ui-bindings/src/YCPWizardCommandParser.cc
trunk/ycp-ui-bindings/src/YCPWizardCommandParser.h
trunk/ycp-ui-bindings/yast2-ycp-ui-bindings.spec.in
Modified: trunk/libyui/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/VERSION?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/VERSION (original)
+++ trunk/libyui/VERSION Thu Apr 10 19:54:22 2008
@@ -1 +1 @@
-2.16.41
+2.16.42
Modified: trunk/libyui/examples/SelectionBox1.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/examples/SelectionBox1.cc?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/examples/SelectionBox1.cc (original)
+++ trunk/libyui/examples/SelectionBox1.cc Thu Apr 10 19:54:22 2008
@@ -21,6 +21,9 @@
int main( int argc, char **argv )
{
+ YUILog::setLogFileName( "/tmp/libyui-examples.log" );
+ YUILog::enableDebugLogging();
+
//
// Create and open dialog
//
Modified: trunk/libyui/package/yast2-libyui.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/package/yast2-libyui.changes?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/package/yast2-libyui.changes (original)
+++ trunk/libyui/package/yast2-libyui.changes Thu Apr 10 19:54:22 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Apr 10 19:51:35 CEST 2008 - sh@suse.de
+
+- Added support for docked sub-wizards
+- V 2.16.42
+
+-------------------------------------------------------------------
Thu Apr 3 15:03:35 CEST 2008 - sh@suse.de
- Added YPushButton::setHelpButton() and isHelpButton()
Modified: trunk/libyui/src/YChildrenManager.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YChildrenManager.h?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/src/YChildrenManager.h (original)
+++ trunk/libyui/src/YChildrenManager.h Thu Apr 10 19:54:22 2008
@@ -71,12 +71,24 @@
{ return _children.begin(); }
/**
- * Returns an iterator that points after the last child.
+ * Return an iterator that points after the last child.
**/
typename ChildrenList::const_iterator end() const
{ return _children.end(); }
/**
+ * Return a reverse iterator that points to the last child.
+ **/
+ typename ChildrenList::const_reverse_iterator rbegin() const
+ { return _children.rbegin(); }
+
+ /**
+ * Return a reverse iterator that points before the first child.
+ **/
+ typename ChildrenList::const_reverse_iterator rend() const
+ { return _children.rend(); }
+
+ /**
* Returns the first child or 0 if there is none.
* Useful mostly for children managers that handle only one child.
**/
@@ -84,6 +96,12 @@
{ return _children.empty() ? (T *) 0 : _children.front(); }
/**
+ * Returns the last child or 0 if there is none.
+ **/
+ T * lastChild()
+ { return _children.empty() ? (T *) 0 : _children.back(); }
+
+ /**
* Add a new child.
*
* This may throw exceptions if more children are added than the class
Modified: trunk/libyui/src/YTypes.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YTypes.h?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/src/YTypes.h (original)
+++ trunk/libyui/src/YTypes.h Thu Apr 10 19:54:22 2008
@@ -30,9 +30,11 @@
class YWidget;
-typedef std::list YWidgetList;
-typedef std::list::iterator YWidgetListIterator;
-typedef std::list::const_iterator YWidgetListConstIterator;
+typedef std::list YWidgetList;
+typedef std::list::iterator YWidgetListIterator;
+typedef std::list::const_iterator YWidgetListConstIterator;
+typedef std::list::reverse_iterator YWidgetListReverseIterator;
+typedef std::list::const_reverse_iterator YWidgetListConstReverseIterator;
#define YUIAllDimensions 2
Modified: trunk/libyui/src/YWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWidget.cc?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/src/YWidget.cc (original)
+++ trunk/libyui/src/YWidget.cc Thu Apr 10 19:54:22 2008
@@ -55,13 +55,14 @@
: magic( YWIDGET_MAGIC )
, childrenManager( manager )
, parent( parentWidget )
+ , id( 0 )
, beingDestroyed( false )
, enabled( true )
, notify( false )
, sendKeyEvents( false )
, autoShortcut( false )
+ , idEnabled( true )
, toolkitWidgetRep( 0 )
- , id( 0 )
, functionKey( 0 )
{
stretch.hor = false;
@@ -77,13 +78,14 @@
int magic;
YWidgetChildrenManager * childrenManager;
YWidget * parent;
+ YWidgetID * id;
bool beingDestroyed;
bool enabled;
bool notify;
bool sendKeyEvents;
bool autoShortcut;
+ bool idEnabled;
void * toolkitWidgetRep;
- YWidgetID * id;
YBothDim<bool> stretch;
YBothDim<int> weight;
int functionKey;
@@ -358,7 +360,7 @@
YWidgetID *
YWidget::id() const
{
- return priv->id;
+ return (priv->idEnabled ? priv->id : 0 );
}
@@ -377,6 +379,18 @@
}
+void YWidget::setIdEnabled( bool enabled )
+{
+ priv->idEnabled = enabled;
+}
+
+
+bool YWidget::isIdEnabled() const
+{
+ return priv->idEnabled;
+}
+
+
YDialog * YWidget::findDialog()
{
YWidget * widget = this;
Modified: trunk/libyui/src/YWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWidget.h?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/src/YWidget.h (original)
+++ trunk/libyui/src/YWidget.h Thu Apr 10 19:54:22 2008
@@ -196,6 +196,7 @@
**/
bool hasChildren() const
{ return childrenManager()->hasChildren(); }
+
/**
* Returns the first child or 0 if there is none.
* Useful mostly for children managers that handle only one child.
@@ -204,6 +205,12 @@
{ return childrenManager()->firstChild(); }
/**
+ * Returns the last child or 0 if there is none.
+ **/
+ YWidget * lastChild() const
+ { return childrenManager()->lastChild(); }
+
+ /**
* Return an iterator that points to the first child or to childrenEnd() if
* there are no children.
**/
@@ -366,7 +373,7 @@
bool hasId() const;
/**
- * Returns this widget's ID.
+ * Returns this widget's ID unless the ID is disabled.
**/
YWidgetID * id() const;
@@ -553,6 +560,21 @@
**/
void setChildrenEnabled( bool enabled );
+ /**
+ * Enable or disable this widget's ID.
+ *
+ * As long as the ID is disabled, subsequent calls to id() will return 0.
+ * Widget IDs are enabled by default. Disabling a widget ID makes sense
+ * only in very rare cases - see YWizard for an example.
+ **/
+ void setIdEnabled( bool enabled = true );
+ void setIdDisabled() { setIdEnabled( false ); }
+
+ /**
+ * Return 'true' if this widget's ID is enabled.
+ **/
+ bool isIdEnabled() const;
+
//
// Macro Recorder Support
//
Modified: trunk/libyui/src/YWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWizard.cc?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/src/YWizard.cc (original)
+++ trunk/libyui/src/YWizard.cc Thu Apr 10 19:54:22 2008
@@ -22,6 +22,7 @@
#include "YWizard.h"
#include "YPushButton.h"
+#include "YReplacePoint.h"
struct YWizardPrivate
@@ -29,10 +30,12 @@
YWizardPrivate( YWizardMode wizardMode )
: wizardMode( wizardMode )
, nextButtonIsProtected( false )
+ , idsDisabledCount( 0 )
{}
YWizardMode wizardMode;
bool nextButtonIsProtected;
+ int idsDisabledCount;
};
@@ -60,7 +63,36 @@
YWizard::~YWizard()
{
- // NOP
+ YWizard * parentWizard = wizardParent();
+
+ if ( parentWizard )
+ parentWizard->setInternalIdsEnabled( true );
+}
+
+
+YWizardMode
+YWizard::wizardMode() const
+{
+ return priv->wizardMode;
+}
+
+
+YWizard *
+YWizard::wizardParent() const
+{
+ YWidget * widget = parent();
+
+ while ( widget )
+ {
+ YWizard * wizard = dynamic_cast (widget);
+
+ if ( wizard )
+ return wizard;
+
+ widget = widget->parent();
+ }
+
+ return 0;
}
@@ -97,6 +129,27 @@
}
+void
+YWizard::setInternalIdsEnabled( bool enabled )
+{
+ if ( enabled )
+ priv->idsDisabledCount--;
+ else
+ priv->idsDisabledCount++;
+
+ if ( enabled && priv->idsDisabledCount > 0 )
+ return;
+
+ this->setIdEnabled( enabled );
+
+ if ( backButton() ) backButton ()->setIdEnabled( enabled );
+ if ( abortButton() ) abortButton()->setIdEnabled( enabled );
+ if ( nextButton() ) nextButton ()->setIdEnabled( enabled );
+
+ if ( contentsReplacePoint() ) contentsReplacePoint()->setIdEnabled( enabled );
+}
+
+
const YPropertySet &
YWizard::propertySet()
{
Modified: trunk/libyui/src/YWizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/libyui/src/YWizard.h?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/libyui/src/YWizard.h (original)
+++ trunk/libyui/src/YWizard.h Thu Apr 10 19:54:22 2008
@@ -114,6 +114,11 @@
//
// Wizard basics
//
+
+ /**
+ * Return this wizard's mode.
+ **/
+ YWizardMode wizardMode() const;
/**
* Return the wizard buttons or 0 if there is no such button.
@@ -165,6 +170,27 @@
**/
virtual void setDialogHeading( const string & headingText ) = 0;
+ /**
+ * Enable or disable the IDs of this wizard and its internal widgets:
+ * backButton(), abortButton(), nextButton(), contentsReplacePoint().
+ *
+ * This wizard keeps count of those calls and really enables the IDs only
+ * when the internal counter reaches 0.
+ **/
+ void setInternalIdsEnabled( bool enabled );
+
+ /**
+ * Return the next widget parent upwards in the hierarchy of this wizard
+ * or 0 if there is none.
+ **/
+ YWizard * wizardParent() const;
+
+ /**
+ * Delete the last sub-wizard of this wizard, if there is one.
+ * Do nothing if there is none.
+ **/
+ virtual void deleteSubWizard() = 0;
+
//
// Steps handling
Modified: trunk/qt/package/yast2-qt.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/qt/package/yast2-qt.changes (original)
+++ trunk/qt/package/yast2-qt.changes Thu Apr 10 19:54:22 2008
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Apr 10 19:53:05 CEST 2008 - sh@suse.de
+
+- Added basic support for docked sub-wizards
+
+-------------------------------------------------------------------
Fri Apr 4 11:10:11 CEST 2008 - tgoettlicher@suse.de
- fixed frame style of rich text widget (bnc #369685)
Modified: trunk/qt/src/YQWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWizard.cc?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/qt/src/YQWizard.cc (original)
+++ trunk/qt/src/YQWizard.cc Thu Apr 10 19:54:22 2008
@@ -22,8 +22,6 @@
#define YUILogComponent "qt-wizard"
#include "YUILog.h"
-// For the command parser
-
#include <string>
#include
@@ -211,6 +209,7 @@
return vbox;
}
+
void YQWizard::layoutStepsPanel()
{
// Steps
@@ -235,6 +234,7 @@
_stepsDirty = true; // no layout yet
}
+
void YQWizard::addStep( const string & text, const string & id )
{
QString qId = fromUTF8( id );
@@ -1143,6 +1143,56 @@
}
+void YQWizard::addChild( YWidget * child )
+{
+ YWidget::addChild( child );
+ YWizard * yWizard = dynamic_cast (child);
+
+ if ( yWizard )
+ {
+ yuiMilestone() << "Docking sub-wizard " << child << " to " << this << endl;
+ YQWizard * yqWizard = (YQWizard *) yWizard->widgetRep();
+
+ // FIXME
+ // FIXME
+ // FIXME
+
+ // Dock sub-wizard - reparent yqWizard to widget stack
+ // Important: Don't mess with the child's YWidget::parent().
+ // This will still remain this wizard.
+
+ // FIXME
+ // FIXME
+ // FIXME
+ }
+}
+
+
+void YQWizard::deleteSubWizard()
+{
+ YWizard * subWizard = 0;
+
+ for ( YWidgetListConstReverseIterator it = childrenManager()->rbegin();
+ it != childrenManager()->rend() && ! subWizard;
+ ++it )
+ {
+ subWizard = dynamic_cast (*it);
+ }
+
+ if ( subWizard )
+ {
+ yuiMilestone() << "Deleting sub-wizard " << subWizard << endl;
+ delete subWizard;
+
+ // FIXME (?)
+ // FIXME (?)
+ // FIXME (?)
+
+ // Make next-lower sub-wizard visible in widget stack, if necessary
+ }
+}
+
+
void YQWizard::Step::deleteLabels()
{
delete _statusLabel;
@@ -1151,11 +1201,13 @@
_nameLabel = 0;
}
+
YQWizard::Step::~Step()
{
deleteLabels();
}
+
void YQWizard::Step::setStatus( Status s )
{
if ( !_statusLabel || !_nameLabel || _status == s )
Modified: trunk/qt/src/YQWizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQWizard.h?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/qt/src/YQWizard.h (original)
+++ trunk/qt/src/YQWizard.h Thu Apr 10 19:54:22 2008
@@ -133,6 +133,20 @@
**/
virtual void setDialogHeading( const string & headingText );
+ /**
+ * Add a child widget.
+ *
+ * Reimplemented from YWidget to dock any YWizard children.
+ **/
+ virtual void addChild( YWidget * child );
+
+ /**
+ * Delete the last sub-wizard of this wizard, if there is one.
+ * Do nothing if there is none.
+ *
+ * Implemented from YWizard.
+ **/
+ virtual void deleteSubWizard();
//
// Steps handling
Modified: trunk/qt/yast2-qt.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/yast2-qt.spec.in?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/qt/yast2-qt.spec.in (original)
+++ trunk/qt/yast2-qt.spec.in Thu Apr 10 19:54:22 2008
@@ -16,8 +16,8 @@
Summary: -
BuildRequires: yast2-devtools >= 2.16.3
-BuildRequires: yast2-libyui-devel >= 2.16.41
-Requires: yast2-libyui >= 2.16.41
+BuildRequires: yast2-libyui-devel >= 2.16.42
+Requires: yast2-libyui >= 2.16.42
Requires: yast2_theme >= 2.16.1
Provides: yast2_ui
Provides: y2base:/usr/lib/YaST2/servers/qt
Modified: trunk/ycp-ui-bindings/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/VERSION?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/VERSION (original)
+++ trunk/ycp-ui-bindings/VERSION Thu Apr 10 19:54:22 2008
@@ -1 +1 @@
-2.16.41
+2.16.42
Added: trunk/ycp-ui-bindings/examples/Wizard-SubWizard1.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/examples/Wizard-SubWizard1.ycp?rev=46374&view=auto
==============================================================================
--- trunk/ycp-ui-bindings/examples/Wizard-SubWizard1.ycp (added)
+++ trunk/ycp-ui-bindings/examples/Wizard-SubWizard1.ycp Thu Apr 10 19:54:22 2008
@@ -0,0 +1,113 @@
+// Example of using the Wizard widget.
+//
+// Note: YCP applications are discouraged from using the Wizard widget directly.
+// Use the Wizard module instead.
+
+{
+ void handleSubWizard()
+ {
+ if ( UI::WizardCommand(`DockSubWizard(`back, "&Back (Sub)",
+ `abort, "Ab&ort (Sub)",
+ `next, "&Next (Sub)" ) ) )
+ {
+ y2milestone( "Docking sub-wizard successful" );
+
+ UI::ReplaceWidget(`contents, `Label( "Sub-Wizard" ) );
+
+ while ( true )
+ {
+ map event = UI::WaitForEvent();
+
+ y2milestone( "Sub-wizard event: %1", event );
+
+ integer serial = (integer) event[ "EventSerialNo" ]:0;
+ string type = (string) event[ "EventType" ]:"";
+ symbol id = (symbol) event[ "ID" ]:`nil;
+
+ if ( id == `abort || id == `cancel )
+ break;
+
+ UI::ReplaceWidget(`id(`contents),
+ `VBox(
+ `Heading( "Sub-Wizard event:" ),
+ `VSpacing(0.5),
+ `Label( "Serial No: " + tostring( serial ) ),
+ `Label( "Type: " + type ),
+ `Label( "ID: " + tostring( id ) )
+ ) );
+ }
+
+ y2milestone( "Closing sub-wizard" );
+ UI::WizardCommand(`DeleteSubWizard() );
+ }
+ }
+
+
+ if ( ! UI::HasSpecialWidget(`Wizard) )
+ {
+ y2error( "This works only with UIs that provide the wizard widget!" );
+ return;
+ }
+
+ string help_text =
+ "<p>This is a help text.</p>"
+ + "<p>It should be helpful.</p>"
+ + "<p>If it isn't helpful, it should rather not be called a <i>help text</i>.</p>";
+
+ UI::OpenDialog(`opt(`defaultsize ),
+ `Wizard(`opt(`stepsEnabled),
+ `back, "&Back",
+ `abort, "Ab&ort",
+ `next, "&Next" ) );
+
+ // UI::DumpWidgetTree();
+
+ UI::WizardCommand(`SetDialogIcon( "/usr/share/YaST2/theme/current/icons/22x22/apps/YaST.png" ) );
+ UI::WizardCommand(`SetDialogHeading( "Welcome to the YaST2 installation" ) );
+ UI::WizardCommand(`SetHelpText( help_text ) );
+
+ UI::WizardCommand(`AddStepHeading( "Base Installation" ) );
+ UI::WizardCommand(`AddStep( "Language", "lang" ) );
+ UI::WizardCommand(`AddStep( "Installation Settings", "proposal" ) );
+ UI::WizardCommand(`AddStep( "Perform Installation", "doit" ) );
+
+ UI::WizardCommand(`AddStepHeading( "Configuration" ) );
+ UI::WizardCommand(`AddStep( "Root Password", "root_pw" ) );
+ UI::WizardCommand(`AddStep( "Network", "net" ) );
+ UI::WizardCommand(`AddStep( "Online Update", "you" ) );
+ UI::WizardCommand(`AddStep( "Users", "auth" ) );
+ UI::WizardCommand(`AddStep( "Clean Up", "suse_config" ) );
+ UI::WizardCommand(`AddStep( "Release Notes", "rel_notes" ) );
+ UI::WizardCommand(`AddStep( "Device Configuration", "hw_proposal" ) );
+ UI::WizardCommand(`UpdateSteps() );
+
+ UI::WizardCommand(`SetCurrentStep( "net" ) );
+
+ UI::ReplaceWidget(`contents,
+ `VBox(
+ `HVCenter( `PushButton(`id(`subWizard), "&Sub-Wizard" ) )
+ )
+ );
+
+ while( true )
+ {
+ map event = UI::WaitForEvent();
+
+ y2milestone( "Got event: %1", event );
+
+ if ( event[ "ID" ]:nil == `abort )
+ break;
+
+ symbol id = (symbol) event[ "ID" ]:`nil;
+
+
+ if ( id == `subWizard )
+ {
+ handleSubWizard();
+ }
+ else if ( id == `cancel || id == `abort )
+ break;
+ }
+
+ UI::CloseDialog();
+}
Modified: trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes (original)
+++ trunk/ycp-ui-bindings/package/yast2-ycp-ui-bindings.changes Thu Apr 10 19:54:22 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Apr 10 19:51:59 CEST 2008 - sh@suse.de
+
+- Added support for docked sub-wizards
+- V 2.16.42
+
+-------------------------------------------------------------------
Thu Apr 3 15:25:08 CEST 2008 - sh@suse.de
- Added `opt(`helpButton) for PushButton widgets
Modified: trunk/ycp-ui-bindings/src/YCPWizardCommandParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/src/YCPWizardCommandParser.cc?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/src/YCPWizardCommandParser.cc (original)
+++ trunk/ycp-ui-bindings/src/YCPWizardCommandParser.cc Thu Apr 10 19:54:22 2008
@@ -24,6 +24,11 @@
#include "YCPValueWidgetID.h"
#include "YWizard.h"
#include "YPushButton.h"
+#include "YReplacePoint.h"
+#include "YDialog.h"
+#include "YUISymbols.h"
+#include "YUI.h"
+#include "YOptionalWidgetFactory.h"
bool
@@ -90,6 +95,13 @@
if ( isCommand( "HideReleaseNotesButton()" , cmd ) ) { wizard->hideReleaseNotesButton(); return true; }
if ( isCommand( "RetranslateInternalButtons()" , cmd ) ) { wizard->retranslateInternalButtons() ; return true; }
if ( isCommand( "Ping()" , cmd ) ) { wizard->ping() ; return true; }
+ if ( isCommand( "DockSubWizard( any, string, any, string, any, string )", cmd ) )
+ {
+ return dockSubWizard( anyArg( cmd, 0 ), stringArg( cmd, 1 ),
+ anyArg( cmd, 2 ), stringArg( cmd, 3 ),
+ anyArg( cmd, 4 ), stringArg( cmd, 5 ) ) != 0;
+ }
+ if ( isCommand( "DeleteSubWizard()" , cmd ) ) { wizard->deleteSubWizard(); return true; }
y2error( "Undefined wizard command: %s", cmd->toString().c_str() );
return false;
}
@@ -332,3 +344,50 @@
y2error( "NULL widget" );
}
+
+YWizard *
+YCPWizardCommandParser::dockSubWizard( const YCPValue & backButtonId, const string & backButtonLabel,
+ const YCPValue & abortButtonId, const string & abortButtonLabel,
+ const YCPValue & nextButtonId, const string & nextButtonLabel )
+{
+ try
+ {
+ YWizard * subWizard = 0;
+ YWidget * w = YDialog::topmostDialog()->firstChild();
+
+ if ( ! w )
+ return 0;
+
+ YWizard * parentWizard = dynamic_cast (w);
+
+ if ( parentWizard && parentWizard->wizardMode() == YWizardMode_Steps )
+ {
+ y2milestone( "Docking subwizard" );
+ subWizard = YUI::optionalWidgetFactory()->createWizard( parentWizard,
+ backButtonLabel,
+ abortButtonLabel,
+ nextButtonLabel,
+ YWizardMode_Standard );
+ YUI_CHECK_NEW( subWizard );
+
+ parentWizard->setInternalIdsEnabled( false ); // avoid duplicate IDs
+
+ // All wizard widgets have a fixed ID `wizard
+ subWizard->setId( new YCPValueWidgetID( YCPSymbol( YWizardID ) ) );
+
+ // The wizard internal contents ReplacePoint has a fixed ID `contents
+ subWizard->contentsReplacePoint()->setId( new YCPValueWidgetID( YCPSymbol( YWizardContentsReplacePointID ) ) );
+
+ if ( subWizard->backButton() ) subWizard->backButton()->setId ( new YCPValueWidgetID( backButtonId ) );
+ if ( subWizard->abortButton() ) subWizard->abortButton()->setId( new YCPValueWidgetID( abortButtonId ) );
+ if ( subWizard->nextButton() ) subWizard->nextButton()->setId ( new YCPValueWidgetID( nextButtonId ) );
+ }
+
+ return subWizard;
+ }
+ catch ( YUIException & exception )
+ {
+ YUI_CAUGHT( exception );
+ return 0;
+ }
+}
Modified: trunk/ycp-ui-bindings/src/YCPWizardCommandParser.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/src/YCPWizardCommandParser.h?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/src/YCPWizardCommandParser.h (original)
+++ trunk/ycp-ui-bindings/src/YCPWizardCommandParser.h Thu Apr 10 19:54:22 2008
@@ -44,6 +44,15 @@
static bool parseAndExecute( YWizard * wizard,
const YCPTerm & command );
+ /**
+ * Try to create a new wizard as a sub-wizard as the existing wizard, if
+ * the current dialog has a wizard in "steps" mode.
+ * Return the new wizard on success and 0 if failed.
+ **/
+ static YWizard * dockSubWizard( const YCPValue & backButtonId, const string & backButtonLabel,
+ const YCPValue & abortButtonId, const string & abortButtonLabel,
+ const YCPValue & nextButtonId, const string & nextButtonLabel );
+
private:
/**
Modified: trunk/ycp-ui-bindings/yast2-ycp-ui-bindings.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ycp-ui-bindings/yast2-ycp-ui-bindings.spec.in?rev=46374&r1=46373&r2=46374&view=diff
==============================================================================
--- trunk/ycp-ui-bindings/yast2-ycp-ui-bindings.spec.in (original)
+++ trunk/ycp-ui-bindings/yast2-ycp-ui-bindings.spec.in Thu Apr 10 19:54:22 2008
@@ -19,8 +19,8 @@
# libycp includes crypto built-ins
BuildRequires: libxcrypt-devel
-Requires: yast2-libyui >= 2.16.41
-BuildRequires: yast2-libyui-devel >= 2.16.41
+Requires: yast2-libyui >= 2.16.42
+BuildRequires: yast2-libyui-devel >= 2.16.42
# libyui ImplPtr
BuildRequires: boost-devel
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org