summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-11-06 10:26:22 (UTC)
committer mickeyl <mickeyl>2003-11-06 10:26:22 (UTC)
commit8c283be8e455571a03f11035b23f649e49de726c (patch) (unidiff)
tree8213d1c2cbf06881649af936362d4035ee63ceed
parent55ea6367fba8a82fbdca74599422717e4b3c3ec6 (diff)
downloadopie-8c283be8e455571a03f11035b23f649e49de726c.zip
opie-8c283be8e455571a03f11035b23f649e49de726c.tar.gz
opie-8c283be8e455571a03f11035b23f649e49de726c.tar.bz2
merge core/apps/*
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xcore/apps/embeddedkonsole/embeddedkonsole.pro4
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp74
-rw-r--r--core/apps/embeddedkonsole/konsole.h14
-rw-r--r--core/apps/embeddedkonsole/main.cpp45
-rw-r--r--core/apps/textedit/main.cpp13
-rw-r--r--core/apps/textedit/textedit.h3
-rw-r--r--core/apps/textedit/textedit.pro4
7 files changed, 72 insertions, 85 deletions
diff --git a/core/apps/embeddedkonsole/embeddedkonsole.pro b/core/apps/embeddedkonsole/embeddedkonsole.pro
index f8d2793..55a1bb4 100755
--- a/core/apps/embeddedkonsole/embeddedkonsole.pro
+++ b/core/apps/embeddedkonsole/embeddedkonsole.pro
@@ -1,54 +1,52 @@
1QMAKE_CFLAGS = -DHAVE_OPENPTY 1QMAKE_CFLAGS = -DHAVE_OPENPTY
2TMAKE_FLAGS += -DHAVE_OPENPTY 2TMAKE_FLAGS += -DHAVE_OPENPTY
3QMAKE_LIBS = -lutil 3QMAKE_LIBS = -lutil
4TEMPLATE = app 4CONFIG += qt warn_on release quick-app
5CONFIG += qt warn_on release
6DESTDIR = $(OPIEDIR)/bin
7HEADERS = TEWidget.h \ 5HEADERS = TEWidget.h \
8 TEScreen.h \ 6 TEScreen.h \
9 TECommon.h \ 7 TECommon.h \
10 TEHistory.h \ 8 TEHistory.h \
11 TEmulation.h \ 9 TEmulation.h \
12 TEmuVt102.h \ 10 TEmuVt102.h \
13 session.h \ 11 session.h \
14 keytrans.h \ 12 keytrans.h \
15 konsole.h \ 13 konsole.h \
16 commandeditdialog.h \ 14 commandeditdialog.h \
17 commandeditwidget.h \ 15 commandeditwidget.h \
18 playlistselection.h \ 16 playlistselection.h \
19 MyPty.h 17 MyPty.h
20SOURCES = TEScreen.cpp \ 18SOURCES = TEScreen.cpp \
21 TEWidget.cpp \ 19 TEWidget.cpp \
22 TEHistory.cpp \ 20 TEHistory.cpp \
23 TEmulation.cpp \ 21 TEmulation.cpp \
24 TEmuVt102.cpp \ 22 TEmuVt102.cpp \
25 session.cpp \ 23 session.cpp \
26 keytrans.cpp \ 24 keytrans.cpp \
27 konsole.cpp \ 25 konsole.cpp \
28 commandeditdialog.cpp \ 26 commandeditdialog.cpp \
29 commandeditwidget.cpp \ 27 commandeditwidget.cpp \
30 playlistselection.cpp \ 28 playlistselection.cpp \
31 MyPty.cpp \ 29 MyPty.cpp \
32 main.cpp 30 main.cpp
33INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui 31INTERFACES = commandeditdialogbase.ui smallcommandeditdialogbase.ui
34TARGET = embeddedkonsole 32TARGET = embeddedkonsole
35INCLUDEPATH += $(OPIEDIR)/include 33INCLUDEPATH += $(OPIEDIR)/include
36DEPENDPATH += $(OPIEDIR)/include 34DEPENDPATH += $(OPIEDIR)/include
37LIBS += -lqpe -lopie 35LIBS += -lqpe -lopie
38TMAKE_CXXFLAGS += -DQT_QWS_OPIE -DHAVE_OPENPTY 36TMAKE_CXXFLAGS += -DQT_QWS_OPIE -DHAVE_OPENPTY
39 37
40TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \ 38TRANSLATIONS = ../../../i18n/de/embeddedkonsole.ts \
41 ../../../i18n/nl/embeddedkonsole.ts \ 39 ../../../i18n/nl/embeddedkonsole.ts \
42 ../../../i18n/xx/embeddedkonsole.ts \ 40 ../../../i18n/xx/embeddedkonsole.ts \
43 ../../../i18n/en/embeddedkonsole.ts \ 41 ../../../i18n/en/embeddedkonsole.ts \
44 ../../../i18n/es/embeddedkonsole.ts \ 42 ../../../i18n/es/embeddedkonsole.ts \
45 ../../../i18n/fr/embeddedkonsole.ts \ 43 ../../../i18n/fr/embeddedkonsole.ts \
46 ../../../i18n/hu/embeddedkonsole.ts \ 44 ../../../i18n/hu/embeddedkonsole.ts \
47 ../../../i18n/ja/embeddedkonsole.ts \ 45 ../../../i18n/ja/embeddedkonsole.ts \
48 ../../../i18n/ko/embeddedkonsole.ts \ 46 ../../../i18n/ko/embeddedkonsole.ts \
49 ../../../i18n/no/embeddedkonsole.ts \ 47 ../../../i18n/no/embeddedkonsole.ts \
50 ../../../i18n/pl/embeddedkonsole.ts \ 48 ../../../i18n/pl/embeddedkonsole.ts \
51 ../../../i18n/pt/embeddedkonsole.ts \ 49 ../../../i18n/pt/embeddedkonsole.ts \
52 ../../../i18n/pt_BR/embeddedkonsole.ts \ 50 ../../../i18n/pt_BR/embeddedkonsole.ts \
53 ../../../i18n/sl/embeddedkonsole.ts \ 51 ../../../i18n/sl/embeddedkonsole.ts \
54 ../../../i18n/zh_CN/embeddedkonsole.ts \ 52 ../../../i18n/zh_CN/embeddedkonsole.ts \
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index c324c35..ec438c3 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -1,96 +1,99 @@
1/* ---------------------------------------------------------------------- */ 1/* ---------------------------------------------------------------------- */
2/* */ 2/* */
3/* [main.C] Konsole */ 3/* [main.C] Konsole */
4/* */ 4/* */
5/* ---------------------------------------------------------------------- */ 5/* ---------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole, an X terminal. */ 9/* This file is part of Konsole, an X terminal. */
10/* */ 10/* */
11/* The material contained in here more or less directly orginates from */ 11/* The material contained in here more or less directly orginates from */
12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ 12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
13/* */ 13/* */
14/* ---------------------------------------------------------------------- */ 14/* ---------------------------------------------------------------------- */
15/* */ 15/* */
16/* Ported Konsole to Qt/Embedded */ 16/* Ported Konsole to Qt/Embedded */
17/* */ 17/* */
18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
19/* */ 19/* */
20/* -------------------------------------------------------------------------- */ 20/* -------------------------------------------------------------------------- */
21// enhancements added by L.J. Potter <ljp@llornkcor.com> 21// enhancements added by L.J. Potter <ljp@llornkcor.com>
22#define QT_QWS_OPIE 22#define QT_QWS_OPIE
23 23
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25 25
26#include <qdir.h> 26#include <qdir.h>
27#include <qevent.h> 27#include <qevent.h>
28#include <qdragobject.h> 28#include <qdragobject.h>
29#include <qobjectlist.h> 29#include <qobjectlist.h>
30#include <qtoolbutton.h> 30#include <qtoolbutton.h>
31#include <qpe/qpetoolbar.h> 31#include <qpe/qpetoolbar.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qfontdialog.h> 33#include <qfontdialog.h>
34#include <qglobal.h> 34#include <qglobal.h>
35#include <qpainter.h> 35#include <qpainter.h>
36#include <qpe/qpemenubar.h> 36#include <qpe/qpemenubar.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <qaction.h> 38#include <qaction.h>
39#include <qapplication.h> 39#include <qapplication.h>
40#include <qfontmetrics.h> 40#include <qfontmetrics.h>
41#include <qcombobox.h> 41#include <qcombobox.h>
42#include <qevent.h> 42#include <qevent.h>
43#include <qtabwidget.h> 43#include <qtabwidget.h>
44#include <qtabbar.h> 44#include <qtabbar.h>
45#include <qpe/config.h> 45#include <qpe/config.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qpalette.h> 47#include <qpalette.h>
48 48
49#include <unistd.h>
50#include <pwd.h>
51#include <sys/types.h>
49#include <sys/wait.h> 52#include <sys/wait.h>
50#include <stdio.h> 53#include <stdio.h>
51#include <stdlib.h> 54#include <stdlib.h>
52#include <assert.h> 55#include <assert.h>
53 56
54#include "konsole.h" 57#include "konsole.h"
55#include "keytrans.h" 58#include "keytrans.h"
56#include "commandeditdialog.h" 59#include "commandeditdialog.h"
57 60
58#ifdef QT_QWS_OPIE 61#ifdef QT_QWS_OPIE
59#include <opie/colorpopupmenu.h> 62#include <opie/colorpopupmenu.h>
60#endif 63#endif
61 64
62class EKNumTabBar : public QTabBar { 65class EKNumTabBar : public QTabBar {
63public: 66public:
64 void numberTabs() 67 void numberTabs()
65 { 68 {
66 // Yes, it really is this messy. QTabWidget needs functions 69 // Yes, it really is this messy. QTabWidget needs functions
67 // that provide acces to tabs in a sequential way. 70 // that provide acces to tabs in a sequential way.
68 int m=INT_MIN; 71 int m=INT_MIN;
69 for (int i=0; i<count(); i++) { 72 for (int i=0; i<count(); i++) {
70 QTab* left=0; 73 QTab* left=0;
71 QListIterator<QTab> it(*tabList()); 74 QListIterator<QTab> it(*tabList());
72 int x=INT_MAX; 75 int x=INT_MAX;
73 for( QTab* t; (t=it.current()); ++it ) { 76 for( QTab* t; (t=it.current()); ++it ) {
74 int tx = t->rect().x(); 77 int tx = t->rect().x();
75 if ( tx<x && tx>m ) { 78 if ( tx<x && tx>m ) {
76 x = tx; 79 x = tx;
77 left = t; 80 left = t;
78 } 81 }
79 } 82 }
80 if ( left ) { 83 if ( left ) {
81 left->setText(QString::number(i+1)); 84 left->setText(QString::number(i+1));
82 m = left->rect().x(); 85 m = left->rect().x();
83 } 86 }
84 } 87 }
85 } 88 }
86}; 89};
87 90
88class EKNumTabWidget : public QTabWidget { 91class EKNumTabWidget : public QTabWidget {
89public: 92public:
90 EKNumTabWidget(QWidget* parent) : QTabWidget(parent) 93 EKNumTabWidget(QWidget* parent) : QTabWidget(parent)
91 { 94 {
92 } 95 }
93 96
94 void addTab(QWidget* w) 97 void addTab(QWidget* w)
95 { 98 {
96 QTab* t = new QTab(QString::number(tabBar()->count()+1)); 99 QTab* t = new QTab(QString::number(tabBar()->count()+1));
@@ -126,110 +129,147 @@ static const char *commonCmds[] =
126 "ifconfig ", 129 "ifconfig ",
127 "ipkg ", 130 "ipkg ",
128 "mkdir ", 131 "mkdir ",
129 "mv ", 132 "mv ",
130 "nc localhost 7776", 133 "nc localhost 7776",
131 "nc localhost 7777", 134 "nc localhost 7777",
132 "netstat ", 135 "netstat ",
133 "nslookup ", 136 "nslookup ",
134 "ping ", 137 "ping ",
135 "ps aux", 138 "ps aux",
136 "pwd ", 139 "pwd ",
137 "qcop QPE/System 'linkChanged(QString)' ''", 140 "qcop QPE/System 'linkChanged(QString)' ''",
138 "qcop QPE/System 'restart()'", 141 "qcop QPE/System 'restart()'",
139 "qcop QPE/System 'quit()'", 142 "qcop QPE/System 'quit()'",
140 "rm ", 143 "rm ",
141 "rmdir ", 144 "rmdir ",
142 "route ", 145 "route ",
143 "set ", 146 "set ",
144 "traceroute", 147 "traceroute",
145 148
146/* 149/*
147 "gzip", 150 "gzip",
148 "gunzip", 151 "gunzip",
149 "chgrp", 152 "chgrp",
150 "chown", 153 "chown",
151 "date", 154 "date",
152 "dd", 155 "dd",
153 "df", 156 "df",
154 "dmesg", 157 "dmesg",
155 "fuser", 158 "fuser",
156 "hostname", 159 "hostname",
157 "kill", 160 "kill",
158 "killall", 161 "killall",
159 "ln", 162 "ln",
160 "ping", 163 "ping",
161 "mount", 164 "mount",
162 "more", 165 "more",
163 "sort", 166 "sort",
164 "touch", 167 "touch",
165 "umount", 168 "umount",
166 "mknod", 169 "mknod",
167 "netstat", 170 "netstat",
168*/ 171*/
169 172
170 "exit", 173 "exit",
171 NULL 174 NULL
172}; 175};
173 176
177static void konsoleInit(const char** shell) {
178 if(setuid(getuid()) !=0) qDebug("setuid failed");
179 if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges
180
181
182// QPEApplication::grabKeyboard(); // for CTRL and ALT
183
184 qDebug("keyboard grabbed");
185#ifdef FAKE_CTRL_AND_ALT
186 qDebug("Fake Ctrl and Alt defined");
187 QPEApplication::grabKeyboard(); // for CTRL and ALT
188#endif
189
190 *shell = getenv("SHELL");
191 qWarning("SHell initially is %s", *shell );
192
193 if (shell == NULL || *shell == '\0') {
194 struct passwd *ent = 0;
195 uid_t me = getuid();
196 *shell = "/bin/sh";
197
198 while ( (ent = getpwent()) != 0 ) {
199 if (ent->pw_uid == me) {
200 if (ent->pw_shell != "")
201 *shell = ent->pw_shell;
202 break;
203 }
204 }
205 endpwent();
206 }
207
208 qWarning("SHELL now is %s", *shell );
209
210 if( putenv((char*)"COLORTERM=") !=0)
211 qDebug("putenv failed"); // to trigger mc's color detection
212}
174 213
175Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : 214Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
176 QMainWindow(parent, name, fl) 215 QMainWindow(parent, name, fl)
177{ 216{
178 QStrList args; 217 QStrList tmp; const char* shell;
179 init("/bin/sh",args);
180}
181 218
182Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 219 setCaption( tr("Terminal") );
183 : QMainWindow(0, name) 220
184{ 221 konsoleInit( &shell);
185 init(_pgm,_args); 222 qWarning("Using shell %s", shell);
223 init(shell,tmp);
186} 224}
187 225
226
227
188void Konsole::initCommandList() 228void Konsole::initCommandList()
189{ 229{
190// qDebug("Konsole::initCommandList"); 230// qDebug("Konsole::initCommandList");
191 Config cfg("Konsole"); 231 Config cfg("Konsole");
192 cfg.setGroup("Commands"); 232 cfg.setGroup("Commands");
193 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 233 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
194 commonCombo->clear(); 234 commonCombo->clear();
195 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { 235 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") {
196 for (int i = 0; commonCmds[i] != NULL; i++) { 236 for (int i = 0; commonCmds[i] != NULL; i++) {
197 commonCombo->insertItem(commonCmds[i],i); 237 commonCombo->insertItem(commonCmds[i],i);
198 } 238 }
199 } else { 239 } else {
200 for (int i = 0; i < 100; i++) { 240 for (int i = 0; i < 100; i++) {
201 if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) 241 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
202 commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); 242 commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
203 } 243 }
204 } 244 }
205 245
206} 246}
207 247
208void Konsole::init(const char* _pgm, QStrList & _args) 248void Konsole::init(const char* _pgm, QStrList & _args)
209{ 249{
210 b_scroll = TRUE; // histon; 250 b_scroll = TRUE; // histon;
211 n_keytab = 0; 251 n_keytab = 0;
212 n_render = 0; 252 n_render = 0;
213 startUp=0; 253 startUp=0;
214 fromMenu = FALSE; 254 fromMenu = FALSE;
215 255
216 setCaption( tr("Terminal") ); 256 setCaption( tr("Terminal") );
217 setIcon( Resource::loadPixmap( "konsole" ) ); 257 setIcon( Resource::loadPixmap( "konsole" ) );
218 258
219 Config cfg("Konsole"); 259 Config cfg("Konsole");
220 cfg.setGroup("Konsole"); 260 cfg.setGroup("Konsole");
221 QString tmp; 261 QString tmp;
222 // initialize the list of allowed fonts /////////////////////////////////// 262 // initialize the list of allowed fonts ///////////////////////////////////
223 cfont = cfg.readNumEntry("FontID", 1); 263 cfont = cfg.readNumEntry("FontID", 1);
224 QFont f = QFont("Micro", 4, QFont::Normal); 264 QFont f = QFont("Micro", 4, QFont::Normal);
225 f.setFixedPitch(TRUE); 265 f.setFixedPitch(TRUE);
226 fonts.append(new VTFont(tr("Micro"), f)); 266 fonts.append(new VTFont(tr("Micro"), f));
227 267
228 f = QFont("Fixed", 7, QFont::Normal); 268 f = QFont("Fixed", 7, QFont::Normal);
229 f.setFixedPitch(TRUE); 269 f.setFixedPitch(TRUE);
230 fonts.append(new VTFont(tr("Small Fixed"), f)); 270 fonts.append(new VTFont(tr("Small Fixed"), f));
231 271
232 f = QFont("Fixed", 12, QFont::Normal); 272 f = QFont("Fixed", 12, QFont::Normal);
233 f.setFixedPitch(TRUE); 273 f.setFixedPitch(TRUE);
234 fonts.append(new VTFont(tr("Medium Fixed"), f)); 274 fonts.append(new VTFont(tr("Medium Fixed"), f));
235 275
@@ -254,216 +294,216 @@ void Konsole::init(const char* _pgm, QStrList & _args)
254 } 294 }
255 fontChanged(cfont); 295 fontChanged(cfont);
256 296
257 configMenu = new QPopupMenu( this); 297 configMenu = new QPopupMenu( this);
258 colorMenu = new QPopupMenu( this); 298 colorMenu = new QPopupMenu( this);
259 scrollMenu = new QPopupMenu( this); 299 scrollMenu = new QPopupMenu( this);
260 editCommandListMenu = new QPopupMenu( this); 300 editCommandListMenu = new QPopupMenu( this);
261 301
262 configMenu->insertItem(tr("Command List"), editCommandListMenu); 302 configMenu->insertItem(tr("Command List"), editCommandListMenu);
263 303
264 bool listHidden; 304 bool listHidden;
265 cfg.setGroup("Menubar"); 305 cfg.setGroup("Menubar");
266 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 306 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
267 editCommandListMenu->insertItem( tr( "Show command list" )); 307 editCommandListMenu->insertItem( tr( "Show command list" ));
268 listHidden=TRUE; 308 listHidden=TRUE;
269 } else { 309 } else {
270 editCommandListMenu->insertItem( tr( "Hide command list" )); 310 editCommandListMenu->insertItem( tr( "Hide command list" ));
271 listHidden=FALSE; 311 listHidden=FALSE;
272 } 312 }
273 313
274 cfg.setGroup("Tabs"); 314 cfg.setGroup("Tabs");
275 tmp=cfg.readEntry("Position","Bottom"); 315 tmp=cfg.readEntry("Position","Bottom");
276 if(tmp=="Top") { 316 if(tmp=="Top") {
277 tab->setTabPosition(QTabWidget::Top); 317 tab->setTabPosition(QTabWidget::Top);
278 configMenu->insertItem( tr( "Tabs on Bottom" ) ); 318 configMenu->insertItem( tr( "Tabs on Bottom" ) );
279 } else { 319 } else {
280 tab->setTabPosition(QTabWidget::Bottom); 320 tab->setTabPosition(QTabWidget::Bottom);
281 configMenu->insertItem(tr("Tabs on Top")); 321 configMenu->insertItem(tr("Tabs on Top"));
282 } 322 }
283 configMenu->insertSeparator(2); 323 configMenu->insertSeparator(2);
284 324
285 colorMenu->insertItem(tr( "Green on Black")); 325 colorMenu->insertItem(tr( "Green on Black"));
286 colorMenu->insertItem(tr( "Black on White")); 326 colorMenu->insertItem(tr( "Black on White"));
287 colorMenu->insertItem(tr( "White on Black")); 327 colorMenu->insertItem(tr( "White on Black"));
288 colorMenu->insertItem(tr( "Black on Transparent")); 328 colorMenu->insertItem(tr( "Black on Transparent"));
289 colorMenu->insertItem(tr( "Black on Red")); 329 colorMenu->insertItem(tr( "Black on Red"));
290 colorMenu->insertItem(tr( "Red on Black")); 330 colorMenu->insertItem(tr( "Red on Black"));
291 colorMenu->insertItem(tr( "Green on Yellow")); 331 colorMenu->insertItem(tr( "Green on Yellow"));
292 colorMenu->insertItem(tr( "Blue on Magenta")); 332 colorMenu->insertItem(tr( "Blue on Magenta"));
293 colorMenu->insertItem(tr( "Magenta on Blue")); 333 colorMenu->insertItem(tr( "Magenta on Blue"));
294 colorMenu->insertItem(tr( "Cyan on White")); 334 colorMenu->insertItem(tr( "Cyan on White"));
295 colorMenu->insertItem(tr( "White on Cyan")); 335 colorMenu->insertItem(tr( "White on Cyan"));
296 colorMenu->insertItem(tr( "Blue on Black")); 336 colorMenu->insertItem(tr( "Blue on Black"));
297 colorMenu->insertItem(tr( "Amber on Black")); 337 colorMenu->insertItem(tr( "Amber on Black"));
298 338
299#ifdef QT_QWS_OPIE 339#ifdef QT_QWS_OPIE
300 colorMenu->insertItem(tr( "Custom")); 340 colorMenu->insertItem(tr( "Custom"));
301#endif 341#endif
302 342
303 configMenu->insertItem( tr("Font"), fontList ); 343 configMenu->insertItem( tr("Font"), fontList );
304 configMenu->insertItem(tr( "Colors") ,colorMenu); 344 configMenu->insertItem(tr( "Colors") ,colorMenu);
305 345
306 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 346 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
307 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 347 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
308 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); 348 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
309 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 349 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
310 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 350 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
311 351
312 menuBar->insertItem( tr("Options"), configMenu ); 352 menuBar->insertItem( tr("Options"), configMenu );
313 353
314 QPEToolBar *toolbar = new QPEToolBar( this ); 354 QPEToolBar *toolbar = new QPEToolBar( this );
315 355
316 QAction *a; 356 QAction *a;
317 357
318 // Button Commands 358 // Button Commands
319 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); 359 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
320 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 360 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
321 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 361 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
322 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 362 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
323 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 363 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
324 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 364 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
325 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 365 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
326 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 366 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
327 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 367 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
328 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 368 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
329 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 369 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
330 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 370 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
331 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 371 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
332 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 372 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
333/* 373/*
334 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 374 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
335 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 375 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
336 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 376 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
337 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 377 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
338*/ 378*/
339 379
340 secondToolBar = new QPEToolBar( this ); 380 secondToolBar = new QPEToolBar( this );
341 secondToolBar->setHorizontalStretchable( TRUE ); 381 secondToolBar->setHorizontalStretchable( TRUE );
342 382
343 commonCombo = new QComboBox( secondToolBar ); 383 commonCombo = new QComboBox( secondToolBar );
344 commonCombo->setMaximumWidth(236); 384 commonCombo->setMaximumWidth(236);
345 385
346 editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 386 editCommandListMenu->insertItem( tr( "Quick Edit" ) );
347 if( listHidden) { 387 if( listHidden) {
348 secondToolBar->hide(); 388 secondToolBar->hide();
349 editCommandListMenu->setItemEnabled(-23 ,FALSE); 389 editCommandListMenu->setItemEnabled(-23 ,FALSE);
350 } 390 }
351 editCommandListMenu->insertItem(tr( "Edit" ) ); 391 editCommandListMenu->insertItem(tr( "Edit" ) );
352 392
353 cfg.setGroup("Commands"); 393 cfg.setGroup("Commands");
354 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 394 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
355 395
356 initCommandList(); 396 initCommandList();
357// for (int i = 0; commonCmds[i] != NULL; i++) { 397// for (int i = 0; commonCmds[i] != NULL; i++) {
358// commonCombo->insertItem( commonCmds[i], i ); 398// commonCombo->insertItem( commonCmds[i], i );
359// tmp = cfg.readEntry( QString::number(i),""); 399// tmp = cfg.readEntry( QString::number(i),"");
360// if(tmp != "") 400// if(tmp != "")
361// commonCombo->changeItem( tmp,i ); 401// commonCombo->changeItem( tmp,i );
362// } 402// }
363 403
364 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 404 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
365 405
366 scrollMenu->insertItem(tr( "None" )); 406 scrollMenu->insertItem(tr( "None" ));
367 scrollMenu->insertItem(tr( "Left" )); 407 scrollMenu->insertItem(tr( "Left" ));
368 scrollMenu->insertItem(tr( "Right" )); 408 scrollMenu->insertItem(tr( "Right" ));
369// scrollMenu->insertSeparator(4); 409// scrollMenu->insertSeparator(4);
370// scrollMenu->insertItem(tr( "Horizontal" )); 410// scrollMenu->insertItem(tr( "Horizontal" ));
371 411
372 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); 412 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
373 413
374 int jut = configMenu->insertItem(tr( "Wrap" )); 414 int jut = configMenu->insertItem(tr( "Wrap" ));
375 cfg.setGroup("ScrollBar"); 415 cfg.setGroup("ScrollBar");
376 configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0)); 416 configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0));
377 417
378 jut = configMenu->insertItem(tr( "Use Beep" )); 418 jut = configMenu->insertItem(tr( "Use Beep" ));
379 cfg.setGroup("Menubar"); 419 cfg.setGroup("Menubar");
380 420
381 configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); 421 configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0));
382 422
383 423
384//scrollMenuSelected(-29); 424//scrollMenuSelected(-29);
385// cfg.setGroup("ScrollBar"); 425// cfg.setGroup("ScrollBar");
386// if(cfg.readBoolEntry("HorzScroll",0)) { 426// if(cfg.readBoolEntry("HorzScroll",0)) {
387// if(cfg.readNumEntry("Position",2) == 0) 427// if(cfg.readNumEntry("Position",2) == 0)
388// te->setScrollbarLocation(1); 428// te->setScrollbarLocation(1);
389// else 429// else
390// te->setScrollbarLocation(0); 430// te->setScrollbarLocation(0);
391// te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 431// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
392// te->setWrapAt(120); 432// te->setWrapAt(120);
393// } 433// }
394 // create applications ///////////////////////////////////////////////////// 434 // create applications /////////////////////////////////////////////////////
395 setCentralWidget(tab); 435 setCentralWidget(tab);
396 436
397 // load keymaps //////////////////////////////////////////////////////////// 437 // load keymaps ////////////////////////////////////////////////////////////
398 KeyTrans::loadAll(); 438 KeyTrans::loadAll();
399 for (int i = 0; i < KeyTrans::count(); i++) 439 for (int i = 0; i < KeyTrans::count(); i++)
400 { KeyTrans* s = KeyTrans::find(i); 440 { KeyTrans* s = KeyTrans::find(i);
401 assert( s ); 441 assert( s );
402 } 442 }
403 443
404 se_pgm = _pgm; 444 se_pgm = _pgm;
405 se_args = _args; 445 se_args = _args;
406 se_args.prepend("--login"); 446 se_args.prepend("--login");
407parseCommandLine(); 447parseCommandLine();
408 // read and apply default values /////////////////////////////////////////// 448 // read and apply default values ///////////////////////////////////////////
409 resize(321, 321); // Dummy. 449 resize(321, 321); // Dummy.
410 QSize currentSize = size(); 450 QSize currentSize = size();
411 if (currentSize != size()) 451 if (currentSize != size())
412 defaultSize = size(); 452 defaultSize = size();
413} 453}
414 454
415void Konsole::show() 455void Konsole::show()
416{ 456{
417 if ( !nsessions ) { 457 if ( !nsessions ) {
418 newSession(); 458 newSession();
419 } 459 }
420 QMainWindow::show(); 460 QMainWindow::show();
421 461
422} 462}
423 463
424void Konsole::initSession(const char*, QStrList &) 464void Konsole::initSession(const char*, QStrList &)
425{ 465{
426 QMainWindow::show(); 466 QMainWindow::show();
427} 467}
428 468
429Konsole::~Konsole() 469Konsole::~Konsole()
430{ 470{
431 while (nsessions > 0) { 471 while (nsessions > 0) {
432 doneSession(getTe()->currentSession, 0); 472 doneSession(getTe()->currentSession, 0);
433 } 473 }
434 474
435 Config cfg("Konsole"); 475 Config cfg("Konsole");
436 cfg.setGroup("Konsole"); 476 cfg.setGroup("Konsole");
437 cfg.writeEntry("FontID", cfont); 477 cfg.writeEntry("FontID", cfont);
438} 478}
439 479
440void Konsole::fontChanged(int f) 480void Konsole::fontChanged(int f)
441{ 481{
442 VTFont* font = fonts.at(f); 482 VTFont* font = fonts.at(f);
443 if (font != 0) { 483 if (font != 0) {
444 for(uint i = 0; i < fonts.count(); i++) { 484 for(uint i = 0; i < fonts.count(); i++) {
445 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); 485 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
446 } 486 }
447 487
448 cfont = f; 488 cfont = f;
449 489
450 TEWidget* te = getTe(); 490 TEWidget* te = getTe();
451 if (te != 0) { 491 if (te != 0) {
452 te->setVTFont(font->getFont()); 492 te->setVTFont(font->getFont());
453 } 493 }
454 } 494 }
455} 495}
456 496
457 497
458void Konsole::enterCommand(int c) 498void Konsole::enterCommand(int c)
459{ 499{
460 TEWidget* te = getTe(); 500 TEWidget* te = getTe();
461 if (te != 0) { 501 if (te != 0) {
462 if(!commonCombo->editable()) { 502 if(!commonCombo->editable()) {
463 QString text = commonCombo->text(c); //commonCmds[c]; 503 QString text = commonCombo->text(c); //commonCmds[c];
464 te->emitText(text); 504 te->emitText(text);
465 } else { 505 } else {
466 changeCommand( commonCombo->text(c), c); 506 changeCommand( commonCombo->text(c), c);
467 } 507 }
468 } 508 }
469} 509}
@@ -496,97 +536,97 @@ void Konsole::hitPaste()
496{ 536{
497 TEWidget* te = getTe(); 537 TEWidget* te = getTe();
498 if (te != 0) { 538 if (te != 0) {
499 te->pasteClipboard(); 539 te->pasteClipboard();
500 } 540 }
501} 541}
502 542
503void Konsole::hitUp() 543void Konsole::hitUp()
504{ 544{
505 TEWidget* te = getTe(); 545 TEWidget* te = getTe();
506 if (te != 0) { 546 if (te != 0) {
507 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); 547 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0);
508 QApplication::sendEvent( te, &ke ); 548 QApplication::sendEvent( te, &ke );
509 } 549 }
510} 550}
511 551
512void Konsole::hitDown() 552void Konsole::hitDown()
513{ 553{
514 TEWidget* te = getTe(); 554 TEWidget* te = getTe();
515 if (te != 0) { 555 if (te != 0) {
516 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); 556 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0);
517 QApplication::sendEvent( te, &ke ); 557 QApplication::sendEvent( te, &ke );
518 } 558 }
519} 559}
520 560
521/** 561/**
522 This function calculates the size of the external widget 562 This function calculates the size of the external widget
523 needed for the internal widget to be 563 needed for the internal widget to be
524 */ 564 */
525QSize Konsole::calcSize(int columns, int lines) { 565QSize Konsole::calcSize(int columns, int lines) {
526 TEWidget* te = getTe(); 566 TEWidget* te = getTe();
527 if (te != 0) { 567 if (te != 0) {
528 QSize size = te->calcSize(columns, lines); 568 QSize size = te->calcSize(columns, lines);
529 return size; 569 return size;
530 } else { 570 } else {
531 QSize size; 571 QSize size;
532 return size; 572 return size;
533 } 573 }
534} 574}
535 575
536/** 576/**
537 sets application window to a size based on columns X lines of the te 577 sets application window to a size based on columns X lines of the te
538 guest widget. Call with (0,0) for setting default size. 578 guest widget. Call with (0,0) for setting default size.
539*/ 579*/
540 580
541void Konsole::setColLin(int columns, int lines) 581void Konsole::setColLin(int columns, int lines)
542{ 582{
543 qDebug("konsole::setColLin:: Columns %d", columns); 583 qDebug("konsole::setColLin:: Columns %d", columns);
544 584
545 if ((columns==0) || (lines==0)) 585 if ((columns==0) || (lines==0))
546 { 586 {
547 if (defaultSize.isEmpty()) // not in config file : set default value 587 if (defaultSize.isEmpty()) // not in config file : set default value
548 { 588 {
549 defaultSize = calcSize(80,24); 589 defaultSize = calcSize(80,24);
550 // notifySize(24,80); // set menu items (strange arg order !) 590 // notifySize(24,80); // set menu items (strange arg order !)
551 } 591 }
552 resize(defaultSize); 592 resize(defaultSize);
553 } else { 593 } else {
554 resize(calcSize(columns, lines)); 594 resize(calcSize(columns, lines));
555 // notifySize(lines,columns); // set menu items (strange arg order !) 595 // notifySize(lines,columns); // set menu items (strange arg order !)
556 } 596 }
557} 597}
558 598
559/* 599/*
560void Konsole::setFont(int fontno) 600void Konsole::setFont(int fontno)
561{ 601{
562 QFont f; 602 QFont f;
563 if (fontno == 0) 603 if (fontno == 0)
564 f = defaultFont = QFont( "Helvetica", 12 ); 604 f = defaultFont = QFont( "Helvetica", 12 );
565 else 605 else
566 if (fonts[fontno][0] == '-') 606 if (fonts[fontno][0] == '-')
567 f.setRawName( fonts[fontno] ); 607 f.setRawName( fonts[fontno] );
568 else 608 else
569 { 609 {
570 f.setFamily(fonts[fontno]); 610 f.setFamily(fonts[fontno]);
571 f.setRawMode( TRUE ); 611 f.setRawMode( TRUE );
572 } 612 }
573 if ( !f.exactMatch() && fontno != 0) 613 if ( !f.exactMatch() && fontno != 0)
574 { 614 {
575 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); 615 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]);
576 QMessageBox(this, msg); 616 QMessageBox(this, msg);
577 return; 617 return;
578 } 618 }
579 if (se) se->setFontNo(fontno); 619 if (se) se->setFontNo(fontno);
580 te->setVTFont(f); 620 te->setVTFont(f);
581 n_font = fontno; 621 n_font = fontno;
582} 622}
583*/ 623*/
584 624
585// --| color selection |------------------------------------------------------- 625// --| color selection |-------------------------------------------------------
586 626
587void Konsole::changeColumns(int columns) 627void Konsole::changeColumns(int columns)
588{ //FIXME this seems to cause silliness when reset command is executed 628{ //FIXME this seems to cause silliness when reset command is executed
589// qDebug("change columns"); 629// qDebug("change columns");
590// TEWidget* te = getTe(); 630// TEWidget* te = getTe();
591// if (te != 0) { 631// if (te != 0) {
592// setColLin(columns,te->Lines()); 632// setColLin(columns,te->Lines());
@@ -718,97 +758,97 @@ void Konsole::colorMenuSelected(int iD)
718 background.setRgb(0x00,0x00,0x00); 758 background.setRgb(0x00,0x00,0x00);
719 cfg.writeEntry("Schema","11"); 759 cfg.writeEntry("Schema","11");
720 colorMenu->setItemChecked(-11,TRUE); 760 colorMenu->setItemChecked(-11,TRUE);
721 } 761 }
722 if(iD==-12) {// Green, Yellow - is ugly 762 if(iD==-12) {// Green, Yellow - is ugly
723// foreground.setRgb(0x18,0xB2,0x18); 763// foreground.setRgb(0x18,0xB2,0x18);
724 foreground.setRgb(36,139,10); 764 foreground.setRgb(36,139,10);
725// background.setRgb(0xB2,0x68,0x18); 765// background.setRgb(0xB2,0x68,0x18);
726 background.setRgb(255,255,0); 766 background.setRgb(255,255,0);
727 cfg.writeEntry("Schema","12"); 767 cfg.writeEntry("Schema","12");
728 colorMenu->setItemChecked(-12,TRUE); 768 colorMenu->setItemChecked(-12,TRUE);
729 } 769 }
730 if(iD==-13) {// Blue, Magenta 770 if(iD==-13) {// Blue, Magenta
731 foreground.setRgb(0x18,0xB2,0xB2); 771 foreground.setRgb(0x18,0xB2,0xB2);
732 background.setRgb(0x18,0x18,0xB2); 772 background.setRgb(0x18,0x18,0xB2);
733 cfg.writeEntry("Schema","13"); 773 cfg.writeEntry("Schema","13");
734 colorMenu->setItemChecked(-13,TRUE); 774 colorMenu->setItemChecked(-13,TRUE);
735 } 775 }
736 if(iD==-14) {// Magenta, Blue 776 if(iD==-14) {// Magenta, Blue
737 foreground.setRgb(0x18,0x18,0xB2); 777 foreground.setRgb(0x18,0x18,0xB2);
738 background.setRgb(0x18,0xB2,0xB2); 778 background.setRgb(0x18,0xB2,0xB2);
739 cfg.writeEntry("Schema","14"); 779 cfg.writeEntry("Schema","14");
740 colorMenu->setItemChecked(-14,TRUE); 780 colorMenu->setItemChecked(-14,TRUE);
741 } 781 }
742 if(iD==-15) {// Cyan, White 782 if(iD==-15) {// Cyan, White
743 foreground.setRgb(0x18,0xB2,0xB2); 783 foreground.setRgb(0x18,0xB2,0xB2);
744 background.setRgb(0xFF,0xFF,0xFF); 784 background.setRgb(0xFF,0xFF,0xFF);
745 cfg.writeEntry("Schema","15"); 785 cfg.writeEntry("Schema","15");
746 colorMenu->setItemChecked(-15,TRUE); 786 colorMenu->setItemChecked(-15,TRUE);
747 } 787 }
748 if(iD==-16) {// White, Cyan 788 if(iD==-16) {// White, Cyan
749 background.setRgb(0x18,0xB2,0xB2); 789 background.setRgb(0x18,0xB2,0xB2);
750 foreground.setRgb(0xFF,0xFF,0xFF); 790 foreground.setRgb(0xFF,0xFF,0xFF);
751 cfg.writeEntry("Schema","16"); 791 cfg.writeEntry("Schema","16");
752 colorMenu->setItemChecked(-16,TRUE); 792 colorMenu->setItemChecked(-16,TRUE);
753 } 793 }
754 if(iD==-17) {// Black, Blue 794 if(iD==-17) {// Black, Blue
755 background.setRgb(0x00,0x00,0x00); 795 background.setRgb(0x00,0x00,0x00);
756 foreground.setRgb(0x18,0xB2,0xB2); 796 foreground.setRgb(0x18,0xB2,0xB2);
757 cfg.writeEntry("Schema","17"); 797 cfg.writeEntry("Schema","17");
758 colorMenu->setItemChecked(-17,TRUE); 798 colorMenu->setItemChecked(-17,TRUE);
759 } 799 }
760 if(iD==-18) {// Black, Gold 800 if(iD==-18) {// Black, Gold
761 background.setRgb(0x00,0x00,0x00); 801 background.setRgb(0x00,0x00,0x00);
762 foreground.setRgb(255,215,0); 802 foreground.setRgb(255,215,0);
763 cfg.writeEntry("Schema","18"); 803 cfg.writeEntry("Schema","18");
764 colorMenu->setItemChecked(-18,TRUE); 804 colorMenu->setItemChecked(-18,TRUE);
765 } 805 }
766#ifdef QT_QWS_OPIE 806#ifdef QT_QWS_OPIE
767 if(iD==-19) { 807 if(iD==-19) {
768// Custom 808// Custom
769 qDebug("do custom"); 809 qDebug("do custom");
770 if(fromMenu) { 810 if(fromMenu) {
771 OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, this, "foreground color"); 811 OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, this, "foreground color");
772 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, 812 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
773 SLOT(changeForegroundColor(const QColor&))); 813 SLOT(changeForegroundColor(const QColor&)));
774 penColorPopupMenu->exec(); 814 penColorPopupMenu->exec();
775 } 815 }
776 cfg.writeEntry("Schema","19"); 816 cfg.writeEntry("Schema","19");
777 if(!fromMenu) { 817 if(!fromMenu) {
778 foreground.setNamedColor(cfg.readEntry("foreground","")); 818 foreground.setNamedColor(cfg.readEntry("foreground",""));
779 background.setNamedColor(cfg.readEntry("background","")); 819 background.setNamedColor(cfg.readEntry("background",""));
780 } 820 }
781 fromMenu=FALSE; 821 fromMenu=FALSE;
782 colorMenu->setItemChecked(-19,TRUE); 822 colorMenu->setItemChecked(-19,TRUE);
783 } 823 }
784#endif 824#endif
785 for (i = 0; i < TABLE_COLORS; i++) { 825 for (i = 0; i < TABLE_COLORS; i++) {
786 if(i==0 || i == 10) { 826 if(i==0 || i == 10) {
787 m_table[i].color = foreground; 827 m_table[i].color = foreground;
788 } 828 }
789 else if(i==1 || i == 11) { 829 else if(i==1 || i == 11) {
790 m_table[i].color = background; m_table[i].transparent=0; 830 m_table[i].color = background; m_table[i].transparent=0;
791 } 831 }
792 else 832 else
793 m_table[i].color = defaultCt[i].color; 833 m_table[i].color = defaultCt[i].color;
794 } 834 }
795 } 835 }
796 lastSelectedMenu = iD; 836 lastSelectedMenu = iD;
797 te->setColorTable(m_table); 837 te->setColorTable(m_table);
798 update(); 838 update();
799 839
800} 840}
801 841
802void Konsole::configMenuSelected(int iD) 842void Konsole::configMenuSelected(int iD)
803{ 843{
804// QString temp; 844// QString temp;
805// qDebug( temp.sprintf("configmenu %d",iD)); 845// qDebug( temp.sprintf("configmenu %d",iD));
806 846
807 TEWidget* te = getTe(); 847 TEWidget* te = getTe();
808 Config cfg("Konsole"); 848 Config cfg("Konsole");
809 cfg.setGroup("Menubar"); 849 cfg.setGroup("Menubar");
810 int i,j; 850 int i,j;
811#ifdef QT_QWS_OPIE 851#ifdef QT_QWS_OPIE
812 i=-29;j=-30; 852 i=-29;j=-30;
813#else 853#else
814 i=-28;j=-29; 854 i=-28;j=-29;
@@ -845,105 +885,105 @@ void Konsole::configMenuSelected(int iD)
845 if(iD == j) { 885 if(iD == j) {
846 cfg.setGroup("Menubar"); 886 cfg.setGroup("Menubar");
847 bool b=cfg.readBoolEntry("useBeep",0); 887 bool b=cfg.readBoolEntry("useBeep",0);
848 b=!b; 888 b=!b;
849 cfg.writeEntry("useBeep", b ); 889 cfg.writeEntry("useBeep", b );
850 cfg.write(); 890 cfg.write();
851 configMenu->setItemChecked(j,b); 891 configMenu->setItemChecked(j,b);
852 te->useBeep=b; 892 te->useBeep=b;
853 } 893 }
854} 894}
855 895
856void Konsole::changeCommand(const QString &text, int c) 896void Konsole::changeCommand(const QString &text, int c)
857{ 897{
858 Config cfg("Konsole"); 898 Config cfg("Konsole");
859 cfg.setGroup("Commands"); 899 cfg.setGroup("Commands");
860 if(commonCmds[c] != text) { 900 if(commonCmds[c] != text) {
861 cfg.writeEntry(QString::number(c),text); 901 cfg.writeEntry(QString::number(c),text);
862 commonCombo->clearEdit(); 902 commonCombo->clearEdit();
863 commonCombo->setCurrentItem(c); 903 commonCombo->setCurrentItem(c);
864 } 904 }
865} 905}
866 906
867void Konsole::setColor() 907void Konsole::setColor()
868{ 908{
869 Config cfg("Konsole"); 909 Config cfg("Konsole");
870 cfg.setGroup("Colors"); 910 cfg.setGroup("Colors");
871 int scheme = cfg.readNumEntry("Schema",1); 911 int scheme = cfg.readNumEntry("Schema",1);
872 if(scheme != 1) colorMenuSelected( -scheme); 912 if(scheme != 1) colorMenuSelected( -scheme);
873} 913}
874 914
875void Konsole::scrollMenuSelected(int index) 915void Konsole::scrollMenuSelected(int index)
876{ 916{
877// qDebug( "scrollbar menu %d",index); 917// qDebug( "scrollbar menu %d",index);
878 918
879 TEWidget* te = getTe(); 919 TEWidget* te = getTe();
880 Config cfg("Konsole"); 920 Config cfg("Konsole");
881 cfg.setGroup("ScrollBar"); 921 cfg.setGroup("ScrollBar");
882 int i,j,k; 922 int i,j,k;
883#ifdef QT_QWS_OPIE 923#ifdef QT_QWS_OPIE
884i=-25;j=-26;k=-27; 924i=-25;j=-26;k=-27;
885#else 925#else
886i=-24;j=-25;k=-26; 926i=-24;j=-25;k=-26;
887#endif 927#endif
888 if(index == i) { 928 if(index == i) {
889 929
890 te->setScrollbarLocation(0); 930 te->setScrollbarLocation(0);
891 cfg.writeEntry("Position",0); 931 cfg.writeEntry("Position",0);
892 } else if(index == j) { 932 } else if(index == j) {
893 933
894 te->setScrollbarLocation(1); 934 te->setScrollbarLocation(1);
895 cfg.writeEntry("Position",1); 935 cfg.writeEntry("Position",1);
896 } else if(index == k) { 936 } else if(index == k) {
897 937
898 te->setScrollbarLocation(2); 938 te->setScrollbarLocation(2);
899 cfg.writeEntry("Position",2); 939 cfg.writeEntry("Position",2);
900 } 940 }
901 941
902// case -29: { 942// case -29: {
903// bool b=cfg.readBoolEntry("HorzScroll",0); 943// bool b=cfg.readBoolEntry("HorzScroll",0);
904// cfg.writeEntry("HorzScroll", !b ); 944// cfg.writeEntry("HorzScroll", !b );
905// cfg.write(); 945// cfg.write();
906// if(cfg.readNumEntry("Position",2) == 0) { 946// if(cfg.readNumEntry("Position",2) == 0) {
907// te->setScrollbarLocation(1); 947// te->setScrollbarLocation(1);
908// te->setWrapAt(0); 948// te->setWrapAt(0);
909// } else { 949// } else {
910// te->setScrollbarLocation(0); 950// te->setScrollbarLocation(0);
911// te->setWrapAt(120); 951// te->setWrapAt(120);
912// } 952// }
913// te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 953// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
914// } 954// }
915// break; 955// break;
916} 956}
917 957
918void Konsole::editCommandListMenuSelected(int iD) 958void Konsole::editCommandListMenuSelected(int iD)
919{ 959{
920// QString temp; 960// QString temp;
921// qDebug( temp.sprintf("edit command list %d",iD)); 961// qDebug( temp.sprintf("edit command list %d",iD));
922 TEWidget* te = getTe(); 962 TEWidget* te = getTe();
923 Config cfg("Konsole"); 963 Config cfg("Konsole");
924 cfg.setGroup("Menubar"); 964 cfg.setGroup("Menubar");
925 if( iD == -3) { 965 if( iD == -3) {
926 if(!secondToolBar->isHidden()) { 966 if(!secondToolBar->isHidden()) {
927 secondToolBar->hide(); 967 secondToolBar->hide();
928 configMenu->changeItem( iD,tr( "Show Command List" )); 968 configMenu->changeItem( iD,tr( "Show Command List" ));
929 cfg.writeEntry("Hidden","TRUE"); 969 cfg.writeEntry("Hidden","TRUE");
930 configMenu->setItemEnabled(-23 ,FALSE); 970 configMenu->setItemEnabled(-23 ,FALSE);
931 } else { 971 } else {
932 secondToolBar->show(); 972 secondToolBar->show();
933 configMenu->changeItem( iD,tr( "Hide Command List" )); 973 configMenu->changeItem( iD,tr( "Hide Command List" ));
934 cfg.writeEntry("Hidden","FALSE"); 974 cfg.writeEntry("Hidden","FALSE");
935 configMenu->setItemEnabled(-23 ,TRUE); 975 configMenu->setItemEnabled(-23 ,TRUE);
936 976
937 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 977 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
938 configMenu->setItemChecked(-23,TRUE); 978 configMenu->setItemChecked(-23,TRUE);
939 commonCombo->setEditable( TRUE ); 979 commonCombo->setEditable( TRUE );
940 } else { 980 } else {
941 configMenu->setItemChecked(-23,FALSE); 981 configMenu->setItemChecked(-23,FALSE);
942 commonCombo->setEditable( FALSE ); 982 commonCombo->setEditable( FALSE );
943 } 983 }
944 } 984 }
945 } 985 }
946 if( iD == -23) { 986 if( iD == -23) {
947 cfg.setGroup("Commands"); 987 cfg.setGroup("Commands");
948// qDebug("enableCommandEdit"); 988// qDebug("enableCommandEdit");
949 if( !configMenu->isItemChecked(iD) ) { 989 if( !configMenu->isItemChecked(iD) ) {
@@ -1002,61 +1042,61 @@ void Konsole::parseCommandLine() {
1002 system(cmd.latin1()); 1042 system(cmd.latin1());
1003 exit(0);//close(); 1043 exit(0);//close();
1004 } // end -e switch 1044 } // end -e switch
1005 } 1045 }
1006 startUp++; 1046 startUp++;
1007} 1047}
1008 1048
1009void Konsole::changeForegroundColor(const QColor &color) { 1049void Konsole::changeForegroundColor(const QColor &color) {
1010 Config cfg("Konsole"); 1050 Config cfg("Konsole");
1011 cfg.setGroup("Colors"); 1051 cfg.setGroup("Colors");
1012 int r, g, b; 1052 int r, g, b;
1013 color.rgb(&r,&g,&b); 1053 color.rgb(&r,&g,&b);
1014 foreground.setRgb(r,g,b); 1054 foreground.setRgb(r,g,b);
1015 1055
1016 cfg.writeEntry("foreground",color.name()); 1056 cfg.writeEntry("foreground",color.name());
1017 qDebug("foreground "+color.name()); 1057 qDebug("foreground "+color.name());
1018 cfg.write(); 1058 cfg.write();
1019 1059
1020qDebug("do other dialog"); 1060qDebug("do other dialog");
1021#ifdef QT_QWS_OPIE 1061#ifdef QT_QWS_OPIE
1022 1062
1023 OColorPopupMenu* penColorPopupMenu2 = new OColorPopupMenu(Qt::black, this,"background color"); 1063 OColorPopupMenu* penColorPopupMenu2 = new OColorPopupMenu(Qt::black, this,"background color");
1024 connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, 1064 connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
1025 SLOT(changeBackgroundColor(const QColor&))); 1065 SLOT(changeBackgroundColor(const QColor&)));
1026 penColorPopupMenu2->exec(); 1066 penColorPopupMenu2->exec();
1027#endif 1067#endif
1028} 1068}
1029 1069
1030void Konsole::changeBackgroundColor(const QColor &color) { 1070void Konsole::changeBackgroundColor(const QColor &color) {
1031 1071
1032 qDebug("Change background"); 1072 qDebug("Change background");
1033 Config cfg("Konsole"); 1073 Config cfg("Konsole");
1034 cfg.setGroup("Colors"); 1074 cfg.setGroup("Colors");
1035 int r, g, b; 1075 int r, g, b;
1036 color.rgb(&r,&g,&b); 1076 color.rgb(&r,&g,&b);
1037 background.setRgb(r,g,b); 1077 background.setRgb(r,g,b);
1038 cfg.writeEntry("background",color.name()); 1078 cfg.writeEntry("background",color.name());
1039 qDebug("background "+color.name()); 1079 qDebug("background "+color.name());
1040 cfg.write(); 1080 cfg.write();
1041} 1081}
1042 1082
1043void Konsole::doWrap() { 1083void Konsole::doWrap() {
1044int i; 1084int i;
1045#ifdef QT_QWS_OPIE 1085#ifdef QT_QWS_OPIE
1046i=-29; 1086i=-29;
1047#else 1087#else
1048i=-28; 1088i=-28;
1049#endif 1089#endif
1050 1090
1051 Config cfg("Konsole"); 1091 Config cfg("Konsole");
1052 cfg.setGroup("ScrollBar"); 1092 cfg.setGroup("ScrollBar");
1053 TEWidget* te = getTe(); 1093 TEWidget* te = getTe();
1054 if( !cfg.readBoolEntry("HorzScroll",0)) { 1094 if( !cfg.readBoolEntry("HorzScroll",0)) {
1055 te->setWrapAt(0); 1095 te->setWrapAt(0);
1056 configMenu->setItemChecked( i,TRUE); 1096 configMenu->setItemChecked( i,TRUE);
1057 } else { 1097 } else {
1058// te->setWrapAt(90); 1098// te->setWrapAt(90);
1059 te->setWrapAt(120); 1099 te->setWrapAt(120);
1060 configMenu->setItemChecked( i,FALSE); 1100 configMenu->setItemChecked( i,FALSE);
1061 } 1101 }
1062} 1102}
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h
index 4938159..e9d0e4b 100644
--- a/core/apps/embeddedkonsole/konsole.h
+++ b/core/apps/embeddedkonsole/konsole.h
@@ -1,144 +1,144 @@
1/* ----------------------------------------------------------------------- */ 1/* ----------------------------------------------------------------------- */
2/* */ 2/* */
3/* [konsole.h] Konsole */ 3/* [konsole.h] Konsole */
4/* */ 4/* */
5/* -------------------------------------------------------------------------- */ 5/* -------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole, an X terminal. */ 9/* This file is part of Konsole, an X terminal. */
10/* */ 10/* */
11/* The material contained in here more or less directly orginates from */ 11/* The material contained in here more or less directly orginates from */
12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ 12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
13/* */ 13/* */
14/* -------------------------------------------------------------------------- */ 14/* -------------------------------------------------------------------------- */
15/* */ 15/* */
16/* Ported Konsole to Qt/Embedded */ 16/* Ported Konsole to Qt/Embedded */
17/* */ 17/* */
18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
19/* */ 19/* */
20/* -------------------------------------------------------------------------- */ 20/* -------------------------------------------------------------------------- */
21 21
22#ifndef KONSOLE_H 22#ifndef KONSOLE_H
23#define KONSOLE_H 23#define KONSOLE_H
24 24
25 25
26#include <qmainwindow.h> 26#include <qmainwindow.h>
27#include <qaction.h> 27#include <qaction.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qstrlist.h> 29#include <qstrlist.h>
30#include <qintdict.h> 30#include <qintdict.h>
31#include <qptrdict.h> 31#include <qptrdict.h>
32#include <qtabwidget.h> 32#include <qtabwidget.h>
33#include <qpe/qpetoolbar.h> 33#include <qpe/qpetoolbar.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qcolor.h> 35#include <qcolor.h>
36 36
37#include "MyPty.h" 37#include "MyPty.h"
38#include "TEWidget.h" 38#include "TEWidget.h"
39#include "TEmuVt102.h" 39#include "TEmuVt102.h"
40#include "session.h" 40#include "session.h"
41 41
42class EKNumTabWidget; 42class EKNumTabWidget;
43 43
44class Konsole : public QMainWindow 44class Konsole : public QMainWindow
45{ 45{
46Q_OBJECT 46 Q_OBJECT
47 47
48public: 48public:
49 static QString appName() { return QString::fromLatin1("embeddedkonsole"); }
49 50
50 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 51 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
51 Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
52 ~Konsole(); 52 ~Konsole();
53 void setColLin(int columns, int lines); 53 void setColLin(int columns, int lines);
54 QPEToolBar *secondToolBar; 54 QPEToolBar *secondToolBar;
55 void show(); 55 void show();
56 void setColor(); 56 void setColor();
57 int lastSelectedMenu; 57 int lastSelectedMenu;
58 int startUp; 58 int startUp;
59private slots: 59private slots:
60 void setDocument(const QString &); 60 void setDocument(const QString &);
61 void doneSession(TESession*,int); 61 void doneSession(TESession*,int);
62 void changeColumns(int); 62 void changeColumns(int);
63 void fontChanged(int); 63 void fontChanged(int);
64 void configMenuSelected(int ); 64 void configMenuSelected(int );
65 void colorMenuSelected(int); 65 void colorMenuSelected(int);
66 void colorMenuIsSelected(int); 66 void colorMenuIsSelected(int);
67 void enterCommand(int); 67 void enterCommand(int);
68 void hitEnter(); 68 void hitEnter();
69 void hitSpace(); 69 void hitSpace();
70 void hitTab(); 70 void hitTab();
71 void hitPaste(); 71 void hitPaste();
72 void hitUp(); 72 void hitUp();
73 void hitDown(); 73 void hitDown();
74 void switchSession(QWidget *); 74 void switchSession(QWidget *);
75 void newSession(); 75 void newSession();
76 void changeCommand(const QString &, int); 76 void changeCommand(const QString &, int);
77 void initCommandList(); 77 void initCommandList();
78 void scrollMenuSelected(int); 78 void scrollMenuSelected(int);
79 void editCommandListMenuSelected(int); 79 void editCommandListMenuSelected(int);
80 void parseCommandLine(); 80 void parseCommandLine();
81 void changeForegroundColor(const QColor &); 81 void changeForegroundColor(const QColor &);
82 void changeBackgroundColor(const QColor &); 82 void changeBackgroundColor(const QColor &);
83private: 83private:
84 void doWrap(); 84 void doWrap();
85 void init(const char* _pgm, QStrList & _args); 85 void init(const char* _pgm, QStrList & _args);
86 void initSession(const char* _pgm, QStrList & _args); 86 void initSession(const char* _pgm, QStrList & _args);
87 void runSession(TESession* s); 87 void runSession(TESession* s);
88 void setColorPixmaps(); 88 void setColorPixmaps();
89 void setHistory(bool); 89 void setHistory(bool);
90 QSize calcSize(int columns, int lines); 90 QSize calcSize(int columns, int lines);
91 TEWidget* getTe(); 91 TEWidget* getTe();
92 QStringList commands; 92 QStringList commands;
93 QLabel * msgLabel; 93 QLabel * msgLabel;
94 QColor foreground, background; 94 QColor foreground, background;
95bool fromMenu; 95bool fromMenu;
96private: 96private:
97 class VTFont 97 class VTFont
98 { 98 {
99 public: 99 public:
100 VTFont(QString name, QFont& font) 100 VTFont(QString name, QFont& font)
101 { 101 {
102 this->name = name; 102 this->name = name;
103 this->font = font; 103 this->font = font;
104 } 104 }
105 105
106 QFont& getFont() 106 QFont& getFont()
107 { 107 {
108 return font; 108 return font;
109 } 109 }
110 110
111 QString getName() 111 QString getName()
112 { 112 {
113 return name; 113 return name;
114 } 114 }
115 115
116 private: 116 private:
117 QString name; 117 QString name;
118 QFont font; 118 QFont font;
119 }; 119 };
120 120
121 EKNumTabWidget* tab; 121 EKNumTabWidget* tab;
122 int nsessions; 122 int nsessions;
123 QList<VTFont> fonts; 123 QList<VTFont> fonts;
124 int cfont; 124 int cfont;
125 QCString se_pgm; 125 QCString se_pgm;
126 QStrList se_args; 126 QStrList se_args;
127 127
128 QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; 128 QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu;
129 QComboBox *commonCombo; 129 QComboBox *commonCombo;
130 // history scrolling I think 130 // history scrolling I think
131 bool b_scroll; 131 bool b_scroll;
132 132
133 int n_keytab; 133 int n_keytab;
134 int n_scroll; 134 int n_scroll;
135 int n_render; 135 int n_render;
136 QString pmPath; // pixmap path 136 QString pmPath; // pixmap path
137 QString dropText; 137 QString dropText;
138 QFont defaultFont; 138 QFont defaultFont;
139 QSize defaultSize; 139 QSize defaultSize;
140 140
141}; 141};
142 142
143#endif 143#endif
144 144
diff --git a/core/apps/embeddedkonsole/main.cpp b/core/apps/embeddedkonsole/main.cpp
index 91199eb..f77fe24 100644
--- a/core/apps/embeddedkonsole/main.cpp
+++ b/core/apps/embeddedkonsole/main.cpp
@@ -1,79 +1,38 @@
1/* ---------------------------------------------------------------------- */ 1/* ---------------------------------------------------------------------- */
2/* */ 2/* */
3/* [main.C] Konsole */ 3/* [main.C] Konsole */
4/* */ 4/* */
5/* ---------------------------------------------------------------------- */ 5/* ---------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole, an X terminal. */ 9/* This file is part of Konsole, an X terminal. */
10/* */ 10/* */
11/* The material contained in here more or less directly orginates from */ 11/* The material contained in here more or less directly orginates from */
12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ 12/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
13/* */ 13/* */
14/* ---------------------------------------------------------------------- */ 14/* ---------------------------------------------------------------------- */
15/* */ 15/* */
16/* Ported Konsole to Qt/Embedded */ 16/* Ported Konsole to Qt/Embedded */
17/* */ 17/* */
18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 18/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
19/* */ 19/* */
20/* -------------------------------------------------------------------------- */ 20/* -------------------------------------------------------------------------- */
21 21
22#include "konsole.h" 22#include "konsole.h"
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <opie/oapplicationfactory.h>
25 26
26#include <qfile.h> 27#include <qfile.h>
27 28
28#include <unistd.h> 29#include <unistd.h>
29#include <stdio.h> 30#include <stdio.h>
30#include <stdlib.h> 31#include <stdlib.h>
31 32
32#include <pwd.h> 33#include <pwd.h>
33#include <sys/types.h> 34#include <sys/types.h>
34 35
35 36
36/* --| main |------------------------------------------------------ */ 37/* --| main |------------------------------------------------------ */
37int main(int argc, char* argv[]) 38OPIE_EXPORT_APP( OApplicationFactory<Konsole> )
38{
39 if(setuid(getuid()) !=0) qDebug("setuid failed");
40 if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges
41
42 QPEApplication a( argc, argv );
43
44// QPEApplication::grabKeyboard(); // for CTRL and ALT
45
46 qDebug("keyboard grabbed");
47#ifdef FAKE_CTRL_AND_ALT
48 qDebug("Fake Ctrl and Alt defined");
49 QPEApplication::grabKeyboard(); // for CTRL and ALT
50#endif
51
52 QStrList tmp;
53 const char* shell = getenv("SHELL");
54
55 if (shell == NULL || *shell == '\0') {
56 struct passwd *ent = 0;
57 uid_t me = getuid();
58 shell = "/bin/sh";
59
60 while ( (ent = getpwent()) != 0 ) {
61 if (ent->pw_uid == me) {
62 if (ent->pw_shell != "")
63 shell = ent->pw_shell;
64 break;
65 }
66 }
67 endpwent();
68 }
69
70 if( putenv((char*)"COLORTERM=") !=0)
71 qDebug("putenv failed"); // to trigger mc's color detection
72
73 Konsole m( "test", shell, tmp, TRUE );
74 m.setCaption( Konsole::tr("Terminal") );
75 a.showMainWidget( &m );
76
77 return a.exec();
78}
79
diff --git a/core/apps/textedit/main.cpp b/core/apps/textedit/main.cpp
index f80c5d8..edab73d 100644
--- a/core/apps/textedit/main.cpp
+++ b/core/apps/textedit/main.cpp
@@ -1,35 +1,26 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "textedit.h" 21#include "textedit.h"
22 22
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <opie/oapplicationfactory.h>
24 25
25int main( int argc, char **argv ) 26OPIE_EXPORT_APP( OApplicationFactory<TextEdit> )
26{
27 QPEApplication a( argc, argv );
28
29 TextEdit e;
30 a.showMainDocumentWidget(&e);
31// if ( argc == 3 && argv[1] == QCString("-f") )
32// e.openFile(argv[2]);
33
34 return a.exec();
35}
diff --git a/core/apps/textedit/textedit.h b/core/apps/textedit/textedit.h
index e0cbea2..303b707 100644
--- a/core/apps/textedit/textedit.h
+++ b/core/apps/textedit/textedit.h
@@ -9,116 +9,117 @@
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
14 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 14 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
15 ** 15 **
16 ** Contact info@trolltech.com if any conditions of this licensing are 16 ** Contact info@trolltech.com if any conditions of this licensing are
17 ** not clear to you. 17 ** not clear to you.
18 ** 18 **
19 **********************************************************************/ 19 **********************************************************************/
20// additions made by L.J. Potter Sun 02-17-2002 22:27:46 20// additions made by L.J. Potter Sun 02-17-2002 22:27:46
21 21
22#ifndef TEXTEDIT_H 22#ifndef TEXTEDIT_H
23#define TEXTEDIT_H 23#define TEXTEDIT_H
24 24
25#define QTEXTEDIT_OPEN_API 25#define QTEXTEDIT_OPEN_API
26 26
27//#include "fileBrowser.h" 27//#include "fileBrowser.h"
28//#include "fileSaver.h" 28//#include "fileSaver.h"
29 29
30#include <qpe/filemanager.h> 30#include <qpe/filemanager.h>
31#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
32 32
33#include <opie/ofileselector.h> 33#include <opie/ofileselector.h>
34 34
35#include <qmainwindow.h> 35#include <qmainwindow.h>
36#include <qmultilineedit.h> 36#include <qmultilineedit.h>
37#include <qlist.h> 37#include <qlist.h>
38#include <qmap.h> 38#include <qmap.h>
39 39
40class QAction; 40class QAction;
41class QWidgetStack; 41class QWidgetStack;
42class QToolButton; 42class QToolButton;
43class QPopupMenu; 43class QPopupMenu;
44class QToolBar; 44class QToolBar;
45class QLineEdit; 45class QLineEdit;
46class QAction; 46class QAction;
47class FileSelector; 47class FileSelector;
48class QpeEditor; 48class QpeEditor;
49class QPopupMenu; 49class QPopupMenu;
50class QTimer; 50class QTimer;
51 51
52class TextEdit : public QMainWindow 52class TextEdit : public QMainWindow
53{ 53{
54 Q_OBJECT 54 Q_OBJECT
55 55
56public: 56public:
57 static QString appName() { return QString::fromLatin1("textedit"); }
57 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 58 TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
58 ~TextEdit(); 59 ~TextEdit();
59 60
60protected: 61protected:
61 QPopupMenu *font; 62 QPopupMenu *font;
62 QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave; 63 QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave;
63 bool edited, edited1; 64 bool edited, edited1;
64 void openFile( const QString & ); 65 void openFile( const QString & );
65 QCopChannel * channel; 66 QCopChannel * channel;
66 67
67 bool featureAutoSave; 68 bool featureAutoSave;
68 void closeEvent( QCloseEvent *e ); 69 void closeEvent( QCloseEvent *e );
69 void doSearchBar(); 70 void doSearchBar();
70 int savePrompt(); 71 int savePrompt();
71 void setTimer(); 72 void setTimer();
72private slots: 73private slots:
73 void editorChanged(); 74 void editorChanged();
74 void receive(const QCString&, const QByteArray&); 75 void receive(const QCString&, const QByteArray&);
75 void timerCrank(); 76 void timerCrank();
76 void doTimer(bool); 77 void doTimer(bool);
77 void editPasteTimeDate(); 78 void editPasteTimeDate();
78 void doPrompt(bool); 79 void doPrompt(bool);
79 void doDesktop(bool); 80 void doDesktop(bool);
80 void doFilePerms(bool); 81 void doFilePerms(bool);
81 void doAbout(); 82 void doAbout();
82 void setDocument(const QString&); 83 void setDocument(const QString&);
83 void changeFont(); 84 void changeFont();
84 void fileNew(); 85 void fileNew();
85 void fileRevert(); 86 void fileRevert();
86 void fileOpen(); 87 void fileOpen();
87 void changeStartConfig(bool); 88 void changeStartConfig(bool);
88 bool save(); 89 bool save();
89 bool saveAs(); 90 bool saveAs();
90 void cleanUp(); 91 void cleanUp();
91 92
92 void gotoLine(); 93 void gotoLine();
93 void doGoto(); 94 void doGoto();
94 95
95 96
96 void editCut(); 97 void editCut();
97 void editCopy(); 98 void editCopy();
98 void editPaste(); 99 void editPaste();
99 void editFind(); 100 void editFind();
100 void editDelete(); 101 void editDelete();
101 102
102 void findNext(); 103 void findNext();
103 void findClose(); 104 void findClose();
104 105
105 void search(); 106 void search();
106 void accept(); 107 void accept();
107 108
108 void newFile( const DocLnk & ); 109 void newFile( const DocLnk & );
109 void openFile( const DocLnk & ); 110 void openFile( const DocLnk & );
110 void showEditTools(); 111 void showEditTools();
111 112
112 void zoomIn(); 113 void zoomIn();
113 void zoomOut(); 114 void zoomOut();
114 void setBold(bool y); 115 void setBold(bool y);
115 void setItalic(bool y); 116 void setItalic(bool y);
116 void setWordWrap(bool y); 117 void setWordWrap(bool y);
117 void setSearchBar(bool); 118 void setSearchBar(bool);
118 119
119private: 120private:
120 void openDotFile(const QString &); 121 void openDotFile(const QString &);
121 void colorChanged( const QColor &c ); 122 void colorChanged( const QColor &c );
122 void clear(); 123 void clear();
123 void updateCaption( const QString &name=QString::null ); 124 void updateCaption( const QString &name=QString::null );
124 void setFontSize(int sz, bool round_down_not_up); 125 void setFontSize(int sz, bool round_down_not_up);
diff --git a/core/apps/textedit/textedit.pro b/core/apps/textedit/textedit.pro
index 2577340..b958ff5 100644
--- a/core/apps/textedit/textedit.pro
+++ b/core/apps/textedit/textedit.pro
@@ -1,31 +1,29 @@
1TEMPLATE = app 1CONFIG += qt warn_on release quick-app
2CONFIG += qt warn_on release
3DESTDIR = $(OPIEDIR)/bin
4HEADERS = textedit.h filePermissions.h 2HEADERS = textedit.h filePermissions.h
5SOURCES = main.cpp textedit.cpp filePermissions.cpp 3SOURCES = main.cpp textedit.cpp filePermissions.cpp
6INCLUDEPATH += $(OPIEDIR)/include 4INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 5DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe -lopie 6LIBS += -lqpe -lopie
9TARGET = textedit 7TARGET = textedit
10 8
11TRANSLATIONS = ../../../i18n/de/textedit.ts \ 9TRANSLATIONS = ../../../i18n/de/textedit.ts \
12 ../../../i18n/nl/textedit.ts \ 10 ../../../i18n/nl/textedit.ts \
13 ../../../i18n/da/textedit.ts \ 11 ../../../i18n/da/textedit.ts \
14 ../../../i18n/xx/textedit.ts \ 12 ../../../i18n/xx/textedit.ts \
15 ../../../i18n/en/textedit.ts \ 13 ../../../i18n/en/textedit.ts \
16 ../../../i18n/es/textedit.ts \ 14 ../../../i18n/es/textedit.ts \
17 ../../../i18n/fr/textedit.ts \ 15 ../../../i18n/fr/textedit.ts \
18 ../../../i18n/hu/textedit.ts \ 16 ../../../i18n/hu/textedit.ts \
19 ../../../i18n/ja/textedit.ts \ 17 ../../../i18n/ja/textedit.ts \
20 ../../../i18n/ko/textedit.ts \ 18 ../../../i18n/ko/textedit.ts \
21 ../../../i18n/no/textedit.ts \ 19 ../../../i18n/no/textedit.ts \
22 ../../../i18n/pl/textedit.ts \ 20 ../../../i18n/pl/textedit.ts \
23 ../../../i18n/pt/textedit.ts \ 21 ../../../i18n/pt/textedit.ts \
24 ../../../i18n/pt_BR/textedit.ts \ 22 ../../../i18n/pt_BR/textedit.ts \
25 ../../../i18n/sl/textedit.ts \ 23 ../../../i18n/sl/textedit.ts \
26 ../../../i18n/zh_CN/textedit.ts \ 24 ../../../i18n/zh_CN/textedit.ts \
27 ../../../i18n/zh_TW/textedit.ts 25 ../../../i18n/zh_TW/textedit.ts
28 26
29 27
30 28
31include ( $(OPIEDIR)/include.pro ) 29include ( $(OPIEDIR)/include.pro )