| 1 |
From eae6156cb7b857d07cb2699e0aed9901fe7ca0ed Mon Sep 17 00:00:00 2001 |
| 2 |
From: Guido Berhoerster <[email protected]> |
| 3 |
Date: Fri, 28 Oct 2022 11:36:27 +0200 |
| 4 |
Subject: [PATCH 4/5] Add QMLTermWidget methods to query whether |
| 5 |
clipboard/selection are set |
| 6 |
|
| 7 |
Signed-off-by: Mike Gabriel <[email protected]> |
| 8 |
--- |
| 9 |
lib/TerminalDisplay.cpp | 9 +++++++++ |
| 10 |
lib/TerminalDisplay.h | 8 +++++++- |
| 11 |
2 files changed, 16 insertions(+), 1 deletion(-) |
| 12 |
|
| 13 |
diff --git a/lib/TerminalDisplay.cpp b/lib/TerminalDisplay.cpp |
| 14 |
index fe3f4cb..e2d75a2 100644 |
| 15 |
--- a/lib/TerminalDisplay.cpp |
| 16 |
+++ b/lib/TerminalDisplay.cpp |
| 17 |
@@ -2877,6 +2877,15 @@ void TerminalDisplay::pasteSelection() |
| 18 |
emitSelection(true,false); |
| 19 |
} |
| 20 |
|
| 21 |
+bool TerminalDisplay::isClipboardEmpty() |
| 22 |
+{ |
| 23 |
+ return QApplication::clipboard()->text().isEmpty(); |
| 24 |
+} |
| 25 |
+ |
| 26 |
+bool TerminalDisplay::isSelectionEmpty() |
| 27 |
+{ |
| 28 |
+ return _screenWindow->selectedText(_preserveLineBreaks).isEmpty(); |
| 29 |
+} |
| 30 |
|
| 31 |
void TerminalDisplay::setConfirmMultilinePaste(bool confirmMultilinePaste) { |
| 32 |
_confirmMultilinePaste = confirmMultilinePaste; |
| 33 |
diff --git a/lib/TerminalDisplay.h b/lib/TerminalDisplay.h |
| 34 |
index 4b0007a..5b99da3 100644 |
| 35 |
--- a/lib/TerminalDisplay.h |
| 36 |
+++ b/lib/TerminalDisplay.h |
| 37 |
@@ -504,7 +504,13 @@ public slots: |
| 38 |
*/ |
| 39 |
void pasteSelection(); |
| 40 |
|
| 41 |
- /** |
| 42 |
+ /** Checks if the clipboard is empty */ |
| 43 |
+ bool isClipboardEmpty(); |
| 44 |
+ |
| 45 |
+ /** Checks if the selection is empty */ |
| 46 |
+ bool isSelectionEmpty(); |
| 47 |
+ |
| 48 |
+ /** |
| 49 |
* Changes whether the flow control warning box should be shown when the flow control |
| 50 |
* stop key (Ctrl+S) are pressed. |
| 51 |
*/ |
| 52 |
-- |
| 53 |
2.30.2 |
| 54 |
|