summaryrefslogtreecommitdiff
path: root/core/apps
Side-by-side diff
Diffstat (limited to 'core/apps') (more/less context) (ignore whitespace changes)
-rwxr-xr-xcore/apps/embeddedkonsole/embeddedkonsole.pro1
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp21
2 files changed, 13 insertions, 9 deletions
diff --git a/core/apps/embeddedkonsole/embeddedkonsole.pro b/core/apps/embeddedkonsole/embeddedkonsole.pro
index bfa16a2..913cb89 100755
--- a/core/apps/embeddedkonsole/embeddedkonsole.pro
+++ b/core/apps/embeddedkonsole/embeddedkonsole.pro
@@ -13,40 +13,41 @@ HEADERS = TEWidget.h \
keytrans.h \
konsole.h \
commandeditdialog.h \
commandeditwidget.h \
playlistselection.h \
MyPty.h
SOURCES = TEScreen.cpp \
TEWidget.cpp \
TEHistory.cpp \
TEmulation.cpp \
TEmuVt102.cpp \
session.cpp \
keytrans.cpp \
konsole.cpp \
commandeditdialog.cpp \
commandeditwidget.cpp \
playlistselection.cpp \
MyPty.cpp \
main.cpp
INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
TARGET = embeddedkonsole
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
+TMAKE_CXXFLAGS += -DQT_QWS_OPIE
TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \
../../../i18n/en/embeddedkonsole.ts \
../../../i18n/es/embeddedkonsole.ts \
../../../i18n/fr/embeddedkonsole.ts \
../../../i18n/hu/embeddedkonsole.ts \
../../../i18n/ja/embeddedkonsole.ts \
../../../i18n/ko/embeddedkonsole.ts \
../../../i18n/no/embeddedkonsole.ts \
../../../i18n/pl/embeddedkonsole.ts \
../../../i18n/pt/embeddedkonsole.ts \
../../../i18n/pt_BR/embeddedkonsole.ts \
../../../i18n/sl/embeddedkonsole.ts \
../../../i18n/zh_CN/embeddedkonsole.ts \
../../../i18n/zh_TW/embeddedkonsole.ts \
../../../i18n/it/embeddedkonsole.ts
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index ebff05e..4480fe2 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -1,82 +1,82 @@
/* ---------------------------------------------------------------------- */
/* */
/* [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>
-#define QWS_QT_OPIE
+//#define QT_QWS_OPIE
#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"
#include "commandeditdialog.h"
-#ifdef QWS_QT_OPIE
+#ifdef QT_QWS_OPIE
#include <opie/colorpopupmenu.h>
#endif
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();
@@ -275,49 +275,49 @@ void Konsole::init(const char* _pgm, QStrList & _args)
tmp=cfg.readEntry("Position","Bottom");
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Top);
configMenu->insertItem( tr( "Tabs on Bottom" ) );
} else {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->insertItem("Tabs on Top");
}
configMenu->insertSeparator(2);
colorMenu->insertItem(tr( "Green on Black"));
colorMenu->insertItem(tr( "Black on White"));
colorMenu->insertItem(tr( "White on Black"));
colorMenu->insertItem(tr( "Black on Transparent"));
colorMenu->insertItem(tr( "Black on Red"));
colorMenu->insertItem(tr( "Red on Black"));
colorMenu->insertItem(tr( "Green on Yellow"));
colorMenu->insertItem(tr( "Blue on Magenta"));
colorMenu->insertItem(tr( "Magenta on Blue"));
colorMenu->insertItem(tr( "Cyan on White"));
colorMenu->insertItem(tr( "White on Cyan"));
colorMenu->insertItem(tr( "Blue on Black"));
colorMenu->insertItem(tr( "Amber on Black"));
-#ifdef QWS_QT_OPIE
+#ifdef QT_QWS_OPIE
colorMenu->insertItem(tr( "Custom"));
#endif
configMenu->insertItem(tr( "Colors") ,colorMenu);
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( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
menuBar->insertItem( tr("Font"), fontList );
menuBar->insertItem( tr("Options"), configMenu );
QPEToolBar *toolbar = new QPEToolBar( this );
QAction *a;
// Button Commands
a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); 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 );
@@ -349,50 +349,53 @@ void Konsole::init(const char* _pgm, QStrList & _args)
}
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) ));
scrollMenu->insertItem(tr( "None" ));
scrollMenu->insertItem(tr( "Left" ));
scrollMenu->insertItem(tr( "Right" ));
// scrollMenu->insertSeparator(4);
// scrollMenu->insertItem(tr( "Horizontal" ));
configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
- configMenu->insertItem(tr( "Wrap" ));
- int jut = configMenu->insertItem(tr( "Use Beep" ));
+ int jut = configMenu->insertItem(tr( "Wrap" ));
+ cfg.setGroup("ScrollBar");
+ configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0));
+
+ jut = configMenu->insertItem(tr( "Use Beep" ));
cfg.setGroup("Menubar");
configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0));
//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 );
}
@@ -732,93 +735,93 @@ void Konsole::colorMenuSelected(int iD)
if(iD==-15) {// Cyan, White
foreground.setRgb(0x18,0xB2,0xB2);
background.setRgb(0xFF,0xFF,0xFF);
cfg.writeEntry("Schema","15");
colorMenu->setItemChecked(-15,TRUE);
}
if(iD==-16) {// White, Cyan
background.setRgb(0x18,0xB2,0xB2);
foreground.setRgb(0xFF,0xFF,0xFF);
cfg.writeEntry("Schema","16");
colorMenu->setItemChecked(-16,TRUE);
}
if(iD==-17) {// Black, Blue
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(0x18,0xB2,0xB2);
cfg.writeEntry("Schema","17");
colorMenu->setItemChecked(-17,TRUE);
}
if(iD==-18) {// Black, Gold
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(255,215,0);
cfg.writeEntry("Schema","18");
colorMenu->setItemChecked(-18,TRUE);
}
-#ifdef QWS_QT_OPIE
+#ifdef QT_QWS_OPIE
if(iD==-19) {
// Custom
qDebug("do custom");
if(fromMenu) {
ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color");
connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
SLOT(changeForegroundColor(const QColor&)));
penColorPopupMenu->exec();
}
cfg.writeEntry("Schema","19");
if(!fromMenu) {
foreground.setNamedColor(cfg.readEntry("foreground",""));
background.setNamedColor(cfg.readEntry("background",""));
}
fromMenu=FALSE;
colorMenu->setItemChecked(-19,TRUE);
}
#endif
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;
// qDebug( temp.sprintf("configmenu %d",iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
int i,j;
-#ifdef QWS_QT_OPIE
+#ifdef QT_QWS_OPIE
i=-29;j=-30;
#else
i=-28;j=-29;
#endif
if(iD == -4) {
cfg.setGroup("Tabs");
QString tmp=cfg.readEntry("Position","Bottom");
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 == i) {
cfg.setGroup("ScrollBar");
bool b=cfg.readBoolEntry("HorzScroll",0);
b=!b;
cfg.writeEntry("HorzScroll", b );
@@ -979,66 +982,66 @@ void Konsole::parseCommandLine() {
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());
cfg.write();
qDebug("do other dialog");
-#ifdef QWS_QT_OPIE
+#ifdef QT_QWS_OPIE
ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(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");
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());
cfg.write();
}
void Konsole::doWrap() {
int i;
-#ifdef QWS_QT_OPIE
+#ifdef QT_QWS_OPIE
i=-29;
#else
i=-28;
#endif
Config cfg("Konsole");
cfg.setGroup("ScrollBar");
TEWidget* te = getTe();
if( !cfg.readBoolEntry("HorzScroll",0)) {
te->setWrapAt(0);
configMenu->setItemChecked( i,TRUE);
} else {
// te->setWrapAt(90);
te->setWrapAt(120);
configMenu->setItemChecked( i,FALSE);
}
}