summaryrefslogtreecommitdiff
authorar <ar>2004-05-02 16:22:24 (UTC)
committer ar <ar>2004-05-02 16:22:24 (UTC)
commit34f1234b010fa80f9ca06e65f46130713f7362d9 (patch) (side-by-side diff)
tree6ded6dcd83ed00b436f312f2403f7afc9f399435
parent4e7ab937501b6495ce5635a7515e66a75e04d37e (diff)
downloadopie-34f1234b010fa80f9ca06e65f46130713f7362d9.zip
opie-34f1234b010fa80f9ca06e65f46130713f7362d9.tar.gz
opie-34f1234b010fa80f9ca06e65f46130713f7362d9.tar.bz2
- convert qDebug to odebug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEScreen.cpp2
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp6
-rw-r--r--core/apps/embeddedkonsole/commandeditdialog.cpp4
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp41
-rw-r--r--core/apps/embeddedkonsole/main.cpp8
-rw-r--r--core/apps/embeddedkonsole/playlistselection.cpp11
6 files changed, 38 insertions, 34 deletions
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp
index 3dbcec2..8e69a88 100644
--- a/core/apps/embeddedkonsole/TEScreen.cpp
+++ b/core/apps/embeddedkonsole/TEScreen.cpp
@@ -1,328 +1,328 @@
/* -------------------------------------------------------------------------- */
/* */
/* [TEScreen.C] Screen Data Type */
/* */
/* -------------------------------------------------------------------------- */
/* */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
/* */
/* This file is part of Konsole - an X terminal for KDE */
/* */
/* -------------------------------------------------------------------------- */
/* */
/* Ported Konsole to Qt/Embedded */
/* */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
/* */
/* -------------------------------------------------------------------------- */
// enhancements added by L.J. Potter <ljp@llornkcor.com>
/*! \file
*/
/*! \class TEScreen
\brief The image manipulated by the emulation.
This class implements the operations of the terminal emulation framework.
It is a complete passive device, driven by the emulation decoder
(TEmuVT102). By this it forms in fact an ADT, that defines operations
on a rectangular image.
It does neither know how to display its image nor about escape sequences.
It is further independent of the underlying toolkit. By this, one can even
use this module for an ordinary text surface.
Since the operations are called by a specific emulation decoder, one may
collect their different operations here.
The state manipulated by the operations is mainly kept in `image', though
it is a little more complex bejond this. See the header file of the class.
\sa TEWidget \sa VT102Emulation
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// #include <kdebug.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <qpe/config.h>
#include "TEScreen.h"
#define HERE printf("%s(%d): here\n",__FILE__,__LINE__)
//FIXME: this is emulation specific. Use FALSE for xterm, TRUE for ANSI.
//FIXME: see if we can get this from terminfo.
#define BS_CLEARS FALSE
#define loc(X,Y) ((Y) * columns + (X))
/*! creates a `TEScreen' of `lines' lines and `columns' columns.
*/
TEScreen::TEScreen(int lines, int columns)
{
this->lines = lines;
this->columns = columns;
-// qDebug("Columns %d", columns);
+// odebug << "Columns " << columns << "" << oendl;
image = (ca*) malloc(lines*columns*sizeof(ca));
tabstops = NULL; initTabStops();
histCursor = 0;
horzCursor = 0;
clearSelection();
reset();
}
/*! Destructor
*/
TEScreen::~TEScreen()
{
free(image);
if (tabstops) free(tabstops);
}
/* ------------------------------------------------------------------------- */
/* */
/* Normalized Screen Operations */
/* */
/* ------------------------------------------------------------------------- */
// Cursor Setting --------------------------------------------------------------
/*! \section Cursor
The `cursor' is a location within the screen that is implicitely used in
many operations. The operations within this section allow to manipulate
the cursor explicitly and to obtain it's value.
The position of the cursor is guarantied to be between (including) 0 and
`columns-1' and `lines-1'.
*/
/*!
Move the cursor up.
The cursor will not be moved beyond the top margin.
*/
void TEScreen::cursorUp(int n)
//=CUU
{
if (n == 0) n = 1; // Default
int stop = cuY < tmargin ? 0 : tmargin;
cuX = QMIN(columns-1,cuX); // nowrap!
cuY = QMAX(stop,cuY-n);
}
/*!
Move the cursor down.
The cursor will not be moved beyond the bottom margin.
*/
void TEScreen::cursorDown(int n)
//=CUD
{
if (n == 0) n = 1; // Default
int stop = cuY > bmargin ? lines-1 : bmargin;
cuX = QMIN(columns-1,cuX); // nowrap!
cuY = QMIN(stop,cuY+n);
}
/*!
Move the cursor left.
The cursor will not move beyond the first column.
*/
void TEScreen::cursorLeft(int n)
//=CUB
{
if (n == 0) n = 1; // Default
cuX = QMIN(columns-1,cuX); // nowrap!
cuX = QMAX(0,cuX-n);
}
/*!
Move the cursor left.
The cursor will not move beyond the rightmost column.
*/
void TEScreen::cursorRight(int n)
//=CUF
{
if (n == 0) n = 1; // Default
cuX = QMIN(columns-1,cuX+n);
}
/*!
Set top and bottom margin.
*/
void TEScreen::setMargins(int top, int bot)
//=STBM
{
if (top == 0) top = 1; // Default
if (bot == 0) bot = lines; // Default
top = top - 1; // Adjust to internal lineno
bot = bot - 1; // Adjust to internal lineno
if ( !( 0 <= top && top < bot && bot < lines ) )
{ fprintf(stderr,"%s(%d) : setRegion(%d,%d) : bad range.\n",
__FILE__,__LINE__,top,bot);
return; // Default error action: ignore
}
tmargin = top;
bmargin = bot;
cuX = 0;
cuY = getMode(MODE_Origin) ? top : 0;
}
/*!
Move the cursor down one line.
If cursor is on bottom margin, the region between the
actual top and bottom margin is scrolled up instead.
*/
void TEScreen::index()
//=IND
{
if (cuY == bmargin)
{
if (tmargin == 0 && bmargin == lines-1) addHistLine(); // hist.history
scrollUp(tmargin,1);
}
else if (cuY < lines-1)
cuY += 1;
}
/*!
Move the cursor up one line.
If cursor is on the top margin, the region between the
actual top and bottom margin is scrolled down instead.
*/
void TEScreen::reverseIndex()
//=RI
{
if (cuY == tmargin)
scrollDown(tmargin,1);
else if (cuY > 0)
cuY -= 1;
}
/*!
Move the cursor to the begin of the next line.
If cursor is on bottom margin, the region between the
actual top and bottom margin is scrolled up.
*/
void TEScreen::NextLine()
//=NEL
{
Return(); index();
}
// Line Editing ----------------------------------------------------------------
/*! \section inserting / deleting characters
*/
/*! erase `n' characters starting from (including) the cursor position.
The line is filled in from the right with spaces.
*/
void TEScreen::eraseChars(int n)
{
if (n == 0) n = 1; // Default
int p = QMAX(0,QMIN(cuX+n-1,columns-1));
clearImage(loc(cuX,cuY),loc(p,cuY),' ');
}
/*! delete `n' characters starting from (including) the cursor position.
The line is filled in from the right with spaces.
*/
void TEScreen::deleteChars(int n)
{
if (n == 0) n = 1; // Default
int p = QMAX(0,QMIN(cuX+n,columns-1));
moveImage(loc(cuX,cuY),loc(p,cuY),loc(columns-1,cuY));
clearImage(loc(columns-n,cuY),loc(columns-1,cuY),' ');
}
/*! insert `n' spaces at the cursor position.
The cursor is not moved by the operation.
*/
void TEScreen::insertChars(int n)
{
if (n == 0) n = 1; // Default
int p = QMAX(0,QMIN(columns-1-n,columns-1));
int q = QMAX(0,QMIN(cuX+n,columns-1));
moveImage(loc(q,cuY),loc(cuX,cuY),loc(p,cuY));
clearImage(loc(cuX,cuY),loc(q-1,cuY),' ');
}
/*! delete `n' lines starting from (including) the cursor position.
The cursor is not moved by the operation.
*/
void TEScreen::deleteLines(int n)
{
if (n == 0) n = 1; // Default
scrollUp(cuY,n);
}
/*! insert `n' lines at the cursor position.
The cursor is not moved by the operation.
*/
void TEScreen::insertLines(int n)
{
if (n == 0) n = 1; // Default
scrollDown(cuY,n);
}
// Mode Operations -----------------------------------------------------------
/*! Set a specific mode. */
void TEScreen::setMode(int m)
{
currParm.mode[m] = TRUE;
switch(m)
{
case MODE_Origin : cuX = 0; cuY = tmargin; break; //FIXME: home
}
}
/*! Reset a specific mode. */
void TEScreen::resetMode(int m)
{
currParm.mode[m] = FALSE;
switch(m)
{
case MODE_Origin : cuX = 0; cuY = 0; break; //FIXME: home
}
}
/*! Save a specific mode. */
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index 93348f4..3cb1c0a 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -688,639 +688,639 @@ void TEWidget::mousePressEvent(QMouseEvent* ev)
if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ;
if (mouse_marks || (ev->state() & ShiftButton))
{
emit clearSelectionSignal();
iPntSel = pntSel = pos;
actSel = 1; // left mouse button pressed but nothing selected yet.
grabMouse( /*crossCursor*/ ); // handle with care!
}
else
{
emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button
}
}
if ( ev->button() == MidButton )
{
emitSelection();
}
if ( ev->button() == RightButton ) // Configure
{
emit configureRequest( this, ev->state()&(ShiftButton|ControlButton), ev->x(), ev->y() );
}
}
void TEWidget::mouseMoveEvent(QMouseEvent* ev)
{
// for auto-hiding the cursor, we need mouseTracking
if (ev->state() == NoButton ) return;
if (actSel == 0) return;
// don't extend selection while pasting
if (ev->state() & MidButton) return;
//if ( !contentsRect().contains(ev->pos()) ) return;
QPoint tL = contentsRect().topLeft();
int tLx = tL.x();
int tLy = tL.y();
int scroll = scrollbar->value();
// int hScroll = hScrollbar->value();
// we're in the process of moving the mouse with the left button pressed
// the mouse cursor will kept catched within the bounds of the text in
// this widget.
// Adjust position within text area bounds. See FIXME above.
QPoint pos = ev->pos();
if ( pos.x() < tLx+blX ) pos.setX( tLx+blX );
if ( pos.x() > tLx+blX+columns*font_w-1 ) pos.setX( tLx+blX+columns*font_w );
if ( pos.y() < tLy+bY ) pos.setY( tLy+bY );
if ( pos.y() > tLy+bY+lines*font_h-1 ) pos.setY( tLy+bY+lines*font_h-1 );
// check if we produce a mouse move event by this
if ( pos != ev->pos() ) cursor().setPos(mapToGlobal(pos));
if ( pos.y() == tLy+bY+lines*font_h-1 )
{
scrollbar->setValue(scrollbar->value()+yMouseScroll); // scrollforward
}
if ( pos.y() == tLy+bY )
{
scrollbar->setValue(scrollbar->value()-yMouseScroll); // scrollback
}
QPoint here = QPoint((pos.x()-tLx-blX)/font_w,(pos.y()-tLy-bY)/font_h);
QPoint ohere;
bool swapping = FALSE;
if ( word_selection_mode )
{
// Extend to word boundaries
int i;
int selClass;
bool left_not_right = ( here.y() < iPntSel.y() ||
here.y() == iPntSel.y() && here.x() < iPntSel.x() );
bool old_left_not_right = ( pntSel.y() < iPntSel.y() ||
pntSel.y() == iPntSel.y() && pntSel.x() < iPntSel.x() );
swapping = left_not_right != old_left_not_right;
// Find left (left_not_right ? from here : from start)
QPoint left = left_not_right ? here : iPntSel;
i = loc(left.x(),left.y());
selClass = charClass(image[i].c);
while ( left.x() > 0 && charClass(image[i-1].c) == selClass )
{ i--; left.rx()--; }
// Find left (left_not_right ? from start : from here)
QPoint right = left_not_right ? iPntSel : here;
i = loc(right.x(),right.y());
selClass = charClass(image[i].c);
while ( right.x() < columns-1 && charClass(image[i+1].c) == selClass )
{ i++; right.rx()++; }
// Pick which is start (ohere) and which is extension (here)
if ( left_not_right )
{
here = left; ohere = right;
}
else
{
here = right; ohere = left;
}
}
if (here == pntSel && scroll == scrollbar->value()) return; // not moved
if ( word_selection_mode ) {
if ( actSel < 2 || swapping ) {
emit beginSelectionSignal( ohere.x(), ohere.y() );
}
} else if ( actSel < 2 ) {
emit beginSelectionSignal( pntSel.x(), pntSel.y() );
}
actSel = 2; // within selection
pntSel = here;
emit extendSelectionSignal( here.x(), here.y() );
}
void TEWidget::mouseReleaseEvent(QMouseEvent* ev)
{
//printf("release [%d,%d] %d\n",ev->x()/font_w,ev->y()/font_h,ev->button());
if ( ev->button() == LeftButton)
{
if (QABS(ev->x() - mouse_down_x) < 3
&& QABS(ev->y() - mouse_down_y) < 3
&& ev->y() < qApp->desktop()->height()/8) {
emit setFullScreen(false);
}
if ( actSel > 1 ) emit endSelectionSignal(preserve_line_breaks);
preserve_line_breaks = TRUE;
actSel = 0;
//FIXME: emits a release event even if the mouse is
// outside the range. The procedure used in `mouseMoveEvent'
// applies here, too.
QPoint tL = contentsRect().topLeft();
int tLx = tL.x();
int tLy = tL.y();
if (!mouse_marks && !(ev->state() & ShiftButton))
emit mouseSignal( 3, // release
(ev->x()-tLx-blX)/font_w + 1,
(ev->y()-tLy-bY)/font_h + 1 );
releaseMouse();
}
}
void TEWidget::mouseDoubleClickEvent(QMouseEvent* ev)
{
if ( ev->button() != LeftButton) return;
QPoint tL = contentsRect().topLeft();
int tLx = tL.x();
int tLy = tL.y();
QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
// pass on double click as two clicks.
if (!mouse_marks && !(ev->state() & ShiftButton))
{
emit mouseSignal( 0, pos.x()+1, pos.y()+1 ); // left button
emit mouseSignal( 3, pos.x()+1, pos.y()+1 ); // release
emit mouseSignal( 0, pos.x()+1, pos.y()+1 ); // left button
return;
}
emit clearSelectionSignal();
QPoint bgnSel = pos;
QPoint endSel = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
int i = loc(bgnSel.x(),bgnSel.y());
iPntSel = bgnSel;
word_selection_mode = TRUE;
// find word boundaries...
int selClass = charClass(image[i].c);
{
// set the start...
int x = bgnSel.x();
while ( x > 0 && charClass(image[i-1].c) == selClass )
{ i--; x--; }
bgnSel.setX(x);
emit beginSelectionSignal( bgnSel.x(), bgnSel.y() );
// set the end...
i = loc( endSel.x(), endSel.y() );
x = endSel.x();
while( x < columns-1 && charClass(image[i+1].c) == selClass )
{ i++; x++ ; }
endSel.setX(x);
actSel = 2; // within selection
emit extendSelectionSignal( endSel.x(), endSel.y() );
emit endSelectionSignal(preserve_line_breaks);
preserve_line_breaks = TRUE;
}
}
void TEWidget::focusInEvent( QFocusEvent * )
{
// do nothing, to prevent repainting
}
void TEWidget::focusOutEvent( QFocusEvent * )
{
// do nothing, to prevent repainting
}
bool TEWidget::focusNextPrevChild( bool next )
{
if (next)
return false; // This disables changing the active part in konqueror
// when pressing Tab
return QFrame::focusNextPrevChild( next );
}
int TEWidget::charClass(char ch) const
{
// This might seem like overkill, but imagine if ch was a Unicode
// character (Qt 2.0 QChar) - it might then be sensible to separate
// the different language ranges, etc.
if ( isspace(ch) ) return ' ';
static const char *word_characters = ":@-./_~";
if ( isalnum(ch) || strchr(word_characters, ch) )
return 'a';
// Everything else is weird
return 1;
}
void TEWidget::setMouseMarks(bool on)
{
mouse_marks = on;
setCursor( mouse_marks ? ibeamCursor : arrowCursor );
}
/* ------------------------------------------------------------------------- */
/* */
/* Clipboard */
/* */
/* ------------------------------------------------------------------------- */
#undef KeyPress
void TEWidget::emitSelection()
// Paste Clipboard by simulating keypress events
{
#ifndef QT_NO_CLIPBOARD
QString text = QApplication::clipboard()->text();
-// qDebug(text);
+// odebug << text << oendl;
if ( ! text.isNull())
{
text.replace(QRegExp("\n"), "\r");
QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text);
emit keyPressedSignal(&e); // expose as a big fat keypress event
emit clearSelectionSignal();
}
#endif
}
void TEWidget::emitText(QString text)
{
QKeyEvent e(QEvent::KeyPress, 0, -1, 0, text);
emit keyPressedSignal(&e); // expose as a big fat keypress event
}
void TEWidget::pasteClipboard( )
{
emitSelection();
}
void TEWidget::setSelection(const QString& t)
{
#ifndef QT_NO_CLIPBOARD
// Disconnect signal while WE set the clipboard
QObject *cb = QApplication::clipboard();
QObject::disconnect( cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
QApplication::clipboard()->setText(t);
QObject::connect( cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
#endif
}
void TEWidget::onClearSelection()
{
emit clearSelectionSignal();
}
/* ------------------------------------------------------------------------- */
/* */
/* Keyboard */
/* */
/* ------------------------------------------------------------------------- */
//FIXME: an `eventFilter' has been installed instead of a `keyPressEvent'
// due to a bug in `QT' or the ignorance of the author to prevent
// repaint events being emitted to the screen whenever one leaves
// or reenters the screen to/from another application.
//
// Troll says one needs to change focusInEvent() and focusOutEvent(),
// which would also let you have an in-focus cursor and an out-focus
// cursor like xterm does.
// for the auto-hide cursor feature, I added empty focusInEvent() and
// focusOutEvent() so that update() isn't called.
// For auto-hide, we need to get keypress-events, but we only get them when
// we have focus.
void TEWidget::doScroll(int lines)
{
scrollbar->setValue(scrollbar->value()+lines);
}
void TEWidget::doHScroll(int lines) {
hScrollbar->setValue( hScrollbar->value()+lines);
}
bool TEWidget::eventFilter( QObject *obj, QEvent *e )
{
if ( (e->type() == QEvent::Accel ||
e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) {
static_cast<QKeyEvent *>( e )->ignore();
return true;
}
if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ )
return FALSE; // not us
if ( e->type() == QEvent::Wheel) {
QApplication::sendEvent(scrollbar, e);
}
#ifdef FAKE_CTRL_AND_ALT
static bool control = FALSE;
static bool alt = FALSE;
-// qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:");
+// odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl;
bool dele=FALSE;
if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
QKeyEvent* ke = (QKeyEvent*)e;
bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
switch (ke->key()) {
case Key_F9: // let this be "Control"
control = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
dele=TRUE;
break;
case Key_F13: // let this be "Alt"
alt = keydown;
e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
dele=TRUE;
break;
default:
if ( control ) {
int a = toupper(ke->ascii())-64;
if ( a >= 0 && a < ' ' ) {
e = new QKeyEvent(e->type(), ke->key(),
a, ke->state()|ControlButton, QChar(a,0));
dele=TRUE;
}
}
if ( alt ) {
e = new QKeyEvent(e->type(), ke->key(),
ke->ascii(), ke->state()|AltButton, ke->text());
dele=TRUE;
}
}
}
#endif
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)e;
actSel=0; // Key stroke implies a screen update, so TEWidget won't
// know where the current selection is.
-// qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state());
+// odebug << "key pressed is 0x" << ke->key() << ", ascii is 0x" << ke->ascii() << ", state " << ke->state() << "" << oendl;
bool special_function = true;
switch(ke->key()) {
// case 0x201b: // fn-5
// case Key_F1:
// switch sessions (?)
// emitText("\\"); // expose (??)
// break;
case 0x2016: // fn-p
case Key_F2:
pasteClipboard();
break;
case 0x2018: // fn-S
case Key_F3:
emit changeSession(1);
break;
case 0x2019: // fn-n
emit newSession();
break;
case Qt::Key_Tab:
if (ke->state() == ControlButton) {
emit changeSession(1);
} else {
special_function = false;
}
break;
#if 0
case Qt::Key_Left:
if (vcolumns == 0) {
emit changeSession(-1);
} else {
special_function = false;
}
break;
case Qt::Key_Right:
if (vcolumns == 0) {
emit changeSession(1);
} else {
special_function = false;
}
break;
#endif
case 0x201b: // fn-5
case Key_F4:
emit toggleFullScreen();
break;
case 0x200f: // fn-1 magnify minus
case Key_F5:
emit changeFontSize(-1);
break;
case 0x2010: // fn-2 magnify plus
case Key_F6:
emit changeFontSize(1);
break;
default:
special_function = false;
}
if (special_function) {
return true;
}
// else if( ke->state() == ControlButton && ke->key() == Key_V) {
// pasteClipboard();
// }
// else if( ke->state() == ControlButton && ke->key() == Key_C) {
// pasteClipboard();
// }
emit keyPressedSignal(ke); // expose
ke->accept();
#ifdef FAKE_CTRL_AND_ALT
if ( dele ) delete e;
#endif
return true; // stop the event
}
if ( e->type() == QEvent::Enter ) {
QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
}
if ( e->type() == QEvent::Leave ) {
QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
this, SLOT(onClearSelection()) );
}
return QFrame::eventFilter( obj, e );
}
/* ------------------------------------------------------------------------- */
/* */
/* Frame */
/* */
/* ------------------------------------------------------------------------- */
void TEWidget::frameChanged()
{
propagateSize();
update();
}
/* ------------------------------------------------------------------------- */
/* */
/* Sound */
/* */
/* ------------------------------------------------------------------------- */
void TEWidget::Bell()
{
//#ifdef QT_QWS_SL5XXX
//# ifndef QT_NO_COP
if(useBeep)
QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
//# endif
//#else
//# ifndef QT_NO_SOUND
// QSound::play(Resource::findSound("alarm"));
//# endif
//#endif
// QApplication::beep();
}
/* ------------------------------------------------------------------------- */
/* */
/* Auxiluary */
/* */
/* ------------------------------------------------------------------------- */
void TEWidget::clearImage()
// initialize the image
// for internal use only
{
for (int y = 0; y < lines; y++)
for (int x = 0; x < columns; x++)
{
image[loc(x,y)].c = 0xff; //' ';
image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR;
image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR;
image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION;
}
}
// Create Image ///////////////////////////////////////////////////////
void TEWidget::calcGeometry()
{
int showhscrollbar = 1;
int hwidth = 0;
int dcolumns = 0;
Config cfg( "Konsole" );
cfg.setGroup("ScrollBar");
useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
if(vcolumns == 0) showhscrollbar = 0;
if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
scrollbar->resize(QApplication::style().scrollBarExtent().width(),
contentsRect().height() - hwidth);
switch(scrollLoc) {
case SCRNONE :
columns = ( contentsRect().width() - 2 * rimX ) / font_w;
dcolumns = columns;
if(vcolumns) columns = vcolumns;
blX = (contentsRect().width() - (columns*font_w) ) / 2;
if(showhscrollbar)
blX = -hposition * font_w;
brX = blX;
scrollbar->hide();
break;
case SCRLEFT :
columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
dcolumns = columns;
if(vcolumns) columns = vcolumns;
brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
if(showhscrollbar)
brX = -hposition * font_w;
blX = brX + scrollbar->width();
scrollbar->move(contentsRect().topLeft());
scrollbar->show();
break;
case SCRRIGHT:
columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
dcolumns = columns;
if(vcolumns) columns = vcolumns;
blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
if(showhscrollbar)
blX = -hposition * font_w;
brX = blX;
scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
scrollbar->show();
break;
}
//FIXME: support 'rounding' styles
lines = ( contentsRect().height() - 2 * rimY ) / font_h;
bY = (contentsRect().height() - (lines *font_h)) / 2;
if(showhscrollbar == 1) {
hScrollbar->resize(contentsRect().width() - hwidth, hwidth);
hScrollbar->setRange(0, vcolumns - dcolumns);
QPoint p = contentsRect().bottomLeft();
if(scrollLoc == SCRLEFT)
hScrollbar->move(QPoint(p.x()+hwidth, p.y() - hwidth));
else
hScrollbar->move(QPoint(p.x(), p.y() - hwidth));
hScrollbar->show();
}
else hScrollbar->hide();
if(showhscrollbar == 1) {
lines = lines - (hwidth / font_h) - 1;
if(lines < 1) lines = 1;
}
//FIXME: support 'rounding' styles
}
void TEWidget::makeImage()
//FIXME: rename 'calcGeometry?
{
calcGeometry();
image = (ca*) malloc(lines*columns*sizeof(ca));
clearImage();
}
// calculate the needed size
QSize TEWidget::calcSize(int cols, int lins) const
{
int frw = width() - contentsRect().width();
int frh = height() - contentsRect().height();
int scw = (scrollLoc==SCRNONE?0:scrollbar->width());
return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh );
}
QSize TEWidget::sizeHint() const
{
return size();
}
void TEWidget::styleChange(QStyle &)
{
propagateSize();
}
#ifndef QT_NO_DRAGANDDROP
/* --------------------------------------------------------------------- */
/* */
/* Drag & Drop */
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp
index 6587b26..697bf72 100644
--- a/core/apps/embeddedkonsole/commandeditdialog.cpp
+++ b/core/apps/embeddedkonsole/commandeditdialog.cpp
@@ -1,191 +1,191 @@
//comandeditdialog.cpp
#include "commandeditdialog.h"
#include "playlistselection.h"
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qtoolbutton.h>
#include <qlineedit.h>
#include <qheader.h>
#include <qlabel.h>
#include "smallcommandeditdialogbase.h"
CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl )
: CommandEditDialogBase(parent, name, TRUE, fl)
{
m_SuggestedCommandList->addColumn( tr("Command Selection") );
m_SuggestedCommandList->header()->hide();
m_SuggestedCommandList->setSorting(-1,FALSE);
m_SuggestedCommandList->clearSelection();
m_SuggestedCommandList->setSorting(0,TRUE);
QListViewItem *item;
item = new QListViewItem( m_SuggestedCommandList,"export ");
item = new QListViewItem( m_SuggestedCommandList,"ifconfig ");
item = new QListViewItem( m_SuggestedCommandList,"ipkg ");
item = new QListViewItem( m_SuggestedCommandList,"gzip ");
item = new QListViewItem( m_SuggestedCommandList,"gunzip ");
item = new QListViewItem( m_SuggestedCommandList,"chgrp ");
item = new QListViewItem( m_SuggestedCommandList,"chown ");
item = new QListViewItem( m_SuggestedCommandList,"date ");
item = new QListViewItem( m_SuggestedCommandList,"dd ");
item = new QListViewItem( m_SuggestedCommandList,"dmesg ");
item = new QListViewItem( m_SuggestedCommandList,"fuser ");
item = new QListViewItem( m_SuggestedCommandList,"hostname ");
item = new QListViewItem( m_SuggestedCommandList,"kill ");
item = new QListViewItem( m_SuggestedCommandList,"killall ");
item = new QListViewItem( m_SuggestedCommandList,"ln ");
item = new QListViewItem( m_SuggestedCommandList,"ln -s ");
item = new QListViewItem( m_SuggestedCommandList,"lsmod");
item = new QListViewItem( m_SuggestedCommandList,"depmod -a");
item = new QListViewItem( m_SuggestedCommandList,"modprobe ");
item = new QListViewItem( m_SuggestedCommandList,"mount ");
item = new QListViewItem( m_SuggestedCommandList,"more ");
item = new QListViewItem( m_SuggestedCommandList,"sort ");
item = new QListViewItem( m_SuggestedCommandList,"touch ");
item = new QListViewItem( m_SuggestedCommandList,"umount ");
item = new QListViewItem( m_SuggestedCommandList,"mknod ");
item = new QListViewItem( m_SuggestedCommandList,"netstat ");
item = new QListViewItem( m_SuggestedCommandList,"route ");
item = new QListViewItem( m_SuggestedCommandList,"cardctl eject ");
m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE);
m_SuggestedCommandList->sort();
connect( m_SuggestedCommandList, SIGNAL( clicked(QListViewItem*) ), m_PlayListSelection, SLOT( addToSelection(QListViewItem*) ) );
ToolButton1->setTextLabel("new");
ToolButton1->setPixmap(Resource::loadPixmap("new"));
ToolButton1->setAutoRaise(TRUE);
ToolButton1->setFocusPolicy(QWidget::NoFocus);
connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog()));
ToolButton2->setTextLabel("edit");
ToolButton2->setPixmap(Resource::loadPixmap("edit"));
ToolButton2->setAutoRaise(TRUE);
ToolButton2->setFocusPolicy(QWidget::NoFocus);
connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog()));
ToolButton3->setTextLabel("delete");
ToolButton3->setPixmap(Resource::loadPixmap("editdelete"));
ToolButton3->setAutoRaise(TRUE);
ToolButton3->setFocusPolicy(QWidget::NoFocus);
connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected()));
ToolButton4->setTextLabel("up");
ToolButton4->setPixmap(Resource::loadPixmap("up"));
ToolButton4->setAutoRaise(TRUE);
ToolButton4->setFocusPolicy(QWidget::NoFocus);
connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp()));
ToolButton5->setTextLabel("down");
ToolButton5->setPixmap(Resource::loadPixmap("down"));
ToolButton5->setAutoRaise(TRUE);
ToolButton5->setFocusPolicy(QWidget::NoFocus);
connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown()));
QListViewItem *current = m_SuggestedCommandList->selectedItem();
if ( current )
item->moveItem( current );
m_SuggestedCommandList->setSelected( item, TRUE );
m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() );
Config cfg( "Konsole" );
cfg.setGroup("Commands");
if (cfg.readEntry("Commands Set","FALSE") == "TRUE") {
for (int i = 0; i < 100; i++) {
QString tmp;
tmp = cfg.readEntry( QString::number(i),"");
if (!tmp.isEmpty())
m_PlayListSelection->addStringToSelection(tmp);
}
} else {
m_PlayListSelection->addStringToSelection("ls ");
m_PlayListSelection->addStringToSelection("cardctl eject");
m_PlayListSelection->addStringToSelection("cat ");
m_PlayListSelection->addStringToSelection("cd ");
m_PlayListSelection->addStringToSelection("chmod ");
m_PlayListSelection->addStringToSelection("cp ");
m_PlayListSelection->addStringToSelection("dc ");
m_PlayListSelection->addStringToSelection("df ");
m_PlayListSelection->addStringToSelection("dmesg");
m_PlayListSelection->addStringToSelection("echo ");
m_PlayListSelection->addStringToSelection("env");
m_PlayListSelection->addStringToSelection("find ");
m_PlayListSelection->addStringToSelection("free");
m_PlayListSelection->addStringToSelection("grep ");
m_PlayListSelection->addStringToSelection("ifconfig ");
m_PlayListSelection->addStringToSelection("ipkg ");
m_PlayListSelection->addStringToSelection("mkdir ");
m_PlayListSelection->addStringToSelection("mv ");
m_PlayListSelection->addStringToSelection("nc localhost 7776");
m_PlayListSelection->addStringToSelection("nc localhost 7777");
m_PlayListSelection->addStringToSelection("nslookup ");
m_PlayListSelection->addStringToSelection("ping ");
m_PlayListSelection->addStringToSelection("ps aux");
m_PlayListSelection->addStringToSelection("pwd ");
m_PlayListSelection->addStringToSelection("rm ");
m_PlayListSelection->addStringToSelection("rmdir ");
m_PlayListSelection->addStringToSelection("route ");
m_PlayListSelection->addStringToSelection("set ");
m_PlayListSelection->addStringToSelection("traceroute");
}
}
CommandEditDialog::~CommandEditDialog()
{
}
void CommandEditDialog::accept()
{
int i = 0;
Config *cfg = new Config("Konsole");
cfg->setGroup("Commands");
cfg->clearGroup();
QListViewItemIterator it( m_PlayListSelection );
for ( ; it.current(); ++it ) {
-// qDebug(it.current()->text(0));
+// odebug << it.current()->text(0) << oendl;
cfg->writeEntry(QString::number(i),it.current()->text(0));
i++;
}
cfg->writeEntry("Commands Set","TRUE");
-// qDebug("CommandEditDialog::accept() - written");
+// odebug << "CommandEditDialog::accept() - written" << oendl;
delete cfg;
emit commandsEdited();
close();
}
void CommandEditDialog::showEditDialog()
{
editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE);
d->setCaption("Edit command");
d->TextLabel->setText("Edit command:");
d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0));
int i = d->exec();
if ((i==1) && (!(d->commandEdit->text()).isEmpty()))
m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text()));
}
void CommandEditDialog::showAddDialog()
{
editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE);
int i = d->exec();
if ((i==1) && (!(d->commandEdit->text()).isEmpty()))
m_PlayListSelection->addStringToSelection(d->commandEdit->text());
}
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 8207f23..80c8223 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -1,772 +1,773 @@
/* ---------------------------------------------------------------------- */
/* */
/* [main.C] Konsole */
/* */
/* ---------------------------------------------------------------------- */
/* */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
/* */
/* This file is part of Konsole, an X terminal. */
/* */
/* The material contained in here more or less directly orginates from */
/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
/* */
/* ---------------------------------------------------------------------- */
/* */
/* Ported Konsole to Qt/Embedded */
/* */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
/* */
/* -------------------------------------------------------------------------- */
// enhancements added by L.J. Potter <ljp@llornkcor.com>
// enhancements added by Phillip Kuhn
#include <stdlib.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
#ifdef QT_QWS_OPIE
#include <opie2/ocolorpopupmenu.h>
+#include <opie2/odebug.h>
using namespace Opie;
#endif
#include <qpe/resource.h>
#include <qmenubar.h>
#include <qtabbar.h>
#include <qpe/config.h>
#include <qfontdatabase.h>
#include <qfile.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "konsole.h"
#include "commandeditdialog.h"
class EKNumTabBar : public QTabBar
{
public:
EKNumTabBar(QWidget *parent = 0, const char *name = 0) :
QTabBar(parent, name)
{}
// QList<QTab> *getTabList() { return(tabList()); }
void numberTabs()
{
// Yes, it really is this messy. QTabWidget needs functions
// that provide acces to tabs in a sequential way.
int m=INT_MIN;
for (int i=0; i<count(); i++)
{
QTab* left=0;
QListIterator<QTab> it(*tabList());
int x=INT_MAX;
for( QTab* t; (t=it.current()); ++it )
{
int tx = t->rect().x();
if ( tx<x && tx>m )
{
x = tx;
left = t;
}
}
if ( left )
{
left->setText(QString::number(i+1));
m = left->rect().x();
}
}
}
virtual QSize sizeHint() const
{
if (isHidden())
{
return(QSize(0,0));
}
else
{
QSize size = QTabBar::sizeHint();
int shrink = 5;
if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600)
{
shrink = 10;
}
size.setHeight(size.height() - shrink);
return(size);
}
}
};
class EKNumTabWidget : public QTabWidget
{
public:
EKNumTabWidget(QWidget* parent) : QTabWidget(parent)
{
setTabBar(new EKNumTabBar(parent,"EKTabBar"));
setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
}
EKNumTabBar *getTabBar() const
{
return ((EKNumTabBar*)tabBar());
}
void addTab(QWidget* w)
{
QTab* t = new QTab(QString::number(tabBar()->count()+1));
QTabWidget::addTab(w,t);
}
void removeTab(QWidget* w)
{
removePage(w);
((EKNumTabBar*)tabBar())->numberTabs();
}
};
// This could be configurable or dynamicly generated from the bash history
// file of the user
static const char *commonCmds[] =
{
"ls ", // I left this here, cause it looks better than the first alpha
"cardctl eject",
"cat ",
"cd ",
"chmod ",
"clear",
"cp ",
"dc ",
"df ",
"dmesg",
"echo ",
"env",
"find ",
"free",
"grep ",
"ifconfig ",
"ipkg ",
"mkdir ",
"mv ",
"nc localhost 7776",
"nc localhost 7777",
"netstat ",
"nslookup ",
"ping ",
"ps aux",
"pwd ",
"qcop QPE/System 'linkChanged(QString)' ''",
"qcop QPE/System 'restart()'",
"qcop QPE/System 'quit()'",
"rm ",
"rmdir ",
"route ",
"set ",
"traceroute",
/*
"gzip",
"gunzip",
"chgrp",
"chown",
"date",
"dd",
"df",
"dmesg",
"fuser",
"hostname",
"kill",
"killall",
"ln",
"ping",
"mount",
"more",
"sort",
"touch",
"umount",
"mknod",
"netstat",
*/
"exit",
NULL
};
static void konsoleInit(const char** shell) {
- if(setuid(getuid()) !=0) qDebug("setuid failed");
- if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges
+ if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl;
+ if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges
// QPEApplication::grabKeyboard(); // for CTRL and ALT
- qDebug("keyboard grabbed");
+ odebug << "keyboard grabbed" << oendl;
#ifdef FAKE_CTRL_AND_ALT
- qDebug("Fake Ctrl and Alt defined");
+ odebug << "Fake Ctrl and Alt defined" << oendl;
QPEApplication::grabKeyboard(); // for CTRL and ALT
#endif
*shell = getenv("SHELL");
- qWarning("SHell initially is %s", *shell );
+ owarn << "SHell initially is " << *shell << "" << oendl;
if (shell == NULL || *shell == '\0') {
struct passwd *ent = 0;
uid_t me = getuid();
*shell = "/bin/sh";
while ( (ent = getpwent()) != 0 ) {
if (ent->pw_uid == me) {
if (ent->pw_shell != "")
*shell = ent->pw_shell;
break;
}
}
endpwent();
}
if( putenv((char*)"COLORTERM=") !=0)
- qDebug("putenv failed"); // to trigger mc's color detection
+ odebug << "putenv failed" << oendl; // to trigger mc's color detection
}
Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
QMainWindow(parent, name, fl)
{
QStrList tmp; const char* shell;
konsoleInit( &shell);
init(shell,tmp);
}
Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
: QMainWindow(0, name)
{
init(_pgm,_args);
}
struct HistoryItem
{
HistoryItem(int c, const QString &l)
{
count = c;
line = l;
}
int count;
QString line;
};
class HistoryList : public QList<HistoryItem>
{
virtual int compareItems( QCollection::Item item1, QCollection::Item item2)
{
int c1 = ((HistoryItem*)item1)->count;
int c2 = ((HistoryItem*)item2)->count;
if (c1 > c2)
return(1);
if (c1 < c2)
return(-1);
return(0);
}
};
void Konsole::initCommandList()
{
- // qDebug("Konsole::initCommandList");
+ // odebug << "Konsole::initCommandList" << oendl;
Config cfg( "Konsole" );
cfg.setGroup("Commands");
// commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
commonCombo->clear();
if (cfg.readEntry("ShellHistory","TRUE") == "TRUE")
{
QString histfilename = QString(getenv("HOME")) + "/.bash_history";
histfilename = cfg.readEntry("ShellHistoryPath",histfilename);
QFile histfile(histfilename);
// note: compiler barfed on:
// QFile histfile(QString(getenv("HOME")) + "/.bash_history");
if (histfile.open( IO_ReadOnly ))
{
QString line;
uint i;
HistoryList items;
int lineno = 0;
while(!histfile.atEnd())
{
if (histfile.readLine(line, 200) < 0)
{
break;
}
line = line.left(line.length()-1);
lineno++;
for(i=0; i<items.count(); i++)
{
if (line == items.at(i)->line)
{
// weight recent commands & repeated commands more
// by adding up the index of each command
items.at(i)->count += lineno;
break;
}
}
if (i >= items.count())
{
items.append(new HistoryItem(lineno, line));
}
}
items.sort();
int n = items.count();
if (n > 40)
{
n = 40;
}
for(int i=0; i<n; i++)
{
// should insert start of command, but keep whole thing
if (items.at(items.count()-i-1)->line.length() < 30)
{
commonCombo->insertItem(items.at(items.count()-i-1)->line);
}
}
histfile.close();
}
}
if (cfg.readEntry("Commands Set","FALSE") == "FALSE")
{
for (int i = 0; commonCmds[i] != NULL; i++)
{
commonCombo->insertItem(commonCmds[i]);
}
}
else
{
for (int i = 0; i < 100; i++)
{
if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
commonCombo->insertItem(cfg.readEntry( QString::number(i),""));
}
}
}
static void sig_handler(int x)
{
printf("got signal %d\n",x);
}
void Konsole::init(const char* _pgm, QStrList & _args)
{
#if 0
for(int i=1; i<=31; i++)
{
if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
&& i != SIGINT && i != SIGILL && i != SIGTERM
&& i != SIGBUS)
signal(i,sig_handler);
}
#endif
signal(SIGSTOP, sig_handler);
signal(SIGCONT, sig_handler);
signal(SIGTSTP, sig_handler);
b_scroll = TRUE; // histon;
n_keytab = 0;
n_render = 0;
startUp=0;
fromMenu = FALSE;
fullscreen = false;
setCaption( tr( "Konsole" ) );
setIcon( Resource::loadPixmap( "konsole/Terminal" ) );
Config cfg( "Konsole" );
cfg.setGroup("Font");
QString tmp;
// initialize the list of allowed fonts ///////////////////////////////////
QString cfgFontName = cfg.readEntry("FontName","Lcfont");
int cfgFontSize = cfg.readNumEntry("FontSize",18);
cfont = -1;
// this code causes repeated access to all the font files
// which does slow down startup
QFontDatabase fontDB;
QStringList familyNames;
familyNames = fontDB.families( FALSE );
QString s;
int fontIndex = 0;
int familyNum = 0;
fontList = new QPopupMenu( this );
for(uint j = 0; j < (uint)familyNames.count(); j++)
{
s = familyNames[j];
if ( s.contains('-') )
{
int i = s.find('-');
s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]";
}
s[0] = s[0].upper();
QValueList<int> sizes = fontDB.pointSizes( familyNames[j] );
printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(),
sizes.count());
if (sizes.count() > 0)
{
QPopupMenu *sizeMenu;
QFont f;
int last_width = -1;
sizeMenu = NULL;
for(uint i = 0; i < (uint)sizes.count() + 4; i++)
{
// printf("family %s size %d ", familyNames[j].latin1(), sizes[i]);
// need to divide by 10 on the Z, but not otherwise
int size;
if (i >= (uint)sizes.count())
{
// try for expandable fonts
size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1);
}
else
{
printf("sizes[%d] = %d\n", i, sizes[i]);
size = sizes[i];
}
f = QFont(familyNames[j], size);
f.setFixedPitch(true);
QFontMetrics fm(f);
// don't trust f.fixedPitch() or f.exactMatch(), they lie!!
if (fm.width("l") == fm.width("m")
&& (i < (uint)sizes.count()
|| fm.width("m") > last_width))
{
if (i < (uint)sizes.count())
{
last_width = fm.width("m");
}
if (sizeMenu == NULL)
{
sizeMenu = new QPopupMenu();
}
int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex);
sizeMenu->setItemParameter(id, fontIndex);
sizeMenu->connectItem(id, this, SLOT(setFont(int)));
QString name = s + " " + QString::number(size);
fonts.append(new VTFont(name, f, familyNames[j], familyNum, size));
if (familyNames[j] == cfgFontName && size == cfgFontSize)
{
cfont = fontIndex;
}
printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size);
fontIndex++;
}
}
if (sizeMenu)
{
fontList->insertItem(s, sizeMenu, familyNum + 1000);
familyNum++;
}
}
}
if (cfont < 0 || cfont >= (int)fonts.count())
{
cfont = 0;
}
// create terminal emulation framework ////////////////////////////////////
nsessions = 0;
tab = new EKNumTabWidget(this);
// tab->setMargin(tab->margin()-5);
connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
// create terminal toolbar ////////////////////////////////////////////////
setToolBarsMovable( FALSE );
menuToolBar = new QToolBar( this );
menuToolBar->setHorizontalStretchable( TRUE );
QMenuBar *menuBar = new QMenuBar( menuToolBar );
setFont(cfont);
configMenu = new QPopupMenu( this);
- colorMenu = new QPopupMenu( this);
+ colorMenu = new QPopupMenu( this);
scrollMenu = new QPopupMenu( this);
editCommandListMenu = new QPopupMenu( this);
configMenu->insertItem(tr("Command List"), editCommandListMenu);
bool listHidden;
cfg.setGroup("Menubar");
if( cfg.readEntry("Hidden","FALSE") == "TRUE")
{
ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" ));
listHidden=TRUE;
}
else
{
ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" ));
listHidden=FALSE;
}
cfg.setGroup("Tabs");
tabMenu = new QPopupMenu(this);
tm_bottom = tabMenu->insertItem(tr("Bottom" ));
tm_top = tabMenu->insertItem(tr("Top"));
tm_hidden = tabMenu->insertItem(tr("Hidden"));
configMenu->insertItem(tr("Tabs"), tabMenu);
tmp=cfg.readEntry("Position","Top");
if(tmp=="Top")
{
tab->setTabPosition(QTabWidget::Top);
tab->getTabBar()->show();
tabPos = tm_top;
}
else if (tmp=="Bottom")
{
tab->setTabPosition(QTabWidget::Bottom);
tab->getTabBar()->show();
tabPos = tm_bottom;
}
else
{
tab->getTabBar()->hide();
tab->setMargin(tab->margin());
tabPos = tm_hidden;
}
cm_bw = colorMenu->insertItem(tr( "Black on White"));
cm_wb = colorMenu->insertItem(tr( "White on Black"));
cm_gb = colorMenu->insertItem(tr( "Green on Black"));
// cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
cm_br = colorMenu->insertItem(tr( "Black on Pink"));
cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));
cm_cw = colorMenu->insertItem(tr( "Cyan on White"));
cm_wc = colorMenu->insertItem(tr( "White on Cyan"));
cm_bb = colorMenu->insertItem(tr( "Blue on Black"));
cm_ab = colorMenu->insertItem(tr( "Amber on Black"));
cm_default = colorMenu->insertItem(tr("default"));
#ifdef QT_QWS_OPIE
colorMenu->insertItem(tr( "Custom"));
#endif
configMenu->insertItem(tr( "Colors") ,colorMenu);
sessionList = new QPopupMenu(this);
sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this,
SLOT(newSession()) );
// connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) ));
connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) );
menuBar->insertItem( tr("View"), configMenu );
menuBar->insertItem( tr("Fonts"), fontList );
menuBar->insertItem( tr("Sessions"), sessionList );
toolBar = new QToolBar( this );
QAction *a;
// Button Commands
a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) );
a->addTo( toolBar );
a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) );
a->addTo( toolBar );
a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) );
a->addTo( toolBar );
a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar );
a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar );
a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar );
a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar );
a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar );
a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) );
a->addTo( toolBar );
secondToolBar = new QToolBar( this );
secondToolBar->setHorizontalStretchable( TRUE );
commonCombo = new QComboBox( secondToolBar );
// commonCombo->setMaximumWidth(236);
ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) );
if( listHidden)
{
secondToolBar->hide();
editCommandListMenu->setItemEnabled(ec_quick ,FALSE);
}
ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) );
cfg.setGroup("Commands");
commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
initCommandList();
// for (int i = 0; commonCmds[i] != NULL; i++) {
// commonCombo->insertItem( commonCmds[i], i );
// tmp = cfg.readEntry( QString::number(i),"");
// if(tmp != "")
// commonCombo->changeItem( tmp,i );
// }
connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
sm_none = scrollMenu->insertItem(tr( "None" ));
sm_left = scrollMenu->insertItem(tr( "Left" ));
sm_right = scrollMenu->insertItem(tr( "Right" ));
// scrollMenu->insertSeparator(4);
// scrollMenu->insertItem(tr( "Horizontal" ));
configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
configMenu->insertItem(tr( "History..." ), this, SLOT(historyDialog()));
cm_wrap = configMenu->insertItem(tr( "Wrap" ));
cfg.setGroup("ScrollBar");
configMenu->setItemChecked(cm_wrap, cfg.readBoolEntry("HorzScroll",0));
cm_beep = configMenu->insertItem(tr( "Use Beep" ));
cfg.setGroup("Menubar");
configMenu->setItemChecked(cm_beep, cfg.readBoolEntry("useBeep",0));
fullscreen_msg = new QLabel(this);
fullscreen_msg-> setAlignment ( AlignCenter | SingleLine );
fullscreen_msg-> hide();
fullscreen_msg-> setSizePolicy ( QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding ));
fullscreen_msg-> setAutoResize(true);
fullscreen_msg-> setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
fullscreen_msg-> setText(tr("To exit fullscreen, tap here."));
fullscreen_timer = new QTimer(this);
connect(fullscreen_timer, SIGNAL(timeout()),
this, SLOT(fullscreenTimeout()));
show_fullscreen_msg = true;
//scrollMenuSelected(-29);
// cfg.setGroup("ScrollBar");
// if(cfg.readBoolEntry("HorzScroll",0)) {
// if(cfg.readNumEntry("Position",2) == 0)
// te->setScrollbarLocation(1);
// else
// te->setScrollbarLocation(0);
// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
// te->setWrapAt(120);
// }
// create applications /////////////////////////////////////////////////////
setCentralWidget(tab);
// load keymaps ////////////////////////////////////////////////////////////
KeyTrans::loadAll();
for (int i = 0; i < KeyTrans::count(); i++)
{
KeyTrans* s = KeyTrans::find(i);
assert( s );
}
se_pgm = _pgm;
se_args = _args;
cfg.setGroup("CommandLine");
if (cfg.hasKey("shell_args"))
{
QStringList se_args_list = cfg.readListEntry("shell_args",'|');
for(uint i = 0; i < se_args_list.count(); i++)
{
se_args.prepend(se_args_list[se_args_list.count() - i - 1].latin1());
}
}
else
{
se_args.prepend("--login");
}
se_pgm = cfg.readEntry("shell_bin", QString(se_pgm));
// this is the "documentation" for those who know to look
if (! cfg.hasKey("shell_args"))
{
cfg.writeEntry("shell_args",QStringList::fromStrList(se_args),'|');
}
if (! cfg.hasKey("shell_bin"))
{
cfg.writeEntry("shell_bin",QString(se_pgm));
}
parseCommandLine();
// read and apply default values ///////////////////////////////////////////
resize(321, 321); // Dummy.
QSize currentSize = size();
if (currentSize != size())
defaultSize = size();
/* allows us to catch cancel/escape */
reparent ( 0, WStyle_Customize | WStyle_NoBorder,
QPoint ( 0, 0 ));
}
void Konsole::show()
{
if ( !nsessions )
{
newSession();
}
QMainWindow::show();
}
void Konsole::initSession(const char*, QStrList &)
{
QMainWindow::show();
}
@@ -814,1110 +815,1110 @@ Konsole::historyDialog()
}
void Konsole::cycleZoom()
{
TEWidget* te = getTe();
QFont font = te->getVTFont();
int size = font.pointSize();
changeFontSize(1);
font = te->getVTFont();
if (font.pointSize() <= size)
{
do
{
font = te->getVTFont();
size = font.pointSize();
changeFontSize(-1);
font = te->getVTFont();
}
while (font.pointSize() < size);
}
}
void Konsole::changeFontSize(int delta)
{
// printf("delta font size %d\n", delta);
TEWidget* te = getTe();
QFont font = te->getVTFont();
int size = font.pointSize();
int closest = delta > 0? 10000 : -10000;
int closest_font = -1;
for(uint i = 0; i < fonts.count(); i++)
{
if (fonts.at(i)->getFont() == font)
{
if (delta > 0)
{
if (i+1 < fonts.count()
&& fonts.at(i+1)->getFamilyNum() == fonts.at(i)->getFamilyNum())
{
setFont(i+1);
printf("font %d\n", i+1);
return;
}
}
else if (delta < 0)
{
if (i > 0
&& fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum())
{
setFont(i-1);
printf("font %d\n", i-1);
return;
}
}
}
int fsize = fonts.at(i)->getSize();
printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest);
if ((delta > 0 && fsize > size && fsize < closest)
|| (delta < 0 && fsize < size && fsize > closest))
{
closest = fsize;
closest_font = i;
}
}
if (closest_font >= 0)
{
printf("font closest %d (%d)\n", closest_font, closest);
setFont(closest_font);
}
}
int Konsole::findFont(const QString& name, int size, bool exactMatch)
{
for(uint i = 0; i < fonts.count(); i++)
{
if (fonts.at(i)->getName() == name
&& fonts.at(i)->getSize() == size)
{
return(i);
}
}
if (exactMatch)
{
return(-1);
}
for(uint i = 0; i < fonts.count(); i++)
{
if (fonts.at(i)->getSize() == size)
{
return(i);
}
}
return(-1);
}
void Konsole::setFont(int f)
{
VTFont* font = fonts.at(f);
if (font)
{
TEWidget* te = getTe();
if (te != 0)
{
te->setVTFont(font->getFont());
}
cfont = f;
int familyNum = font->getFamilyNum();
int size = font->getSize();
printf("familyNum = %d size = %d count=%d\n", familyNum, size,
fontList->count());
for(int i = 0; i < (int)fontList->count(); i++)
{
fontList->setItemChecked(i + 1000, i == familyNum);
}
for(int i = 0; i < (int)fonts.count(); i++)
{
fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum
&& fonts.at(i)->getSize() == size);
}
Config cfg( "Konsole" );
cfg.setGroup("Font");
QString ss = "Session"+ QString::number(tab->currentPageIndex()+1);
if (tab->currentPageIndex() == 0)
{
cfg.writeEntry("FontName", fonts.at(cfont)->getFamily());
cfg.writeEntry("FontSize", fonts.at(cfont)->getSize());
}
cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily());
cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize());
}
}
#if 0
void Konsole::fontChanged(int f)
{
VTFont* font = fonts.at(f);
if (font != 0)
{
for(uint i = 0; i < fonts.count(); i++)
{
fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
}
cfont = f;
TEWidget* te = getTe();
if (te != 0)
{
te->setVTFont(font->getFont());
}
}
}
#endif
void Konsole::enterCommand(int c)
{
TEWidget* te = getTe();
if (te != 0)
{
if(!commonCombo->editable())
{
QString text = commonCombo->text(c); //commonCmds[c];
te->emitText(text);
}
else
{
changeCommand( commonCombo->text(c), c);
}
}
}
void Konsole::hitEnter()
{
TEWidget* te = getTe();
if (te != 0)
{
te->emitText(QString("\r"));
}
}
void Konsole::hitSpace()
{
TEWidget* te = getTe();
if (te != 0)
{
te->emitText(QString(" "));
}
}
void Konsole::hitTab()
{
TEWidget* te = getTe();
if (te != 0)
{
te->emitText(QString("\t"));
}
}
void Konsole::hitPaste()
{
TEWidget* te = getTe();
if (te != 0)
{
te->pasteClipboard();
}
}
void Konsole::hitUp()
{
TEWidget* te = getTe();
if (te != 0)
{
QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0);
QApplication::sendEvent( te, &ke );
}
}
void Konsole::hitDown()
{
TEWidget* te = getTe();
if (te != 0)
{
QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0);
QApplication::sendEvent( te, &ke );
}
}
/**
This function calculates the size of the external widget
needed for the internal widget to be
*/
QSize Konsole::calcSize(int columns, int lines)
{
TEWidget* te = getTe();
if (te != 0)
{
QSize size = te->calcSize(columns, lines);
return size;
}
else
{
QSize size;
return size;
}
}
/**
sets application window to a size based on columns X lines of the te
guest widget. Call with (0,0) for setting default size.
*/
void Konsole::setColLin(int columns, int lines)
{
- qDebug("konsole::setColLin:: Columns %d", columns);
+ odebug << "konsole::setColLin:: Columns " << columns << "" << oendl;
if ((columns==0) || (lines==0))
{
if (defaultSize.isEmpty()) // not in config file : set default value
{
defaultSize = calcSize(80,24);
// notifySize(24,80); // set menu items (strange arg order !)
}
resize(defaultSize);
}
else
{
resize(calcSize(columns, lines));
// notifySize(lines,columns); // set menu items (strange arg order !)
}
}
/*
void Konsole::setFont(int fontno)
{
QFont f;
if (fontno == 0)
f = defaultFont = QFont( "Helvetica", 12 );
else
if (fonts[fontno][0] == '-')
f.setRawName( fonts[fontno] );
else
{
f.setFamily(fonts[fontno]);
f.setRawMode( TRUE );
}
if ( !f.exactMatch() && fontno != 0)
{
QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]);
QMessageBox(this, msg);
return;
}
if (se) se->setFontNo(fontno);
te->setVTFont(f);
n_font = fontno;
}
*/
// --| color selection |-------------------------------------------------------
void Konsole::changeColumns(int /*columns*/)
{ //FIXME this seems to cause silliness when reset command is executed
- // qDebug("change columns");
+ // odebug << "change columns" << oendl;
// TEWidget* te = getTe();
// if (te != 0) {
// setColLin(columns,te->Lines());
// te->update();
// }
}
//FIXME: If a child dies during session swap,
// this routine might be called before
// session swap is completed.
void Konsole::doneSession(TEWidget* te, int )
{
// TEWidget *te = NULL;
// if (sess->currentSession == tab->currentPage()) {
// printf("done current session\n");
// te = getTe();
// } else {
// int currentPage = tab->currentPageIndex();
// printf("done not current session\n");
// for(int i = 0; i < nsessions; i++) {
// tab->setCurrentPage(i);
// printf("find session %d tab page %x session %x\n",
// i, tab->currentPage(), sess->currentSession);
// if (tab->currentPage() == sess->currentSession) {
// printf("found session %d\n", i);
// te = tab->currentPage();
// break;
// }
// }
// tab->setCurrentPage(currentPage);
// }
if (te != 0)
{
te->currentSession->setConnect(FALSE);
tab->removeTab(te);
delete te->currentSession;
delete te;
sessionList->removeItem(nsessions);
nsessions--;
}
if (nsessions == 0)
{
close();
}
}
void Konsole::changeTitle(TEWidget* te, const QString& newTitle )
{
if (te == getTe())
{
setCaption( newTitle + " - " + tr( "Konsole " ) );
}
}
void Konsole::newSession()
{
if(nsessions < 15)
{ // seems to be something weird about 16 tabs on the Zaurus.... memory?
TEWidget* te = new TEWidget(tab);
Config cfg( "Konsole" );
cfg.setGroup("Menubar");
// FIXME use more defaults from config file
te->useBeep=cfg.readBoolEntry("useBeep",0);
// te->setBackgroundMode(PaletteBase); //we want transparent!!
cfg.setGroup("Font");
QString sn = "Session" + QString::number(nsessions+1);
printf("read font session %s\n", sn.latin1());
QString fontName = cfg.readEntry("FontName"+sn,
cfg.readEntry("FontName",
fonts.at(cfont)->getFamily()));
int fontSize = cfg.readNumEntry("FontSize"+sn,
cfg.readNumEntry("FontSize",
fonts.at(cfont)->getSize()));
cfont = findFont(fontName, fontSize, false);
printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont);
if (cfont < 0)
cfont = 0;
te->setVTFont(fonts.at(cfont)->getFont());
tab->addTab(te);
TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
te->currentSession = se;
connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) );
connect( se, SIGNAL(changeTitle(TEWidget*,const QString&)), this,
SLOT(changeTitle(TEWidget*,const QString&)) );
connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int)));
connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int)));
connect(te, SIGNAL(newSession()), this, SLOT(newSession()));
connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen()));
connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool)));
se->run();
se->setConnect(TRUE);
se->setHistory(b_scroll);
nsessions++;
sessionList->insertItem(QString::number(nsessions), nsessions);
sessionListSelected(nsessions);
doWrap();
setColor(nsessions-1);
}
}
TEWidget* Konsole::getTe()
{
if (nsessions)
{
return (TEWidget *) tab->currentPage();
}
else
{
return 0;
}
}
void Konsole::sessionListSelected(int id)
{
if (id < 0)
{
return;
}
QString selected = sessionList->text(id);
EKNumTabBar *tabBar = tab->getTabBar();
int n = 0;
for(int i = 0; n < tabBar->count(); i++)
{
if (tabBar->tab(i))
{
// printf("selected = %s tab %d = %s\n", selected.latin1(),
// i, tabBar->tab(i)->text().latin1());
if (tabBar->tab(i)->text() == selected)
{
tab->setCurrentPage(i);
break;
}
n++;
}
}
}
void Konsole::changeSession(int delta)
{
printf("delta session %d\n", delta);
QTabBar *tabBar = tab->getTabBar();
int i = tabBar->tab(tabBar->currentTab())->text().toInt() - 1;
i += delta;
if (i < 0)
i += tabBar->count();
if (i >= tabBar->count())
i -= tabBar->count();
QString selected = QString::number(i+1);
int n = 0;
for(int i = 0; n < tabBar->count(); i++)
{
if (tabBar->tab(i))
{
printf("selected = %s tab %d = %s\n", selected.latin1(),
i, tabBar->tab(i)->text().latin1());
if (tabBar->tab(i)->text() == selected)
{
tab->setCurrentPage(i);
break;
}
n++;
}
}
}
void Konsole::switchSession(QWidget* w)
{
TEWidget* te = (TEWidget *) w;
QFont teFnt = te->getVTFont();
int familyNum = -1;
for(uint i = 0; i < fonts.count(); i++)
{
VTFont *fnt = fonts.at(i);
bool cf = fnt->getFont() == teFnt;
fontList->setItemChecked(i, cf);
if (cf)
{
cfont = i;
familyNum = fnt->getFamilyNum();
}
}
for(int i = 0; i < (int)fontList->count(); i++)
{
fontList->setItemChecked(i + 1000, i == familyNum);
}
if (! te->currentSession->Title().isEmpty() )
{
setCaption( te->currentSession->Title() + " - " + tr( "Konsole" ) );
}
else
{
setCaption( tr( "Konsole" ) );
}
// colorMenuSelected(te->color_menu_item);
}
void Konsole::toggleFullScreen()
{
setFullScreen(! fullscreen);
}
void Konsole::setFullScreen ( bool b )
{
static QSize normalsize;
static bool listHidden;
if (b == fullscreen)
{
return;
}
fullscreen = b;
if ( b )
{
if ( !normalsize. isValid ( ))
{
normalsize = size ( );
}
setFixedSize ( qApp-> desktop ( )-> size ( ));
showNormal ( );
reparent ( 0, WStyle_Customize | WStyle_NoBorder,
QPoint ( 0, 0 ));
showFullScreen ( );
menuToolBar->hide();
toolBar->hide();
listHidden = secondToolBar->isHidden();
secondToolBar->hide();
// commonCombo->hide();
tab->getTabBar()->hide();
tab->setMargin(tab->margin());
if (show_fullscreen_msg)
{
fullscreen_msg-> move(tab->x() + tab->width()/2 - fullscreen_msg->width()/2,
qApp->desktop()->height()/16 - fullscreen_msg->height()/2);
fullscreen_msg->show();
fullscreen_timer->start(3000, true);
show_fullscreen_msg = false;
}
}
else
{
showNormal ( );
reparent ( 0, WStyle_Customize, QPoint ( 0, 0 ));
resize ( normalsize );
showMaximized ( );
normalsize = QSize ( );
menuToolBar->show();
toolBar->show();
if(! listHidden)
{
secondToolBar->show();
}
// commonCombo->show();
menuToolBar->show();
if (tabPos != tm_hidden)
{
tab->getTabBar()->show();
}
}
tab->setMargin(tab->margin()); // cause setup to run
}
void Konsole::fullscreenTimeout()
{
fullscreen_msg->hide();
}
void Konsole::colorMenuIsSelected(int iD)
{
fromMenu = TRUE;
colorMenuSelected(iD);
}
/// ------------------------------- some new stuff by L.J. Potter
void Konsole::colorMenuSelected(int iD)
{
// this is NOT pretty, elegant or anything else besides functional
// QString temp;
- // qDebug( temp.sprintf("colormenu %d", iD));
+ // odebug << temp.sprintf("colormenu " << iD) << "" << oendl;
TEWidget* te = getTe();
Config cfg( "Konsole" );
cfg.setGroup("Colors");
ColorEntry m_table[TABLE_COLORS];
const ColorEntry * defaultCt=te->getdefaultColorTable();
int i;
// te->color_menu_item = iD;
colorMenu->setItemChecked(cm_ab,FALSE);
colorMenu->setItemChecked(cm_bb,FALSE);
colorMenu->setItemChecked(cm_wc,FALSE);
colorMenu->setItemChecked(cm_cw,FALSE);
colorMenu->setItemChecked(cm_mb,FALSE);
colorMenu->setItemChecked(cm_bm,FALSE);
colorMenu->setItemChecked(cm_gy,FALSE);
colorMenu->setItemChecked(cm_rb,FALSE);
colorMenu->setItemChecked(cm_br,FALSE);
colorMenu->setItemChecked(cm_wb,FALSE);
colorMenu->setItemChecked(cm_bw,FALSE);
colorMenu->setItemChecked(cm_gb,FALSE);
if(iD==cm_default)
{ // default default
printf("default colors\n");
for (i = 0; i < TABLE_COLORS; i++)
{
m_table[i].color = defaultCt[i].color;
if(i==1 || i == 11)
m_table[i].transparent=1;
colorMenu->setItemChecked(cm_default,TRUE);
}
te->setColorTable(m_table);
}
if(iD==cm_gb)
{ // green black
foreground.setRgb(100,255,100); // (0x18,255,0x18);
background.setRgb(0x00,0x00,0x00);
colorMenu->setItemChecked(cm_gb,TRUE);
}
if(iD==cm_bw)
{ // black white
foreground.setRgb(0x00,0x00,0x00);
background.setRgb(0xFF,0xFF,0xFF);
colorMenu->setItemChecked(cm_bw,TRUE);
}
if(iD==cm_wb)
{ // white black
foreground.setRgb(0xFF,0xFF,0xFF);
background.setRgb(0x00,0x00,0x00);
colorMenu->setItemChecked(cm_wb,TRUE);
}
if(iD==cm_br)
{// Black, Red
foreground.setRgb(0x00,0x00,0x00);
background.setRgb(255,85,85); //(0xB2,0x18,0x18);
colorMenu->setItemChecked(cm_br,TRUE);
}
if(iD==cm_rb)
{// Red, Black
foreground.setRgb(255,85,85);
background.setRgb(0x00,0x00,0x00);
colorMenu->setItemChecked(cm_rb,TRUE);
}
if(iD==cm_gy)
{// Green, Yellow - is ugly
// foreground.setRgb(0x18,0xB2,0x18);
foreground.setRgb(15,115,0);
// background.setRgb(0xB2,0x68,0x18);
background.setRgb(255,255,0);
colorMenu->setItemChecked(cm_gy,TRUE);
}
if(iD==cm_bm)
{// Blue, Magenta
foreground.setRgb(3,24,132);
background.setRgb(225,2,255);
colorMenu->setItemChecked(cm_bm,TRUE);
}
if(iD==cm_mb)
{// Magenta, Blue
foreground.setRgb(225,2,255);
background.setRgb(3,24,132);
colorMenu->setItemChecked(cm_mb,TRUE);
}
if(iD==cm_cw)
{// Cyan, White
foreground.setRgb(8,91,129);
background.setRgb(0xFF,0xFF,0xFF);
colorMenu->setItemChecked(cm_cw,TRUE);
}
if(iD==cm_wc)
{// White, Cyan
background.setRgb(8,91,129);
foreground.setRgb(0xFF,0xFF,0xFF);
colorMenu->setItemChecked(cm_wc,TRUE);
}
if(iD==cm_bb)
{// Black, Blue
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(127,147,225);
colorMenu->setItemChecked(cm_bb,TRUE);
}
if(iD==cm_ab)
{// Black, Gold
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(255,215,105);
colorMenu->setItemChecked(cm_ab,TRUE);
}
#ifdef QT_QWS_OPIE
if(iD==-19)
{
// Custom
- qDebug("do custom");
+ odebug << "do custom" << oendl;
if(fromMenu)
{
Opie::OColorPopupMenu* penColorPopupMenu = new Opie::OColorPopupMenu(Qt::black, this, "foreground color");
connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
SLOT(changeForegroundColor(const QColor&)));
penColorPopupMenu->exec();
}
if(!fromMenu)
{
foreground.setNamedColor(cfg.readEntry("foreground",""));
background.setNamedColor(cfg.readEntry("background",""));
}
fromMenu=FALSE;
colorMenu->setItemChecked(-19,TRUE);
}
#endif
lastSelectedMenu = iD;
setColors(foreground, background);
QTabBar *tabBar = tab->getTabBar();
QString ss = QString("Session%1").arg(tabBar->currentTab());
// printf("current tab = %d\n", tabBar->currentTab());
if (tabBar->currentTab() == 0)
{
cfg.writeEntry("foregroundRed",QString::number(foreground.red()));
cfg.writeEntry("foregroundGreen",QString::number(foreground.green()));
cfg.writeEntry("foregroundBlue",QString::number(foreground.blue()));
cfg.writeEntry("backgroundRed",QString::number(background.red()));
cfg.writeEntry("backgroundGreen",QString::number(background.green()));
cfg.writeEntry("backgroundBlue",QString::number(background.blue()));
}
cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red()));
cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green()));
cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue()));
cfg.writeEntry("backgroundRed"+ss,QString::number(background.red()));
cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green()));
cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue()));
update();
}
void Konsole::setColors(QColor foreground, QColor background)
{
int i;
ColorEntry m_table[TABLE_COLORS];
TEWidget* te = getTe();
const ColorEntry * defaultCt=te->getdefaultColorTable();
for (i = 0; i < TABLE_COLORS; i++)
{
if(i==0 || i == 10)
{
m_table[i].color = foreground;
}
else if(i==1 || i == 11)
{
m_table[i].color = background;
m_table[i].transparent=0;
}
else
m_table[i].color = defaultCt[i].color;
}
te->setColorTable(m_table);
}
void Konsole::tabMenuSelected(int id)
{
Config cfg( "Konsole" );
cfg.setGroup("Tabs");
tabMenu->setItemChecked(tabPos, false);
if (id == tm_bottom)
{
printf("set bottom tab\n");
tab->getTabBar()->show();
tab->setTabPosition(QTabWidget::Bottom);
tab->getTabBar()->show();
cfg.writeEntry("Position","Bottom");
}
else if (id == tm_top)
{
printf("set top tab\n");
tab->getTabBar()->show();
tab->setTabPosition(QTabWidget::Bottom);
tab->setTabPosition(QTabWidget::Top);
tab->getTabBar()->show();
cfg.writeEntry("Position","Top");
}
else if (id == tm_hidden)
{
tab->getTabBar()->hide();
tab->setMargin(tab->margin());
cfg.writeEntry("Position","Hidden");
}
tabMenu->setItemChecked(id, true);
tabPos = id;
}
void Konsole::configMenuSelected(int iD)
{
// QString temp;
- // qDebug( temp.sprintf("configmenu %d",iD));
+ // odebug << temp.sprintf("configmenu " << iD) << "" << oendl;
TEWidget* te = getTe();
Config cfg( "Konsole" );
cfg.setGroup("Menubar");
if(iD == cm_wrap)
{
cfg.setGroup("ScrollBar");
bool b=cfg.readBoolEntry("HorzScroll",0);
b=!b;
cfg.writeEntry("HorzScroll", b );
cfg.write();
doWrap();
if(cfg.readNumEntry("Position",2) == 0)
{
te->setScrollbarLocation(1);
}
else
{
te->setScrollbarLocation(0);
}
te->setScrollbarLocation( cfg.readNumEntry("Position",2));
}
if(iD == cm_beep)
{
cfg.setGroup("Menubar");
bool b=cfg.readBoolEntry("useBeep",0);
b=!b;
cfg.writeEntry("useBeep", b );
cfg.write();
configMenu->setItemChecked(cm_beep,b);
te->useBeep=b;
}
}
void Konsole::changeCommand(const QString &text, int c)
{
Config cfg( "Konsole" );
cfg.setGroup("Commands");
if(commonCmds[c] != text)
{
cfg.writeEntry(QString::number(c),text);
commonCombo->clearEdit();
commonCombo->setCurrentItem(c);
}
}
void Konsole::setColor(int sess)
{
Config cfg( "Konsole" );
cfg.setGroup("Colors");
QColor foreground, background;
QString ss = QString("Session") + QString::number(sess);
foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss,
cfg.readNumEntry("foregroundRed",0xff)),
cfg.readNumEntry("foregroundGreen"+ss,
cfg.readNumEntry("foregroundGreen",0xff)),
cfg.readNumEntry("foregroundBlue"+ss,
cfg.readNumEntry("foregroundBlue",0xff)));
background.setRgb(cfg.readNumEntry("backgroundRed"+ss,
cfg.readNumEntry("backgroundRed",0)),
cfg.readNumEntry("backgroundGreen"+ss,
cfg.readNumEntry("backgroundGreen",0)),
cfg.readNumEntry("backgroundBlue"+ss,
cfg.readNumEntry("backgroundBlue",0)));
setColors(foreground, background);
}
void Konsole::scrollMenuSelected(int index)
{
- // qDebug( "scrollbar menu %d",index);
+ // odebug << "scrollbar menu " << index << "" << oendl;
TEWidget* te = getTe();
Config cfg( "Konsole" );
cfg.setGroup("ScrollBar");
if(index == sm_none)
{
te->setScrollbarLocation(0);
cfg.writeEntry("Position",0);
}
else if(index == sm_left)
{
te->setScrollbarLocation(1);
cfg.writeEntry("Position",1);
}
else if(index == sm_right)
{
te->setScrollbarLocation(2);
cfg.writeEntry("Position",2);
}
scrollMenu->setItemChecked(sm_none, index == sm_none);
scrollMenu->setItemChecked(sm_left, index == sm_left);
scrollMenu->setItemChecked(sm_right, index == sm_right);
}
// case -29: {
// bool b=cfg.readBoolEntry("HorzScroll",0);
// cfg.writeEntry("HorzScroll", !b );
// cfg.write();
// if(cfg.readNumEntry("Position",2) == 0) {
// te->setScrollbarLocation(1);
// te->setWrapAt(0);
// } else {
// te->setScrollbarLocation(0);
// te->setWrapAt(120);
// }
// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
// }
// break;
void Konsole::editCommandListMenuSelected(int iD)
{
// QString temp;
- // qDebug( temp.sprintf("edit command list %d",iD));
+ // odebug << temp.sprintf("edit command list " << iD) << "" << oendl;
// FIXME: more cleanup needed here
TEWidget* te = getTe();
Config cfg( "Konsole" );
cfg.setGroup("Menubar");
if( iD == ec_cmdlist)
{
if(!secondToolBar->isHidden())
{
secondToolBar->hide();
configMenu->changeItem( iD,tr( "Show Command List" ));
cfg.writeEntry("Hidden","TRUE");
configMenu->setItemEnabled(ec_edit ,FALSE);
configMenu->setItemEnabled(ec_quick ,FALSE);
}
else
{
secondToolBar->show();
configMenu->changeItem( iD,tr( "Hide Command List" ));
cfg.writeEntry("Hidden","FALSE");
configMenu->setItemEnabled(ec_edit ,TRUE);
configMenu->setItemEnabled(ec_quick ,TRUE);
if(cfg.readEntry("EditEnabled","FALSE")=="TRUE")
{
configMenu->setItemChecked(ec_edit,TRUE);
commonCombo->setEditable( TRUE );
}
else
{
configMenu->setItemChecked(ec_edit,FALSE);
commonCombo->setEditable( FALSE );
}
}
}
if( iD == ec_quick)
{
cfg.setGroup("Commands");
- // qDebug("enableCommandEdit");
+ // odebug << "enableCommandEdit" << oendl;
if( !configMenu->isItemChecked(iD) )
{
commonCombo->setEditable( TRUE );
configMenu->setItemChecked(iD,TRUE);
commonCombo->setCurrentItem(0);
cfg.writeEntry("EditEnabled","TRUE");
}
else
{
commonCombo->setEditable( FALSE );
configMenu->setItemChecked(iD,FALSE);
cfg.writeEntry("EditEnabled","FALSE");
commonCombo->setFocusPolicy(QWidget::NoFocus);
te->setFocus();
}
}
if(iD == ec_edit)
{
// "edit commands"
CommandEditDialog *m = new CommandEditDialog(this);
connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList()));
m->showMaximized();
}
}
// $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V'
void Konsole::setDocument( const QString &cmd)
{
newSession();
TEWidget* te = getTe();
if(cmd.find("-e", 0, TRUE) != -1)
{
QString cmd2;
cmd2=cmd.right(cmd.length()-3)+" &";
system(cmd2.latin1());
if(startUp <= 1 && nsessions < 2)
{
doneSession(getTe(), 0);
exit(0);
}
else
doneSession(getTe(), 0);
}
else
{
if (te != 0)
{
te->emitText(cmd+"\r");
}
}
startUp++;
}
// what is the point of this when you can just
// run commands by using the shell directly??
void Konsole::parseCommandLine()
{
QString cmd;
// newSession();
for (int i=1;i< qApp->argc();i++)
{
if( QString(qApp->argv()[i]) == "-e")
{
i++;
for ( int j=i;j< qApp->argc();j++)
{
cmd+=QString(qApp->argv()[j])+" ";
}
cmd.stripWhiteSpace();
system(cmd.latin1());
exit(0);//close();
} // end -e switch
}
startUp++;
}
void Konsole::changeForegroundColor(const QColor &color)
{
Config cfg( "Konsole" );
cfg.setGroup("Colors");
int r, g, b;
color.rgb(&r,&g,&b);
foreground.setRgb(r,g,b);
cfg.writeEntry("foreground",color.name());
- qDebug("foreground "+color.name());
+ odebug << "foreground "+color.name() << oendl;
cfg.write();
- qDebug("do other dialog");
+ odebug << "do other dialog" << oendl;
#ifdef QT_QWS_OPIE
Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color");
connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
SLOT(changeBackgroundColor(const QColor&)));
penColorPopupMenu2->exec();
#endif
}
void Konsole::changeBackgroundColor(const QColor &color)
{
- qDebug("Change background");
+ odebug << "Change background" << oendl;
Config cfg( "Konsole" );
cfg.setGroup("Colors");
int r, g, b;
color.rgb(&r,&g,&b);
background.setRgb(r,g,b);
cfg.writeEntry("background",color.name());
- qDebug("background "+color.name());
+ odebug << "background "+color.name() << oendl;
cfg.write();
}
void Konsole::doWrap()
{
Config cfg( "Konsole" );
cfg.setGroup("ScrollBar");
TEWidget* te = getTe();
if( !cfg.readBoolEntry("HorzScroll",0))
{
te->setWrapAt(0);
configMenu->setItemChecked( cm_wrap,TRUE);
}
else
{
// te->setWrapAt(90);
te->setWrapAt(120);
configMenu->setItemChecked( cm_wrap,FALSE);
}
}
diff --git a/core/apps/embeddedkonsole/main.cpp b/core/apps/embeddedkonsole/main.cpp
index b851d3e..131e782 100644
--- a/core/apps/embeddedkonsole/main.cpp
+++ b/core/apps/embeddedkonsole/main.cpp
@@ -1,85 +1,85 @@
/* ---------------------------------------------------------------------- */
/* */
/* [main.C] Konsole */
/* */
/* ---------------------------------------------------------------------- */
/* */
/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
/* */
/* This file is part of Konsole, an X terminal. */
/* */
/* The material contained in here more or less directly orginates from */
/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
/* */
/* ---------------------------------------------------------------------- */
/* */
/* Ported Konsole to Qt/Embedded */
/* */
/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
/* */
/* -------------------------------------------------------------------------- */
#include "konsole.h"
#ifdef QT_QWS_OPIE
#include <opie2/oapplicationfactory.h>
/* --| main |------------------------------------------------------ */
using namespace Opie::Core;
OPIE_EXPORT_APP( OApplicationFactory<Konsole> )
#else //for non opie builds
#include <qpe/qpeapplication.h>
#include <qfile.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <sys/types.h>
/* --| main |------------------------------------------------------ */
int main(int argc, char* argv[]) {
- if(setuid(getuid()) !=0) qDebug("setuid failed");
- if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges
+ if(setuid(getuid()) !=0) odebug << "setuid failed" << oendl;
+ if(setgid(getgid()) != 0) odebug << "setgid failed" << oendl; // drop privileges
QPEApplication a( argc, argv );
#ifdef FAKE_CTRL_AND_ALT
- qDebug("Fake Ctrl and Alt defined");
+ odebug << "Fake Ctrl and Alt defined" << oendl;
QPEApplication::grabKeyboard(); // for CTRL and ALT
#endif
QStrList tmp;
const char* shell = getenv("SHELL");
if (shell == NULL || *shell == '\0') {
struct passwd *ent = 0;
uid_t me = getuid();
shell = "/bin/sh";
while ( (ent = getpwent()) != 0 ) {
if (ent->pw_uid == me) {
if (ent->pw_shell != "")
shell = ent->pw_shell;
break;
}
}
endpwent();
}
if( putenv((char*)"COLORTERM=") !=0)
- qDebug("putenv failed"); // to trigger mc's color detection
+ odebug << "putenv failed" << oendl; // to trigger mc's color detection
Konsole m( "test", shell, tmp, TRUE );
m.setCaption( Konsole::tr("Terminal") );
a.showMainWidget( &m );
return a.exec();
}
#endif
diff --git a/core/apps/embeddedkonsole/playlistselection.cpp b/core/apps/embeddedkonsole/playlistselection.cpp
index fc5330f..096d36a 100644
--- a/core/apps/embeddedkonsole/playlistselection.cpp
+++ b/core/apps/embeddedkonsole/playlistselection.cpp
@@ -1,154 +1,157 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <qheader.h>
#include "playlistselection.h"
-#include <stdlib.h>
-
+/* OPIE */
+#include <opie2/odebug.h>
+/* Qt */
+#include <qheader.h>
+/* STD */
+#include <stdlib.h>
PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
: QListView( parent, name )
{
setAllColumnsShowFocus( TRUE );
addColumn( tr( "Command Selection" ) );
header()->hide();
setSorting( -1, FALSE );
}
PlayListSelection::~PlayListSelection() {
}
void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
if ( event->state() == QMouseEvent::LeftButton ) {
QListViewItem *currentItem = selectedItem();
QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
if ( currentItem && currentItem->itemAbove() == itemUnder )
moveSelectedUp();
else if ( currentItem && currentItem->itemBelow() == itemUnder )
moveSelectedDown();
}
}
const QString *PlayListSelection::current() {
PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
if ( item )
return item->file();
return NULL;
}
void PlayListSelection::addToSelection( QListViewItem *lnk ) {
PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) );
QListViewItem *current = selectedItem();
if ( current )
item->moveItem( current );
setSelected( item, TRUE );
ensureItemVisible( selectedItem() );
}
void PlayListSelection::addStringToSelection (const QString & lnk) {
PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) );
QListViewItem *current = selectedItem();
if ( current )
item->moveItem( current );
setSelected( item, TRUE );
ensureItemVisible( selectedItem() );
}
void PlayListSelection::removeSelected() {
- qDebug("removeSelected()");
+ odebug << "removeSelected()" << oendl;
QListViewItem *item = selectedItem();
if ( item )
delete item;
setSelected( currentItem(), TRUE );
ensureItemVisible( selectedItem() );
}
void PlayListSelection::moveSelectedUp() {
QListViewItem *item = selectedItem();
if ( item && item->itemAbove() )
item->itemAbove()->moveItem( item );
ensureItemVisible( selectedItem() );
}
void PlayListSelection::moveSelectedDown() {
QListViewItem *item = selectedItem();
if ( item && item->itemBelow() )
item->moveItem( item->itemBelow() );
ensureItemVisible( selectedItem() );
}
bool PlayListSelection::prev() {
QListViewItem *item = selectedItem();
if ( item && item->itemAbove() )
setSelected( item->itemAbove(), TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
bool PlayListSelection::next() {
QListViewItem *item = selectedItem();
if ( item && item->itemBelow() )
setSelected( item->itemBelow(), TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
bool PlayListSelection::first() {
QListViewItem *item = firstChild();
if ( item )
setSelected( item, TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
bool PlayListSelection::last() {
QListViewItem *prevItem = NULL;
QListViewItem *item = firstChild();
while ( ( item = item->nextSibling() ) )
prevItem = item;
if ( prevItem )
setSelected( prevItem, TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}