From 49227638e76fa71209390a9c42528a02e3803e3d Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 01 May 2004 21:10:02 +0000 Subject: Convert to quicklaunch. Integrate the Sharp ROM fixlet in c'tor and d'tor of the mainwindow --- (limited to 'noncore') 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 + +#include +#include +#include +#include + +/* + * 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 - -#include -#include -#include -#include - -#include +#include #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 ); - 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 @@ -9,6 +9,7 @@ #include "function_keyboard.h" #include "emulation_handler.h" #include "script.h" +#include "fixit.h" /* OPIE */ #include @@ -29,6 +30,12 @@ using namespace Opie::Ui; #include 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 ); @@ -298,6 +305,10 @@ void MainWindow::populateScripts() { MainWindow::~MainWindow() { delete m_factory; manager()->save(); +#ifdef FSCKED_DISTRI + FixIt fix; + fix.breakIt(); +#endif } MetaFactory* MainWindow::factory() { @@ -449,13 +460,13 @@ void MainWindow::slotClose() { 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 ); @@ -573,7 +584,7 @@ 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(); @@ -582,7 +593,7 @@ void MainWindow::slotSessionChanged( Session* ses ) { 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 ); 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 @@ -28,6 +28,7 @@ class MainWindow : public QMainWindow { 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,6 +1,4 @@ -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 \ -- cgit v0.9.0.2