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

List:       kde-commits
Subject:    [palapeli/KDE/4.13] src: BUG: 332589 Add "Enable all messages" action and new string.
From:       Ian Wadham <iandw.au () gmail ! com>
Date:       2014-03-29 1:29:13
Message-ID: E1WTi5B-0008Ga-UI () scm ! kde ! org
[Download RAW message or body]

Git commit e433e5c1f617a75af8b1e9d58bdf53e025975e18 by Ian Wadham.
Committed on 29/03/2014 at 01:23.
Pushed by ianw into branch 'KDE/4.13'.

BUG: 332589 Add "Enable all messages" action and new string.

M  +4    -1    src/palapeliui.rc
M  +17   -0    src/window/mainwindow.cpp
M  +2    -0    src/window/mainwindow.h

http://commits.kde.org/palapeli/e433e5c1f617a75af8b1e9d58bdf53e025975e18

diff --git a/src/palapeliui.rc b/src/palapeliui.rc
index eebcdac..39d686f 100644
--- a/src/palapeliui.rc
+++ b/src/palapeliui.rc
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<gui name="palapeli" version="4"
+<gui name="palapeli" version="5"
 	xmlns="http://www.kde.org/standards/kxmlgui/1.0"
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 \
http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd"> @@ -27,6 +27,9 @@
 			<Action name="view_zoom_in"/>
 			<Action name="view_zoom_out"/>
 		</Menu>
+		<Menu name="settings">
+			<Action name="enable_messages"/>
+		</Menu>
 	</MenuBar>
 	<ToolBar name="mainToolBar">
 		<text>Main toolbar</text>
diff --git a/src/window/mainwindow.cpp b/src/window/mainwindow.cpp
index 7e929e5..31c3689 100644
--- a/src/window/mainwindow.cpp
+++ b/src/window/mainwindow.cpp
@@ -30,6 +30,7 @@
 #include <KDE/KLocalizedString>
 #include <KDE/KStandardAction>
 #include <KDE/KToggleAction>
+#include <KDE/KMessageBox>
 
 Palapeli::MainWindow::MainWindow(KCmdLineArgs* args)
 	: m_game(new Palapeli::GamePlay(this))
@@ -155,6 +156,22 @@ void Palapeli::MainWindow::setupActions()
 	// View zoom out.
 	KStandardAction::zoomOut(m_game, SLOT(actionZoomOut()),
 						actionCollection());
+	// Settings: enable messages that the user marked "Do not show again".
+	KAction* enableMessagesAct = new KAction(i18n("Enable all messages"),0);
+	actionCollection()->addAction("enable_messages", enableMessagesAct);
+	connect(enableMessagesAct, SIGNAL(triggered()), SLOT(enableMessages()));
+}
+
+void Palapeli::MainWindow::enableMessages()
+{
+	// Enable all messages that the user has marked "Do not show again".
+	int result = KMessageBox::questionYesNo(this,
+					i18n("Enable all messages"));
+	if (result == KMessageBox::Yes) {
+		qDebug() << "ENABLE ALL MESSAGES";
+		KMessageBox::enableAllMessages();
+		KGlobal::config()->sync();	// Save the changes to disk.
+	}
 }
 
 #include "mainwindow.moc"
diff --git a/src/window/mainwindow.h b/src/window/mainwindow.h
index 273f39f..fcefbb6 100644
--- a/src/window/mainwindow.h
+++ b/src/window/mainwindow.h
@@ -38,6 +38,8 @@ namespace Palapeli
 			MainWindow(KCmdLineArgs* args);
 		protected:
 			virtual bool queryClose();
+		private Q_SLOTS:
+			void enableMessages();
 		private:
 			void setupActions();
 


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

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