index 3c22019..025299d 100644 --- a/yakuake/app/terminal.cpp +++ b/yakuake/app/terminal.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -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); + } } 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: