summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-10-08 20:03:40 (UTC)
committer harlekin <harlekin>2004-10-08 20:03:40 (UTC)
commit4e884ee63f16d1367ff7b854dbe5b50a6871c008 (patch) (side-by-side diff)
treefb9d9d13e9329e6ee9048bfc0e857d3918f4ecca
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 (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;
+
#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 @@
#include "script.h"
+#include "logger.h"
@@ -7,2 +8,6 @@
#include <opie2/odebug.h>
+
+#include <qfile.h>
+#include <qtextstream.h>
+
using namespace Opie::Core;
@@ -18,2 +23,3 @@ EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const c
m_script = 0;
+ m_log = 0;
parent->resize( m_teWid->calcSize(80, 24 ) );
@@ -40,2 +46,3 @@ EmulationHandler::~EmulationHandler() {
delete m_teWid;
+ delete m_log;
}
@@ -70,3 +77,7 @@ void EmulationHandler::recv( const QByteArray& ar) {
m_teEmu->onRcvBlock(ar.data(), ar.count() );
+ if ( isLogging() ) {
+ m_log->append( ar );
+ }
}
+
void EmulationHandler::recvEmulation(const char* src, int len ) {
@@ -79,2 +90,4 @@ void EmulationHandler::recvEmulation(const char* src, int len ) {
}
+
+
QWidget* EmulationHandler::widget() {
@@ -186,2 +199,6 @@ bool EmulationHandler::isRecording() {
+bool EmulationHandler::isLogging() {
+ return (m_log != 0);
+}
+
void EmulationHandler::startRecording() {
@@ -191,2 +208,12 @@ void EmulationHandler::startRecording() {
+void EmulationHandler::startLogging(const QString fileName) {
+ m_logFileName = fileName;
+ if (!isLogging())
+ m_log = new Logger(m_logFileName);
+}
+
+QString EmulationHandler::logFileName() {
+ return m_logFileName;
+}
+
void EmulationHandler::clearScript() {
@@ -198,2 +225,9 @@ void EmulationHandler::clearScript() {
+void EmulationHandler::clearLog() {
+ if (isLogging()) {
+ delete m_log;
+ m_log = 0;
+ }
+}
+
void 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;
class TEWidget;
+class QFile;
class TEmulation;
class QFont;
+class QTextStream;
class Script;
+class Logger;
+
class EmulationHandler : public QObject {
@@ -57,2 +61,4 @@ public:
+ void startLogging(const QString);
+
/* Return whether we are currently recording a script */
@@ -60,2 +66,7 @@ public:
+ /* Return whether we are currently recording a log */
+ bool isLogging();
+
+ QString logFileName();
+
/* Return the current script (or NULL) */
@@ -65,2 +76,5 @@ public:
void clearScript();
+
+ /* Stop logging and remove the current log from memory */
+ void clearLog();
@@ -92,2 +106,4 @@ private:
Script * m_script;
+ Logger *m_log;
+ QString m_logFileName;
};
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 @@
+
+#include "fixit.h"
+
+using namespace Opie::Core;
+
+#ifdef FSCKED_DISTRI
+FixIt::FixIt() : QObject() {
+ /* 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() {
+ #ifndef EAST
+ ::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 );
+
+ #else
+
+ OProcess m_kill;
+ m_kill << "sh";
+ m_kill << "-c";
+ m_kill << QString(QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_kill_0_1.sh");
+
+
+ if ( !m_kill.start(OProcess::DontCare,OProcess::NoCommunication) ) {
+ owarn << "could not execute kill script" << oendl;
+ } else {
+ Global::statusMessage( tr("Fixing up Embedix"));
+ }
+
+ #endif
+}
+
+void FixIt::breakIt() {
+ #ifdef EAST
+ OProcess m_restart;
+ m_restart << "sh";
+ m_restart << "-c";
+ m_restart << QString(QPEApplication::qpeDir() + "/share/opie-console/sl6000_embedix_restart_0_1.sh");
+
+
+ if ( !m_restart.start() ) {
+ owarn << "could not execute restart script" << oendl;
+ }
+
+ #endif
+}
+
+
+#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 @@
+#include <opie2/oprocess.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+#include <qpe/qpeapplication.h>
@@ -9,3 +14,3 @@
#include <signal.h>
-#include <qfile.h>
+
@@ -14,3 +19,6 @@
*/
-class FixIt {
+class FixIt : public QObject {
+
+ Q_OBJECT
+
public:
@@ -20,5 +28,3 @@ public:
/* no real interested in implementing it */
- void breakIt() {
-
- };
+ void breakIt();
char* m_file;
@@ -26,62 +32,2 @@ public:
-#ifdef FSCKED_DISTRI
-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 );
-}
@@ -89,2 +35 @@ void FixIt::fixIt() {
-#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 @@
+#include <qfile.h>
+#include <qtextstream.h>
+
+#include "logger.h"
+
+
+Logger::Logger() {}
+
+Logger::Logger(const QString fileName) {
+ m_file.setName(fileName);
+ m_file.open(IO_ReadWrite);
+}
+
+Logger::~Logger() {
+ m_file.close();
+}
+
+void Logger::append(QByteArray ar) {
+ m_file.writeBlock(ar);
+} \ 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 @@
+#ifndef CONSOLE_LOGGER_H
+#define CONSOLE_LOGGER_H
+
+#include <qstring.h>
+#include <qfile.h>
+
+class Logger {
+
+public:
+ Logger();
+ Logger(const QString fileName);
+ void append(QByteArray ar);
+ ~Logger();
+
+private:
+ QFile m_file;
+};
+
+#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;
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
+
#ifdef FSCKED_DISTRI
- FixIt fix;
- fix.fixIt();
+ FixIt fix;
+ fix.fixIt();
#endif
@@ -124,3 +125,3 @@ void MainWindow::initUI() {
-
+#ifndef EAST
m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
@@ -129,2 +130,3 @@ void MainWindow::initUI() {
this, SLOT( slotQuickLaunch() ) );
+#endif
@@ -162,2 +164,9 @@ void MainWindow::initUI() {
+ m_recordLog = new QAction();
+ m_recordLog->setText( tr("Start log") );
+ m_recordLog->addTo( m_console );
+ connect(m_recordLog, SIGNAL(activated() ),
+ this, SLOT( slotSaveLog() ) );
+ m_recordingLog = false;
+
QAction *a = new QAction();
@@ -424,7 +433,5 @@ void MainWindow::slotTerminate() {
-
-
-
void MainWindow::slotQuickLaunch() {
- Profile prof = manager()->profile( "default" );
+
+ Profile prof = manager()->profile( "default" );
if ( prof.name() == "default" ) {
@@ -432,2 +439,3 @@ void MainWindow::slotQuickLaunch() {
} else {
+ #ifndef EAST
Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
@@ -436,4 +444,4 @@ void MainWindow::slotQuickLaunch() {
slotSaveSession();
+ #endif
}
-
}
@@ -610,2 +618,8 @@ void MainWindow::slotSessionChanged( Session* ses ) {
+ if ( ( currentSession()->emulationHandler()->isLogging() ) ) {
+ m_recordLog->setText( tr("Stop log") );
+ } else {
+ m_recordLog->setText( tr("Start log") );
+ }
+
if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
@@ -709,2 +723,32 @@ void MainWindow::slotSaveSession() {
}
+
+
+
+void MainWindow::slotSaveLog() {
+
+ if( currentSession()->emulationHandler()->isLogging() ) {
+ DocLnk nf;
+ QString m_logName = currentSession()->emulationHandler()->logFileName();
+ QFileInfo info(m_logName);
+ nf.setType("text/plain");
+ nf.setFile(m_logName);
+ nf.setName(info.fileName());
+ nf.writeLink();
+ m_recordLog->setText( tr("Start log") );
+ m_recordingLog = false;
+ currentSession()->emulationHandler()->clearLog();
+ } else {
+ QMap<QString, QStringList> map;
+ QStringList text;
+ text << "text/plain";
+ map.insert(tr("Log"), text );
+ QString m_logName = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
+ if (m_logName.isEmpty() ) return;
+
+ m_recordLog->setText( tr("Stop log") );
+ m_recordingLog = true;
+ currentSession()->emulationHandler()->startLogging(m_logName);
+ }
+}
+
void 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 @@
#include <qlist.h>
+#include <qfile.h>
@@ -75,2 +76,3 @@ private slots:
void slotSaveHistory();
+ void slotSaveLog();
@@ -128,2 +130,3 @@ private:
QAction* m_closewindow;
+ QAction* m_recordLog;
@@ -133,2 +136,3 @@ private:
bool m_isWrapped;
+ bool m_recordingLog;
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 @@
+Package: opie-console
+Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* share/opie-console/*
+Priority: optional
+Section: opie/applications
+Maintainer: Opie Team <opie@handhelds.org>
+Architecture: arm
+Version: 0.6-$SUB_VERSION
+Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs
+License: GPL
+Description: 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 \
script.h \
- dialer.h \
+ dialer.h logger.h \
terminalwidget.h \
@@ -30,3 +30,3 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
TEmuVt102.h TEmulation.h MyPty.h \
- consoleconfigwidget.h
+ consoleconfigwidget.h fixit.h
@@ -55,3 +55,3 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
script.cpp \
- dialer.cpp \
+ dialer.cpp logger.cpp \
terminalwidget.cpp \
@@ -60,3 +60,3 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
TEmuVt102.cpp TEmulation.cpp MyPty.cpp \
- consoleconfigwidget.cpp
+ consoleconfigwidget.cpp fixit.cpp
@@ -67,7 +67,7 @@ INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopiecore2 -lopieui2 -lutil
+LIBS += -lqpe -lopiecore2 -lopieui2
TARGET = opie-console
-DEFINES += HAVE_OPENPTY
-
+#DEFINES += HAVE_OPENPTY
+#DEFINES += EAST FSCKED_DISTRI