1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
index 3c22019..877d2c2 100644
--- a/yakuake/app/terminal.cpp
+++ b/yakuake/app/terminal.cpp
@@ -24,6 +24,7 @@
#include <KActionCollection>
#include <KApplication>
+#include <KAction>
#include <KColorScheme>
#include <kde_terminal_interface.h>
#include <KLocalizedString>
@@ -183,6 +184,21 @@ void Terminal::displayKPartLoadError()
layout->setStretchFactor(label,5);
}
+void Terminal::paste()
+{
+ QApplication::postEvent(m_terminalWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_V, Qt::ShiftModifier|Qt::ControlModifier));
+}
+
+void Terminal::copy()
+{
+ QApplication::postEvent(m_terminalWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_C, Qt::ShiftModifier|Qt::ControlModifier));
+}
+
+void Terminal::clear_scrollback()
+{
+ QApplication::postEvent(m_terminalWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_K, Qt::ShiftModifier|Qt::ControlModifier));
+}
+
void Terminal::disableOffendingPartActions()
{
// This is an unwelcome stop-gap that will be removed once we can
@@ -220,6 +236,31 @@ void Terminal::disableOffendingPartActions()
action = actionCollection->action("shrink-font");
if (action) action->setEnabled(false);
+
+ KAction *newAct = actionCollection->addAction("terminal-paste", this, SLOT(paste()));
+ newAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_V));
+ newAct->setEnabled(true);
+
+ newAct = actionCollection->addAction("terminal-copy", this, SLOT(copy()));
+ newAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_C));
+ newAct->setEnabled(true);
+
+ newAct = actionCollection->addAction("terminal-clear", this, SLOT(clear_scrollback()));
+ newAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_K));
+ newAct->setEnabled(true);
+
+ newAct = actionCollection->addAction("terminal-paste1", this, SLOT(paste()));
+ newAct->setShortcut(QKeySequence(Qt::META + Qt::Key_V));
+ newAct->setEnabled(true);
+
+ newAct = actionCollection->addAction("terminal-copy1", this, SLOT(copy()));
+ newAct->setShortcut(QKeySequence(Qt::META + Qt::Key_C));
+ newAct->setEnabled(true);
+
+ newAct = actionCollection->addAction("terminal-clear1", this, SLOT(clear_scrollback()));
+ newAct->setShortcut(QKeySequence(Qt::META + Qt::Key_K));
+ newAct->setEnabled(true);
+
}
}
diff --git a/yakuake/app/terminal.h b/yakuake/app/terminal.h
index 23e70a0..bdd5a23 100644
--- a/yakuake/app/terminal.h
+++ b/yakuake/app/terminal.h
@@ -81,6 +81,9 @@ class Terminal : public QObject
void overrideShortcut(QKeyEvent* event, bool& override);
void silenceDetected();
void activityDetected();
+ void paste();
+ void copy();
+ void clear_scrollback();
private:
|