Author: sh-sh-sh
Date: Tue Jul 1 17:26:12 2008
New Revision: 48731
URL: http://svn.opensuse.org/viewcvs/yast?rev=48731&view=rev
Log:
first wizard page
Added:
branches/tmp/jdsn/registration/src/reg_update_repo_page.cc
branches/tmp/jdsn/registration/src/reg_update_repo_page.h
Modified:
branches/tmp/jdsn/registration/src/Makefile.am
branches/tmp/jdsn/registration/src/reg_main.cc
branches/tmp/jdsn/registration/src/reg_wizard.cc
branches/tmp/jdsn/registration/src/reg_wizard.h
Modified: branches/tmp/jdsn/registration/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/Makefile.am?rev=48731&r1=48730&r2=48731&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/Makefile.am (original)
+++ branches/tmp/jdsn/registration/src/Makefile.am Tue Jul 1 17:26:12 2008
@@ -8,7 +8,8 @@
yast2_registration_SOURCES = \
reg_main.cc \
- reg_wizard.cc
+ reg_wizard.cc \
+ reg_update_repo_page.cc
yast2_registration_LDADD = -L$(top_srcdir)/src -lyui
Modified: branches/tmp/jdsn/registration/src/reg_main.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/reg_main.cc?rev=48731&r1=48730&r2=48731&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/reg_main.cc (original)
+++ branches/tmp/jdsn/registration/src/reg_main.cc Tue Jul 1 17:26:12 2008
@@ -15,6 +15,7 @@
#include "reg_i18n.h"
#include "reg_wizard.h"
+#include "reg_update_repo_page.h"
int main( int argc, char **argv )
@@ -22,7 +23,10 @@
YUILog::setLogFileName( "/tmp/registration.log" );
YUILog::enableDebugLogging();
- RegWizard::open();
- RegWizard::dialog()->waitForEvent();
+ RegUpdateRepoPage updateRepoPage( true, "http://download.opensuse.org/update/11.0/" );
+
+ updateRepoPage.show();
+ updateRepoPage.waitForEvent();
+
RegWizard::close();
}
Added: branches/tmp/jdsn/registration/src/reg_update_repo_page.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/reg_update_repo_page.cc?rev=48731&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/reg_update_repo_page.cc (added)
+++ branches/tmp/jdsn/registration/src/reg_update_repo_page.cc Tue Jul 1 17:26:12 2008
@@ -0,0 +1,116 @@
+// Wizard page for "Update Repository"
+
+
+#define YUILogComponent "reg"
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "reg_update_repo_page.h"
+#include "reg_wizard.h"
+#include "reg_i18n.h"
+
+
+
+RegUpdateRepoPage::RegUpdateRepoPage( bool enableUpdates,
+ const string & updateRepoURL )
+ : _enableUpdates( enableUpdates )
+ , _updateRepoURL( updateRepoURL )
+{
+ forgetWidgets();
+}
+
+
+void RegUpdateRepoPage::show()
+{
+ if ( ! RegWizard::isOpen() )
+ RegWizard::open();
+
+ YWizard * wizard = RegWizard::regWizard()->wizard();
+ YUI_CHECK_PTR( wizard );
+
+ wizard->setDialogHeading( _( "Update Repository" ) );
+ wizard->setDialogIcon( "yast-product-registration.png" );
+ wizard->setHelpText( helpText() );
+
+ // Get rid of old wizard contents
+ wizard->contentsReplacePoint()->deleteChildren();
+
+ YWidgetFactory * fac = YUI::widgetFactory(); // shortcut
+
+ YLayoutBox * vbox = fac->createVBox( wizard->contentsReplacePoint() );
+
+ string explanationText =
+ _( "You should update your system on a regular basis"
+ "to keep it secure." );
+ fac->createLabel( vbox, explanationText );
+
+ fac->createVSpacing( vbox, 0.4 );
+
+ _enableUpdatesCheckBoxFrame = fac->createCheckBoxFrame( vbox, _( "Enable Updates" ), _enableUpdates );
+ YAlignment * marginBox = fac->createMarginBox( _enableUpdatesCheckBoxFrame, 2, 0.7 );
+ YLayoutBox * innerVBox = fac->createVBox( marginBox );
+
+ YAlignment * left1 = fac->createLeft( innerVBox );
+ fac->createLabel( left1, _( "Update Repository" ) );
+
+ YAlignment * left2 = fac->createLeft( innerVBox );
+ _updateRepoURLLabel = fac->createOutputField( left2, _updateRepoURL );
+
+ // Trigger geometry management once all new widgets are created
+ wizard->contentsReplacePoint()->showChild();
+}
+
+
+string RegUpdateRepoPage::helpText()
+{
+ string text =
+ _( "Help text for update repo page" );
+
+ // TO DO: Help text
+
+ return text;
+}
+
+
+void RegUpdateRepoPage::waitForEvent()
+{
+ YDialog * dialog = RegWizard::dialog();
+ YUI_CHECK_PTR( dialog );
+
+ dialog->waitForEvent();
+}
+
+
+void RegUpdateRepoPage::save()
+{
+ _enableUpdates = _enableUpdatesCheckBoxFrame->value();
+}
+
+
+void RegUpdateRepoPage::forgetWidgets()
+{
+ _enableUpdatesCheckBoxFrame = 0;
+ _updateRepoURLLabel = 0;
+}
+
+
+bool RegUpdateRepoPage::enableUpdates()
+{
+ if ( _enableUpdatesCheckBoxFrame &&
+ _enableUpdatesCheckBoxFrame->isValid() )
+ {
+ _enableUpdates = _enableUpdatesCheckBoxFrame->value();
+ }
+
+ return _enableUpdates;
+}
Added: branches/tmp/jdsn/registration/src/reg_update_repo_page.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/reg_update_repo_page.h?rev=48731&view=auto
==============================================================================
--- branches/tmp/jdsn/registration/src/reg_update_repo_page.h (added)
+++ branches/tmp/jdsn/registration/src/reg_update_repo_page.h Tue Jul 1 17:26:12 2008
@@ -0,0 +1,77 @@
+// Wizard page for "Update Repository"
+
+#ifndef RegUpdateRepoPage_h
+#define RegUpdateRepoPage_h
+
+#include <string>
+
+using std::string;
+
+class YLabel;
+class YCheckBoxFrame;
+
+
+/**
+ * Wizard page for "Update Repository" in the registration workflow.
+ *
+ * This class holds the data of this page, regardless whether or not this page
+ * is currently displayed.
+ **/
+class RegUpdateRepoPage
+{
+public:
+ /**
+ * Constructor.
+ *
+ * This does not create any widget yet or show any page content; it only
+ * stores the parameters for later use when show() is called.
+ **/
+ RegUpdateRepoPage( bool enableUpdates,
+ const string & updateRepoURL );
+
+ /**
+ * Show the page inside a RegWizard. This will create the RegWizard if it
+ * doesn't exist yet.
+ **/
+ void show();
+
+ /**
+ * Event handler
+ **/
+ void waitForEvent();
+
+ /**
+ * Save the widget values to the internal values.
+ **/
+ void save();
+
+ /**
+ * Clear all pointers to internally stored widgets.
+ * This needs to be done prior to showing another wizard page.
+ **/
+ void forgetWidgets();
+
+ /**
+ * Return the help text for this wizard page.
+ **/
+ string helpText();
+
+ /**
+ * Return 'true' if updates are enabled. If the page is currently shown,
+ * this will retrieve the status of the CheckBoxFrame. Otherwise, it
+ * returns the stored value.
+ **/
+ bool enableUpdates();
+
+
+private:
+
+ bool _enableUpdates;
+ string _updateRepoURL;
+
+ YCheckBoxFrame * _enableUpdatesCheckBoxFrame;
+ YLabel * _updateRepoURLLabel;
+};
+
+
+#endif // RegUpdateRepoPage_h
Modified: branches/tmp/jdsn/registration/src/reg_wizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/reg_wizard.cc?rev=48731&r1=48730&r2=48731&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/reg_wizard.cc (original)
+++ branches/tmp/jdsn/registration/src/reg_wizard.cc Tue Jul 1 17:26:12 2008
@@ -96,10 +96,16 @@
}
+bool
+RegWizard::isOpen()
+{
+ return regWizard()->_dialog ? true: false;
+}
+
+
YWizard *
RegWizard::wizard()
{
return regWizard()->_wizard;
}
-
Modified: branches/tmp/jdsn/registration/src/reg_wizard.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/registration/src/reg_wizard.h?rev=48731&r1=48730&r2=48731&view=diff
==============================================================================
--- branches/tmp/jdsn/registration/src/reg_wizard.h (original)
+++ branches/tmp/jdsn/registration/src/reg_wizard.h Tue Jul 1 17:26:12 2008
@@ -23,6 +23,11 @@
static void open();
/**
+ * Return 'true' if the registration wizard is open.
+ **/
+ static bool isOpen();
+
+ /**
* Close the registration wizard. Does nothing if there is none.
**/
static void close();
@@ -42,10 +47,6 @@
**/
static YWizard * wizard();
- static void showUpdateRepoPage();
- static void showHWInfoPage();
- static void showRegistrationPage();
-
protected:
// Constructor and destructor are not public:
// Use the public static methods instead.
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org