← 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 "paste" if the clipboard buffer is empty

Requested reviews:
  Ubuntu Terminal Developers (ubuntu-terminal-dev)
Related bugs:
  Bug #1432258 in Ubuntu Terminal App: ""Paste" should be disabled when buffer empty"
  https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1432258

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

Disables "paste" if the clipboard buffer is empty
-- 
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~mcintire-evan/ubuntu-terminal-app/disable-paste into lp:ubuntu-terminal-app.
=== modified file 'src/app/qml/AlternateActionPopover.qml'
--- src/app/qml/AlternateActionPopover.qml	2015-08-02 12:49:18 +0000
+++ src/app/qml/AlternateActionPopover.qml	2016-01-20 01:55:23 +0000
@@ -17,9 +17,11 @@
                 text: i18n.tr("Copy")
                 onTriggered: terminal.copyClipboard();
             }
+
             Action {
                 text: i18n.tr("Paste")
                 onTriggered: terminal.pasteClipboard();
+                visible: 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-01-20 01:55:23 +0000
@@ -2570,6 +2570,12 @@
   emitSelection(true,false);
 }
 
+bool TerminalDisplay::isClipboardEmpty()
+{
+    QString text = _screenWindow->selectedText(_preserveLineBreaks);
+    return 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-01-20 01:55:23 +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