KAssistantDialog - reworked proposal

Jason Harris jharris at 30doradus.org
Thu Sep 14 17:00:07 BST 2006


Thomas Friedrichsmeier wrote:
> I wonder whether this is not slightly too high level for many cases. Sure, 
> your proposal is very helpful, if you have a structure like this:
> 
>       Page2a - Page3a - Page4a
>      /                        \
> Page1                          End
>      \                        /
>       Page2b - Page3b    - 
> 
> However, what about cases where you really just want to skip over one page:
> 
> 
> 
> Page1   -   Page3 - Page4   -   Page6 - End
>      \     /             \     /
>       Page2               Page5
> 
> If I understand your proposal correctly, this would mean setting up four 
> different paths, eight if there's a third optional page.

What if a KAssistantPath did not need to define the entire path from 
start to end, but could instead "branch off" of another path at page N, 
and merge back at page M.

One idea is that a KAssistantDialog always has a default path, which can 
be populated with KAssistantDialog::addPage().  You can then branch off 
the main path with addPath( KAssistantPath*, KAssistantPage *start, 
KAssistantPage *end ).  By default, *start and *end would be the first 
and last page of the default path.

The advantage is that it makes the simple case (one path through the 
Assistant dialog) very simple; one only has to worry about paths when 
they are actually needed.

Pseudocode for Thomas's first example:

KAssistantDialog *kad = new KAssistantDialog( this );

//Populate the default path
kad->addPage( new KAssistantPage( page1_Widget, i18n("Page 1")) );
kad->addPage( new KAssistantPage( page2a_Widget, i18n("Page 2a")) );
kad->addPage( new KAssistantPage( page3a_Widget, i18n("Page 3a")) );
kad->addPage( new KAssistantPage( page4a_Widget, i18n("Page 4a")) );
kad->addPage( new KAssistantPage( page5_Widget, i18n("Last Page")) );

//Add alternative path
KAssistantPath *altPath = new KAssistantPath();
altPath->addPage( new KAssistantPage( page2b_Widget, i18n("Page 2b")) );
altPath->addPage( new KAssistantPage( page3b_Widget, i18n("Page 3b")) );
altPath->addPage( new KAssistantPage( page4b_Widget, i18n("Page 4b")) );

//Add this path to the dialog
kad->addPath( altPath );


In the second example, you'd create two one-page altPath's and call 
addPath() with pointers to the start/end pages in the arg list.

What do you think?

regards,
Jason




More information about the kde-core-devel mailing list