summaryrefslogtreecommitdiff
path: root/core/apps
authormickeyl <mickeyl>2003-11-06 10:26:22 (UTC)
committer mickeyl <mickeyl>2003-11-06 10:26:22 (UTC)
commit8c283be8e455571a03f11035b23f649e49de726c (patch) (side-by-side diff)
tree8213d1c2cbf06881649af936362d4035ee63ceed /core/apps
parent55ea6367fba8a82fbdca74599422717e4b3c3ec6 (diff)
downloadopie-8c283be8e455571a03f11035b23f649e49de726c.zip
opie-8c283be8e455571a03f11035b23f649e49de726c.tar.gz
opie-8c283be8e455571a03f11035b23f649e49de726c.tar.bz2
merge core/apps/*
Diffstat (limited to 'core/apps') (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,12 +1,10 @@
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 \
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
@@ -43,12 +43,15 @@
#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"
@@ -168,26 +171,63 @@ static const char *commonCmds[] =
*/
"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);
@@ -296,13 +336,13 @@ void Konsole::init(const char* _pgm, QStrList & _args)
colorMenu->insertItem(tr( "Blue on Black"));
colorMenu->insertItem(tr( "Amber on Black"));
#ifdef QT_QWS_OPIE
colorMenu->insertItem(tr( "Custom"));
#endif
-
+
configMenu->insertItem( tr("Font"), fontList );
configMenu->insertItem(tr( "Colors") ,colorMenu);
connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
@@ -365,25 +405,25 @@ void Konsole::init(const char* _pgm, QStrList & _args)
scrollMenu->insertItem(tr( "None" ));
scrollMenu->insertItem(tr( "Left" ));
scrollMenu->insertItem(tr( "Right" ));
// scrollMenu->insertSeparator(4);
// scrollMenu->insertItem(tr( "Horizontal" ));
-
+
configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
int jut = configMenu->insertItem(tr( "Wrap" ));
cfg.setGroup("ScrollBar");
configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0));
jut = configMenu->insertItem(tr( "Use Beep" ));
cfg.setGroup("Menubar");
configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0));
-
+
//scrollMenuSelected(-29);
// cfg.setGroup("ScrollBar");
// if(cfg.readBoolEntry("HorzScroll",0)) {
// if(cfg.readNumEntry("Position",2) == 0)
// te->setScrollbarLocation(1);
// else
@@ -415,13 +455,13 @@ parseCommandLine();
void Konsole::show()
{
if ( !nsessions ) {
newSession();
}
QMainWindow::show();
-
+
}
void Konsole::initSession(const char*, QStrList &)
{
QMainWindow::show();
}
@@ -538,13 +578,13 @@ QSize Konsole::calcSize(int columns, int lines) {
guest widget. Call with (0,0) for setting default size.
*/
void Konsole::setColLin(int columns, int lines)
{
qDebug("konsole::setColLin:: Columns %d", columns);
-
+
if ((columns==0) || (lines==0))
{
if (defaultSize.isEmpty()) // not in config file : set default value
{
defaultSize = calcSize(80,24);
// notifySize(24,80); // set menu items (strange arg order !)
@@ -760,13 +800,13 @@ void Konsole::colorMenuSelected(int iD)
if(iD==-18) {// Black, Gold
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(255,215,0);
cfg.writeEntry("Schema","18");
colorMenu->setItemChecked(-18,TRUE);
}
-#ifdef QT_QWS_OPIE
+#ifdef QT_QWS_OPIE
if(iD==-19) {
// Custom
qDebug("do custom");
if(fromMenu) {
OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, this, "foreground color");
connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
@@ -887,21 +927,21 @@ i=-24;j=-25;k=-26;
#endif
if(index == i) {
te->setScrollbarLocation(0);
cfg.writeEntry("Position",0);
} else if(index == j) {
-
+
te->setScrollbarLocation(1);
cfg.writeEntry("Position",1);
} else if(index == k) {
te->setScrollbarLocation(2);
cfg.writeEntry("Position",2);
}
-
+
// case -29: {
// bool b=cfg.readBoolEntry("HorzScroll",0);
// cfg.writeEntry("HorzScroll", !b );
// cfg.write();
// if(cfg.readNumEntry("Position",2) == 0) {
// te->setScrollbarLocation(1);
@@ -1044,19 +1084,19 @@ void Konsole::doWrap() {
int i;
#ifdef QT_QWS_OPIE
i=-29;
#else
i=-28;
#endif
-
+
Config cfg("Konsole");
cfg.setGroup("ScrollBar");
TEWidget* te = getTe();
if( !cfg.readBoolEntry("HorzScroll",0)) {
te->setWrapAt(0);
configMenu->setItemChecked( i,TRUE);
} else {
// te->setWrapAt(90);
te->setWrapAt(120);
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
@@ -40,21 +40,21 @@
#include "session.h"
class EKNumTabWidget;
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();
void setColor();
int lastSelectedMenu;
int startUp;
private slots:
void setDocument(const QString &);
@@ -91,27 +91,27 @@ private:
TEWidget* getTe();
QStringList commands;
QLabel * msgLabel;
QColor foreground, background;
bool fromMenu;
private:
- class VTFont
+ class VTFont
{
public:
- VTFont(QString name, QFont& font)
+ VTFont(QString name, QFont& font)
{
this->name = name;
this->font = font;
}
- QFont& getFont()
+ QFont& getFont()
{
return font;
}
- QString getName()
+ QString getName()
{
return name;
}
private:
QString name;
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
@@ -19,61 +19,20 @@
/* */
/* -------------------------------------------------------------------------- */
#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
@@ -18,18 +18,9 @@
**
**********************************************************************/
#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
@@ -51,12 +51,13 @@ 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;
@@ -70,13 +71,13 @@ protected:
int savePrompt();
void setTimer();
private slots:
void editorChanged();
void receive(const QCString&, const QByteArray&);
void timerCrank();
- void doTimer(bool);
+ void doTimer(bool);
void editPasteTimeDate();
void doPrompt(bool);
void doDesktop(bool);
void doFilePerms(bool);
void doAbout();
void setDocument(const QString&);
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,9 +1,7 @@
-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