summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
authorharlekin <harlekin>2004-10-08 20:03:40 (UTC)
committer harlekin <harlekin>2004-10-08 20:03:40 (UTC)
commit4e884ee63f16d1367ff7b854dbe5b50a6871c008 (patch) (unidiff)
treefb9d9d13e9329e6ee9048bfc0e857d3918f4ecca /noncore/apps/opie-console
parent51e49f0bd035545b983c799f7089de6b0ff2547e (diff)
downloadopie-4e884ee63f16d1367ff7b854dbe5b50a6871c008.zip
opie-4e884ee63f16d1367ff7b854dbe5b50a6871c008.tar.gz
opie-4e884ee63f16d1367ff7b854dbe5b50a6871c008.tar.bz2
added a 10east define for some changed builds for them, also added a logging mode, also some changes to the "fix broken distros" part, snapshot
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp1
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp34
-rw-r--r--noncore/apps/opie-console/emulation_handler.h16
-rw-r--r--noncore/apps/opie-console/fixit.cpp101
-rw-r--r--noncore/apps/opie-console/fixit.h77
-rw-r--r--noncore/apps/opie-console/logger.cpp20
-rw-r--r--noncore/apps/opie-console/logger.h19
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp60
-rw-r--r--noncore/apps/opie-console/mainwindow.h4
-rw-r--r--noncore/apps/opie-console/opie-console-embedix.control10
-rw-r--r--noncore/apps/opie-console/opie-console.pro14
11 files changed, 275 insertions, 81 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 6d57703..315ea4a 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -87,2 +87,3 @@ using namespace Opie::Core;
87 87
88
88#ifdef HAVE_OPENPTY 89#ifdef HAVE_OPENPTY
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 956ac76..e045aef 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -4,2 +4,3 @@
4#include "script.h" 4#include "script.h"
5#include "logger.h"
5 6
@@ -7,2 +8,6 @@
7#include <opie2/odebug.h> 8#include <opie2/odebug.h>
9
10#include <qfile.h>
11#include <qtextstream.h>
12
8using namespace Opie::Core; 13using namespace Opie::Core;
@@ -18,2 +23,3 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
18 m_script = 0; 23 m_script = 0;
24 m_log = 0;
19 parent->resize( m_teWid->calcSize(80, 24 ) ); 25 parent->resize( m_teWid->calcSize(80, 24 ) );
@@ -40,2 +46,3 @@ EmulationHandler::~EmulationHandler() {
40 delete m_teWid; 46 delete m_teWid;
47 delete m_log;
41} 48}
@@ -70,3 +77,7 @@ void EmulationHandler::recv( const QByteArray& ar) {
70 m_teEmu->onRcvBlock(ar.data(), ar.count() ); 77 m_teEmu->onRcvBlock(ar.data(), ar.count() );
78 if ( isLogging() ) {
79 m_log->append( ar );
80 }
71} 81}
82
72void EmulationHandler::recvEmulation(const char* src, int len ) { 83void EmulationHandler::recvEmulation(const char* src, int len ) {
@@ -79,2 +90,4 @@ void EmulationHandler::recvEmulation(const char* src, int len ) {
79} 90}
91
92
80QWidget* EmulationHandler::widget() { 93QWidget* EmulationHandler::widget() {
@@ -186,2 +199,6 @@ bool EmulationHandler::isRecording() {
186 199
200bool EmulationHandler::isLogging() {
201 return (m_log != 0);
202}
203
187void EmulationHandler::startRecording() { 204void EmulationHandler::startRecording() {
@@ -191,2 +208,12 @@ void EmulationHandler::startRecording() {
191 208
209void EmulationHandler::startLogging(const QString fileName) {
210 m_logFileName = fileName;
211 if (!isLogging())
212 m_log = new Logger(m_logFileName);
213}
214
215QString EmulationHandler::logFileName() {
216 return m_logFileName;
217}
218
192void EmulationHandler::clearScript() { 219void EmulationHandler::clearScript() {
@@ -198,2 +225,9 @@ void EmulationHandler::clearScript() {
198 225
226void EmulationHandler::clearLog() {
227 if (isLogging()) {
228 delete m_log;
229 m_log = 0;
230 }
231}
232
199void EmulationHandler::runScript(const Script *script) { 233void EmulationHandler::runScript(const Script *script) {
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 1338525..1092c82 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -29,5 +29,9 @@ class QPushButton;
29class TEWidget; 29class TEWidget;
30class QFile;
30class TEmulation; 31class TEmulation;
31class QFont; 32class QFont;
33class QTextStream;
32class Script; 34class Script;
35class Logger;
36
33class EmulationHandler : public QObject { 37class EmulationHandler : public QObject {
@@ -57,2 +61,4 @@ public:
57 61
62 void startLogging(const QString);
63
58 /* Return whether we are currently recording a script */ 64 /* Return whether we are currently recording a script */
@@ -60,2 +66,7 @@ public:
60 66
67 /* Return whether we are currently recording a log */
68 bool isLogging();
69
70 QString logFileName();
71
61 /* Return the current script (or NULL) */ 72 /* Return the current script (or NULL) */
@@ -65,2 +76,5 @@ public:
65 void clearScript(); 76 void clearScript();
77
78 /* Stop logging and remove the current log from memory */
79 void clearLog();
66 80
@@ -92,2 +106,4 @@ private:
92 Script * m_script; 106 Script * m_script;
107 Logger *m_log;
108 QString m_logFileName;
93}; 109};
diff --git a/noncore/apps/opie-console/fixit.cpp b/noncore/apps/opie-console/fixit.cpp
new file mode 100644
index 0000000..c14e35e
--- a/dev/null
+++ b/noncore/apps/opie-console/fixit.cpp
@@ -0,0 +1,101 @@
1
2#include "fixit.h"
3
4using namespace Opie::Core;
5
6#ifdef FSCKED_DISTRI
7FixIt::FixIt() : QObject() {
8 /* the new inittab */
9 m_file = "#\n# /etc/inittab"
10"#"
11""
12"# 0 - halt (Do NOT set initdefault to this)"
13"# 1 - Single user mode"
14"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)"
15"# 3 - Full multiuser mode"
16"# 4 - JavaVM(Intent) developer mode"
17"# 5 - JavaVM(Intent)"
18"# 6 - reboot (Do NOT set initdefault to this)"
19"#"
20"id:5:initdefault:"
21""
22"# Specify things to do when starting"
23"si::sysinit:/etc/rc.d/rc.sysinit"
24""
25"l0:0:wait:/root/etc/rc.d/rc 0"
26"l1:1:wait:/etc/rc.d/rc 1"
27"l2:2:wait:/etc/rc.d/rc 2"
28"l3:3:wait:/etc/rc.d/rc 3"
29"l4:4:wait:/etc/rc.d/rc 4"
30"l5:5:wait:/etc/rc.d/rc 5"
31"l6:6:wait:/root/etc/rc.d/rc 6"
32""
33"# Specify things to do before rebooting"
34"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1"
35"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1"
36""
37"# Specify program to run on ttyS0"
38"s0:24:respawn:/sbin/getty 9600 ttyS0"
39"#pd:5:respawn:/etc/sync/serialctl"
40""
41"# Specify program to run on tty1"
42"1:2:respawn:/sbin/getty 9600 tty1"
43"ln:345:respawn:survive -l 6 /sbin/launch"
44"#qt:5:respawn:/sbin/qt"
45""
46"# collie sp."
47"sy::respawn:/sbin/shsync\n";
48}
49
50FixIt::~FixIt() {
51}
52
53/*
54 * the retail Zaurus is broken in many ways
55 * one is that pppd is listening on our port...
56 * we've to stop it from that and then do kill(SIGHUP,1);
57 */
58void FixIt::fixIt() {
59 #ifndef EAST
60 ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" );
61 QFile file( "/etc/inittab" );
62 if ( file.open(IO_WriteOnly | IO_Raw ) ) {
63 file.writeBlock(m_file,strlen(m_file) );
64 }
65 file.close();
66 ::kill( SIGHUP, 1 );
67
68 #else
69
70 OProcess m_kill;
71 m_kill << "sh";
72 m_kill << "-c";
73 m_kill << QString(QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_kill_0_1.sh");
74
75
76 if ( !m_kill.start(OProcess::DontCare,OProcess::NoCommunication) ) {
77 owarn << "could not execute kill script" << oendl;
78 } else {
79 Global::statusMessage( tr("Fixing up Embedix"));
80 }
81
82 #endif
83}
84
85void FixIt::breakIt() {
86 #ifdef EAST
87 OProcess m_restart;
88 m_restart << "sh";
89 m_restart << "-c";
90 m_restart << QString(QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_restart_0_1.sh");
91
92
93 if ( !m_restart.start() ) {
94 owarn << "could not execute restart script" << oendl;
95 }
96
97 #endif
98}
99
100
101#endif
diff --git a/noncore/apps/opie-console/fixit.h b/noncore/apps/opie-console/fixit.h
index 6a8a101..c9188cf 100644
--- a/noncore/apps/opie-console/fixit.h
+++ b/noncore/apps/opie-console/fixit.h
@@ -3,2 +3,7 @@
3 3
4#include <opie2/oprocess.h>
5#include <opie2/odebug.h>
6
7#include <qpe/global.h>
8#include <qpe/qpeapplication.h>
4 9
@@ -9,3 +14,3 @@
9#include <signal.h> 14#include <signal.h>
10#include <qfile.h> 15
11 16
@@ -14,3 +19,6 @@
14 */ 19 */
15class FixIt { 20class FixIt : public QObject {
21
22 Q_OBJECT
23
16public: 24public:
@@ -20,5 +28,3 @@ public:
20 /* no real interested in implementing it */ 28 /* no real interested in implementing it */
21 void breakIt() { 29 void breakIt();
22
23 };
24 char* m_file; 30 char* m_file;
@@ -26,62 +32,2 @@ public:
26 32
27#ifdef FSCKED_DISTRI
28FixIt::FixIt() {
29 /* the new inittab */
30 m_file = "#\n# /etc/inittab"
31"#"
32""
33"# 0 - halt (Do NOT set initdefault to this)"
34"# 1 - Single user mode"
35"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)"
36"# 3 - Full multiuser mode"
37"# 4 - JavaVM(Intent) developer mode"
38"# 5 - JavaVM(Intent)"
39"# 6 - reboot (Do NOT set initdefault to this)"
40"#"
41"id:5:initdefault:"
42""
43"# Specify things to do when starting"
44"si::sysinit:/etc/rc.d/rc.sysinit"
45""
46"l0:0:wait:/root/etc/rc.d/rc 0"
47"l1:1:wait:/etc/rc.d/rc 1"
48"l2:2:wait:/etc/rc.d/rc 2"
49"l3:3:wait:/etc/rc.d/rc 3"
50"l4:4:wait:/etc/rc.d/rc 4"
51"l5:5:wait:/etc/rc.d/rc 5"
52"l6:6:wait:/root/etc/rc.d/rc 6"
53""
54"# Specify things to do before rebooting"
55"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1"
56"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1"
57""
58"# Specify program to run on ttyS0"
59"s0:24:respawn:/sbin/getty 9600 ttyS0"
60"#pd:5:respawn:/etc/sync/serialctl"
61""
62"# Specify program to run on tty1"
63"1:2:respawn:/sbin/getty 9600 tty1"
64"ln:345:respawn:survive -l 6 /sbin/launch"
65"#qt:5:respawn:/sbin/qt"
66""
67"# collie sp."
68"sy::respawn:/sbin/shsync\n";
69
70}
71FixIt::~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 */
78void 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 33
@@ -89,2 +35 @@ void FixIt::fixIt() {
89
90#endif
diff --git a/noncore/apps/opie-console/logger.cpp b/noncore/apps/opie-console/logger.cpp
new file mode 100644
index 0000000..56557f3
--- a/dev/null
+++ b/noncore/apps/opie-console/logger.cpp
@@ -0,0 +1,20 @@
1#include <qfile.h>
2#include <qtextstream.h>
3
4#include "logger.h"
5
6
7Logger::Logger() {}
8
9Logger::Logger(const QString fileName) {
10 m_file.setName(fileName);
11 m_file.open(IO_ReadWrite);
12}
13
14Logger::~Logger() {
15 m_file.close();
16}
17
18void Logger::append(QByteArray ar) {
19 m_file.writeBlock(ar);
20} \ No newline at end of file
diff --git a/noncore/apps/opie-console/logger.h b/noncore/apps/opie-console/logger.h
new file mode 100644
index 0000000..cdc9f68
--- a/dev/null
+++ b/noncore/apps/opie-console/logger.h
@@ -0,0 +1,19 @@
1#ifndef CONSOLE_LOGGER_H
2#define CONSOLE_LOGGER_H
3
4#include <qstring.h>
5#include <qfile.h>
6
7class Logger {
8
9public:
10 Logger();
11 Logger(const QString fileName);
12 void append(QByteArray ar);
13 ~Logger();
14
15private:
16 QFile m_file;
17};
18
19#endif \ No newline at end of file
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 1a5a59f..a0622d4 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -32,5 +32,6 @@ using namespace Opie::Ui;
32MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 32MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
33
33#ifdef FSCKED_DISTRI 34#ifdef FSCKED_DISTRI
34 FixIt fix; 35 FixIt fix;
35 fix.fixIt(); 36 fix.fixIt();
36#endif 37#endif
@@ -124,3 +125,3 @@ void MainWindow::initUI() {
124 125
125 126#ifndef EAST
126 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); 127 m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
@@ -129,2 +130,3 @@ void MainWindow::initUI() {
129 this, SLOT( slotQuickLaunch() ) ); 130 this, SLOT( slotQuickLaunch() ) );
131#endif
130 132
@@ -162,2 +164,9 @@ void MainWindow::initUI() {
162 164
165 m_recordLog = new QAction();
166 m_recordLog->setText( tr("Start log") );
167 m_recordLog->addTo( m_console );
168 connect(m_recordLog, SIGNAL(activated() ),
169 this, SLOT( slotSaveLog() ) );
170 m_recordingLog = false;
171
163 QAction *a = new QAction(); 172 QAction *a = new QAction();
@@ -424,7 +433,5 @@ void MainWindow::slotTerminate() {
424 433
425
426
427
428void MainWindow::slotQuickLaunch() { 434void MainWindow::slotQuickLaunch() {
429 Profile prof = manager()->profile( "default" ); 435
436 Profile prof = manager()->profile( "default" );
430 if ( prof.name() == "default" ) { 437 if ( prof.name() == "default" ) {
@@ -432,2 +439,3 @@ void MainWindow::slotQuickLaunch() {
432 } else { 439 } else {
440 #ifndef EAST
433 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); 441 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
@@ -436,4 +444,4 @@ void MainWindow::slotQuickLaunch() {
436 slotSaveSession(); 444 slotSaveSession();
445 #endif
437 } 446 }
438
439} 447}
@@ -610,2 +618,8 @@ void MainWindow::slotSessionChanged( Session* ses ) {
610 618
619 if ( ( currentSession()->emulationHandler()->isLogging() ) ) {
620 m_recordLog->setText( tr("Stop log") );
621 } else {
622 m_recordLog->setText( tr("Start log") );
623 }
624
611 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 625 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
@@ -709,2 +723,32 @@ void MainWindow::slotSaveSession() {
709} 723}
724
725
726
727void MainWindow::slotSaveLog() {
728
729 if( currentSession()->emulationHandler()->isLogging() ) {
730 DocLnk nf;
731 QString m_logName = currentSession()->emulationHandler()->logFileName();
732 QFileInfo info(m_logName);
733 nf.setType("text/plain");
734 nf.setFile(m_logName);
735 nf.setName(info.fileName());
736 nf.writeLink();
737 m_recordLog->setText( tr("Start log") );
738 m_recordingLog = false;
739 currentSession()->emulationHandler()->clearLog();
740 } else {
741 QMap<QString, QStringList> map;
742 QStringList text;
743 text << "text/plain";
744 map.insert(tr("Log"), text );
745 QString m_logName = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
746 if (m_logName.isEmpty() ) return;
747
748 m_recordLog->setText( tr("Stop log") );
749 m_recordingLog = true;
750 currentSession()->emulationHandler()->startLogging(m_logName);
751 }
752}
753
710void MainWindow::slotSaveHistory() { 754void MainWindow::slotSaveHistory() {
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index db07f5a..f3c8b81 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -5,2 +5,3 @@
5#include <qlist.h> 5#include <qlist.h>
6#include <qfile.h>
6 7
@@ -75,2 +76,3 @@ private slots:
75 void slotSaveHistory(); 76 void slotSaveHistory();
77 void slotSaveLog();
76 78
@@ -128,2 +130,3 @@ private:
128 QAction* m_closewindow; 130 QAction* m_closewindow;
131 QAction* m_recordLog;
129 132
@@ -133,2 +136,3 @@ private:
133 bool m_isWrapped; 136 bool m_isWrapped;
137 bool m_recordingLog;
134 138
diff --git a/noncore/apps/opie-console/opie-console-embedix.control b/noncore/apps/opie-console/opie-console-embedix.control
new file mode 100644
index 0000000..cf27554
--- a/dev/null
+++ b/noncore/apps/opie-console/opie-console-embedix.control
@@ -0,0 +1,10 @@
1Package: opie-console
2Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* share/opie-console/*
3Priority: optional
4Section: opie/applications
5Maintainer: Opie Team <opie@handhelds.org>
6Architecture: arm
7Version: 0.6-$SUB_VERSION
8Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs
9License: GPL
10Description: Opie terminal app
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 6bc42bd..223cb91 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -25,3 +25,3 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
25 script.h \ 25 script.h \
26 dialer.h \ 26 dialer.h logger.h \
27 terminalwidget.h \ 27 terminalwidget.h \
@@ -30,3 +30,3 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
30 TEmuVt102.h TEmulation.h MyPty.h \ 30 TEmuVt102.h TEmulation.h MyPty.h \
31 consoleconfigwidget.h 31 consoleconfigwidget.h fixit.h
32 32
@@ -55,3 +55,3 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
55 script.cpp \ 55 script.cpp \
56 dialer.cpp \ 56 dialer.cpp logger.cpp \
57 terminalwidget.cpp \ 57 terminalwidget.cpp \
@@ -60,3 +60,3 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
60 TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ 60 TEmuVt102.cpp TEmulation.cpp MyPty.cpp \
61 consoleconfigwidget.cpp 61 consoleconfigwidget.cpp fixit.cpp
62 62
@@ -67,7 +67,7 @@ INCLUDEPATH += $(OPIEDIR)/include
67DEPENDPATH += $(OPIEDIR)/include 67DEPENDPATH += $(OPIEDIR)/include
68LIBS += -lqpe -lopiecore2 -lopieui2 -lutil 68LIBS += -lqpe -lopiecore2 -lopieui2
69TARGET = opie-console 69TARGET = opie-console
70 70
71DEFINES += HAVE_OPENPTY 71#DEFINES += HAVE_OPENPTY
72 72#DEFINES += EAST FSCKED_DISTRI
73 73