Summary: | Add "clear" command in CVS console area in main window | ||
---|---|---|---|
Product: | [Applications] cervisia | Reporter: | greendeath |
Component: | general | Assignee: | Christian Loose <christian.loose> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 2.0 | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
greendeath
2003-06-02 23:32:52 UTC
Subject: KDE_3_1_BRANCH: kdesdk/cervisia CVS commit by cloose: Backport fix for BR #59267: * Re-added "clear" command to the RMB context menu of the ProtocolView. * Removed non functional methods that were supposed to handle the RMB context menu from ProtocolView source. CCMAIL: 59267-done@bugs.kde.org M +8 -0 ChangeLog 1.22.2.8 M +15 -37 protocolview.cpp 1.7.2.3 M +7 -6 protocolview.h 1.6.2.1 --- kdesdk/cervisia/ChangeLog #1.22.2.7:1.22.2.8 @@ -1,2 +1,10 @@ +2003-06-03 Christian Loose <christian.loose@hamburg.de> + + * Fix BR #59267: Re-added "clear" command to the + RMB context menu of the ProtocolView + * Removed non functional methods that were supposed + to handle the RMB context menu from ProtocolView + source. + 2003-02-28 Christian Loose <christian.loose@hamburg.de> --- kdesdk/cervisia/protocolview.cpp #1.7.2.2:1.7.2.3 @@ -98,4 +98,17 @@ bool ProtocolView::startJob(const QStrin +QPopupMenu* ProtocolView::createPopupMenu(const QPoint &pos) +{ + QPopupMenu* menu = QTextEdit::createPopupMenu(pos); + + int id = menu->insertItem(i18n("Clear"), this, SLOT( clear() ), 0, -1, 0); + + if( text().isEmpty() ) + menu->setItemEnabled(id, false); + + return menu; +} + + void ProtocolView::cancelJob() { @@ -170,39 +183,4 @@ void ProtocolView::appendLine(const QStr } - -void ProtocolView::execContextMenu(const QPoint &p) -{ - QPopupMenu *popup = new QPopupMenu(this); - int clearId = popup->insertItem(i18n("Clear")); - int selallId = popup->insertItem(i18n("Select All")); - - int res = popup->exec(p); - if (res == clearId) - clear(); - else if (res == selallId) - selectAll(); - - delete popup; -} - - -void ProtocolView::mousePressEvent(QMouseEvent *e) -{ - if (e->button() == RightButton) - execContextMenu(e->globalPos()); - else - QTextEdit::mousePressEvent(e); -} - - -void ProtocolView::keyPressEvent(QKeyEvent *e) -{ - if (e->key() == KGlobalSettings::contextMenuKey()) - execContextMenu(mapToGlobal(QPoint(10, 10))); - else if (e->key() == Key_Tab) - QTextEdit::focusNextPrevChild(true); - else - QTextEdit::keyPressEvent(e); -} #include "protocolview.moc" --- kdesdk/cervisia/protocolview.h #1.6:1.6.2.1 @@ -19,4 +19,7 @@ #include <kprocess.h> +class QPoint; +class QPopupMenu; + class ProtocolView : public QTextEdit @@ -35,6 +38,5 @@ signals: protected: - void mousePressEvent(QMouseEvent *e); - void keyPressEvent(QKeyEvent *e); + virtual QPopupMenu* createPopupMenu(const QPoint &pos); private slots: @@ -46,5 +48,4 @@ private: void processOutput(); void appendLine(const QString &line); - void execContextMenu(const QPoint &pos); KShellProcess *childproc; |