KMyMoneyWizard Class Reference

#include <kmymoneywizard.h>

Inheritance diagram for KMyMoneyWizard:

QDialog NewAccountWizard::Wizard NewUserWizard::Wizard
Collaboration diagram for KMyMoneyWizard:

Collaboration graph

List of all members.


void createPayee (const QString &txt, QString &id)
void createCategory (const QString &txt, QString &id)

Public Member Functions

void setTitle (const QString &txt)
void addStep (const QString &text)
QValueList< KMyMoneyWizardPage * > historyPages (void) const
void reselectStep (void)
void setHelpContext (const QString &ctx)
virtual ~KMyMoneyWizard ()

Protected Slots

virtual void accept (void)
void completeStateChanged (void)

Protected Member Functions

 KMyMoneyWizard (QWidget *parent=0, const char *name=0, bool modal=false, WFlags f=0)
void setFirstPage (KMyMoneyWizardPage *page)
void setStepHidden (unsigned int step, bool hidden=true)

Protected Attributes

KPushButton * m_cancelButton
KPushButton * m_backButton
KPushButton * m_nextButton
KPushButton * m_finishButton
KPushButton * m_helpButton

Private Slots

void backButtonClicked (void)
void nextButtonClicked (void)
void helpButtonClicked (void)

Private Member Functions

void updateStepCount (void)
void switchPage (KMyMoneyWizardPage *oldPage)
void selectStep (unsigned int step)

Private Attributes

QVBoxLayout * m_wizardLayout
QVBoxLayout * m_stepLayout
QVBoxLayout * m_pageLayout
QHBoxLayout * m_buttonLayout
QPalette m_stepPalette
QValueList< QLabel * > m_steps
int m_step
QValueList< KMyMoneyWizardPage * > m_history
QString m_helpContext


class KMyMoneyWizardPage

Detailed Description

Thomas Baumgart (C) 2006
This is a base class for implementation of the KMyMoneyWizard. It provides the following layout of a wizard:

 |                                                            |
 ||             ||+-pageLayout------------------------------+||
 ||             |||                                         |||
 ||             |||                                         |||
 ||             |||                                         |||
 ||             |||                                         |||
 ||             |||                                         |||
 ||             |||                                         |||
 ||             ||+-----------------------------------------+||
 ||             |||+-buttonLayout--------------------------+|||
 ||             ||||                                       ||||
 ||             |||+---------------------------------------+|||
 ||             ||+-----------------------------------------+||

The top bar is filled with a KMyMoneyTitleLabel as known from KMyMoney's views. To the left there is an area in the same color as the title bar showing the steps for this wizard. Each such step can consist of one or more wizard pages. At the bottom of this area the text "Step x of y" is shown and updated. To the right of this part, the actual wizard page is shown. At the bottom of the page the class inserts a standard button widget consisting of a Help, Back, Next/Finish and Cancel button.

The wizard serves as container for the wizard pages. In order to access the data filled into the pages, one would have to provide getter methods.

Here is an example how this object could be used. Please also see the example described with the KMyMoneyWizardPage class.

 class KNewUserGeneral;
 class KNewUserPersonal;

 class KNewUserWizard : public KMyMoneyWizard
   KNewUserWizard(QWidget* parent = 0, const char* name = 0, bool modal = false, WFlags flags = 0);

   KNewUserGeneral*  m_generalPage;
   KNewUserPersonal* m_personalPage;
   KNewUserFinal*    m_finalPage;
   // add more pages here

   friend class KNewUserGeneral;
   friend class KNewUserPersonal;
   friend class KNewUserFinal;
   // add more pages here

The implementation is also easy and looks like this:

 KNewUserWizard::KNewUserWizard(QWidget* parent, const char* name, bool modal, WFlags flags) :
   KMyMoneyWizard(parent, name, modal, flags)
   setTitle("KMyMoney New User Setup");
   addStep("General Data");
   addStep("Personal Data");

   m_generalPage = new KNewUserGeneral(this);
   m_personalPage = new KNewUserPersonal(this);
   m_finalPage = new KNewUserFinal(this);


Don't forget to call setFirstPage() to get things started.

The code to use this whole structure would then look something like this:

     KNewUserWizard* wizard = new KNewUserWizard(this, "NewUserWizard");
     int rc = wizard->exec();

The return code of exec() is either QDialog::Accepted or QDialog::Rejected.

The implementation of this class is heavily based on ideas found at

Constructor & Destructor Documentation

virtual KMyMoneyWizard::~KMyMoneyWizard (  )  [inline, virtual]

KMyMoneyWizard::KMyMoneyWizard ( QWidget parent = 0,
const char *  name = 0,
bool  modal = false,
WFlags  f = 0 
) [protected]

Constructor (kept protected, so that one cannot create such an object directly)

Member Function Documentation

void KMyMoneyWizard::setTitle ( const QString &  txt  ) 

Modify the title of the wizard to be txt.

txt The text that should be used as title

void KMyMoneyWizard::addStep ( const QString &  text  ) 

Add step text to the wizard

text Text to be shown for this step

QValueList<KMyMoneyWizardPage*> KMyMoneyWizard::historyPages ( void   )  const [inline]

void KMyMoneyWizard::reselectStep ( void   ) 

This method repeats selection of the current step in the step frame. This is used to allow changes made to showing and hiding pages to immediately to be reflected in the step frame

void KMyMoneyWizard::setHelpContext ( const QString &  ctx  )  [inline]

Setup a global help context for the wizard. It will be used whenever there is no specific help context available for the current page.

See also:

void KMyMoneyWizard::createPayee ( const QString &  txt,
QString &  id 
) [signal]

This signal is sent out, when a new payee needs to be created

See also:
txt The name of the payee to be created
id A connected slot should store the id of the created object in this variable

void KMyMoneyWizard::createCategory ( const QString &  txt,
QString &  id 
) [signal]

This signal is sent out, when a new category needs to be created

See also:
txt The name of the category to be created
id A connected slot should store the id of the created object in this variable

void KMyMoneyWizard::setFirstPage ( KMyMoneyWizardPage page  )  [protected]

This method sets up the first page after creation of the object

page pointer to first page of wizard

void KMyMoneyWizard::setStepHidden ( unsigned int  step,
bool  hidden = true 
) [protected]

This method allows to hide or show a step.

step step to be shown/hidden
hidden hide step if true (the default) or show it if false

virtual void KMyMoneyWizard::accept ( void   )  [protected, virtual, slot]

void KMyMoneyWizard::completeStateChanged ( void   )  [protected, slot]

void KMyMoneyWizard::updateStepCount ( void   )  [private]

void KMyMoneyWizard::backButtonClicked ( void   )  [private, slot]

void KMyMoneyWizard::nextButtonClicked ( void   )  [private, slot]

void KMyMoneyWizard::helpButtonClicked ( void   )  [private, slot]

void KMyMoneyWizard::switchPage ( KMyMoneyWizardPage oldPage  )  [private]

Switch to page which is currently the top of the history stack. oldPage is a pointer to the current page or 0 if no page is shown.

oldPage pointer to currently displayed page

void KMyMoneyWizard::selectStep ( unsigned int  step  )  [private]

This method selects the step given by step.

step step to be selected

Friends And Related Function Documentation

friend class KMyMoneyWizardPage [friend]

Member Data Documentation

KPushButton* KMyMoneyWizard::m_cancelButton [protected]

KPushButton* KMyMoneyWizard::m_backButton [protected]

KPushButton* KMyMoneyWizard::m_nextButton [protected]

KPushButton* KMyMoneyWizard::m_finishButton [protected]

KPushButton* KMyMoneyWizard::m_helpButton [protected]

QVBoxLayout* KMyMoneyWizard::m_wizardLayout [private]

QVBoxLayout* KMyMoneyWizard::m_stepLayout [private]

QVBoxLayout* KMyMoneyWizard::m_pageLayout [private]

QHBoxLayout* KMyMoneyWizard::m_buttonLayout [private]

QPalette KMyMoneyWizard::m_stepPalette [private]

int KMyMoneyWizard::m_step [private]

QString KMyMoneyWizard::m_helpContext [private]

The documentation for this class was generated from the following file:

Generated on Wed Jan 26 13:08:14 2011 for KMyMoney by  doxygen 1.5.6