[spectacle] /: Move printing to a new tools button

Henrik Fehlauer null at kde.org
Wed Feb 7 23:31:42 UTC 2018


Git commit 5206cdda229225333bd94fa4dfe24c6be2291d98 by Henrik Fehlauer.
Committed on 07/02/2018 at 23:14.
Pushed by rkflx into branch 'master'.

Move printing to a new tools button

Summary:
{nav Print} does neither belong to {nav Save} nor {nav Save As}, so it
goes into a new menu button called {nav Tools}. More entries will be
added to the menu in D10295 and possibly in T6321.

In order to gain more horizontal space, {nav Export Image...} is renamed
to {nav Export}, which is in line with the other buttons not repeating
"image". "..." is removed as it should be only added to the menu entries
itself if necessary and the arrow on the button is enough to indicate
its purpose.

Ref. T7841

Test Plan:
{F5697449}

- Printing via the button still works, as well as {key Ctrl P}.
- Somewhat sensible icon chosen for the button.
- Docbook updated.

Reviewers: #spectacle, ngraham

Reviewed By: #spectacle, ngraham

Subscribers: ngraham

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

M  +8    -2    doc/index.docbook
M  +10   -5    src/Gui/KSMainWindow.cpp
M  +3    -1    src/Gui/KSMainWindow.h

https://commits.kde.org/spectacle/5206cdda229225333bd94fa4dfe24c6be2291d98

diff --git a/doc/index.docbook b/doc/index.docbook
index 1013761..946485f 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -186,7 +186,7 @@
 		<sect1>
 			<title>Buttons</title>
 
-			<para>There are five buttons located at the bottom of the &spectacle; window. Their functions are described below:</para>
+			<para>There are six buttons located at the bottom of the &spectacle; window. Their functions are described below:</para>
 
 			<variablelist>
 				<varlistentry>
@@ -202,7 +202,13 @@
 					</listitem>
 				</varlistentry>
 				<varlistentry>
-					<term><guibutton>Export Image...</guibutton></term>
+					<term><guibutton>Tools</guibutton></term>
+					<listitem>
+						<para>Clicking on this button shows a drop-down menu, offering access to the print dialog.</para>
+					</listitem>
+				</varlistentry>
+				<varlistentry>
+					<term><guibutton>Export</guibutton></term>
 					<listitem>
 						<para>This drop-down menu will allow you to directly open the screenshot with all programs that are associated with the PNG (Portable Network Graphics) &MIME; type. Depending on what programs are installed, you will be able to open and edit the snapshot in your graphics applications or viewers.</para>
 
diff --git a/src/Gui/KSMainWindow.cpp b/src/Gui/KSMainWindow.cpp
index 193b6bf..60dbab7 100644
--- a/src/Gui/KSMainWindow.cpp
+++ b/src/Gui/KSMainWindow.cpp
@@ -51,12 +51,14 @@ KSMainWindow::KSMainWindow(bool onClickAvailable, QWidget *parent) :
     mKSWidget(new KSWidget),
     mDivider(new QFrame),
     mDialogButtonBox(new QDialogButtonBox),
-    mSendToButton(new QPushButton),
     mConfigureButton(new QToolButton),
+    mToolsButton(new QPushButton),
+    mSendToButton(new QPushButton),
     mClipboardButton(new QToolButton),
     mSaveButton(new QToolButton),
     mSaveMenu(new QMenu),
     mMessageWidget(new KMessageWidget),
+    mToolsMenu(new QMenu),
     mExportMenu(new ExportMenu(this)),
     mOnClickAvailable(onClickAvailable)
 {
@@ -132,7 +134,13 @@ void KSMainWindow::init()
     mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
     mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole);
 
-    KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export Image...")));
+    KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools")));
+    mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
+    mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole);
+    mToolsMenu->addAction(KStandardAction::print(this, SLOT(showPrintDialog()), this));
+    mToolsButton->setMenu(mToolsMenu);
+
+    KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export")));
     mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share")));
     mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole);
 
@@ -220,9 +228,6 @@ void KSMainWindow::buildSaveMenu()
         mSaveMenu->addAction(actionSaveAs);
         break;
     }
-
-    // finish off building the menu
-    mSaveMenu->addAction(KStandardAction::print(this, SLOT(showPrintDialog()), this));
 }
 
 // overrides
diff --git a/src/Gui/KSMainWindow.h b/src/Gui/KSMainWindow.h
index d35443d..350e572 100644
--- a/src/Gui/KSMainWindow.h
+++ b/src/Gui/KSMainWindow.h
@@ -73,12 +73,14 @@ class KSMainWindow : public QDialog
     KSWidget         *mKSWidget;
     QFrame           *mDivider;
     QDialogButtonBox *mDialogButtonBox;
-    QPushButton      *mSendToButton;
     QToolButton      *mConfigureButton;
+    QPushButton      *mToolsButton;
+    QPushButton      *mSendToButton;
     QToolButton      *mClipboardButton;
     QToolButton      *mSaveButton;
     QMenu            *mSaveMenu;
     KMessageWidget   *mMessageWidget;
+    QMenu            *mToolsMenu;
     ExportMenu       *mExportMenu;
     bool              mOnClickAvailable;
 };


More information about the kde-doc-english mailing list