summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-01 18:27:20 (UTC)
committer llornkcor <llornkcor>2002-02-01 18:27:20 (UTC)
commit96f799b935cda52dfed323cadb9025ba1ae737df (patch) (side-by-side diff)
treea171ad37eed9bfb8619e8c524f4311a9abc3f4f1
parent4ffeffe4e91867dca42c02ddc5521d4182cabbb6 (diff)
downloadopie-96f799b935cda52dfed323cadb9025ba1ae737df.zip
opie-96f799b935cda52dfed323cadb9025ba1ae737df.tar.gz
opie-96f799b935cda52dfed323cadb9025ba1ae737df.tar.bz2
enabled fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index f3f0c29..efcb1f2 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -7,164 +7,166 @@
/* 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 <qpe/resource.h>
#include <qdir.h>
#include <qevent.h>
#include <qdragobject.h>
#include <qobjectlist.h>
#include <qtoolbutton.h>
#include <qpe/qpetoolbar.h>
#include <qpushbutton.h>
#include <qfontdialog.h>
#include <qglobal.h>
#include <qpainter.h>
#include <qpe/qpemenubar.h>
#include <qmessagebox.h>
#include <qaction.h>
#include <qapplication.h>
#include <qfontmetrics.h>
#include <qcombobox.h>
#include <qevent.h>
#include <qtabwidget.h>
#include <qtabbar.h>
#include <qpe/config.h>
#include <qstringlist.h>
#include <qpalette.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "konsole.h"
#include "keytrans.h"
+
class EKNumTabBar : public QTabBar {
public:
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();
}
}
}
};
class EKNumTabWidget : public QTabWidget {
public:
EKNumTabWidget(QWidget* parent) : QTabWidget(parent)
{
}
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 ",
"cp ",
"dc ",
"df ",
"dmesg",
"echo ",
"find ",
"free",
"grep ",
"ifconfig ",
"ipkg ",
"mkdir ",
"mv ",
"nc localhost 7776",
"nc localhost 7777",
+ "netstat ",
"nslookup ",
"ping ",
"ps aux",
"pwd ",
"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
};
Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
QMainWindow(parent, name, fl)
{
QStrList args;
init("/bin/sh",args);
}
Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
: QMainWindow(0, name)
@@ -656,97 +658,97 @@ void Konsole::colorMenuSelected(int iD)
foreground.setRgb(0xFF,0xFF,0xFF);
cfg.writeEntry("Schema","15");
colorMenu->setItemChecked(-15,TRUE);
}
if(iD==-16) {// Black, Blue
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(0x18,0xB2,0xB2);
cfg.writeEntry("Schema","16");
colorMenu->setItemChecked(-16,TRUE);
}
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;
}
}
lastSelectedMenu = iD;
te->setColorTable(m_table);
update();
}
void Konsole::configMenuSelected(int iD)
{
// QString temp;
// temp.sprintf("%d",iD);
// qDebug(temp);
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
if( iD == -2) {
if(!secondToolBar->isHidden()) {
secondToolBar->hide();
configMenu->changeItem( iD,"Show Command List");
cfg.writeEntry("Hidden","TRUE");
configMenu->setItemEnabled(-20 ,FALSE);
} else {
secondToolBar->show();
configMenu->changeItem( iD,"Hide Command List");
cfg.writeEntry("Hidden","FALSE");
configMenu->setItemEnabled(-20 ,TRUE);
if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
- configMenu->setItemChecked(-16,TRUE);
+ configMenu->setItemChecked(-20,TRUE);
commonCombo->setEditable( TRUE );
} else {
configMenu->setItemChecked(-20,FALSE);
commonCombo->setEditable( FALSE );
}
}
}
if( iD == -3) {
cfg.setGroup("Tabs");
QString tmp=cfg.readEntry("Position","Top");
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->changeItem( iD,"Tabs on Top");
cfg.writeEntry("Position","Bottom");
} else {
tab->setTabPosition(QTabWidget::Top);
configMenu->changeItem( iD,"Tabs on Bottom");
cfg.writeEntry("Position","Top");
}
}
if( iD == -20) {
cfg.setGroup("Commands");
// qDebug("enableCommandEdit");
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();
}
}
}
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);
}