← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mcintire-evan/ubuntu-terminal-app/disable_paste into lp:ubuntu-terminal-app

 

Evan McIntire has proposed merging lp:~mcintire-evan/ubuntu-terminal-app/disable_paste into lp:ubuntu-terminal-app.

Commit message:
Disables pasteo option if the clipboard buffer is empty

Requested reviews:
  Alan Pope  (popey)
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
  Stefano Verzegnassi (verzegnassi-stefano)
  Niklas Wenzel (nikwen)

For more details, see:
https://code.launchpad.net/~mcintire-evan/ubuntu-terminal-app/disable_paste/+merge/285280

Disables "paste" if the clipboard buffer is empty
-- 
Your team Ubuntu Terminal Developers is subscribed to branch lp:ubuntu-terminal-app.
=== modified file 'src/app/qml/AlternateActionPopover.qml'
--- src/app/qml/AlternateActionPopover.qml	2016-01-09 01:47:56 +0000
+++ src/app/qml/AlternateActionPopover.qml	2016-02-06 20:18:56 +0000
@@ -20,6 +20,7 @@
             Action {
                 text: i18n.tr("Paste")
                 onTriggered: terminal.pasteClipboard();
+                enabled: !terminal.isClipboardEmpty();
             }
         }
     }

=== modified file 'src/plugin/qmltermwidget/lib/TerminalDisplay.cpp'
--- src/plugin/qmltermwidget/lib/TerminalDisplay.cpp	2015-02-14 10:33:32 +0000
+++ src/plugin/qmltermwidget/lib/TerminalDisplay.cpp	2016-02-06 20:18:56 +0000
@@ -2570,6 +2570,11 @@
   emitSelection(true,false);
 }
 
+bool TerminalDisplay::isClipboardEmpty()
+{
+    return QApplication::clipboard()->text().isEmpty();
+}
+
 /* ------------------------------------------------------------------------- */
 /*                                                                           */
 /*                                Keyboard                                   */

=== modified file 'src/plugin/qmltermwidget/lib/TerminalDisplay.h'
--- src/plugin/qmltermwidget/lib/TerminalDisplay.h	2015-02-14 10:33:32 +0000
+++ src/plugin/qmltermwidget/lib/TerminalDisplay.h	2016-02-06 20:18:56 +0000
@@ -482,6 +482,10 @@
      */
     void pasteSelection();
 
+    /** Checks if the clipboard is empty
+     */
+    bool isClipboardEmpty();
+
     /** 
        * Changes whether the flow control warning box should be shown when the flow control
        * stop key (Ctrl+S) are pressed.


Follow ups