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

List:       kde-commits
Subject:    kdegames/kpat
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2004-10-15 14:58:13
Message-ID: 20041015145813.203BB16D49 () office ! kde ! org
[Download RAW message or body]

CVS commit by ingwa: 

Fix bug 89276: kpat: make nag screen "you have lost this game" an option

I will backport this one.

CCMAIL: 89276-done@bugs.kde.org


  M +4 -0      CHANGES   1.11
  M +26 -1     pwidget.cpp   1.117


--- kdegames/kpat/CHANGES  #1.10:1.11
@@ -1,2 +1,6 @@
+2004-10-15 Inge Wallin <inge@lysator.liu.se>
+
+        - fix bug 89276: kpat: make nag screen "you have lost this game" an option
+
 2004-10-14 Inge Wallin <inge@lysator.liu.se>
 

--- kdegames/kpat/pwidget.cpp  #1.116:1.117
@@ -433,10 +433,35 @@ void pWidget::gameWon(bool withhelp)
 void pWidget::gameLost()
 {
+    QString   dontAskAgainName = "gameLostDontAskAgain";
+
+    // The following code is taken out of kmessagebox.cpp in kdeui.
+    // Is there a better way?
+    KConfig  *config = 0;
+    QString grpNotifMsgs = QString::fromLatin1("Notification Messages");
+
+    config = KGlobal::config();
+    KConfigGroupSaver saver(config, 
+                            QString::fromLatin1("Notification Messages"));
+    QString dontAsk = config->readEntry(dontAskAgainName).lower();
+
+    // If we are ordered never to ask again and to continue the game,
+    // then do so.
+    if (dontAsk == "no")
+        return;
+    // If it says yes, we ask anyway. Just starting a new game would
+    // be incredibly annoying.
+    if (dontAsk == "yes")
+        dontAskAgainName = QString::null;
+
     if (KMessageBox::questionYesNo(this, i18n("You could not win this game, "
                                               "but there is always a second try.\nStart a new game?"),
                                    i18n("Could Not Win!"),
-                                   i18n("New Game"), KStdGuiItem::cont()) == KMessageBox::Yes)
+                                   i18n("New Game"), 
+                                   KStdGuiItem::cont(),
+                                   dontAskAgainName) == KMessageBox::Yes) {
+
         QTimer::singleShot(0, this, SLOT(newGame()));
  }
+ }
 
 void pWidget::openGame(const KURL &url)


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

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