-rwxr-xr-x | core/apps/embeddedkonsole/embeddedkonsole.pro | 4 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 74 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 14 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/main.cpp | 45 | ||||
-rw-r--r-- | core/apps/textedit/main.cpp | 13 | ||||
-rw-r--r-- | core/apps/textedit/textedit.h | 3 | ||||
-rw-r--r-- | core/apps/textedit/textedit.pro | 4 |
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,14 +1,12 @@ | |||
1 | QMAKE_CFLAGS = -DHAVE_OPENPTY | 1 | QMAKE_CFLAGS = -DHAVE_OPENPTY |
2 | TMAKE_FLAGS += -DHAVE_OPENPTY | 2 | TMAKE_FLAGS += -DHAVE_OPENPTY |
3 | QMAKE_LIBS = -lutil | 3 | QMAKE_LIBS = -lutil |
4 | TEMPLATE = app | 4 | CONFIG += qt warn_on release quick-app |
5 | CONFIG += qt warn_on release | ||
6 | DESTDIR = $(OPIEDIR)/bin | ||
7 | HEADERS = TEWidget.h \ | 5 | HEADERS = 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 \ |
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 | |||
@@ -41,16 +41,19 @@ | |||
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" |
@@ -166,30 +169,67 @@ static const char *commonCmds[] = | |||
166 | "mknod", | 169 | "mknod", |
167 | "netstat", | 170 | "netstat", |
168 | */ | 171 | */ |
169 | 172 | ||
170 | "exit", | 173 | "exit", |
171 | NULL | 174 | NULL |
172 | }; | 175 | }; |
173 | 176 | ||
177 | static 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 | ||
175 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 214 | Konsole::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 | ||
182 | Konsole::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 | |||
188 | void Konsole::initCommandList() | 228 | void 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") { |
@@ -294,17 +334,17 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
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))); |
@@ -363,29 +403,29 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
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)); |
@@ -413,17 +453,17 @@ parseCommandLine(); | |||
413 | } | 453 | } |
414 | 454 | ||
415 | void Konsole::show() | 455 | void 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 | ||
424 | void Konsole::initSession(const char*, QStrList &) | 464 | void Konsole::initSession(const char*, QStrList &) |
425 | { | 465 | { |
426 | QMainWindow::show(); | 466 | QMainWindow::show(); |
427 | } | 467 | } |
428 | 468 | ||
429 | Konsole::~Konsole() | 469 | Konsole::~Konsole() |
@@ -536,17 +576,17 @@ QSize Konsole::calcSize(int columns, int lines) { | |||
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 | ||
541 | void Konsole::setColLin(int columns, int lines) | 581 | void 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); |
@@ -758,17 +798,17 @@ void Konsole::colorMenuSelected(int iD) | |||
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(); |
@@ -885,25 +925,25 @@ i=-25;j=-26;k=-27; | |||
885 | #else | 925 | #else |
886 | i=-24;j=-25;k=-26; | 926 | i=-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 { |
@@ -1042,21 +1082,21 @@ void Konsole::changeBackgroundColor(const QColor &color) { | |||
1042 | 1082 | ||
1043 | void Konsole::doWrap() { | 1083 | void Konsole::doWrap() { |
1044 | int i; | 1084 | int i; |
1045 | #ifdef QT_QWS_OPIE | 1085 | #ifdef QT_QWS_OPIE |
1046 | i=-29; | 1086 | i=-29; |
1047 | #else | 1087 | #else |
1048 | i=-28; | 1088 | i=-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 | |||
@@ -38,25 +38,25 @@ | |||
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 | ||
42 | class EKNumTabWidget; | 42 | class EKNumTabWidget; |
43 | 43 | ||
44 | class Konsole : public QMainWindow | 44 | class Konsole : public QMainWindow |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
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; |
59 | private slots: | 59 | private 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); |
@@ -89,31 +89,31 @@ private: | |||
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; |
95 | bool fromMenu; | 95 | bool fromMenu; |
96 | private: | 96 | private: |
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 | }; |
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 | |||
@@ -17,63 +17,22 @@ | |||
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 |------------------------------------------------------ */ |
37 | int main(int argc, char* argv[]) | 38 | OPIE_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 | |||
@@ -16,20 +16,11 @@ | |||
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 | ||
25 | int main( int argc, char **argv ) | 26 | OPIE_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 | |||
@@ -49,16 +49,17 @@ class QpeEditor; | |||
49 | class QPopupMenu; | 49 | class QPopupMenu; |
50 | class QTimer; | 50 | class QTimer; |
51 | 51 | ||
52 | class TextEdit : public QMainWindow | 52 | class TextEdit : public QMainWindow |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
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 | ||
60 | protected: | 61 | protected: |
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 & ); |
@@ -68,17 +69,17 @@ protected: | |||
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(); |
72 | private slots: | 73 | private 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(); |
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,11 +1,9 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = textedit.h filePermissions.h | 2 | HEADERS = textedit.h filePermissions.h |
5 | SOURCES = main.cpp textedit.cpp filePermissions.cpp | 3 | SOURCES = main.cpp textedit.cpp filePermissions.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 4 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 5 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lqpe -lopie | 6 | LIBS += -lqpe -lopie |
9 | TARGET = textedit | 7 | TARGET = textedit |
10 | 8 | ||
11 | TRANSLATIONS = ../../../i18n/de/textedit.ts \ | 9 | TRANSLATIONS = ../../../i18n/de/textedit.ts \ |