author | mickeyl <mickeyl> | 2003-11-06 10:26:22 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-11-06 10:26:22 (UTC) |
commit | 8c283be8e455571a03f11035b23f649e49de726c (patch) (unidiff) | |
tree | 8213d1c2cbf06881649af936362d4035ee63ceed | |
parent | 55ea6367fba8a82fbdca74599422717e4b3c3ec6 (diff) | |
download | opie-8c283be8e455571a03f11035b23f649e49de726c.zip opie-8c283be8e455571a03f11035b23f649e49de726c.tar.gz opie-8c283be8e455571a03f11035b23f649e49de726c.tar.bz2 |
merge core/apps/*
-rwxr-xr-x | core/apps/embeddedkonsole/embeddedkonsole.pro | 4 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 54 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 2 | ||||
-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 | 1 | ||||
-rw-r--r-- | core/apps/textedit/textedit.pro | 4 |
7 files changed, 55 insertions, 68 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 | |||
@@ -3,5 +3,3 @@ 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 \ |
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 | |||
@@ -48,2 +48,5 @@ | |||
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> |
@@ -173,2 +176,38 @@ static const char *commonCmds[] = | |||
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 | ||
@@ -177,12 +216,13 @@ Konsole::Konsole(QWidget* parent, const char* name, WFlags 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() |
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 | |||
@@ -48,5 +48,5 @@ Q_OBJECT | |||
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(); |
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 | |||
@@ -24,2 +24,3 @@ | |||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <opie/oapplicationfactory.h> | ||
25 | 26 | ||
@@ -36,44 +37,2 @@ | |||
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 | |||
@@ -23,13 +23,4 @@ | |||
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 | |||
@@ -56,2 +56,3 @@ class TextEdit : public QMainWindow | |||
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 ); |
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,4 +1,2 @@ | |||
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 |