[spectacle] /: Auto-copy shared image link to clipboard

Nathaniel Graham null at kde.org
Tue Jun 19 22:44:27 UTC 2018


Git commit 205d6b369cf53c19d6387e5b389f861ccc65c2aa by Nathaniel Graham.
Committed on 19/06/2018 at 22:36.
Pushed by ngraham into branch 'master'.

Auto-copy shared image link to clipboard

Summary:
Whenever an image is shared and a link is provided, the link is automatically copied to the clipboard.

We also rename the {nav Copy save location} checkbox to prevent user confusion with this new feature (and also to better reflect what the {nav Copy save location} feature actually does).

FEATURE: 392722
FIXED-IN 18.08.0

Test Plan:
Shared an image via Imgur. The link immediately appeared at the top of Klipper's history.

{F5918565}

Reviewers: #spectacle, #kde_applications, rkflx

Reviewed By: #spectacle, rkflx

Subscribers: kde-doc-english, rkflx

Tags: #documentation

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

M  +1    -1    doc/index.docbook
M  +3    -1    src/Gui/KSMainWindow.cpp
M  +2    -2    src/Gui/SettingsDialog/GeneralOptionsPage.cpp
M  +1    -1    src/SpectacleConfig.cpp

https://commits.kde.org/spectacle/205d6b369cf53c19d6387e5b389f861ccc65c2aa

diff --git a/doc/index.docbook b/doc/index.docbook
index a6db8e4..adbc003 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -257,7 +257,7 @@
                 </mediaobject>
             <variablelist>
                 <varlistentry>
-                    <term><guilabel>Copy save location to clipboard</guilabel></term>
+                    <term><guilabel>Copy file location to clipboard after saving</guilabel></term>
                     <listitem>
                         <para>When a screenshot is saved, copy the location at which the file was saved to the clipboard. You can then paste it anywhere that accepts
                         text input. Note that you must be running a clipboard manager in order to keep the path in the clipboard after &spectacle; quits.</para>
diff --git a/src/Gui/KSMainWindow.cpp b/src/Gui/KSMainWindow.cpp
index cd16002..56f6b27 100644
--- a/src/Gui/KSMainWindow.cpp
+++ b/src/Gui/KSMainWindow.cpp
@@ -32,6 +32,7 @@
 #include <KStandardGuiItem>
 #include <KWindowSystem>
 
+#include <QClipboard>
 #include <QDesktopServices>
 #include <QJsonArray>
 #include <QPrintDialog>
@@ -363,8 +364,9 @@ void KSMainWindow::showImageSharedFeedback(bool error, const QString &message)
         if (message.isEmpty()) {
             showInlineMessage(i18n("Image shared"), KMessageWidget::Positive);
         } else {
-            showInlineMessage(i18n("You can find the shared image at: <a href=\"%1\">%1</a>", message),
+            showInlineMessage(i18n("The shared image link (<a href=\"%1\">%1</a>) has been copied to the clipboard.", message),
                               KMessageWidget::Positive, MessageDuration::Persistent);
+            QApplication::clipboard()->setText(message);
         }
     }
 }
diff --git a/src/Gui/SettingsDialog/GeneralOptionsPage.cpp b/src/Gui/SettingsDialog/GeneralOptionsPage.cpp
index 18f33f8..b94bb46 100644
--- a/src/Gui/SettingsDialog/GeneralOptionsPage.cpp
+++ b/src/Gui/SettingsDialog/GeneralOptionsPage.cpp
@@ -34,9 +34,9 @@ GeneralOptionsPage::GeneralOptionsPage(QWidget *parent) :
 
     QVBoxLayout *mainLayout = new QVBoxLayout(this);
 
-    // copy save path to clipboard
+    // copy file location to clipboard after saving
 
-    mCopyPathToClipboard = new QCheckBox(i18n("Copy save location to the clipboard"), this);
+    mCopyPathToClipboard = new QCheckBox(i18n("Copy file location to clipboard after saving"), this);
     connect(mCopyPathToClipboard, &QCheckBox::toggled, this, &GeneralOptionsPage::markDirty);
     mainLayout->addWidget(mCopyPathToClipboard, 1);
 
diff --git a/src/SpectacleConfig.cpp b/src/SpectacleConfig.cpp
index afaf329..1517e31 100644
--- a/src/SpectacleConfig.cpp
+++ b/src/SpectacleConfig.cpp
@@ -240,7 +240,7 @@ void SpectacleConfig::setAutoSaveLocation(const QString &location)
     mGeneralConfig.sync();
 }
 
-// copy save location to clipboard
+// copy file location to clipboard after saving
 
 bool SpectacleConfig::copySaveLocationToClipboard() const
 {


More information about the kde-doc-english mailing list