[Konsole-devel] [Bug 52524] need a way to clear kwrited history buffer
Kurt V.Hindenburg
kurt.hindenburg at kdemail.net
Wed May 3 09:16:21 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
kurt.hindenburg kdemail net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From kurt.hindenburg kdemail net 2006-05-03 11:16 -------
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;
More information about the konsole-devel
mailing list