[Kde-games-devel] [PATCH] KShisen: remember last entered player name

Marc Mutz kde-games-devel@mail.kde.org
Wed, 1 Jan 2003 12:33:38 +0100


--Boundary-03=_eItE+Xk/O/i0Zkc
Content-Type: multipart/mixed;
  boundary="Boundary-01=_TItE+LlDTAjQ1GV"
Content-Transfer-Encoding: 7bit
Content-Description: signed data
Content-Disposition: inline

--Boundary-01=_TItE+LlDTAjQ1GV
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Description: body text
Content-Disposition: inline

Hi!

This patch fixes an annoying "usablility bug" in KShisen: It doesn't=20
remember the last used player name, so you always have to re-enter it=20
(well, at least when you make it into the high score list).

OK to apply to 3_1_BRANCH?

Marc

=2D-=20
This is as small as I think is sensible.
        -- Don Sanders after commiting a 1MB patch to KMail CVS

--Boundary-01=_TItE+LlDTAjQ1GV
Content-Type: text/x-diff;
  charset="us-ascii";
  name="kshisen_remember_last_playername.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="kshisen_remember_last_playername.diff"

Index: app.cpp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/kde/kdegames/kshisen/app.cpp,v
retrieving revision 1.65
diff -u -3 -p -r1.65 app.cpp
=2D-- app.cpp	13 Aug 2002 18:09:43 -0000	1.65
+++ app.cpp	1 Jan 2003 11:38:04 -0000
@@ -422,7 +422,10 @@ QString App::getPlayerName() {
   e->setText("XXXXXXXXXXXXXXXX");
   e->setMinimumWidth(e->sizeHint().width());
   e->setFixedHeight(e->sizeHint().height());
=2D  e->setText("");
+  if ( !lastPlayerName.isEmpty() )
+    e->setText( lastPlayerName );
+  else
+    e->setText("");
   e->setFocus();
=20
   QPushButton *b =3D new QPushButton(i18n("OK"), dlg);
@@ -453,12 +456,12 @@ QString App::getPlayerName() {
=20
   dlg->exec();
=20
=2D  QString s =3D e->text();
+  lastPlayerName =3D e->text();
   delete dlg;
=20
=2D  if(s.length() =3D=3D 0)
=2D    s =3D " ";
=2D  return s;
+  if(lastPlayerName.isEmpty())
+    return " ";
+  return lastPlayerName;
 }
=20
 int App::getScore(const HighScore &hs) {
Index: app.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/kde/kdegames/kshisen/app.h,v
retrieving revision 1.21
diff -u -3 -p -r1.21 app.h
=2D-- app.h	16 Jul 2002 17:02:33 -0000	1.21
+++ app.h	1 Jan 2003 11:38:04 -0000
@@ -113,6 +113,7 @@ private:
   void resetCheatMode();
=20
 private:
+  QString lastPlayerName;
   Board *b;
   QValueVector<HighScore> highscore;
   KHighscore* highscoreTable;

--Boundary-01=_TItE+LlDTAjQ1GV--

--Boundary-03=_eItE+Xk/O/i0Zkc
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQA+EtIe3oWD+L2/6DgRAvR8AJ4lOi3qOR2pmllAZS0KGsmVR4CmzACfXPGR
YahJxLstPZ2nmO8Wj3g/wxc=
=jmbd
-----END PGP SIGNATURE-----

--Boundary-03=_eItE+Xk/O/i0Zkc--