[spectacle] /: (1/3) Remove unnecessary Discard/Quit button

Nathaniel Graham null at kde.org
Mon Feb 5 23:38:23 UTC 2018


Git commit 2c31ae4acba9bce24953c0f2584cd15589c4bb71 by Nathaniel Graham.
Committed on 05/02/2018 at 23:31.
Pushed by ngraham into branch 'master'.

(1/3) Remove unnecessary Discard/Quit button

Summary:
Part 1 of 3 for {T7841}

CCBUG: 386163
FIXED-IN: 18.04

Spectacle's main window doesn't need a discard/quit button, because there's already a user-visible way of closing the window: the titlebar's close button. The escape key does it, too. This button duplicates existing functionality and takes up room that could be used for a "Configure..." button, and has led to user confusion in the past as well (see https://bugs.kde.org/show_bug.cgi?id=386163)

Test Plan:
Tested in KDE Neon:
- Can still quit with the Escape key
- Quitting automatically discards the current screenshot if it has not been saved yet
- There's now more room in the button bar so we can add a visible "Configure..." button

{F5690995}

Reviewers: #spectacle, alexeymin

Reviewed By: #spectacle, alexeymin

Subscribers: alexeymin

Differential Revision: https://phabricator.kde.org/D10283

M  +0    -6    doc/index.docbook
M  +1    -7    src/Gui/KSMainWindow.cpp

https://commits.kde.org/spectacle/2c31ae4acba9bce24953c0f2584cd15589c4bb71

diff --git a/doc/index.docbook b/doc/index.docbook
index 07df632..83b1056 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -217,12 +217,6 @@
 						<para>Additionally, if you click the arrow on the right side of the button, a drop-down menu allows you to simply <guilabel>Save</guilabel> the image, save the image with a different filename, location and format (<guilabel>Save As...</guilabel>), <guilabel>Print</guilabel> the image, and configure the default <guimenuitem>Preferences</guimenuitem>, such as application preferences and where to save the image by default and what filename to save it as.</para>
 					</listitem>
 				</varlistentry>
-				<varlistentry>
-					<term><guibutton>Discard</guibutton></term>
-					<listitem>
-						<para>Discards the screenshot and immediately exits the application.</para>
-					</listitem>
-				</varlistentry>
 			</variablelist>
 		</sect1>
 
diff --git a/src/Gui/KSMainWindow.cpp b/src/Gui/KSMainWindow.cpp
index f6db783..73ed41c 100644
--- a/src/Gui/KSMainWindow.cpp
+++ b/src/Gui/KSMainWindow.cpp
@@ -123,7 +123,7 @@ void KSMainWindow::init()
 
     // the Button Bar
 
-    mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Discard);
+    mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help);
 
     KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export Image...")));
     mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share")));
@@ -142,10 +142,6 @@ void KSMainWindow::init()
     buildSaveMenu();
     mDialogButtonBox->addButton(mSaveButton, QDialogButtonBox::ActionRole);
 
-    QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), mDialogButtonBox->button(QDialogButtonBox::Discard));
-    connect(shortcut, &QShortcut::activated, qApp, &QApplication::quit);
-    connect(mDialogButtonBox->button(QDialogButtonBox::Discard), &QPushButton::clicked, qApp, &QApplication::quit);
-
     // the help menu
 
     KHelpMenu *helpMenu = new KHelpMenu(this, KAboutData::applicationData(), true);
@@ -255,7 +251,6 @@ void KSMainWindow::setScreenshotAndShow(const QPixmap &pixmap)
     setWindowTitle(i18nc("Unsaved Screenshot", "Unsaved[*]"));
     setWindowModified(true);
 
-    KGuiItem::assign(mDialogButtonBox->button(QDialogButtonBox::Discard), KStandardGuiItem::discard());
     show();
 }
 
@@ -311,7 +306,6 @@ void KSMainWindow::setScreenshotWindowTitle(QUrl location)
 {
     setWindowTitle(location.fileName());
     setWindowModified(false);
-    KGuiItem::assign(mDialogButtonBox->button(QDialogButtonBox::Discard), KStandardGuiItem::quit());
 }
 
 void KSMainWindow::save()


More information about the kde-doc-english mailing list