Source Code (Use browser search to find items of interest.)
Class Index
kiconedit'KWizard (./kdegraphics/kiconedit/kwizard.h:76)
class KWizard : public KDialog
{
friend class KNoteBook;
Q_OBJECT
public:
/**
* Constructor
*/
KWizard(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
/**
* Destructor
*/
~KWizard();
/**
* Adds a page to the wizard.
* The pages are numbered from 0-n where 0 is the page first added and n is the
* page last added.
* @param p KWizardPage containing the page data.
*
* @return Returns the id of the new page.
*/
int addPage(KWizardPage *p);
/**
* Changes the QWidget on the page with id "id" to "w".
*/
void setPage(int id, QWidget *w);
/**
* Changes the title on the page with id "id" to "title".
*/
void setPage(int id, QString title);
/**
* En/disable a specified page. If a page is disable its content will be
* grayd out and it will not receive keyboard input.
* @param page The page to en/disable.
* @param state If 'state' is false the page will be disabled, otherwise it will be enabled.
* @see KNoteBook#setPageEnabled
*/
void setPageEnabled(int page, bool state);
/**
* Check the state of the page.
* @see #setPageEnabled
* @return Returns true if the page is enabled, otherwise false.
*/
bool isPageEnabled(int page) { return pages->at(page)->enabled; };
/**
* Adds a Cancel button to the bottom of the dialog.
* The text will be a translated version of the string '&Cancel' thereby
* giving it the shortcut key 'c' if text is null.
*
* If any buttons are added a space will be created at the bottom of the
* dialog to fit the buttons. When clicked the button will emit the @ref
* cancelclicked signal.
* @param text A user supplied text to write to the button.
*/
void setCancelButton(const QString &text = QString::null);
/**
* Adds a Default button to the bottom of the dialog.
* The text will be a translated version of the string '&Default' thereby
* giving it the shortcut key 'd' if text is null.
*
* If any buttons are added a space will be created at the bottom of the
* dialog to fit the buttons. When clicked the button will emit the @ref
* defaultclicked signal.
* @param text A user supplied text to write to the button.
*/
void setDefaultButton(const QString& text = QString::null);
/**
* Adds a Help button to the bottom of the dialog. This button will
* generate the signal @ref helpclicked where the int is the page to
* which the help was requested.
*
* if text is null, the text will be a translated version of the string
* '&Help' thereby giving it the shortcut key 'h'.
* @see #getHelpButton
* @param text A user supplied text to write to the button.
*/
void setHelpButton(const QString& text = QString::null);
/**
* Adds an Ok button to the bottom of the dialog. This button will generate
* the signal @ref okclicked where the int is the page to which the help
* was requested.
*
* The text will be a translated version of the string '&Ok' thereby
* giving it the shortcut key 'o' if text is null.
* @see #getOkButton
* @param text A user supplied text to write to the button.
*/
void setOkButton(const QString& text = QString::null);
/**
* @see #setOkButton
* @return Returns the Ok buttonwidget or 0L if no button is added.
*/
QButton * getOkButton();
/**
* @see #setCancelButton
* @return Returns the Cancel buttonwidget or 0L if no button is added.
*/
QButton * getCancelButton();
/**
* @see #setDefaultButton
* @return Returns the Default buttonwidget or 0L if no button is added.
*/
QButton * getDefaultButton();
/**
* @see #setHelpButton
* @return Returns the Help buttonwidget or 0L if no button is added.
*/
QButton * getHelpButton();
/**
* getNextButton.
* @return Returns the Next buttonwidget.
*/
QButton * getNextButton();
/**
* getPreviousButton
* @return Returns the Previous buttonwidget.
*/
QButton * getPreviousButton();
/**
* @see #setEnableArrowButtons
* @return Returns the left arrowbutton.
*/
KDirectionButton * getLeftArrow();
/**
* @see #setEnableArrowButtons
* @return Returns the right arrowbutton.
*/
KDirectionButton * getRightArrow();
/**
* Let direction buttons reflect page.
* @see #directionsReflectsPage
* @param state If state is true the direction buttons (Previous and Next) will have the
* title of the corresponding page.
*/
void setDirectionsReflectsPage(bool state);
/**
* @return Returns whether the direction buttons reflects the title of the corresponding page.
*
* @see #setDirectionsReflectsPage(bool state)
*/
bool directionsReflectsPage();
/**
* En/Disable the popup menu.
* @see #enablePopupMenu
* @param state If state is true a menu containing the pages in the wizard
* will popup when the user RMB-clicks on the page-title.
*/
void setEnablePopupMenu(bool state);
/**
* @see #setEnablePopupMenu
* @return Returns 'true' if the popupmenu is enabled.
*/
bool enablePopupMenu();
/**
* getMenu
* @see #setEnablePopupMenu #enablePopupMenu
* @return Returns the handle of the popup menu.
*/
QPopupMenu * getMenu();
/**
* En/Disable the arrow buttons at the rightmost of the title.
* @param state If state is true two arrows will appear to the right of the pagination
* allowing the user to change pages by clicking on them.
* @see #enableArrowButtons
*/
void setEnableArrowButtons(bool state);
/**
* @see #setEnableArrowButtons
* @return Returns 'true' if the arrow buttons are enabled.
*/
bool enableArrowButtons();
QSize sizeHint();
void adjustSize() { resize(sizeHint()); };
/**
* getTitle
* @return Returns the title of a specified page. Used by KNoteBook
* @param page The page to retrieve the title from.
*/
QString getTitle(int page) { return pages->at(page)->title.data(); };
/**
* numPages
* @return Returns the number of pages in the wizard.
*/
int numPages();
signals:
/**
* This signal is emitted when the user clicks on the Ok button.
*/
void okclicked();
/**
* This signal is emitted when the user clicks on the Cancel button.
*/
void cancelclicked();
/**
* This signal is emitted when the user clicks on the Default button.
* The int is the page which was showing when default settings was requested.
*/
void defaultclicked(int);
/**
* This signal is emitted when the user clicks on the Help button.
* The int is the page which was showing when help was requested.
*
* @see #setHelpButton, #getHelpButton
*/
void helpclicked(int);
/**
* This signal is emitted when a page is selected. The int is the page number
*/
void selected(int);
/**
* This signal is emitted when the dialog is closed. Mainly usable if the dialog
* is a top level widget.
*/
void closed();
/**
* This signal is emitted when a popup menu is requested. This happens when the user
* RMB-clicks somewhere in the title (not the titlebar). This is used by KNoteBook.
*/
void popup(QPoint);
/**
* This signal is used by KNoteBook.
*/
void nomorepages(bool, bool);
public slots:
/*
* Goto to a specified page.
* @param page The page number to turn to.
*/
void gotoPage(int page);
protected slots:
void nextPage();
void previousPage();
void okClicked();
void cancelClicked();
void defaultClicked();
void helpClicked();
protected:
bool eventFilter( QObject *, QEvent * );
void closeEvent(QCloseEvent *);
/**
* @internal
*/
QSize pageSize();
/**
* @internal
*/
void setSizes();
/**
* @internal
*/
void resizeEvent(QResizeEvent *);
/**
* @internal
*/
void paintEvent(QPaintEvent *);
QList<KWizardPage> *pages;
//QList<QWidget> pages;
//QStrList titles;
KWizProtected *pwiz;
};
kiconedit'KWizard::KWizard() (./kdegraphics/kiconedit/kwizard.cpp:58)
KWizard::KWizard(QWidget *parent, const char *name, bool modal, WFlags f)
: KDialog(parent, name, modal, f)
// : QWidget(parent, name, modal ? (f | WType_Modal) : f)
{
//debug("KWizard creation");
initMetaObject();
pwiz = new KWizProtected;
pages = new QList<KWizardPage>;
pages->setAutoDelete(true);
pwiz->menu = new QPopupMenu();
connect( pwiz->menu, SIGNAL(activated(int)), SLOT(gotoPage(int)));
pwiz->numpages = 0;
pwiz->current = -1;
pwiz->minwidth = 300;
pwiz->minheight = 300;
pwiz->currentwidget = 0L;
pwiz->ok = pwiz->cancel = pwiz->def = pwiz->help = pwiz->next = pwiz->previous = 0L;
pwiz->directionsreflectspage = pwiz->enablepopupmenu = pwiz->enablearrowbuttons = false;
pwiz->title = new QLabel(this);
pwiz->title->installEventFilter(this);
pwiz->title->setAlignment(AlignLeft|AlignVCenter);
pwiz->pagina = new QLabel("Page 1 of 1", this);
pwiz->pagina->setAlignment(AlignLeft|AlignVCenter);
pwiz->left = new KDirectionButton(LeftArrow, this);
connect( pwiz->left, SIGNAL(clicked()), SLOT(previousPage()));
pwiz->left->hide();
pwiz->right = new KDirectionButton(RightArrow, this);
connect( pwiz->right, SIGNAL(clicked()), SLOT(nextPage()));
pwiz->right->hide();
pwiz->sep1 = new KSeparator(this);
//sep1->setFixedHeight(sep1->sizeHint().height());
pwiz->sep2 = new KSeparator(this);
//sep2->setFixedHeight(sep2->sizeHint().height());
pwiz->previous = new QPushButton("<< " + i18n("&Previous"), this);
pwiz->previous->hide();
connect( pwiz->previous, SIGNAL(clicked()), SLOT(previousPage()));
pwiz->next = new QPushButton(i18n("&Next") + " >>", this);
pwiz->next->hide();
connect( pwiz->next, SIGNAL(clicked()), SLOT(nextPage()));
installEventFilter(this);
//debug("KWizard created");
}
// Destructor
kiconedit'KWizard::~KWizard() (./kdegraphics/kiconedit/kwizard.cpp:114)
KWizard::~KWizard()
{
//debug("KWizard - destructor");
//if (menu) delete menu;
//menu = 0L;
delete pwiz;
delete pages;
//debug("KWizard - destructor done");
}
kiconedit'KWizard::setCancelButton() (./kdegraphics/kiconedit/kwizard.cpp:124)
void KWizard::setCancelButton(const QString& name)
{
if (name.isNull())
{
setCancelButton(i18n("&Cancel"));
return;
}
if(!pwiz->cancel)
{
pwiz->cancel = new QPushButton(name, this);
pwiz->cancel->show();
connect( pwiz->cancel, SIGNAL(clicked()), SLOT(cancelClicked()));
}
else
pwiz->cancel->setText(name);
setSizes();
}
kiconedit'KWizard::getCancelButton() (./kdegraphics/kiconedit/kwizard.cpp:143)
QButton *KWizard::getCancelButton()
{
return pwiz->cancel;
}
kiconedit'KWizard::setDefaultButton() (./kdegraphics/kiconedit/kwizard.cpp:148)
void KWizard::setDefaultButton(const QString& name)
{
if (name.isNull())
{
setDefaultButton(i18n("&Default"));
return;
}
if(!pwiz->def)
{
pwiz->def = new QPushButton(name, this);
pwiz->def->show();
connect( pwiz->def, SIGNAL(clicked()), SLOT(defaultClicked()));
}
else
pwiz->def->setText(name);
setSizes();
}
kiconedit'KWizard::getDefaultButton() (./kdegraphics/kiconedit/kwizard.cpp:167)
QButton *KWizard::getDefaultButton()
{
return pwiz->def;
}
kiconedit'KWizard::setHelpButton() (./kdegraphics/kiconedit/kwizard.cpp:172)
void KWizard::setHelpButton(const QString& name)
{
if (name.isNull())
{
setHelpButton(i18n("&Help"));
return;
}
if(!pwiz->help)
{
pwiz->help = new QPushButton(name, this);
pwiz->help->show();
connect( pwiz->help, SIGNAL(clicked()), SLOT(helpClicked()));
}
else
pwiz->help->setText(name);
setSizes();
}
kiconedit'KWizard::getHelpButton() (./kdegraphics/kiconedit/kwizard.cpp:191)
QButton *KWizard::getHelpButton()
{
return pwiz->help;
}
kiconedit'KWizard::setOkButton() (./kdegraphics/kiconedit/kwizard.cpp:196)
void KWizard::setOkButton(const QString& name)
{
if (name.isNull())
{
setOkButton(i18n("&OK"));
return;
}
if(!pwiz->ok)
{
pwiz->ok = new QPushButton(name, this);
pwiz->ok->show();
connect( pwiz->ok, SIGNAL(clicked()), SLOT(okClicked()));
}
else
pwiz->ok->setText(name);
setSizes();
}
kiconedit'KWizard::getOkButton() (./kdegraphics/kiconedit/kwizard.cpp:215)
QButton *KWizard::getOkButton()
{
return pwiz->ok;
}
kiconedit'KWizard::getNextButton() (./kdegraphics/kiconedit/kwizard.cpp:220)
QButton *KWizard::getNextButton()
{
return pwiz->next;
}
kiconedit'KWizard::getPreviousButton() (./kdegraphics/kiconedit/kwizard.cpp:225)
QButton *KWizard::getPreviousButton()
{
return pwiz->previous;
}
kiconedit'KWizard::getLeftArrow() (./kdegraphics/kiconedit/kwizard.cpp:230)
KDirectionButton *KWizard::getLeftArrow()
{
return pwiz->left;
}
kiconedit'KWizard::getRightArrow() (./kdegraphics/kiconedit/kwizard.cpp:235)
KDirectionButton *KWizard::getRightArrow()
{
return pwiz->right;
}
kiconedit'KWizard::pageSize() (./kdegraphics/kiconedit/kwizard.cpp:240)
QSize KWizard::pageSize()
{
//debug("Calculating sizes");
QSize size(0,0);
//int x = 0, y = 0;
for(int i = 0; i < pwiz->numpages; i++)
{
QSize csize = pages->at(i)->w->minimumSize();
if(size.height() < csize.height())
size.setHeight(csize.height());
if(size.width() < csize.width())
size.setWidth(csize.width());
//debug("Page size: %d x %d", size.width(), size.height());
}
return size;
}
kiconedit'KWizard::setSizes() (./kdegraphics/kiconedit/kwizard.cpp:258)
void KWizard::setSizes()
{
//debug("setSizes");
QFont titlefont;
//titlefont.setPointSize(titlefont.pointSize()*2);
titlefont.setWeight(QFont::Bold);
pwiz->title->setFont(titlefont);
pwiz->title->adjustSize();
//debug("Title points: %d", titlefont.pointSize());
//debug("Title height: %d", title->height());
pwiz->pagina->adjustSize();
QSize pagesize = pageSize();
int subtr = 5;
bool f = false;
if(pwiz->ok)
{
pwiz->ok->adjustSize();
f = true;
subtr = pwiz->ok->height() + 10;
}
if(pwiz->cancel)
{
pwiz->cancel->adjustSize();
if(!f)
subtr = pwiz->cancel->height() + 10;
}
if(pwiz->def)
{
pwiz->def->adjustSize();
if(!f)
subtr = pwiz->def->height() + 10;
}
if(pwiz->help)
{
pwiz->help->adjustSize();
if(!f)
subtr = pwiz->help->height() + 10;
}
int y = pwiz->title->height() + pagesize.height() + pwiz->next->height() + 35 + subtr;
int x = 20 + pagesize.width();
setMinimumSize(x, y);
//resize(x, y);
}
kiconedit'KWizard::resizeEvent() (./kdegraphics/kiconedit/kwizard.cpp:307)
void KWizard::resizeEvent(QResizeEvent *)
{
//QSize pagesize = pageSize();
//debug("KWizard, resizeEvent()");
int subtr = 4;
if(pwiz->ok && pwiz->ok->isVisible())
subtr = pwiz->ok->height() + 10;
else if(pwiz->cancel && pwiz->cancel->isVisible())
subtr = pwiz->cancel->height() + 10;
else if(pwiz->def && pwiz->def->isVisible())
subtr = pwiz->cancel->height() + 10;
else if(pwiz->help && pwiz->help->isVisible())
subtr = pwiz->help->height() + 10;
//main->setGeometry(2, 2, width()-4, height()-(subtr));
//debug("main");
//pagina->adjustSize();
pwiz->title->setGeometry(7, 7,
width()-14,
pwiz->title->sizeHint().height());
pwiz->right->setGeometry(width()-(pwiz->title->sizeHint().height()+10),
5, // had to make a little hack :-(
pwiz->title->sizeHint().height(),
pwiz->title->sizeHint().height()+2);
pwiz->left->setGeometry(width()-((pwiz->title->sizeHint().height()*2)+10),
5,
pwiz->title->sizeHint().height(),
pwiz->title->sizeHint().height()+2);
pwiz->pagina->setGeometry(
width()-(pwiz->pagina->sizeHint().width()+(pwiz->title->sizeHint().height()*2)+20),
7,
pwiz->pagina->sizeHint().width(),
pwiz->pagina->sizeHint().height());
if(pwiz->numpages > 1)
pwiz->pagina->show();
else
pwiz->pagina->hide();
//debug("header - pagina: %d", pagina->width());
pwiz->sep1->setGeometry(7,
pwiz->title->height()+10,
width()-14,
2);
//debug("sep1");
if(pwiz->currentwidget)
{
int hack = 15;
if(pwiz->ok || pwiz->cancel || pwiz->help) hack = 0;
int offs = pwiz->title->height() + 12;
pwiz->currentwidget->setGeometry( 7, offs, width()-14,
height()-( pwiz->next->height() + 40 + subtr + hack));
}
else debug("No currentwidget!");
//debug("currentwidget");
if(pwiz->directionsreflectspage)
{
QString str;
if(pwiz->current < pwiz->numpages-1)
{
str = pages->at(pwiz->current+1)->title;
str += " >>";
pwiz->next->setText(str);
}
if(pwiz->current > 0)
{
str = "<< ";
str += pages->at(pwiz->current-1)->title;
pwiz->previous->setText(str);
}
}
else
{
pwiz->next->setText(i18n("&Next") + " >>");
pwiz->previous->setText("<< " + i18n("&Previous"));
}
pwiz->sep2->setGeometry(7, height()-(pwiz->next->height()+14+subtr),
width()-14, 2);
//debug("sep2");
pwiz->next->adjustSize();
pwiz->previous->adjustSize();
pwiz->next->move(width()-(pwiz->next->width()+7),
height()-(pwiz->next->height()+7+subtr));
pwiz->previous->move(width()-(pwiz->previous->width()+14+pwiz->next->width()),
height()-(pwiz->previous->height()+7+subtr));
int offs = 1;
if(pwiz->ok && pwiz->ok->isVisible())
{
pwiz->ok->setGeometry(offs, height()-(pwiz->ok->height()+2),
pwiz->ok->width(), pwiz->ok->height());
offs = 6 + pwiz->ok->width();
}
if(pwiz->cancel && pwiz->cancel->isVisible())
{
pwiz->cancel->setGeometry(offs, height()-(pwiz->cancel->height()+2),
pwiz->cancel->width(), pwiz->cancel->height());
offs += 6 + pwiz->cancel->width();
}
if(pwiz->def && pwiz->def->isVisible())
pwiz->def->setGeometry(offs, height()-(pwiz->def->height()+2),
pwiz->def->width(), pwiz->def->height());
if(pwiz->help && pwiz->help->isVisible())
pwiz->help->setGeometry(width()-(pwiz->help->width()+1),
height()-(pwiz->help->height()+2),
pwiz->help->width(), pwiz->cancel->height());
//debug("KWizard, resizeEvent done");
}
kiconedit'KWizard::paintEvent() (./kdegraphics/kiconedit/kwizard.cpp:423)
void KWizard::paintEvent(QPaintEvent *)
{
int subtr = 4;
if(pwiz->ok)
subtr = pwiz->ok->height() + 10;
else if(pwiz->cancel)
subtr = pwiz->cancel->height() + 10;
else if(pwiz->help)
subtr = pwiz->help->height() + 10;
// start painting widget
QPainter paint;
paint.begin( this );
QPen pen( white, 1 );
paint.setPen( pen );
// left
paint.drawLine( 2, height()-subtr, 2, 3);
// top
paint.drawLine( 3 , 2, width()-4, 2);
pen.setColor( black );
paint.setPen( pen );
// right
paint.drawLine( width()-4 , 3, width()-4, height()-subtr);
// bottom
paint.drawLine( width()-4 , height()-subtr, 3, height()-subtr);
paint.end();
}
kiconedit'KWizard::addPage() (./kdegraphics/kiconedit/kwizard.cpp:457)
int KWizard::addPage(KWizardPage *p)
{
CHECK_PTR(p->w);
p->w->recreate(this, 0, QPoint(0, 0));
//debug("recreated");
p->w->hide();
//debug("hidden");
if(pwiz->numpages == 0)
{
pwiz->current = 0;
pwiz->currentwidget = p->w;
pwiz->title->setText(p->title);
pwiz->title->setEnabled(p->enabled);
pwiz->currentwidget->setEnabled(p->enabled);
pwiz->pagina->setEnabled(p->enabled);
pwiz->currentwidget->show();
}
p->id = pwiz->numpages;
pwiz->numpages++;
pwiz->menu->insertItem(p->title, p->id);
pwiz->menu->setItemEnabled(p->id, p->enabled);
//debug("inserted menuitem");
pages->append(p);
//titles.append(strtitle);
if(pwiz->numpages > 1)
{
if(pwiz->current < (pwiz->numpages-1))
{
pwiz->next->show();
if(pwiz->enablearrowbuttons)
pwiz->right->show();
}
if(pwiz->current > 0)
{
pwiz->previous->show();
if(pwiz->enablearrowbuttons)
pwiz->left->show();
}
}
//debug("enabled buttons");
QString strpagina = i18n("Page %1 of %2").arg(pwiz->current+1).arg(pwiz->numpages);
if(pwiz->numpages > 1)
pwiz->pagina->setText(strpagina);
else
pwiz->pagina->setText("");
//debug("pagina");
setSizes();
//debug("Add page, done");
return (p->id);
}
kiconedit'KWizard::setPage() (./kdegraphics/kiconedit/kwizard.cpp:513)
void KWizard::setPage(int id, QWidget *w)
{
if(!w || pages->count() <= (uint)id)
return;
pages->at(id)->w = w;
}
kiconedit'KWizard::setPage() (./kdegraphics/kiconedit/kwizard.cpp:520)
void KWizard::setPage(int id, QString title)
{
if(pages->count() <= (uint)id)
return;
pages->at(id)->title = title;
}
kiconedit'KWizard::setPageEnabled() (./kdegraphics/kiconedit/kwizard.cpp:527)
void KWizard::setPageEnabled(int id, bool state)
{
if(id >= 0 && id < pwiz->numpages)
{
pages->at(id)->enabled = state;
pwiz->menu->setItemEnabled(id, state);
if(id == pwiz->current)
{
pwiz->title->setEnabled(state);
pwiz->pagina->setEnabled(state);
pwiz->currentwidget->setEnabled(state);
}
}
}
kiconedit'KWizard::okClicked() (./kdegraphics/kiconedit/kwizard.cpp:542)
void KWizard::okClicked()
{
emit okclicked();
}
kiconedit'KWizard::cancelClicked() (./kdegraphics/kiconedit/kwizard.cpp:547)
void KWizard::cancelClicked()
{
emit cancelclicked();
}
kiconedit'KWizard::defaultClicked() (./kdegraphics/kiconedit/kwizard.cpp:552)
void KWizard::defaultClicked()
{
emit defaultclicked(pwiz->current);
}
kiconedit'KWizard::helpClicked() (./kdegraphics/kiconedit/kwizard.cpp:557)
void KWizard::helpClicked()
{
emit helpclicked(pwiz->current);
}
kiconedit'KWizard::setDirectionsReflectsPage() (./kdegraphics/kiconedit/kwizard.cpp:562)
void KWizard::setDirectionsReflectsPage(bool state)
{
pwiz->directionsreflectspage = state;
setSizes();
}
kiconedit'KWizard::directionsReflectsPage() (./kdegraphics/kiconedit/kwizard.cpp:568)
bool KWizard::directionsReflectsPage()
{
return pwiz->directionsreflectspage;
}
kiconedit'KWizard::setEnablePopupMenu() (./kdegraphics/kiconedit/kwizard.cpp:573)
void KWizard::setEnablePopupMenu(bool state)
{
pwiz->enablepopupmenu = state;
}
kiconedit'KWizard::enablePopupMenu() (./kdegraphics/kiconedit/kwizard.cpp:578)
bool KWizard::enablePopupMenu()
{
return pwiz->enablepopupmenu;
}
kiconedit'KWizard::getMenu() (./kdegraphics/kiconedit/kwizard.cpp:583)
QPopupMenu *KWizard::getMenu()
{
return pwiz->menu;
}
kiconedit'KWizard::setEnableArrowButtons() (./kdegraphics/kiconedit/kwizard.cpp:588)
void KWizard::setEnableArrowButtons(bool state)
{
pwiz->enablearrowbuttons = state;
}
kiconedit'KWizard::enableArrowButtons() (./kdegraphics/kiconedit/kwizard.cpp:593)
bool KWizard::enableArrowButtons()
{
return pwiz->enablearrowbuttons;
}
kiconedit'KWizard::numPages() (./kdegraphics/kiconedit/kwizard.cpp:598)
int KWizard::numPages()
{
return pwiz->numpages;
}
kiconedit'KWizard::gotoPage() (./kdegraphics/kiconedit/kwizard.cpp:603)
void KWizard::gotoPage(int p)
{
//debug("gotopage: %d", p);
if(p >= pwiz->numpages) // || p == pwiz->current)
return;
//debug("Changing to page %d", p);
if(p < (pwiz->numpages-1))
{
pwiz->next->show();
if(pwiz->enablearrowbuttons)
pwiz->right->show();
}
if(p > 0 && p < pwiz->numpages)
{
pwiz->previous->show();
if(pwiz->enablearrowbuttons)
pwiz->left->show();
}
if(p == (pwiz->numpages-1))
{
pwiz->next->hide();
if(pwiz->enablearrowbuttons)
pwiz->right->hide();
emit nomorepages(false, true);
}
if(p == 0)
{
if(pwiz->numpages > 1)
{
pwiz->next->show();
if(pwiz->enablearrowbuttons)
pwiz->right->show();
}
pwiz->previous->hide();
if(pwiz->enablearrowbuttons)
pwiz->left->hide();
emit nomorepages(false, false);
}
pwiz->current = p;
QString strpagina = i18n("Page %1 of %2").arg(pwiz->current+1).arg(pwiz->numpages);
if(pwiz->numpages > 1)
pwiz->pagina->setText(strpagina);
else
pwiz->pagina->setText("");
pwiz->title->setText(pages->at(pwiz->current)->title);
pwiz->currentwidget->hide();
pwiz->currentwidget = pages->at(pwiz->current)->w;
pwiz->title->setEnabled(pages->at(pwiz->current)->enabled);
pwiz->currentwidget->setEnabled(pages->at(pwiz->current)->enabled);
pwiz->pagina->setEnabled(pages->at(pwiz->current)->enabled);
pwiz->currentwidget->show();
//setSizes();
// fake a resize event to trigger child widget moves
QResizeEvent r( size(), size() );
resizeEvent( &r );
emit selected(pwiz->current);
}
kiconedit'KWizard::nextPage() (./kdegraphics/kiconedit/kwizard.cpp:667)
void KWizard::nextPage()
{
if((pwiz->current+1) == pwiz->numpages)
emit nomorepages(true, true);
else
gotoPage(pwiz->current + 1);
}
kiconedit'KWizard::previousPage() (./kdegraphics/kiconedit/kwizard.cpp:675)
void KWizard::previousPage()
{
if((pwiz->current-1) < 0)
emit nomorepages(true, false);
else
gotoPage(pwiz->current - 1);
}
// Grab QDialogs keypresses if non-modal and grab mouse events on title
// to popup menu.
kiconedit'KWizard::eventFilter() (./kdegraphics/kiconedit/kwizard.cpp:685)
bool KWizard::eventFilter( QObject *obj, QEvent *e )
{
if ( e->type() == QEvent::MouseButtonPress && obj == pwiz->title)
{
QMouseEvent *m = (QMouseEvent*)e;
if(pwiz->title->rect().contains( m->pos()) && m->button() == RightButton)
{
//debug("KWizard::eventFilter() - inside");
emit popup(mapToGlobal(m->pos()));
if(!pwiz->enablepopupmenu)
return false;
pwiz->menu->popup(mapToGlobal(m->pos()));
return true;
}
}
if ( e->type() == QEvent::KeyPress && obj == this)
{
QKeyEvent *k = (QKeyEvent*)e;
if(k->key() == Key_PageUp)
{
//debug("Received keyevent PageUp");
previousPage();
return true;
}
else if(k->key() == Key_PageDown)
{
//debug("Received keyevent PageDown");
nextPage();
return true;
}
else
return false;
}
return false;
}
kiconedit'KWizard::closeEvent() (./kdegraphics/kiconedit/kwizard.cpp:723)
void KWizard::closeEvent(QCloseEvent *e)
{
e->accept();
emit closed();
}
kiconedit'KWizard::sizeHint() (./kdegraphics/kiconedit/kwizard.cpp:729)
QSize KWizard::sizeHint()
{
QSize s = minimumSize();
int h = 0;
if(pwiz->title)
h += pwiz->title->height();
if(pwiz->previous)
h += pwiz->previous->height();
if(pwiz->ok)
h += pwiz->ok->height();
else if(pwiz->cancel)
h += pwiz->cancel->height();
else if(pwiz->def)
h += pwiz->def->height();
else if(pwiz->help)
h += pwiz->help->height();
h += 20;
s.setHeight(s.height() + h);
return s;
}