author | zecke <zecke> | 2004-05-01 21:10:02 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-01 21:10:02 (UTC) |
commit | 49227638e76fa71209390a9c42528a02e3803e3d (patch) (side-by-side diff) | |
tree | 3fbbf00962bbb2698e63a196a83fb156443bafd3 | |
parent | 0d4fd8b708eddb609fd3b14ffe7df1cb3a1401f1 (diff) | |
download | opie-49227638e76fa71209390a9c42528a02e3803e3d.zip opie-49227638e76fa71209390a9c42528a02e3803e3d.tar.gz opie-49227638e76fa71209390a9c42528a02e3803e3d.tar.bz2 |
Convert to quicklaunch. Integrate the Sharp ROM fixlet in c'tor and d'tor
of the mainwindow
-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 | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 4 |
5 files changed, 107 insertions, 111 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 @@ -8,8 +8,9 @@ #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> @@ -28,8 +29,14 @@ using namespace Opie::Ui; /* 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 ); @@ -297,8 +304,12 @@ void MainWindow::populateScripts() { MainWindow::~MainWindow() { delete m_factory; manager()->save(); +#ifdef FSCKED_DISTRI + FixIt fix; + fix.breakIt(); +#endif } MetaFactory* MainWindow::factory() { return m_factory; @@ -448,15 +459,15 @@ void MainWindow::slotClose() { if (!currentSession() ) return; Session* ses = currentSession(); - owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; + owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ m_curSession = NULL; tabWidget()->remove( /*currentSession()*/ses ); /*it's autodelete */ m_sessions.remove( ses ); - owarn << "after remove!!" << oendl; + owarn << "after remove!!" << oendl; if (!currentSession() ) { m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); @@ -572,18 +583,18 @@ void MainWindow::slotOpenButtons( bool state ) { void MainWindow::slotSessionChanged( Session* ses ) { - owarn << "changed!" << oendl; + owarn << "changed!" << oendl; if(m_curSession) if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); if(ses) if(ses->transferDialog()) ses->transferDialog()->show(); if ( ses ) { m_curSession = ses; - odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; + odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; if ( m_curSession->layer()->isConnected() ) { m_connect->setEnabled( false ); m_disconnect->setEnabled( true ); m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 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 @@ -27,8 +27,9 @@ 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 * 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,7 +1,5 @@ -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 \ |