| Summary: | need a way to clear kwrited history buffer | ||
|---|---|---|---|
| Product: | [Applications] konsole | Reporter: | Marc Boucher <marc> |
| Component: | kwrited | Assignee: | Konsole Bugs <konsole-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Mandrake RPMs | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | Replacment /usr/sbin/utempter to work around the bug | ||
|
Description
Marc Boucher
2003-01-02 16:38:26 UTC
Created attachment 15793 [details]
Replacment /usr/sbin/utempter to work around the bug
SVN commit 536788 by hindenburg:
Add a 'Clear Messages' to the popup menu.
BUG: 52524
M +29 -12 kwrited.cpp
M +6 -1 kwrited.h
--- branches/KDE/3.5/kdebase/konsole/konsole/kwrited.cpp #536787:536788
@@ -39,18 +39,19 @@
see ../Makefile.am - kwrited doesn't seem to work well without utempter
*/
-KWrited::KWrited() : QObject()
+KWrited::KWrited() : QTextEdit()
{
int pref_width, pref_height;
- wid = new QTextEdit(0, "messages");
- wid->setFont(KGlobalSettings::fixedFont());
+ setFont(KGlobalSettings::fixedFont());
pref_width = (2 * KGlobalSettings::desktopGeometry(0).width()) / 3;
- pref_height = wid->fontMetrics().lineSpacing() * 10;
- wid->setMinimumWidth(pref_width);
- wid->setMinimumHeight(pref_height);
- wid->setReadOnly(true);
- wid->setFocusPolicy(QWidget::NoFocus);
+ 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();
@@ -59,7 +60,7 @@
connect(sn, SIGNAL(activated(int)), this, SLOT(block_in(int)));
QString txt = i18n("KWrited - Listening on Device %1").arg(pty->ttyName());
- wid->setCaption(txt);
+ setCaption(txt);
puts(txt.local8Bit().data());
}
@@ -76,11 +77,27 @@
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();
+}
+
+QPopupMenu *KWrited::createPopupMenu( const QPoint &pos )
+{
+ QPopupMenu *menu = QTextEdit::createPopupMenu( pos );
+
+ menu->insertItem( i18n( "Clear Messages" ),
+ this, SLOT( clearText() ),
+ 0, -1, 0 );
+
+ return menu;
+}
+
KWritedModule::KWritedModule( const QCString& obj )
: KDEDModule( obj )
{
--- branches/KDE/3.5/kdebase/konsole/konsole/kwrited.h #536787:536788
@@ -3,16 +3,21 @@
#include <qtextedit.h>
#include <kdedmodule.h>
+#include <qpopupmenu.h>
+#include <qtextedit.h>
class KPty;
-class KWrited : public QObject
+class KWrited : public QTextEdit
{ Q_OBJECT
public:
KWrited();
~KWrited();
+protected:
+ virtual QPopupMenu *createPopupMenu(const QPoint &);
private slots:
void block_in(int fd);
+ void clearText(void);
private:
QTextEdit* wid;
KPty* pty;
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;
|