author | mickeyl <mickeyl> | 2003-11-06 10:26:22 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-11-06 10:26:22 (UTC) |
commit | 8c283be8e455571a03f11035b23f649e49de726c (patch) (side-by-side diff) | |
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 @@ -1,18 +1,16 @@ QMAKE_CFLAGS = -DHAVE_OPENPTY 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 \ TEScreen.h \ TECommon.h \ TEHistory.h \ TEmulation.h \ TEmuVt102.h \ session.h \ keytrans.h \ konsole.h \ commandeditdialog.h \ commandeditwidget.h \ playlistselection.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 @@ -37,24 +37,27 @@ #include <qmessagebox.h> #include <qaction.h> #include <qapplication.h> #include <qfontmetrics.h> #include <qcombobox.h> #include <qevent.h> #include <qtabwidget.h> #include <qtabbar.h> #include <qpe/config.h> #include <qstringlist.h> #include <qpalette.h> +#include <unistd.h> +#include <pwd.h> +#include <sys/types.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "konsole.h" #include "keytrans.h" #include "commandeditdialog.h" #ifdef QT_QWS_OPIE #include <opie/colorpopupmenu.h> #endif @@ -162,38 +165,75 @@ static const char *commonCmds[] = "more", "sort", "touch", "umount", "mknod", "netstat", */ "exit", NULL }; +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 +} Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, 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() { // qDebug("Konsole::initCommandList"); Config cfg("Konsole"); cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); commonCombo->clear(); if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { for (int i = 0; commonCmds[i] != NULL; i++) { commonCombo->insertItem(commonCmds[i],i); } } else { 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 @@ -37,27 +37,27 @@ #include "MyPty.h" #include "TEWidget.h" #include "TEmuVt102.h" #include "session.h" class EKNumTabWidget; class Konsole : public QMainWindow { 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; void show(); void setColor(); int lastSelectedMenu; int startUp; private slots: void setDocument(const QString &); void doneSession(TESession*,int); void changeColumns(int); void fontChanged(int); 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 @@ -13,67 +13,26 @@ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ #include "konsole.h" #include <qpe/qpeapplication.h> +#include <opie/oapplicationfactory.h> #include <qfile.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <pwd.h> #include <sys/types.h> /* --| 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 @@ -12,24 +12,15 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "textedit.h" #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 @@ -45,24 +45,25 @@ class QToolBar; class QLineEdit; class QAction; class FileSelector; class QpeEditor; class QPopupMenu; class QTimer; class TextEdit : public QMainWindow { Q_OBJECT public: + static QString appName() { return QString::fromLatin1("textedit"); } TextEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~TextEdit(); protected: QPopupMenu *font; QAction *nStart, *nFileDlgOpt, *nAdvanced, *desktopAction, *filePermAction, *searchBarAction, *nAutoSave; bool edited, edited1; void openFile( const QString & ); QCopChannel * channel; bool featureAutoSave; void closeEvent( QCloseEvent *e ); 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,15 +1,13 @@ -TEMPLATE = app -CONFIG += qt warn_on release -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt warn_on release quick-app HEADERS = textedit.h filePermissions.h SOURCES = main.cpp textedit.cpp filePermissions.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie TARGET = textedit TRANSLATIONS = ../../../i18n/de/textedit.ts \ ../../../i18n/nl/textedit.ts \ ../../../i18n/da/textedit.ts \ ../../../i18n/xx/textedit.ts \ ../../../i18n/en/textedit.ts \ |