-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 @@ | |||
1 | #ifndef FIX_IT_H | ||
2 | #define FIX_IT_H | ||
3 | |||
4 | |||
5 | #include <sys/types.h> | ||
6 | |||
7 | #include <stdio.h> | ||
8 | #include <stdlib.h> | ||
9 | #include <signal.h> | ||
10 | #include <qfile.h> | ||
11 | |||
12 | /* | ||
13 | * The Zaurus rom | ||
14 | */ | ||
15 | class FixIt { | ||
16 | public: | ||
17 | FixIt(); | ||
18 | ~FixIt(); | ||
19 | void fixIt(); | ||
20 | /* no real interested in implementing it */ | ||
21 | void breakIt() { | ||
22 | |||
23 | }; | ||
24 | char* m_file; | ||
25 | }; | ||
26 | |||
27 | FixIt::FixIt() { | ||
28 | /* the new inittab */ | ||
29 | m_file = "#\n# /etc/inittab" | ||
30 | "#" | ||
31 | "" | ||
32 | "# 0 - halt (Do NOT set initdefault to this)" | ||
33 | "# 1 - Single user mode" | ||
34 | "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" | ||
35 | "# 3 - Full multiuser mode" | ||
36 | "# 4 - JavaVM(Intent) developer mode" | ||
37 | "# 5 - JavaVM(Intent)" | ||
38 | "# 6 - reboot (Do NOT set initdefault to this)" | ||
39 | "#" | ||
40 | "id:5:initdefault:" | ||
41 | "" | ||
42 | "# Specify things to do when starting" | ||
43 | "si::sysinit:/etc/rc.d/rc.sysinit" | ||
44 | "" | ||
45 | "l0:0:wait:/root/etc/rc.d/rc 0" | ||
46 | "l1:1:wait:/etc/rc.d/rc 1" | ||
47 | "l2:2:wait:/etc/rc.d/rc 2" | ||
48 | "l3:3:wait:/etc/rc.d/rc 3" | ||
49 | "l4:4:wait:/etc/rc.d/rc 4" | ||
50 | "l5:5:wait:/etc/rc.d/rc 5" | ||
51 | "l6:6:wait:/root/etc/rc.d/rc 6" | ||
52 | "" | ||
53 | "# Specify things to do before rebooting" | ||
54 | "um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" | ||
55 | "sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" | ||
56 | "" | ||
57 | "# Specify program to run on ttyS0" | ||
58 | "s0:24:respawn:/sbin/getty 9600 ttyS0" | ||
59 | "#pd:5:respawn:/etc/sync/serialctl" | ||
60 | "" | ||
61 | "# Specify program to run on tty1" | ||
62 | "1:2:respawn:/sbin/getty 9600 tty1" | ||
63 | "ln:345:respawn:survive -l 6 /sbin/launch" | ||
64 | "#qt:5:respawn:/sbin/qt" | ||
65 | "" | ||
66 | "# collie sp." | ||
67 | "sy::respawn:/sbin/shsync\n"; | ||
68 | |||
69 | } | ||
70 | FixIt::~FixIt() { | ||
71 | } | ||
72 | /* | ||
73 | * the retail Zaurus is broken in many ways | ||
74 | * one is that pppd is listening on our port... | ||
75 | * we've to stop it from that and then do kill(SIGHUP,1); | ||
76 | */ | ||
77 | void FixIt::fixIt() { | ||
78 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | ||
79 | QFile file( "/etc/inittab" ); | ||
80 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | ||
81 | file.writeBlock(m_file,strlen(m_file) ); | ||
82 | } | ||
83 | file.close(); | ||
84 | ::kill( SIGHUP, 1 ); | ||
85 | } | ||
86 | |||
87 | |||
88 | #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 @@ | |||
1 | #include <sys/types.h> | 1 | #include <opie2/oapplicationfactory.h> |
2 | |||
3 | #include <stdio.h> | ||
4 | #include <stdlib.h> | ||
5 | #include <signal.h> | ||
6 | #include <qfile.h> | ||
7 | |||
8 | #include <qpe/qpeapplication.h> | ||
9 | 2 | ||
10 | #include "mainwindow.h" | 3 | #include "mainwindow.h" |
11 | 4 | ||
12 | // #define FSCKED_DISTRIBUTION 1 | ||
13 | #ifdef FSCKED_DISTRIBUTION | ||
14 | /* | ||
15 | * The Zaurus rom | ||
16 | */ | ||
17 | class FixIt { | ||
18 | public: | ||
19 | FixIt(); | ||
20 | ~FixIt(); | ||
21 | void fixIt(); | ||
22 | /* no real interested in implementing it */ | ||
23 | void breakIt() { | ||
24 | |||
25 | }; | ||
26 | char* m_file; | ||
27 | }; | ||
28 | |||
29 | FixIt::FixIt() { | ||
30 | /* the new inittab */ | ||
31 | m_file = "#\n# /etc/inittab" | ||
32 | "#" | ||
33 | "" | ||
34 | "# 0 - halt (Do NOT set initdefault to this)" | ||
35 | "# 1 - Single user mode" | ||
36 | "# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" | ||
37 | "# 3 - Full multiuser mode" | ||
38 | "# 4 - JavaVM(Intent) developer mode" | ||
39 | "# 5 - JavaVM(Intent)" | ||
40 | "# 6 - reboot (Do NOT set initdefault to this)" | ||
41 | "#" | ||
42 | "id:5:initdefault:" | ||
43 | "" | ||
44 | "# Specify things to do when starting" | ||
45 | "si::sysinit:/etc/rc.d/rc.sysinit" | ||
46 | "" | ||
47 | "l0:0:wait:/root/etc/rc.d/rc 0" | ||
48 | "l1:1:wait:/etc/rc.d/rc 1" | ||
49 | "l2:2:wait:/etc/rc.d/rc 2" | ||
50 | "l3:3:wait:/etc/rc.d/rc 3" | ||
51 | "l4:4:wait:/etc/rc.d/rc 4" | ||
52 | "l5:5:wait:/etc/rc.d/rc 5" | ||
53 | "l6:6:wait:/root/etc/rc.d/rc 6" | ||
54 | "" | ||
55 | "# Specify things to do before rebooting" | ||
56 | "um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" | ||
57 | "sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" | ||
58 | "" | ||
59 | "# Specify program to run on ttyS0" | ||
60 | "s0:24:respawn:/sbin/getty 9600 ttyS0" | ||
61 | "#pd:5:respawn:/etc/sync/serialctl" | ||
62 | "" | ||
63 | "# Specify program to run on tty1" | ||
64 | "1:2:respawn:/sbin/getty 9600 tty1" | ||
65 | "ln:345:respawn:survive -l 6 /sbin/launch" | ||
66 | "#qt:5:respawn:/sbin/qt" | ||
67 | "" | ||
68 | "# collie sp." | ||
69 | "sy::respawn:/sbin/shsync\n"; | ||
70 | } | ||
71 | FixIt::~FixIt() { | ||
72 | } | ||
73 | /* | ||
74 | * the retail Zaurus is broken in many ways | ||
75 | * one is that pppd is listening on our port... | ||
76 | * we've to stop it from that and then do kill(SIGHUP,1); | ||
77 | */ | ||
78 | void FixIt::fixIt() { | ||
79 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | ||
80 | QFile file( "/etc/inittab" ); | ||
81 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | ||
82 | file.writeBlock(m_file,strlen(m_file) ); | ||
83 | } | ||
84 | file.close(); | ||
85 | ::kill( SIGHUP, 1 ); | ||
86 | } | ||
87 | #endif | ||
88 | |||
89 | int main(int argc, char **argv) { | ||
90 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; | ||
91 | QPEApplication app( argc, argv ); | ||
92 | |||
93 | #ifdef FSCKED_DISTRIBUTION | ||
94 | // owarn << "fscked" << oendl; | ||
95 | FixIt it; | ||
96 | it.fixIt(); | ||
97 | #endif | ||
98 | 5 | ||
99 | MainWindow mw; | 6 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ); |
100 | mw.setCaption(QObject::tr("Opie Console") ); | ||
101 | app.showMainWidget( &mw ); | ||
102 | 7 | ||
103 | int ap = app.exec(); | ||
104 | 8 | ||
105 | #ifdef FSCKED_DISTRIBUTION | ||
106 | /* should add a signal handler too */ | ||
107 | it.breakIt(); | ||
108 | #endif | ||
109 | return ap; | ||
110 | } | ||
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 | |||
@@ -6,12 +6,13 @@ | |||
6 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
7 | #include "tabwidget.h" | 7 | #include "tabwidget.h" |
8 | #include "transferdialog.h" | 8 | #include "transferdialog.h" |
9 | #include "function_keyboard.h" | 9 | #include "function_keyboard.h" |
10 | #include "emulation_handler.h" | 10 | #include "emulation_handler.h" |
11 | #include "script.h" | 11 | #include "script.h" |
12 | #include "fixit.h" | ||
12 | 13 | ||
13 | /* OPIE */ | 14 | /* OPIE */ |
14 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
15 | #include <opie2/ofiledialog.h> | 16 | #include <opie2/ofiledialog.h> |
16 | #include <qpe/filemanager.h> | 17 | #include <qpe/filemanager.h> |
17 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
@@ -26,12 +27,18 @@ using namespace Opie::Ui; | |||
26 | #include <qfileinfo.h> | 27 | #include <qfileinfo.h> |
27 | 28 | ||
28 | /* STD */ | 29 | /* STD */ |
29 | #include <assert.h> | 30 | #include <assert.h> |
30 | 31 | ||
31 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 32 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
33 | #ifdef FSCKED_DISTRI | ||
34 | FixIt fix; | ||
35 | fix.fixIt(); | ||
36 | #endif | ||
37 | |||
38 | setCaption(QObject::tr("Opie Console") ); | ||
32 | KeyTrans::loadAll(); | 39 | KeyTrans::loadAll(); |
33 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 40 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
34 | KeyTrans* s = KeyTrans::find(i ); | 41 | KeyTrans* s = KeyTrans::find(i ); |
35 | assert( s ); | 42 | assert( s ); |
36 | } | 43 | } |
37 | m_factory = new MetaFactory(); | 44 | m_factory = new MetaFactory(); |
@@ -295,12 +302,16 @@ void MainWindow::populateScripts() { | |||
295 | 302 | ||
296 | } | 303 | } |
297 | 304 | ||
298 | MainWindow::~MainWindow() { | 305 | MainWindow::~MainWindow() { |
299 | delete m_factory; | 306 | delete m_factory; |
300 | manager()->save(); | 307 | manager()->save(); |
308 | #ifdef FSCKED_DISTRI | ||
309 | FixIt fix; | ||
310 | fix.breakIt(); | ||
311 | #endif | ||
301 | } | 312 | } |
302 | 313 | ||
303 | MetaFactory* MainWindow::factory() { | 314 | MetaFactory* MainWindow::factory() { |
304 | return m_factory; | 315 | return m_factory; |
305 | } | 316 | } |
306 | 317 | ||
@@ -446,19 +457,19 @@ void MainWindow::slotConfigure() { | |||
446 | */ | 457 | */ |
447 | void MainWindow::slotClose() { | 458 | void MainWindow::slotClose() { |
448 | if (!currentSession() ) | 459 | if (!currentSession() ) |
449 | return; | 460 | return; |
450 | 461 | ||
451 | Session* ses = currentSession(); | 462 | Session* ses = currentSession(); |
452 | owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; | 463 | owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; |
453 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 464 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
454 | m_curSession = NULL; | 465 | m_curSession = NULL; |
455 | tabWidget()->remove( /*currentSession()*/ses ); | 466 | tabWidget()->remove( /*currentSession()*/ses ); |
456 | /*it's autodelete */ | 467 | /*it's autodelete */ |
457 | m_sessions.remove( ses ); | 468 | m_sessions.remove( ses ); |
458 | owarn << "after remove!!" << oendl; | 469 | owarn << "after remove!!" << oendl; |
459 | 470 | ||
460 | if (!currentSession() ) { | 471 | if (!currentSession() ) { |
461 | m_connect->setEnabled( false ); | 472 | m_connect->setEnabled( false ); |
462 | m_disconnect->setEnabled( false ); | 473 | m_disconnect->setEnabled( false ); |
463 | m_terminate->setEnabled( false ); | 474 | m_terminate->setEnabled( false ); |
464 | m_transfer->setEnabled( false ); | 475 | m_transfer->setEnabled( false ); |
@@ -570,22 +581,22 @@ void MainWindow::slotOpenButtons( bool state ) { | |||
570 | } | 581 | } |
571 | } | 582 | } |
572 | 583 | ||
573 | 584 | ||
574 | 585 | ||
575 | void MainWindow::slotSessionChanged( Session* ses ) { | 586 | void MainWindow::slotSessionChanged( Session* ses ) { |
576 | owarn << "changed!" << oendl; | 587 | owarn << "changed!" << oendl; |
577 | 588 | ||
578 | if(m_curSession) | 589 | if(m_curSession) |
579 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 590 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
580 | if(ses) | 591 | if(ses) |
581 | if(ses->transferDialog()) ses->transferDialog()->show(); | 592 | if(ses->transferDialog()) ses->transferDialog()->show(); |
582 | 593 | ||
583 | if ( ses ) { | 594 | if ( ses ) { |
584 | m_curSession = ses; | 595 | m_curSession = ses; |
585 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; | 596 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; |
586 | if ( m_curSession->layer()->isConnected() ) { | 597 | if ( m_curSession->layer()->isConnected() ) { |
587 | m_connect->setEnabled( false ); | 598 | m_connect->setEnabled( false ); |
588 | m_disconnect->setEnabled( true ); | 599 | m_disconnect->setEnabled( true ); |
589 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 600 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
590 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 601 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
591 | m_scripts->setItemEnabled(m_runScript_id, true); | 602 | m_scripts->setItemEnabled(m_runScript_id, 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 | |||
@@ -25,12 +25,13 @@ class DocLnk; | |||
25 | 25 | ||
26 | class MainWindow : public QMainWindow { | 26 | class MainWindow : public QMainWindow { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | public: | 28 | public: |
29 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 29 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
30 | ~MainWindow(); | 30 | ~MainWindow(); |
31 | static QString appName() {return QString::fromLatin1("console"); } | ||
31 | 32 | ||
32 | /** | 33 | /** |
33 | * our factory to generate IOLayer and so on | 34 | * our factory to generate IOLayer and so on |
34 | * | 35 | * |
35 | */ | 36 | */ |
36 | MetaFactory* factory(); | 37 | MetaFactory* factory(); |
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,9 +1,7 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG += qt warn_on quick-app |
2 | CONFIG += qt warn_on | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ | 2 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ |
5 | file_layer.h filetransfer.h \ | 3 | file_layer.h filetransfer.h \ |
6 | metafactory.h \ | 4 | metafactory.h \ |
7 | session.h \ | 5 | session.h \ |
8 | mainwindow.h \ | 6 | mainwindow.h \ |
9 | profile.h \ | 7 | profile.h \ |