SVN commit 604212 by henrique: * Use KInputDialog M +14 -19 KSameWidget.cpp --- trunk/KDE/kdegames/ksame/KSameWidget.cpp #604211:604212 @@ -42,6 +42,7 @@ #include #include #include +#include #include "StoneWidget.h" #include "view.h" @@ -149,31 +150,25 @@ void KSameWidget::newGame() { + if ( not confirmAbort() ) + return; + if ( random->isChecked() ) { - if ( confirmAbort() ) - newGame( KRandom::random() % 1000000, default_colors ); + newGame( KRandom::random() % 1000000, default_colors ); } else { - KDialog dlg(this); - dlg.setCaption(i18n("Select Board")); - dlg.setButtons(KDialog::Ok | KDialog::Cancel); - dlg.setDefaultButton(KDialog::Ok); - dlg.setModal(true); + // Get the board number from the user + bool ok = false; + int newBoard = KInputDialog::getInteger( i18n( "Select Board" ), + i18n( "Select a board number:" ), + m_board->boardNumber(), 1, 1000000, 1, + &ok, this ); - KVBox *page = new KVBox(this); - dlg.setMainWidget(page); - - KIntNumInput bno(0, page); - bno.setRange(0, 1000000, 1); - bno.setLabel(i18n("Select a board:")); - bno.setFocus(); - bno.setFixedSize(bno.sizeHint()); - bno.setValue(stone->board()); - - if (dlg.exec()) - newGame(bno.value(),default_colors); + // Start a game if the user asked for that + if ( ok ) + newGame( newBoard, default_colors ); } }