summaryrefslogtreecommitdiff
path: root/core
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 /core
parent4e7ab937501b6495ce5635a7515e66a75e04d37e (diff)
downloadopie-34f1234b010fa80f9ca06e65f46130713f7362d9.zip
opie-34f1234b010fa80f9ca06e65f46130713f7362d9.tar.gz
opie-34f1234b010fa80f9ca06e65f46130713f7362d9.tar.bz2
- convert qDebug to odebug
Diffstat (limited to 'core') (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
@@ -40,65 +40,65 @@
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
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
@@ -912,65 +912,65 @@ int TEWidget::charClass(char ch) const
// 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()),
@@ -999,104 +999,104 @@ void TEWidget::onClearSelection()
// 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
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
@@ -122,70 +122,70 @@ 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,63 +1,64 @@
/* ---------------------------------------------------------------------- */
/* */
/* [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()
{
@@ -175,142 +176,142 @@ static const char *commonCmds[] =
"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)
{
@@ -484,65 +485,65 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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();
@@ -1038,113 +1039,113 @@ void Konsole::hitDown()
{
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);
// }
@@ -1384,65 +1385,65 @@ void Konsole::setFullScreen ( bool b )
{
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)
@@ -1500,65 +1501,65 @@ void Konsole::colorMenuSelected(int iD)
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()));
@@ -1605,65 +1606,65 @@ void Konsole::tabMenuSelected(int id)
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;
}
@@ -1675,150 +1676,150 @@ void Konsole::changeCommand(const QString &text, int c)
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)
@@ -1848,76 +1849,76 @@ void Konsole::setDocument( const QString &cmd)
// 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
@@ -16,70 +16,70 @@
/* 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,116 +1,119 @@
/**********************************************************************
** 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;