27 class KAssistantDialog::Private
36 QHash<KPageWidgetItem*, bool> valid;
37 QHash<KPageWidgetItem*, bool> appropriate;
41 void _k_slotUpdateButtons();
43 QModelIndex getNext(QModelIndex nextIndex)
45 QModelIndex currentIndex;
47 currentIndex=nextIndex;
48 nextIndex=currentIndex.child(0, 0);
49 if (!nextIndex.isValid())
50 nextIndex=currentIndex.sibling(currentIndex.row() + 1, 0);
51 }
while (nextIndex.isValid() && !appropriate.value(pageModel->item(nextIndex),
true));
55 QModelIndex getPrevious(QModelIndex nextIndex)
57 QModelIndex currentIndex;
59 currentIndex=nextIndex;
60 nextIndex=currentIndex.sibling(currentIndex.row() - 1, 0);
61 if (!nextIndex.isValid())
62 nextIndex=currentIndex.parent();
63 }
while (nextIndex.isValid() && !appropriate.value(pageModel->item(nextIndex),
true));
79 :
KPageDialog(widget, parent, flags), d(new Private(this))
90 void KAssistantDialog::Private::init()
101 q->connect(q, SIGNAL(user3Clicked()), q, SLOT(
back()));
102 q->connect(q, SIGNAL(user2Clicked()), q, SLOT(
next()));
103 q->connect(q, SIGNAL(user1Clicked()), q, SLOT(accept()));
111 QModelIndex nextIndex=d->getPrevious(d->pageModel->index(
currentPage()));
112 if (nextIndex.isValid())
118 QModelIndex nextIndex=d->getNext(d->pageModel->index(
currentPage()));
119 if (nextIndex.isValid())
127 d->valid[page]=enable;
129 d->_k_slotUpdateButtons();
134 return d->valid.value(page,
true);
137 void KAssistantDialog::Private::_k_slotUpdateButtons()
139 QModelIndex currentIndex=pageModel->index(q->currentPage());
141 QModelIndex nextIndex=getNext(currentIndex);
142 q->enableButton(
KDialog::User1, !nextIndex.isValid() && q->isValid(q->currentPage()));
143 q->enableButton(
KDialog::User2, nextIndex.isValid() && q->isValid(q->currentPage()));
146 nextIndex=getPrevious(currentIndex);
152 d->_k_slotUpdateButtons();
158 d->appropriate[page]=appropriate;
159 d->_k_slotUpdateButtons();
164 return d->appropriate.value(page,
true);
167 #include "kassistantdialog.moc"