← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

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

Commit message:
Disable copy if selection is empty

Requested reviews:
  Ubuntu Terminal Developers (ubuntu-terminal-dev)

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

Disable copy if selection is empty
-- 
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~mcintire-evan/ubuntu-terminal-app/disable-copy into lp:ubuntu-terminal-app.
=== modified file 'src/app/qml/AlternateActionPopover.qml'
--- src/app/qml/AlternateActionPopover.qml	2016-02-06 20:16:58 +0000
+++ src/app/qml/AlternateActionPopover.qml	2016-02-07 07:34:33 +0000
@@ -16,6 +16,7 @@
             Action {
                 text: i18n.tr("Copy")
                 onTriggered: terminal.copyClipboard();
+                enabled: !terminal.isSelectionEmpty();
             }
             Action {
                 text: i18n.tr("Paste")

=== modified file 'src/plugin/qmltermwidget/lib/TerminalDisplay.cpp'
--- src/plugin/qmltermwidget/lib/TerminalDisplay.cpp	2016-02-06 20:16:58 +0000
+++ src/plugin/qmltermwidget/lib/TerminalDisplay.cpp	2016-02-07 07:34:33 +0000
@@ -2570,11 +2570,18 @@
   emitSelection(true,false);
 }
 
+//TODO: These 2 functions are not in the upstream LxQt version
+//See https://code.launchpad.net/~mcintire-evan/ubuntu-terminal-app/disable-paste/+merge/283244/comments/725331
 bool TerminalDisplay::isClipboardEmpty()
 {
     return QApplication::clipboard()->text().isEmpty();
 }
 
+bool TerminalDisplay::isSelectionEmpty()
+{
+    return _screenWindow->selectedText(_preserveLineBreaks).isEmpty();
+}
+
 /* ------------------------------------------------------------------------- */
 /*                                                                           */
 /*                                Keyboard                                   */

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


Follow ups