summaryrefslogtreecommitdiff
path: root/noncore/apps
Unidiff
Diffstat (limited to 'noncore/apps') (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
@@ -76,24 +76,25 @@ using namespace Opie::Core;
76 76
77/* STD */ 77/* STD */
78#include <stdlib.h> 78#include <stdlib.h>
79#include <stdio.h> 79#include <stdio.h>
80#include <signal.h> 80#include <signal.h>
81#include <fcntl.h> 81#include <fcntl.h>
82#include <unistd.h> 82#include <unistd.h>
83#include <termios.h> 83#include <termios.h>
84#include <sys/types.h> 84#include <sys/types.h>
85#include <sys/ioctl.h> 85#include <sys/ioctl.h>
86#include <sys/wait.h> 86#include <sys/wait.h>
87 87
88
88#ifdef HAVE_OPENPTY 89#ifdef HAVE_OPENPTY
89#include <pty.h> 90#include <pty.h>
90#endif 91#endif
91 92
92#undef VERBOSE_DEBUG 93#undef VERBOSE_DEBUG
93 94
94 95
95/* -------------------------------------------------------------------------- */ 96/* -------------------------------------------------------------------------- */
96 97
97/*! 98/*!
98 Informs the client program about the 99 Informs the client program about the
99 actual size of the window. 100 actual size of the window.
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
@@ -1,52 +1,59 @@
1#include "TEmuVt102.h" 1#include "TEmuVt102.h"
2#include "profile.h" 2#include "profile.h"
3#include "emulation_handler.h" 3#include "emulation_handler.h"
4#include "script.h" 4#include "script.h"
5#include "logger.h"
5 6
6/* OPIE */ 7/* OPIE */
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;
9 14
10EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) 15EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name )
11 : QObject(0, name ) 16 : QObject(0, name )
12{ 17{
13 m_teWid = new TEWidget( parent, "TerminalMain"); 18 m_teWid = new TEWidget( parent, "TerminalMain");
14 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) 19 // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar)
15 // use setWrapAt(80) for normal console with scrollbar 20 // use setWrapAt(80) for normal console with scrollbar
16 setWrap(prof.readNumEntry("Wrap", 80) ? 0 : 80); 21 setWrap(prof.readNumEntry("Wrap", 80) ? 0 : 80);
17 m_teWid->setMinimumSize(150, 70 ); 22 m_teWid->setMinimumSize(150, 70 );
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 ) );
20 m_teEmu = new TEmuVt102(m_teWid ); 26 m_teEmu = new TEmuVt102(m_teWid );
21 27
22 connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), 28 connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ),
23 this, SIGNAL(changeSize(int,int) ) ); 29 this, SIGNAL(changeSize(int,int) ) );
24 connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), 30 connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ),
25 this, SLOT(recvEmulation(const char*,int) ) ); 31 this, SLOT(recvEmulation(const char*,int) ) );
26 m_teEmu->setConnect( true ); 32 m_teEmu->setConnect( true );
27 m_teEmu->setHistory( TRUE ); 33 m_teEmu->setHistory( TRUE );
28 load( prof ); 34 load( prof );
29 35
30 36
31 37
32} 38}
33TEmulation* EmulationHandler::emulation() { 39TEmulation* EmulationHandler::emulation() {
34 return m_teEmu; 40 return m_teEmu;
35} 41}
36EmulationHandler::~EmulationHandler() { 42EmulationHandler::~EmulationHandler() {
37 if (isRecording()) 43 if (isRecording())
38 clearScript(); 44 clearScript();
39 delete m_teEmu; 45 delete m_teEmu;
40 delete m_teWid; 46 delete m_teWid;
47 delete m_log;
41} 48}
42 49
43void EmulationHandler::load( const Profile& prof) { 50void EmulationHandler::load( const Profile& prof) {
44 51
45// m_teWid->setVTFont( font( prof.readNumEntry("Font") ) ); 52// m_teWid->setVTFont( font( prof.readNumEntry("Font") ) );
46 QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal ); 53 QFont font( prof.readEntry("Font"), prof.readNumEntry( "FontSize" ), QFont::Normal );
47 font.setFixedPitch( TRUE ); 54 font.setFixedPitch( TRUE );
48 m_teWid->setVTFont( font ); 55 m_teWid->setVTFont( font );
49 56
50 int num = prof.readNumEntry("Color"); 57 int num = prof.readNumEntry("Color");
51 setColor( foreColor(num), backColor(num) ); 58 setColor( foreColor(num), backColor(num) );
52 m_teWid->setBackgroundColor(backColor(num) ); 59 m_teWid->setBackgroundColor(backColor(num) );
@@ -59,33 +66,39 @@ void EmulationHandler::load( const Profile& prof) {
59 m_teEmu->setKeytrans("vt100.keytab"); 66 m_teEmu->setKeytrans("vt100.keytab");
60 break; 67 break;
61 case Profile::Linux: 68 case Profile::Linux:
62 m_teEmu->setKeytrans("linux.keytab"); 69 m_teEmu->setKeytrans("linux.keytab");
63 break; 70 break;
64 case Profile::XTerm: 71 case Profile::XTerm:
65 m_teEmu->setKeytrans("default.Keytab"); 72 m_teEmu->setKeytrans("default.Keytab");
66 break; 73 break;
67 } 74 }
68} 75}
69void EmulationHandler::recv( const QByteArray& ar) { 76void 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 ) {
73 QByteArray ar(len); 84 QByteArray ar(len);
74 85
75 memcpy(ar.data(), src, sizeof(char) * len ); 86 memcpy(ar.data(), src, sizeof(char) * len );
76 if (isRecording()) 87 if (isRecording())
77 m_script->append(ar); 88 m_script->append(ar);
78 emit send(ar); 89 emit send(ar);
79} 90}
91
92
80QWidget* EmulationHandler::widget() { 93QWidget* EmulationHandler::widget() {
81 return m_teWid; 94 return m_teWid;
82} 95}
83/* 96/*
84 * allocate a new table of colors 97 * allocate a new table of colors
85 */ 98 */
86void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { 99void EmulationHandler::setColor( const QColor& fore, const QColor& back ) {
87 ColorEntry table[TABLE_COLORS]; 100 ColorEntry table[TABLE_COLORS];
88 const ColorEntry *defaultCt = m_teWid->getdefaultColorTable(); 101 const ColorEntry *defaultCt = m_teWid->getdefaultColorTable();
89 102
90 for (int i = 0; i < TABLE_COLORS; i++ ) { 103 for (int i = 0; i < TABLE_COLORS; i++ ) {
91 if ( i == 0 || i == 10 ) { 104 if ( i == 0 || i == 10 ) {
@@ -175,36 +188,57 @@ QPushButton* EmulationHandler::cornerButton() {
175 return m_teWid->cornerButton(); 188 return m_teWid->cornerButton();
176} 189}
177 190
178 191
179Script *EmulationHandler::script() { 192Script *EmulationHandler::script() {
180 return m_script; 193 return m_script;
181} 194}
182 195
183bool EmulationHandler::isRecording() { 196bool EmulationHandler::isRecording() {
184 return (m_script != 0); 197 return (m_script != 0);
185} 198}
186 199
200bool EmulationHandler::isLogging() {
201 return (m_log != 0);
202}
203
187void EmulationHandler::startRecording() { 204void EmulationHandler::startRecording() {
188 if (!isRecording()) 205 if (!isRecording())
189 m_script = new Script(); 206 m_script = new Script();
190} 207}
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() {
193 if (isRecording()) { 220 if (isRecording()) {
194 delete m_script; 221 delete m_script;
195 m_script = 0; 222 m_script = 0;
196 } 223 }
197} 224}
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) {
200 emit send(script->script()); 234 emit send(script->script());
201} 235}
202 236
203void EmulationHandler::copy() { 237void EmulationHandler::copy() {
204 m_teWid->emitSelection(); 238 m_teWid->emitSelection();
205} 239}
206void EmulationHandler::paste() { 240void EmulationHandler::paste() {
207 m_teWid->pasteClipboard(); 241 m_teWid->pasteClipboard();
208} 242}
209 243
210void EmulationHandler::setWrap(int columns) { 244void EmulationHandler::setWrap(int columns) {
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
@@ -18,27 +18,31 @@
18 * This nice QObject here will get stuff from 18 * This nice QObject here will get stuff from
19 * got a slot and a signal 19 * got a slot and a signal
20 * the signal for data 20 * the signal for data
21 * the slot for receiving 21 * the slot for receiving
22 * it'll set up the widget internally 22 * it'll set up the widget internally
23 * and manage the communication between 23 * and manage the communication between
24 * the pre QByteArray world! 24 * the pre QByteArray world!
25 */ 25 */
26class Profile; 26class Profile;
27class QWidget; 27class QWidget;
28class QPushButton; 28class 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 {
34 Q_OBJECT 38 Q_OBJECT
35public: 39public:
36 /** 40 /**
37 * simple c'tor the parent of the TEWdiget 41 * simple c'tor the parent of the TEWdiget
38 * and a name 42 * and a name
39 * and a Profile 43 * and a Profile
40 */ 44 */
41 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l ); 45 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l );
42 46
43 /** 47 /**
44 * delete all components 48 * delete all components
@@ -46,32 +50,42 @@ public:
46 ~EmulationHandler(); 50 ~EmulationHandler();
47 51
48 void load( const Profile& ); 52 void load( const Profile& );
49 QWidget* widget(); 53 QWidget* widget();
50 TEmulation *emulation(); 54 TEmulation *emulation();
51 void setColor( const QColor& fore, const QColor& back ); 55 void setColor( const QColor& fore, const QColor& back );
52 QPushButton* cornerButton(); 56 QPushButton* cornerButton();
53 57
54 /* Scripts */ 58 /* Scripts */
55 /* Create a new script and record all typed characters */ 59 /* Create a new script and record all typed characters */
56 void startRecording(); 60 void startRecording();
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 */
59 bool isRecording(); 65 bool isRecording();
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) */
62 Script *script(); 73 Script *script();
63 74
64 /* Stop recording and remove the current script from memory */ 75 /* Stop recording and remove the current script from memory */
65 void clearScript(); 76 void clearScript();
77
78 /* Stop logging and remove the current log from memory */
79 void clearLog();
66 80
67 /* Run a script by forwarding its keys to the EmulationLayer */ 81 /* Run a script by forwarding its keys to the EmulationLayer */
68 void runScript(const Script *); 82 void runScript(const Script *);
69 83
70 /* Propagate change to widget */ 84 /* Propagate change to widget */
71 void setWrap(int columns); 85 void setWrap(int columns);
72signals: 86signals:
73 void send( const QByteArray& ); 87 void send( const QByteArray& );
74 void changeSize(int rows, int cols ); 88 void changeSize(int rows, int cols );
75 89
76 90
77public slots: 91public slots:
@@ -81,15 +95,17 @@ public slots:
81 95
82private slots: 96private slots:
83 void recvEmulation( const char*, int len ); 97 void recvEmulation( const char*, int len );
84private: 98private:
85 QFont font( int ); 99 QFont font( int );
86 QColor foreColor(int ); 100 QColor foreColor(int );
87 QColor backColor(int ); 101 QColor backColor(int );
88 102
89private: 103private:
90 TEWidget* m_teWid; 104 TEWidget* m_teWid;
91 TEmulation* m_teEmu; 105 TEmulation* m_teEmu;
92 Script * m_script; 106 Script * m_script;
107 Logger *m_log;
108 QString m_logFileName;
93}; 109};
94 110
95#endif 111#endif
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
@@ -1,90 +1,35 @@
1#ifndef FIX_IT_H 1#ifndef FIX_IT_H
2#define FIX_IT_H 2#define FIX_IT_H
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
5#include <sys/types.h> 10#include <sys/types.h>
6 11
7#include <stdio.h> 12#include <stdio.h>
8#include <stdlib.h> 13#include <stdlib.h>
9#include <signal.h> 14#include <signal.h>
10#include <qfile.h> 15
11 16
12/* 17/*
13 * The Zaurus rom 18 * The Zaurus rom
14 */ 19 */
15class FixIt { 20class FixIt : public QObject {
21
22 Q_OBJECT
23
16public: 24public:
17 FixIt(); 25 FixIt();
18 ~FixIt(); 26 ~FixIt();
19 void fixIt(); 27 void fixIt();
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;
25}; 31};
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
88#endif 34#endif
89 35
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
@@ -21,27 +21,28 @@ using namespace Opie::Ui;
21/* QT */ 21/* QT */
22#include <qaction.h> 22#include <qaction.h>
23#include <qmenubar.h> 23#include <qmenubar.h>
24#include <qtoolbar.h> 24#include <qtoolbar.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qfileinfo.h> 27#include <qfileinfo.h>
28 28
29/* STD */ 29/* STD */
30#include <assert.h> 30#include <assert.h>
31 31
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
37 38
38 setCaption(QObject::tr("Opie Console") ); 39 setCaption(QObject::tr("Opie Console") );
39 KeyTrans::loadAll(); 40 KeyTrans::loadAll();
40 for (int i = 0; i < KeyTrans::count(); i++ ) { 41 for (int i = 0; i < KeyTrans::count(); i++ ) {
41 KeyTrans* s = KeyTrans::find(i ); 42 KeyTrans* s = KeyTrans::find(i );
42 assert( s ); 43 assert( s );
43 } 44 }
44 m_factory = new MetaFactory(); 45 m_factory = new MetaFactory();
45 Default def(m_factory); 46 Default def(m_factory);
46 m_sessions.setAutoDelete( TRUE ); 47 m_sessions.setAutoDelete( TRUE );
47 m_curSession = 0; 48 m_curSession = 0;
@@ -113,29 +114,30 @@ void MainWindow::initUI() {
113 114
114 /* 115 /*
115 * disconnect action 116 * disconnect action
116 */ 117 */
117 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), 118 m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
118 QString::null, 0, this, 0 ); 119 QString::null, 0, this, 0 );
119 m_disconnect->addTo( m_console ); 120 m_disconnect->addTo( m_console );
120 connect(m_disconnect, SIGNAL(activated() ), 121 connect(m_disconnect, SIGNAL(activated() ),
121 this, SLOT(slotDisconnect() ) ); 122 this, SLOT(slotDisconnect() ) );
122 123
123 m_console->insertSeparator(); 124 m_console->insertSeparator();
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 );
127 m_quickLaunch->addTo( m_icons ); 128 m_quickLaunch->addTo( m_icons );
128 connect( m_quickLaunch, SIGNAL( activated() ), 129 connect( m_quickLaunch, SIGNAL( activated() ),
129 this, SLOT( slotQuickLaunch() ) ); 130 this, SLOT( slotQuickLaunch() ) );
131#endif
130 132
131 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); 133 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
132 134
133 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 135 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
134 0, this, 0 ); 136 0, this, 0 );
135 m_transfer->addTo( m_console ); 137 m_transfer->addTo( m_console );
136 connect(m_transfer, SIGNAL(activated() ), 138 connect(m_transfer, SIGNAL(activated() ),
137 this, SLOT(slotTransfer() ) ); 139 this, SLOT(slotTransfer() ) );
138 140
139 141
140 142
141 /* 143 /*
@@ -151,24 +153,31 @@ void MainWindow::initUI() {
151 * fullscreen 153 * fullscreen
152 */ 154 */
153 m_isFullscreen = false; 155 m_isFullscreen = false;
154 156
155 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 157 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
156 , QString::null, 0, this, 0 ); 158 , QString::null, 0, this, 0 );
157 m_fullscreen->addTo( m_console ); 159 m_fullscreen->addTo( m_console );
158 connect( m_fullscreen, SIGNAL( activated() ), 160 connect( m_fullscreen, SIGNAL( activated() ),
159 this, SLOT( slotFullscreen() ) ); 161 this, SLOT( slotFullscreen() ) );
160 162
161 m_console->insertSeparator(); 163 m_console->insertSeparator();
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();
164 a->setText( tr("Save history") ); 173 a->setText( tr("Save history") );
165 a->addTo( m_console ); 174 a->addTo( m_console );
166 connect(a, SIGNAL(activated() ), 175 connect(a, SIGNAL(activated() ),
167 this, SLOT(slotSaveHistory() ) ); 176 this, SLOT(slotSaveHistory() ) );
168 /* 177 /*
169 * terminate action 178 * terminate action
170 */ 179 */
171 m_terminate = new QAction(); 180 m_terminate = new QAction();
172 m_terminate->setText( tr("Terminate") ); 181 m_terminate->setText( tr("Terminate") );
173 m_terminate->addTo( m_console ); 182 m_terminate->addTo( m_console );
174 connect(m_terminate, SIGNAL(activated() ), 183 connect(m_terminate, SIGNAL(activated() ),
@@ -413,38 +422,37 @@ void MainWindow::slotDisconnect() {
413} 422}
414 423
415void MainWindow::slotTerminate() { 424void MainWindow::slotTerminate() {
416 if ( currentSession() ) 425 if ( currentSession() )
417 currentSession()->layer()->close(); 426 currentSession()->layer()->close();
418 427
419 slotClose(); 428 slotClose();
420 /* FIXME move to the next session */ 429 /* FIXME move to the next session */
421} 430}
422 431
423 432
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" ) {
431 create( prof ); 438 create( prof );
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 );
434 newProf.setAutoConnect( true ); 442 newProf.setAutoConnect( true );
435 create( newProf ); 443 create( newProf );
436 slotSaveSession(); 444 slotSaveSession();
445 #endif
437 } 446 }
438
439} 447}
440 448
441void MainWindow::slotConfigure() { 449void MainWindow::slotConfigure() {
442 ConfigDialog conf( manager()->all(), factory() ); 450 ConfigDialog conf( manager()->all(), factory() );
443 451
444 int ret = QPEApplication::execDialog( &conf ); 452 int ret = QPEApplication::execDialog( &conf );
445 453
446 if ( QDialog::Accepted == ret ) { 454 if ( QDialog::Accepted == ret ) {
447 manager()->setProfiles( conf.list() ); 455 manager()->setProfiles( conf.list() );
448 manager()->save(); 456 manager()->save();
449 populateProfiles(); 457 populateProfiles();
450 } 458 }
@@ -599,24 +607,30 @@ void MainWindow::slotSessionChanged( Session* ses ) {
599 m_disconnect->setEnabled( true ); 607 m_disconnect->setEnabled( true );
600 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 608 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
601 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 609 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
602 m_scripts->setItemEnabled(m_runScript_id, true); 610 m_scripts->setItemEnabled(m_runScript_id, true);
603 } else { 611 } else {
604 m_connect->setEnabled( true ); 612 m_connect->setEnabled( true );
605 m_disconnect->setEnabled( false ); 613 m_disconnect->setEnabled( false );
606 m_recordScript->setEnabled( false ); 614 m_recordScript->setEnabled( false );
607 m_saveScript->setEnabled( false ); 615 m_saveScript->setEnabled( false );
608 m_scripts->setItemEnabled(m_runScript_id, false); 616 m_scripts->setItemEnabled(m_runScript_id, false);
609 } 617 }
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 ) {
612 m_transfer->setEnabled( false ); 626 m_transfer->setEnabled( false );
613 } else { 627 } else {
614 m_transfer->setEnabled( true ); 628 m_transfer->setEnabled( true );
615 } 629 }
616 630
617 QWidget *w = m_curSession->widget(); 631 QWidget *w = m_curSession->widget();
618 if(w) w->setFocus(); 632 if(w) w->setFocus();
619 633
620 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 634 if(currentSession()->profile().readNumEntry("Wrap", 80)){
621 m_isWrapped = true; 635 m_isWrapped = true;
622 } else { 636 } else {
@@ -698,24 +712,54 @@ void MainWindow::slotPaste() {
698 */ 712 */
699 713
700void MainWindow::slotSaveSession() { 714void MainWindow::slotSaveSession() {
701 if (!currentSession() ) { 715 if (!currentSession() ) {
702 QMessageBox::information(this, tr("Save Connection"), 716 QMessageBox::information(this, tr("Save Connection"),
703 tr("<qt>There is no Connection.</qt>"), 1 ); 717 tr("<qt>There is no Connection.</qt>"), 1 );
704 return; 718 return;
705 } 719 }
706 manager()->add( currentSession()->profile() ); 720 manager()->add( currentSession()->profile() );
707 manager()->save(); 721 manager()->save();
708 populateProfiles(); 722 populateProfiles();
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() {
711 QMap<QString, QStringList> map; 755 QMap<QString, QStringList> map;
712 QStringList text; 756 QStringList text;
713 text << "text/plain"; 757 text << "text/plain";
714 map.insert(tr("History"), text ); 758 map.insert(tr("History"), text );
715 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 759 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
716 if (filename.isEmpty() ) return; 760 if (filename.isEmpty() ) return;
717 761
718 QFileInfo info(filename); 762 QFileInfo info(filename);
719 763
720 DocLnk nf; 764 DocLnk nf;
721 nf.setType("text/plain"); 765 nf.setType("text/plain");
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
@@ -1,17 +1,18 @@
1#ifndef OPIE_MAIN_WINDOW_H 1#ifndef OPIE_MAIN_WINDOW_H
2#define OPIE_MAIN_WINDOW_H 2#define OPIE_MAIN_WINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlist.h> 5#include <qlist.h>
6#include <qfile.h>
6 7
7#include "session.h" 8#include "session.h"
8 9
9/** 10/**
10 * this is the MainWindow of the new opie console 11 * this is the MainWindow of the new opie console
11 * it's also the dispatcher between the different 12 * it's also the dispatcher between the different
12 * actions supported by the gui 13 * actions supported by the gui
13 */ 14 */
14class QToolBar; 15class QToolBar;
15class QToolButton; 16class QToolButton;
16class QMenuBar; 17class QMenuBar;
17class QAction; 18class QAction;
@@ -64,24 +65,25 @@ private slots:
64 void slotTransfer(); 65 void slotTransfer();
65 void slotOpenKeb(bool); 66 void slotOpenKeb(bool);
66 void slotOpenButtons(bool); 67 void slotOpenButtons(bool);
67 void slotRecordScript(); 68 void slotRecordScript();
68 void slotSaveScript(); 69 void slotSaveScript();
69 void slotRunScript(int); 70 void slotRunScript(int);
70 void slotFullscreen(); 71 void slotFullscreen();
71 void slotQuickLaunch(); 72 void slotQuickLaunch();
72 void slotWrap(); 73 void slotWrap();
73 void slotSessionChanged( Session* ); 74 void slotSessionChanged( Session* );
74 void slotKeyReceived(FKey, ushort, ushort, bool); 75 void slotKeyReceived(FKey, ushort, ushort, bool);
75 void slotSaveHistory(); 76 void slotSaveHistory();
77 void slotSaveLog();
76 78
77 /* what could these both slot do? */ 79 /* what could these both slot do? */
78 void slotCopy(); 80 void slotCopy();
79 void slotPaste(); 81 void slotPaste();
80 82
81 /* save the currentSession() to Profiles */ 83 /* save the currentSession() to Profiles */
82 void slotSaveSession(); 84 void slotSaveSession();
83 85
84private: 86private:
85 void initUI(); 87 void initUI();
86 void populateProfiles(); 88 void populateProfiles();
87 void populateScripts(); 89 void populateScripts();
@@ -117,23 +119,25 @@ private:
117 QAction* m_disconnect; 119 QAction* m_disconnect;
118 QAction* m_quickLaunch; 120 QAction* m_quickLaunch;
119 QAction* m_terminate; 121 QAction* m_terminate;
120 QAction* m_transfer; 122 QAction* m_transfer;
121 QAction* m_setProfiles; 123 QAction* m_setProfiles;
122 QAction* m_openKeys; 124 QAction* m_openKeys;
123 QAction* m_openButtons; 125 QAction* m_openButtons;
124 QAction* m_recordScript; 126 QAction* m_recordScript;
125 QAction* m_saveScript; 127 QAction* m_saveScript;
126 QAction* m_fullscreen; 128 QAction* m_fullscreen;
127 QAction* m_wrap; 129 QAction* m_wrap;
128 QAction* m_closewindow; 130 QAction* m_closewindow;
131 QAction* m_recordLog;
129 132
130 FunctionKeyboard *m_kb; 133 FunctionKeyboard *m_kb;
131 int m_runScript_id; 134 int m_runScript_id;
132 bool m_isFullscreen; 135 bool m_isFullscreen;
133 bool m_isWrapped; 136 bool m_isWrapped;
137 bool m_recordingLog;
134 138
135 QWidget* savedParentFullscreen; 139 QWidget* savedParentFullscreen;
136}; 140};
137 141
138 142
139#endif 143#endif
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
@@ -14,61 +14,61 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \
14 transferdialog.h \ 14 transferdialog.h \
15 profiledialogwidget.h \ 15 profiledialogwidget.h \
16 profileeditordialog.h \ 16 profileeditordialog.h \
17 default.h \ 17 default.h \
18 iolayerbase.h \ 18 iolayerbase.h \
19 serialconfigwidget.h irdaconfigwidget.h \ 19 serialconfigwidget.h irdaconfigwidget.h \
20 btconfigwidget.h modemconfigwidget.h \ 20 btconfigwidget.h modemconfigwidget.h \
21 atconfigdialog.h dialdialog.h \ 21 atconfigdialog.h dialdialog.h \
22 procctl.h \ 22 procctl.h \
23 function_keyboard.h \ 23 function_keyboard.h \
24 receive_layer.h filereceive.h \ 24 receive_layer.h filereceive.h \
25 script.h \ 25 script.h \
26 dialer.h \ 26 dialer.h logger.h \
27 terminalwidget.h \ 27 terminalwidget.h \
28 emulation_handler.h TECommon.h \ 28 emulation_handler.h TECommon.h \
29 TEHistory.h TEScreen.h TEWidget.h \ 29 TEHistory.h TEScreen.h TEWidget.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
33SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ 33SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \
34 file_layer.cpp filetransfer.cpp \ 34 file_layer.cpp filetransfer.cpp \
35 main.cpp \ 35 main.cpp \
36 metafactory.cpp \ 36 metafactory.cpp \
37 session.cpp \ 37 session.cpp \
38 mainwindow.cpp \ 38 mainwindow.cpp \
39 profile.cpp \ 39 profile.cpp \
40 profileconfig.cpp \ 40 profileconfig.cpp \
41 profilemanager.cpp \ 41 profilemanager.cpp \
42 tabwidget.cpp \ 42 tabwidget.cpp \
43 configdialog.cpp \ 43 configdialog.cpp \
44 keytrans.cpp \ 44 keytrans.cpp \
45 transferdialog.cpp \ 45 transferdialog.cpp \
46 profiledialogwidget.cpp \ 46 profiledialogwidget.cpp \
47 profileeditordialog.cpp \ 47 profileeditordialog.cpp \
48 iolayerbase.cpp \ 48 iolayerbase.cpp \
49 serialconfigwidget.cpp irdaconfigwidget.cpp \ 49 serialconfigwidget.cpp irdaconfigwidget.cpp \
50 btconfigwidget.cpp modemconfigwidget.cpp \ 50 btconfigwidget.cpp modemconfigwidget.cpp \
51 atconfigdialog.cpp dialdialog.cpp \ 51 atconfigdialog.cpp dialdialog.cpp \
52 default.cpp procctl.cpp \ 52 default.cpp procctl.cpp \
53 function_keyboard.cpp \ 53 function_keyboard.cpp \
54 receive_layer.cpp filereceive.cpp \ 54 receive_layer.cpp filereceive.cpp \
55 script.cpp \ 55 script.cpp \
56 dialer.cpp \ 56 dialer.cpp logger.cpp \
57 terminalwidget.cpp \ 57 terminalwidget.cpp \
58 emulation_handler.cpp TEHistory.cpp \ 58 emulation_handler.cpp TEHistory.cpp \
59 TEScreen.cpp TEWidget.cpp \ 59 TEScreen.cpp TEWidget.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
63 63
64DESTDIR = $(OPIEDIR)/bin/ 64DESTDIR = $(OPIEDIR)/bin/
65INTERFACES = configurebase.ui editbase.ui 65INTERFACES = configurebase.ui editbase.ui
66INCLUDEPATH += $(OPIEDIR)/include 66INCLUDEPATH += $(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
74include ( $(OPIEDIR)/include.pro ) 74include ( $(OPIEDIR)/include.pro )