Author: sh-sh-sh
Date: Thu Jul 3 14:28:49 2008
New Revision: 48819
URL: http://svn.opensuse.org/viewcvs/yast?rev=48819&view=rev
Log:
moved complex formalities to base class
Modified:
branches/tmp/jdsn/registration/src/RegUpdateRepoPage.cc
branches/tmp/jdsn/registration/src/RegUpdateRepoPage.h
branches/tmp/jdsn/registration/src/RegWizardPage.cc
branches/tmp/jdsn/registration/src/RegWizardPage.h
Modified: branches/tmp/jdsn/registration/src/RegUpdateRepoPage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegUpdateRepoPage.cc?rev=48819&r1=48818&r2=48819&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegUpdateRepoPage.cc (original)
+++ branches/tmp/jdsn/registration/src/RegUpdateRepoPage.cc Thu Jul 3 14:28:49 2008
@@ -7,10 +7,8 @@
#include
#include
#include
-#include
#include
#include
-#include
#include
#include
#include
@@ -37,10 +35,8 @@
}
-void RegUpdateRepoPage::show()
+void RegUpdateRepoPage::createWidgets( YWidget * parent )
{
- RegWizardPage::show(); // RegWizard::open()
-
YWizard * wizard = RegWizard::regWizard()->wizard();
YUI_CHECK_PTR( wizard );
@@ -48,12 +44,9 @@
wizard->setDialogIcon( "yast-product-registration.png" );
wizard->setHelpText( helpText() );
- // Get rid of old wizard contents
- wizard->contentsReplacePoint()->deleteChildren();
-
YWidgetFactory * fac = YUI::widgetFactory(); // shortcut
- YSquash * squash = fac->createHSquash( wizard->contentsReplacePoint() );
+ YSquash * squash = fac->createHSquash( parent );
YLayoutBox * vbox = fac->createVBox( squash );
string explanationText =
@@ -72,14 +65,6 @@
YAlignment * left2 = fac->createLeft( innerVBox );
_updateRepoURLLabel = fac->createOutputField( left2, _updateRepoURL );
-
- // Trigger geometry management once all new widgets are created
- wizard->contentsReplacePoint()->showChild();
-
- YDialog * dialog = wizard->findDialog();
- YUI_CHECK_PTR( dialog );
- dialog->setInitialSize();
- dialog->checkShortcuts();
}
Modified: branches/tmp/jdsn/registration/src/RegUpdateRepoPage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegUpdateRepoPage.h?rev=48819&r1=48818&r2=48819&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegUpdateRepoPage.h (original)
+++ branches/tmp/jdsn/registration/src/RegUpdateRepoPage.h Thu Jul 3 14:28:49 2008
@@ -36,26 +36,27 @@
virtual ~RegUpdateRepoPage();
/**
- * Show the page inside a RegWizard. This will create the RegWizard if it
- * doesn't exist yet.
+ * Create the widgets for this page.
*
- * Reimplemented from RegWizardPage.
+ * Implemented from RegWizardPage.
**/
- virtual void show();
+ virtual void createWidgets( YWidget * parent );
/**
- * Save the widget values to the internal values.
+ * Clear all pointers to internally stored widgets. This should not delete
+ * the widgets, just set all internally stored pointers to widgets etc. to
+ * 0.
*
* Reimplemented from RegWizardPage.
**/
- virtual void save();
+ virtual void forgetWidgets();
/**
- * Clear all pointers to internally stored widgets.
+ * Save the widget values to the internal values.
*
* Reimplemented from RegWizardPage.
**/
- virtual void forgetWidgets();
+ virtual void save();
/**
* Return the help text for this wizard page.
Modified: branches/tmp/jdsn/registration/src/RegWizardPage.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegWizardPage.cc?rev=48819&r1=48818&r2=48819&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegWizardPage.cc (original)
+++ branches/tmp/jdsn/registration/src/RegWizardPage.cc Thu Jul 3 14:28:49 2008
@@ -3,6 +3,9 @@
#define YUILogComponent "reg"
#include
+#include
+#include
+#include
#include "RegWizard.h"
#include "RegWizardPage.h"
@@ -24,7 +27,31 @@
if ( ! RegWizard::isOpen() )
RegWizard::open();
- RegWizard::regWizard()->setCurrentPage( this );
- RegWizard::regWizard()->historyAdd( this );
+ RegWizard * regWizard = RegWizard::regWizard();
+ YUI_CHECK_PTR( regWizard );
+
+ RegWizardPage * oldPage = regWizard->currentPage();
+ regWizard->setCurrentPage( this );
+ regWizard->historyAdd( this );
+
+ YWizard * wizard = RegWizard::regWizard()->wizard();
+ YUI_CHECK_PTR( wizard );
+
+ init();
+
+ if ( oldPage )
+ oldPage->forgetWidgets();
+
+ YReplacePoint * replacePoint = wizard->contentsReplacePoint();
+ YUI_CHECK_PTR( replacePoint );
+
+ replacePoint->deleteChildren();
+ createWidgets( replacePoint );
+ replacePoint->showChild();
+
+ YDialog * dialog = wizard->findDialog();
+ YUI_CHECK_PTR( dialog );
+ dialog->setInitialSize(); // trigger geometry management
+ dialog->checkShortcuts();
}
Modified: branches/tmp/jdsn/registration/src/RegWizardPage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/RegWizardPage.h?rev=48819&r1=48818&r2=48819&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/RegWizardPage.h (original)
+++ branches/tmp/jdsn/registration/src/RegWizardPage.h Thu Jul 3 14:28:49 2008
@@ -3,8 +3,9 @@
#ifndef RegWizardPage_h
#define RegWizardPage_h
-
class YEvent;
+class YWizard;
+
/**
* Abstract base class for all wizard pages in the registration workflow.
@@ -31,16 +32,34 @@
* Derived classes should implement this and call this base class method at
* the start of the new implementation.
**/
- virtual void show();
-
+ void show();
+
/**
- * Initialize internal data just prior to show().
+ * Initialize internal data. This is called in show() just before widgets
+ * are created.
*
* Derived classes can implement this to read external data etc.
**/
virtual void init() {}
/**
+ * Create the widgets for this page's content. This is called in each
+ * show() call. 'parent' is the ReplacePoint of the wizard. All old
+ * children of this ReplacePoint have already been deleted.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual void createWidgets( YWidget * parent ) = 0;
+
+ /**
+ * Clear all pointers to internally stored widgets.
+ * This needs to be done prior to showing another wizard page.
+ *
+ * Derived classes that store widget pointers should implement this.
+ **/
+ virtual void forgetWidgets() {}
+
+ /**
* Event handler.
*
* This base class event handler handles the wizard buttons "Next", "Back",
@@ -67,14 +86,6 @@
virtual void save() {}
/**
- * Clear all pointers to internally stored widgets.
- * This needs to be done prior to showing another wizard page.
- *
- * Derived classes that store widget pointers should implement this.
- **/
- virtual void forgetWidgets() {}
-
- /**
* Return the help text for this wizard page.
**/
virtual string helpText() { return ""; };
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org