[games/kpat] /: Use KStandardAction::preferences for opening appearance dialog

Albert Astals Cid null at kde.org
Wed Oct 18 00:37:20 BST 2023


Git commit 95affa7f9631b7d61cc913d471263bd7a483afef by Albert Astals Cid, on behalf of Friedrich W. H. Kossebau.
Committed on 18/10/2023 at 01:36.
Pushed by aacid into branch 'master'.

Use KStandardAction::preferences for opening appearance dialog

Following the pattern used by other KDE games, also freeing F10 shortcut.

M  +0    -8    doc/index.docbook
M  +1    -2    src/kpatui.rc
M  +2    -5    src/mainwindow.cpp

https://invent.kde.org/games/kpat/-/commit/95affa7f9631b7d61cc913d471263bd7a483afef

diff --git a/doc/index.docbook b/doc/index.docbook
index 1d28a6e6..fa5a69cb 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -808,14 +808,6 @@ chapter of the &kde; Fundamentals documentation &kpatience; has these applicatio
 				</menuchoice></term>
 				<listitem><para><action>Allows you to choose if the card faces should be shown.</action> This menu is available in Spider only.</para></listitem>
 			</varlistentry>
-			<varlistentry id="settings-menu-deck">
-				<term><menuchoice>
-					<shortcut><keycap>F10</keycap></shortcut>
-					<guimenu>Settings</guimenu>
-					<guimenuitem>Change Appearance...</guimenuitem>
-				</menuchoice></term>
-				<listitem><para><action>Open a dialog to change the card deck and game theme used.</action></para></listitem>
-			</varlistentry>
 			<varlistentry id="settings-menu-autodrop">
 				<term><menuchoice>
 					<guimenu>Settings</guimenu>
diff --git a/src/kpatui.rc b/src/kpatui.rc
index 575699d7..0047a354 100644
--- a/src/kpatui.rc
+++ b/src/kpatui.rc
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gui name="kpat"
-     version="30"
+     version="31"
      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
@@ -29,7 +29,6 @@
   <Menu name="settings">
     <ActionList name="dealer_options"/>
     <Separator/>
-    <Action name="select_deck"/>
     <Action name="enable_autodrop"/>
     <Action name="enable_solver"/>
     <Action name="play_sounds"/>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c6e2bb0e..77cb4823 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -246,11 +246,6 @@ void MainWindow::setupActions()
     connect(m_dropAction, &QAction::triggered, this, &MainWindow::toggleDrop);
 
     // Settings Menu
-    a = actionCollection()->addAction(QStringLiteral("select_deck"));
-    a->setText(i18n("Change Appearance..."));
-    connect(a, &QAction::triggered, this, &MainWindow::configureAppearance);
-    KActionCollection::setDefaultShortcut(a, Qt::Key_F10);
-
     m_autoDropEnabledAction = new KToggleAction(i18n("&Enable Autodrop"), this);
     actionCollection()->addAction(QStringLiteral("enable_autodrop"), m_autoDropEnabledAction);
     connect(m_autoDropEnabledAction, &KToggleAction::triggered, this, &MainWindow::setAutoDropEnabled);
@@ -277,6 +272,8 @@ void MainWindow::setupActions()
     connect(m_gameHelpAction, &QAction::triggered, this, &MainWindow::helpGame);
     KActionCollection::setDefaultShortcut(m_gameHelpAction, Qt::CTRL | Qt::SHIFT | Qt::Key_F1);
 
+    KStandardAction::preferences(this, &MainWindow::configureAppearance, actionCollection());
+
     // Hidden actions
     if (!qEnvironmentVariableIsEmpty("KDE_DEBUG")) // developer shortcut
     {


More information about the kde-doc-english mailing list