-rw-r--r-- | noncore/apps/opie-console/fixit.h | 88 | ||||
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 106 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 4 |
5 files changed, 103 insertions, 107 deletions
diff --git a/noncore/apps/opie-console/fixit.h b/noncore/apps/opie-console/fixit.h new file mode 100644 index 0000000..501914e --- a/dev/null +++ b/noncore/apps/opie-console/fixit.h @@ -0,0 +1,88 @@ +#ifndef FIX_IT_H +#define FIX_IT_H + + +#include <sys/types.h> + +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> +#include <qfile.h> + +/* + * The Zaurus rom + */ +class FixIt { +public: + FixIt(); + ~FixIt(); + void fixIt(); + /* no real interested in implementing it */ + void breakIt() { + + }; + char* m_file; +}; + +FixIt::FixIt() { + /* the new inittab */ + m_file = "#\n# /etc/inittab" +"#" +"" +"# 0 - halt (Do NOT set initdefault to this)" +"# 1 - Single user mode" +"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" +"# 3 - Full multiuser mode" +"# 4 - JavaVM(Intent) developer mode" +"# 5 - JavaVM(Intent)" +"# 6 - reboot (Do NOT set initdefault to this)" +"#" +"id:5:initdefault:" +"" +"# Specify things to do when starting" +"si::sysinit:/etc/rc.d/rc.sysinit" +"" +"l0:0:wait:/root/etc/rc.d/rc 0" +"l1:1:wait:/etc/rc.d/rc 1" +"l2:2:wait:/etc/rc.d/rc 2" +"l3:3:wait:/etc/rc.d/rc 3" +"l4:4:wait:/etc/rc.d/rc 4" +"l5:5:wait:/etc/rc.d/rc 5" +"l6:6:wait:/root/etc/rc.d/rc 6" +"" +"# Specify things to do before rebooting" +"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" +"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" +"" +"# Specify program to run on ttyS0" +"s0:24:respawn:/sbin/getty 9600 ttyS0" +"#pd:5:respawn:/etc/sync/serialctl" +"" +"# Specify program to run on tty1" +"1:2:respawn:/sbin/getty 9600 tty1" +"ln:345:respawn:survive -l 6 /sbin/launch" +"#qt:5:respawn:/sbin/qt" +"" +"# collie sp." +"sy::respawn:/sbin/shsync\n"; + +} +FixIt::~FixIt() { +} +/* + * the retail Zaurus is broken in many ways + * one is that pppd is listening on our port... + * we've to stop it from that and then do kill(SIGHUP,1); + */ +void FixIt::fixIt() { + ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); + QFile file( "/etc/inittab" ); + if ( file.open(IO_WriteOnly | IO_Raw ) ) { + file.writeBlock(m_file,strlen(m_file) ); + } + file.close(); + ::kill( SIGHUP, 1 ); +} + + +#endif diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index 92921ab..eafc9b2 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp @@ -1,110 +1,8 @@ -#include <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <qfile.h> - -#include <qpe/qpeapplication.h> +#include <opie2/oapplicationfactory.h> #include "mainwindow.h" -// #define FSCKED_DISTRIBUTION 1 -#ifdef FSCKED_DISTRIBUTION -/* - * The Zaurus rom - */ -class FixIt { -public: - FixIt(); - ~FixIt(); - void fixIt(); - /* no real interested in implementing it */ - void breakIt() { - - }; - char* m_file; -}; - -FixIt::FixIt() { - /* the new inittab */ - m_file = "#\n# /etc/inittab" -"#" -"" -"# 0 - halt (Do NOT set initdefault to this)" -"# 1 - Single user mode" -"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" -"# 3 - Full multiuser mode" -"# 4 - JavaVM(Intent) developer mode" -"# 5 - JavaVM(Intent)" -"# 6 - reboot (Do NOT set initdefault to this)" -"#" -"id:5:initdefault:" -"" -"# Specify things to do when starting" -"si::sysinit:/etc/rc.d/rc.sysinit" -"" -"l0:0:wait:/root/etc/rc.d/rc 0" -"l1:1:wait:/etc/rc.d/rc 1" -"l2:2:wait:/etc/rc.d/rc 2" -"l3:3:wait:/etc/rc.d/rc 3" -"l4:4:wait:/etc/rc.d/rc 4" -"l5:5:wait:/etc/rc.d/rc 5" -"l6:6:wait:/root/etc/rc.d/rc 6" -"" -"# Specify things to do before rebooting" -"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" -"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" -"" -"# Specify program to run on ttyS0" -"s0:24:respawn:/sbin/getty 9600 ttyS0" -"#pd:5:respawn:/etc/sync/serialctl" -"" -"# Specify program to run on tty1" -"1:2:respawn:/sbin/getty 9600 tty1" -"ln:345:respawn:survive -l 6 /sbin/launch" -"#qt:5:respawn:/sbin/qt" -"" -"# collie sp." -"sy::respawn:/sbin/shsync\n"; -} -FixIt::~FixIt() { -} -/* - * the retail Zaurus is broken in many ways - * one is that pppd is listening on our port... - * we've to stop it from that and then do kill(SIGHUP,1); - */ -void FixIt::fixIt() { - ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); - QFile file( "/etc/inittab" ); - if ( file.open(IO_WriteOnly | IO_Raw ) ) { - file.writeBlock(m_file,strlen(m_file) ); - } - file.close(); - ::kill( SIGHUP, 1 ); -} -#endif - -int main(int argc, char **argv) { -// too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; - QPEApplication app( argc, argv ); - -#ifdef FSCKED_DISTRIBUTION -// owarn << "fscked" << oendl; - FixIt it; - it.fixIt(); -#endif - MainWindow mw; - mw.setCaption(QObject::tr("Opie Console") ); - app.showMainWidget( &mw ); +OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ); - int ap = app.exec(); -#ifdef FSCKED_DISTRIBUTION - /* should add a signal handler too */ - it.breakIt(); -#endif - return ap; -} diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index b403b4d..b160604 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,43 +1,50 @@ #include "TEmulation.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "emulation_handler.h" #include "script.h" +#include "fixit.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/ofiledialog.h> #include <qpe/filemanager.h> using namespace Opie::Core; using namespace Opie::Ui; /* QT */ #include <qaction.h> #include <qmenubar.h> #include <qtoolbar.h> #include <qmessagebox.h> #include <qwhatsthis.h> #include <qfileinfo.h> /* STD */ #include <assert.h> MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { +#ifdef FSCKED_DISTRI + FixIt fix; + fix.fixIt(); +#endif + + setCaption(QObject::tr("Opie Console") ); KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++ ) { KeyTrans* s = KeyTrans::find(i ); assert( s ); } m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); m_scriptsData.setAutoDelete(TRUE); @@ -289,24 +296,28 @@ void MainWindow::populateScripts() { if (info.extension(false) == "script") { m_scriptsData.append(new DocLnk(**dit)); m_scriptsPop->insertItem((*dit)->name()); } } } } MainWindow::~MainWindow() { delete m_factory; manager()->save(); +#ifdef FSCKED_DISTRI + FixIt fix; + fix.breakIt(); +#endif } MetaFactory* MainWindow::factory() { return m_factory; } Session* MainWindow::currentSession() { return m_curSession; } QList<Session> MainWindow::sessions() { return m_sessions; diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index 86939c1..b1f175a 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h @@ -19,24 +19,25 @@ class MetaFactory; class TabWidget; class ProfileManager; class Profile; class FunctionKeyboard; class FKey; class DocLnk; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); ~MainWindow(); + static QString appName() {return QString::fromLatin1("console"); } /** * our factory to generate IOLayer and so on * */ MetaFactory* factory(); /** * A session contains a QWidget*, * an IOLayer* and some infos for us */ Session* currentSession(); diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 8268b01..baa5a55 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,15 +1,13 @@ -TEMPLATE = app -CONFIG += qt warn_on -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt warn_on quick-app HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ file_layer.h filetransfer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ tabwidget.h \ configdialog.h \ keytrans.h \ transferdialog.h \ |