[Konsole-devel] [Bug 52524] need a way to clear kwrited history buffer
Kurt V.Hindenburg
kurt.hindenburg at kdemail.net
Sat May 6 16:54:48 UTC 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=52524
------- Additional Comments From kurt.hindenburg kdemail net 2006-05-06 18:54 -------
SVN commit 538058 by hindenburg:
Add a 'Clear Messages' to the popup menu.
Can not test on /trunk right now.
CCBUG: 52524
M +30 -11 kwrited.cpp
M +7 -1 kwrited.h
--- trunk/KDE/kdebase/apps/konsole/konsole/kwrited.cpp #538057:538058
@ -42,15 +42,20 @
see ../Makefile.am - kwrited doesn't seem to work well without utempter
*/
-KWrited::KWrited() : QObject()
+KWrited::KWrited() : QTextEdit()
{
- wid = new Q3TextEdit(0, "messages");
- wid->setFont(KGlobalSettings::fixedFont());
- wid->setMinimumWidth(wid->fontMetrics().maxWidth()*80 +
- wid->minimumSizeHint().width());
- wid->setReadOnly(true);
- wid->setFocusPolicy(Qt::NoFocus);
+ int pref_width, pref_height;
+ setFont(KGlobalSettings::fixedFont());
+ pref_width = (2 * KGlobalSettings::desktopGeometry(0).width()) / 3;
+ pref_height = fontMetrics().lineSpacing() * 10;
+ setMinimumWidth(pref_width);
+ setMinimumHeight(pref_height);
+ setReadOnly(true);
+// setFocusPolicy(QWidget::NoFocus);
+// setWordWrap(QTextEdit::WidgetWidth);
+// setTextFormat(Qt::PlainText);
+
pty = new KPty();
pty->open();
pty->login(KUser().loginName().toLocal8Bit().data(), getenv("DISPLAY"));
@ -58,7 +63,7 @
connect(sn, SIGNAL(activated(int)), this, SLOT(block_in(int)));
QString txt = i18n("KWrited - Listening on Device %1", pty->ttyName());
- wid->setWindowTitle(txt);
+ setWindowTitle(txt);
puts(txt.toLocal8Bit().data());
}
@ -75,11 +80,25 @
if (len <= 0)
return;
- wid->insert( QString::fromLocal8Bit( buf, len ).remove('\r') );
- wid->show();
- wid->raise();
+ insert( QString::fromLocal8Bit( buf, len ).remove('\r') );
+ show();
+ raise();
}
+void KWrited::clearText()
+{
+ clear();
+}
+
+void KWrited::contextMenuEvent(QContextMenuEvent * e)
+{
+ QMenu *menu = createStandardContextMenu();
+ menu->addAction("Clear Messages");
+ // Add connection and shortcut if possible
+ menu->exec(e->globalPos());
+ delete menu;
+}
+
KWritedModule::KWritedModule( const DCOPCString& obj )
: KDEDModule( obj )
{
--- trunk/KDE/kdebase/apps/konsole/konsole/kwrited.h #538057:538058
@ -3,16 +3,22 @
#include <q3textedit.h>
#include <kdedmodule.h>
+#include <QTextEdit>
+#include <QMenu>
class KPty;
-class KWrited : public QObject
+class KWrited : public QTextEdit
{ Q_OBJECT
public:
KWrited();
~KWrited();
+protected:
+ virtual void contextMenuEvent(QContextMenuEvent *);
+
private Q_SLOTS:
void block_in(int fd);
+ void clearText(void);
private:
Q3TextEdit* wid;
KPty* pty;
More information about the konsole-devel
mailing list