22 #include "historydialog.moc"
24 #include "ui_historywidget.h"
27 #include <qtextedit.h>
29 #include <qundostack.h>
33 #include <klineedit.h>
35 #include <knumvalidator.h>
36 #include <kpushbutton.h>
41 setCaption( i18n(
"History Browser" ) );
45 mwidget =
new Ui_HistoryWidget();
46 mwidget->setupUi( main );
47 setMainWidget( main );
49 mtotalsteps = mch->
count() + 1;
51 bool reversed = layoutDirection() == Qt::RightToLeft;
53 mwidget->buttonFirst->setIcon( KIcon( reversed ?
"go-last" :
"go-first" ) );
54 connect( mwidget->buttonFirst, SIGNAL( clicked() ),
this, SLOT( goToFirst() ) );
56 mwidget->buttonBack->setIcon( KIcon( reversed ?
"go-next" :
"go-previous" ) );
57 connect( mwidget->buttonBack, SIGNAL( clicked() ),
this, SLOT( goBack() ) );
59 mwidget->editStep->setValidator(
new KIntValidator( 1, mtotalsteps, mwidget->editStep ) );
62 mwidget->buttonNext->setIcon( KIcon( reversed ?
"go-previous" :
"go-next" ) );
63 connect( mwidget->buttonNext, SIGNAL( clicked() ),
this, SLOT( goToNext() ) );
65 mwidget->buttonLast->setIcon( KIcon( reversed ?
"go-first" :
"go-last" ) );
66 connect( mwidget->buttonLast, SIGNAL( clicked() ),
this, SLOT( goToLast() ) );
78 void HistoryDialog::goToFirst()
80 int undosteps = mch->
index();
81 for (
int i = 0; i < undosteps; ++i )
89 void HistoryDialog::goBack()
96 void HistoryDialog::goToNext()
103 void HistoryDialog::goToLast()
106 for (
int i = 0; i < redosteps; ++i )
114 void HistoryDialog::updateWidgets()
116 int currentstep = mch->
index() + 1;
119 if ( mch->
index() > 0 )
121 mwidget->description->setPlainText( mch->
text( mch->
index() - 1 ) );
125 mwidget->description->setPlainText( i18n(
"Start of the construction" ) );
128 bool notfirst = currentstep > 1;
129 bool notlast = currentstep < mtotalsteps;
130 mwidget->buttonFirst->setEnabled( notfirst );
131 mwidget->buttonBack->setEnabled( notfirst );
132 mwidget->buttonNext->setEnabled( notlast );
133 mwidget->buttonLast->setEnabled( notlast );
QString text(int idx) const
int main(int argc, char **argv)
QString number(int n, int base)
HistoryDialog(QUndoStack *kch, QWidget *parent)