20#include "KPrGotoPage.h"
25#include <tqpushbutton.h>
30#include "KPrDocument.h"
33KPrGotoPage::KPrGotoPage( const KPrDocument *doc,
34 const TQValueList<int> &slides, int start,
35 TQWidget *parent, const char *name )
36 : KDialogBase( parent, name, true, i18n( "Goto Slide..."), Ok|Cancel),
40 TQWidget *page = new TQWidget( this );
42 TQVBoxLayout *ml = new TQVBoxLayout( page, KDialog::marginHint(),
43 KDialog::spacingHint());
44 TQLabel *label = new TQLabel( i18n( "Go to slide:" ), page );
45 ml->addWidget( label );
46 spinbox = new TQListBox( page );
47 connect( spinbox, TQ_SIGNAL(doubleClicked( TQListBoxItem* )),
48 this, TQ_SLOT(accept()) );
49 connect( spinbox, TQ_SIGNAL(returnPressed( TQListBoxItem* )),
50 this, TQ_SLOT(accept()) );
51 ml->addWidget( spinbox );
53 TQPtrList<KPrPage> pageList = doc->getPageList();
54 TQValueList<int>::ConstIterator it = slides.begin();
55 for ( ; it != slides.end(); ++it ) {
56 TQString t( pageList.at( (*it) - 1 )->pageTitle() );
62 spinbox->insertItem( TQString( "%1 - %2" ).arg( *it ).arg( t ), -1 );
64 spinbox->setCurrentItem( spinbox->count()-1 );
68 parent->setCursor( TQt::forbiddenCursor );
71int KPrGotoPage::gotoPage( const KPrDocument *doc,
72 const TQValueList<int> &slides, int start,
75 KPrGotoPage dia( doc, slides, start,parent, 0L );
81int KPrGotoPage::page() const {
82 if(result()==TQDialog::Accepted)
83 return spinbox->currentText().left( spinbox->currentText().find( "-" ) - 1 ).toInt();
87void KPrGotoPage::resetCursor() {
89 parentWidget()->setCursor( TQt::blankCursor );
|