-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 @@ -3,5 +3,3 @@ TMAKE_FLAGS += -DHAVE_OPENPTY QMAKE_LIBS = -lutil -TEMPLATE = app -CONFIG += qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt warn_on release quick-app 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 @@ +#include <unistd.h> +#include <pwd.h> +#include <sys/types.h> #include <sys/wait.h> @@ -173,2 +176,38 @@ static const char *commonCmds[] = +static void konsoleInit(const char** shell) { + if(setuid(getuid()) !=0) qDebug("setuid failed"); + if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges + + +// QPEApplication::grabKeyboard(); // for CTRL and ALT + + qDebug("keyboard grabbed"); +#ifdef FAKE_CTRL_AND_ALT + qDebug("Fake Ctrl and Alt defined"); + QPEApplication::grabKeyboard(); // for CTRL and ALT +#endif + + *shell = getenv("SHELL"); + qWarning("SHell initially is %s", *shell ); + + if (shell == NULL || *shell == '\0') { + struct passwd *ent = 0; + uid_t me = getuid(); + *shell = "/bin/sh"; + + while ( (ent = getpwent()) != 0 ) { + if (ent->pw_uid == me) { + if (ent->pw_shell != "") + *shell = ent->pw_shell; + break; + } + } + endpwent(); + } + + qWarning("SHELL now is %s", *shell ); + + if( putenv((char*)"COLORTERM=") !=0) + qDebug("putenv failed"); // to trigger mc's color detection +} @@ -177,12 +216,13 @@ Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : { - QStrList args; - init("/bin/sh",args); -} + QStrList tmp; const char* shell; -Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) - : QMainWindow(0, name) -{ - init(_pgm,_args); + setCaption( tr("Terminal") ); + + konsoleInit( &shell); + qWarning("Using shell %s", shell); + init(shell,tmp); } + + void Konsole::initCommandList() @@ -301,3 +341,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) #endif - + configMenu->insertItem( tr("Font"), fontList ); @@ -370,3 +410,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) // scrollMenu->insertItem(tr( "Horizontal" )); - + configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); @@ -382,3 +422,3 @@ void Konsole::init(const char* _pgm, QStrList & _args) - + //scrollMenuSelected(-29); @@ -420,3 +460,3 @@ void Konsole::show() QMainWindow::show(); - + } @@ -543,3 +583,3 @@ void Konsole::setColLin(int columns, int lines) qDebug("konsole::setColLin:: Columns %d", columns); - + if ((columns==0) || (lines==0)) @@ -765,3 +805,3 @@ void Konsole::colorMenuSelected(int iD) } -#ifdef QT_QWS_OPIE +#ifdef QT_QWS_OPIE if(iD==-19) { @@ -892,3 +932,3 @@ i=-24;j=-25;k=-26; } else if(index == j) { - + te->setScrollbarLocation(1); @@ -900,3 +940,3 @@ i=-24;j=-25;k=-26; } - + // case -29: { @@ -1049,3 +1089,3 @@ i=-28; #endif - + Config cfg("Konsole"); @@ -1060,3 +1100,3 @@ i=-28; configMenu->setItemChecked( i,FALSE); - } + } } 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 @@ -45,11 +45,11 @@ class Konsole : public QMainWindow { -Q_OBJECT + Q_OBJECT public: + static QString appName() { return QString::fromLatin1("embeddedkonsole"); } Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); - Konsole(const char * name, const char* pgm, QStrList & _args, int histon); ~Konsole(); void setColLin(int columns, int lines); - QPEToolBar *secondToolBar; + QPEToolBar *secondToolBar; void show(); @@ -96,6 +96,6 @@ bool fromMenu; private: - class VTFont + class VTFont { public: - VTFont(QString name, QFont& font) + VTFont(QString name, QFont& font) { @@ -105,3 +105,3 @@ private: - QFont& getFont() + QFont& getFont() { @@ -110,3 +110,3 @@ private: - QString getName() + QString getName() { 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 @@ #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> @@ -36,44 +37,2 @@ /* --| main |------------------------------------------------------ */ -int main(int argc, char* argv[]) -{ - if(setuid(getuid()) !=0) qDebug("setuid failed"); - if(setgid(getgid()) != 0) qDebug("setgid failed"); // drop privileges - - QPEApplication a( argc, argv ); - -// QPEApplication::grabKeyboard(); // for CTRL and ALT - - qDebug("keyboard grabbed"); -#ifdef FAKE_CTRL_AND_ALT - qDebug("Fake Ctrl and Alt defined"); - QPEApplication::grabKeyboard(); // for CTRL and ALT -#endif - - QStrList tmp; - const char* shell = getenv("SHELL"); - - if (shell == NULL || *shell == '\0') { - struct passwd *ent = 0; - uid_t me = getuid(); - shell = "/bin/sh"; - - while ( (ent = getpwent()) != 0 ) { - if (ent->pw_uid == me) { - if (ent->pw_shell != "") - shell = ent->pw_shell; - break; - } - } - endpwent(); - } - - if( putenv((char*)"COLORTERM=") !=0) - qDebug("putenv failed"); // to trigger mc's color detection - - Konsole m( "test", shell, tmp, TRUE ); - m.setCaption( Konsole::tr("Terminal") ); - a.showMainWidget( &m ); - - return a.exec(); -} - +OPIE_EXPORT_APP( OApplicationFactory<Konsole> ) 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 @@ #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> -int main( int argc, char **argv ) -{ - QPEApplication a( argc, argv ); - - TextEdit e; - a.showMainDocumentWidget(&e); -// if ( argc == 3 && argv[1] == QCString("-f") ) -// e.openFile(argv[2]); - - return a.exec(); -} +OPIE_EXPORT_APP( OApplicationFactory<TextEdit> ) 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 public: + static QString appName() { return QString::fromLatin1("textedit"); } TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); @@ -75,3 +76,3 @@ private slots: void timerCrank(); - void doTimer(bool); + void doTimer(bool); void editPasteTimeDate(); 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 @@ -TEMPLATE = app -CONFIG += qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt warn_on release quick-app HEADERS = textedit.h filePermissions.h |