[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [PATCH] KSame
From:       Adriaan de Groot <adridg () cs ! kun ! nl>
Date:       2003-11-27 14:22:46
[Download RAW message or body]

In HEAD, KSame pops up irritating KPassivePopups with the number of stones 
removed. Unfortunately, (1) the number is always 0 (2) it doesn't do plurals 
right (3) it uses deprecated KNotify::event calls.

The attached patch fixes (1) and (2) - breaking the string freeze by adding a 
string that needn't be translated (since the one-stone case never occurs) and 
changing a %1 to a %n for plural handling. (3) is addressed as well, though I 
feel that moving the popup to the taskbar (as opposed to somewhere on screen) 
isn't exactly a big improvement.

OK to commit? I can take out the (2) fix, if that's a big issue.


-- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot@kde.org>
            If the door is ajar, can we fill it with door-jamb?

["ksame.diff" (text/x-diff)]

Index: KSameWidget.cpp
===================================================================
RCS file: /home/kde/kdegames/ksame/KSameWidget.cpp,v
retrieving revision 1.55
diff -u -3 -p -r1.55 KSameWidget.cpp
--- KSameWidget.cpp	26 Oct 2003 09:57:01 -0000	1.55
+++ KSameWidget.cpp	27 Nov 2003 14:22:07 -0000
@@ -210,11 +210,12 @@ void KSameWidget::setBoard(int board) {
 
 void KSameWidget::setMarked(int m) {
   status->changeItem(i18n("Marked: %1").arg(m, 6),3);
+  m_markedStones=m;
 }
 
 void KSameWidget::stonesRemoved(int,int) {
-	KNotifyClient::event("stones removed",
-	   i18n("%1 stones removed.").arg(stone->marked()));
+	KNotifyClient::event(winId(),"stones removed",
+	   i18n("One stone removed.","%n stones removed.",m_markedStones));
 }
 
 void KSameWidget::setScore(int score) {
@@ -226,11 +227,11 @@ void KSameWidget::setScore(int score) {
 void KSameWidget::gameover() {
   kdDebug() << "GameOver" << endl;
   if (stone->hasBonus()) {
-	  KNotifyClient::event("game won",
+	  KNotifyClient::event(winId(),"game won",
 		  i18n("You even removed the last stone, great job! "
 			   "This gave you a score of %1 in total.").arg(stone->score()));
   } else {
-	  KNotifyClient::event("game over",
+	  KNotifyClient::event(winId(),"game over",
 		  i18n("There are no more removeable stones. "
 			   "You got a score of %1 in total.").arg(stone->score()));
   }
Index: KSameWidget.h
===================================================================
RCS file: /home/kde/kdegames/ksame/KSameWidget.h,v
retrieving revision 1.15
diff -u -3 -p -r1.15 KSameWidget.h
--- KSameWidget.h	9 May 2003 21:09:35 -0000	1.15
+++ KSameWidget.h	27 Nov 2003 14:22:07 -0000
@@ -74,6 +74,11 @@ protected:
      void stonesRemoved(int,int);
     void slotConfigureKeys();
 
+protected:
+     // Remember how many stones were last marked, since when
+     // the stones are removed, board->marked() suddenly becomes
+     // 0 (or doesn't otherwise reflect the number of stones just removed).
+     int m_markedStones;
 };
 
 


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic