[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames/ksame
From: Henrique Pinto <henrique.pinto () kdemail ! net>
Date: 2006-11-12 0:58:11
Message-ID: 1163293091.382761.6694.nullmailer () svn ! kde ! org
[Download RAW message or body]
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 <kglobal.h>
#include <ktoggleaction.h>
#include <kstdaction.h>
+#include <kinputdialog.h>
#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 );
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic