-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 34 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.h | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/fixit.cpp | 101 | ||||
-rw-r--r-- | noncore/apps/opie-console/fixit.h | 77 | ||||
-rw-r--r-- | noncore/apps/opie-console/logger.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-console/logger.h | 19 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 60 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console-embedix.control | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 14 |
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 | |||
@@ -82,12 +82,13 @@ using namespace Opie::Core; | |||
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 | ||
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,24 +1,30 @@ | |||
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 | |||
8 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
9 | 14 | ||
10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 15 | EmulationHandler::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) ), |
@@ -35,12 +41,13 @@ TEmulation* EmulationHandler::emulation() { | |||
35 | } | 41 | } |
36 | EmulationHandler::~EmulationHandler() { | 42 | EmulationHandler::~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 | ||
43 | void EmulationHandler::load( const Profile& prof) { | 50 | void 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 ); |
@@ -65,21 +72,27 @@ void EmulationHandler::load( const Profile& prof) { | |||
65 | m_teEmu->setKeytrans("default.Keytab"); | 72 | m_teEmu->setKeytrans("default.Keytab"); |
66 | break; | 73 | break; |
67 | } | 74 | } |
68 | } | 75 | } |
69 | void EmulationHandler::recv( const QByteArray& ar) { | 76 | 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 | |||
72 | void EmulationHandler::recvEmulation(const char* src, int len ) { | 83 | void 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 | |||
80 | QWidget* EmulationHandler::widget() { | 93 | QWidget* 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 | */ |
@@ -181,24 +194,45 @@ Script *EmulationHandler::script() { | |||
181 | } | 194 | } |
182 | 195 | ||
183 | bool EmulationHandler::isRecording() { | 196 | bool EmulationHandler::isRecording() { |
184 | return (m_script != 0); | 197 | return (m_script != 0); |
185 | } | 198 | } |
186 | 199 | ||
200 | bool EmulationHandler::isLogging() { | ||
201 | return (m_log != 0); | ||
202 | } | ||
203 | |||
187 | void EmulationHandler::startRecording() { | 204 | void EmulationHandler::startRecording() { |
188 | if (!isRecording()) | 205 | if (!isRecording()) |
189 | m_script = new Script(); | 206 | m_script = new Script(); |
190 | } | 207 | } |
191 | 208 | ||
209 | void EmulationHandler::startLogging(const QString fileName) { | ||
210 | m_logFileName = fileName; | ||
211 | if (!isLogging()) | ||
212 | m_log = new Logger(m_logFileName); | ||
213 | } | ||
214 | |||
215 | QString EmulationHandler::logFileName() { | ||
216 | return m_logFileName; | ||
217 | } | ||
218 | |||
192 | void EmulationHandler::clearScript() { | 219 | void 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 | ||
226 | void EmulationHandler::clearLog() { | ||
227 | if (isLogging()) { | ||
228 | delete m_log; | ||
229 | m_log = 0; | ||
230 | } | ||
231 | } | ||
232 | |||
199 | void EmulationHandler::runScript(const Script *script) { | 233 | void EmulationHandler::runScript(const Script *script) { |
200 | emit send(script->script()); | 234 | emit send(script->script()); |
201 | } | 235 | } |
202 | 236 | ||
203 | void EmulationHandler::copy() { | 237 | void EmulationHandler::copy() { |
204 | m_teWid->emitSelection(); | 238 | m_teWid->emitSelection(); |
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 | |||
@@ -24,15 +24,19 @@ | |||
24 | * the pre QByteArray world! | 24 | * the pre QByteArray world! |
25 | */ | 25 | */ |
26 | class Profile; | 26 | class Profile; |
27 | class QWidget; | 27 | class QWidget; |
28 | class QPushButton; | 28 | class QPushButton; |
29 | class TEWidget; | 29 | class TEWidget; |
30 | class QFile; | ||
30 | class TEmulation; | 31 | class TEmulation; |
31 | class QFont; | 32 | class QFont; |
33 | class QTextStream; | ||
32 | class Script; | 34 | class Script; |
35 | class Logger; | ||
36 | |||
33 | class EmulationHandler : public QObject { | 37 | class EmulationHandler : public QObject { |
34 | Q_OBJECT | 38 | Q_OBJECT |
35 | public: | 39 | public: |
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 |
@@ -52,20 +56,30 @@ public: | |||
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); |
@@ -87,9 +101,11 @@ private: | |||
87 | QColor backColor(int ); | 101 | QColor backColor(int ); |
88 | 102 | ||
89 | private: | 103 | private: |
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 | |||
4 | using namespace Opie::Core; | ||
5 | |||
6 | #ifdef FSCKED_DISTRI | ||
7 | FixIt::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 | |||
50 | FixIt::~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 | */ | ||
58 | void 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 | |||
85 | void 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 | */ |
15 | class FixIt { | 20 | class FixIt : public QObject { |
21 | |||
22 | Q_OBJECT | ||
23 | |||
16 | public: | 24 | public: |
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 | ||
28 | FixIt::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 | } | ||
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 | 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 | |||
7 | Logger::Logger() {} | ||
8 | |||
9 | Logger::Logger(const QString fileName) { | ||
10 | m_file.setName(fileName); | ||
11 | m_file.open(IO_ReadWrite); | ||
12 | } | ||
13 | |||
14 | Logger::~Logger() { | ||
15 | m_file.close(); | ||
16 | } | ||
17 | |||
18 | void 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 | |||
7 | class Logger { | ||
8 | |||
9 | public: | ||
10 | Logger(); | ||
11 | Logger(const QString fileName); | ||
12 | void append(QByteArray ar); | ||
13 | ~Logger(); | ||
14 | |||
15 | private: | ||
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 | |||
@@ -27,15 +27,16 @@ using namespace Opie::Ui; | |||
27 | #include <qfileinfo.h> | 27 | #include <qfileinfo.h> |
28 | 28 | ||
29 | /* STD */ | 29 | /* STD */ |
30 | #include <assert.h> | 30 | #include <assert.h> |
31 | 31 | ||
32 | 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 | |||
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 ); |
@@ -119,17 +120,18 @@ void MainWindow::initUI() { | |||
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 ); |
@@ -157,12 +159,19 @@ void MainWindow::initUI() { | |||
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 | /* |
@@ -419,26 +428,25 @@ void MainWindow::slotTerminate() { | |||
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 | |||
428 | void MainWindow::slotQuickLaunch() { | 434 | void 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 | ||
441 | void MainWindow::slotConfigure() { | 449 | void 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 ); |
@@ -605,12 +613,18 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
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 | ||
@@ -704,12 +718,42 @@ void MainWindow::slotSaveSession() { | |||
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 | |||
727 | void 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 | |||
710 | void MainWindow::slotSaveHistory() { | 754 | void 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); |
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,11 +1,12 @@ | |||
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 |
@@ -70,12 +71,13 @@ private slots: | |||
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 */ |
@@ -123,17 +125,19 @@ private: | |||
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 @@ | |||
1 | Package: opie-console | ||
2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* share/opie-console/* | ||
3 | Priority: optional | ||
4 | Section: opie/applications | ||
5 | Maintainer: Opie Team <opie@handhelds.org> | ||
6 | Architecture: arm | ||
7 | Version: 0.6-$SUB_VERSION | ||
8 | Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs | ||
9 | License: GPL | ||
10 | 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 | |||
@@ -20,18 +20,18 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.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 | ||
33 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ | 33 | SOURCES = 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 \ |
@@ -50,25 +50,25 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.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 | ||
64 | DESTDIR = $(OPIEDIR)/bin/ | 64 | DESTDIR = $(OPIEDIR)/bin/ |
65 | INTERFACES = configurebase.ui editbase.ui | 65 | INTERFACES = configurebase.ui editbase.ui |
66 | INCLUDEPATH += $(OPIEDIR)/include | 66 | INCLUDEPATH += $(OPIEDIR)/include |
67 | DEPENDPATH += $(OPIEDIR)/include | 67 | DEPENDPATH += $(OPIEDIR)/include |
68 | LIBS += -lqpe -lopiecore2 -lopieui2 -lutil | 68 | LIBS += -lqpe -lopiecore2 -lopieui2 |
69 | TARGET = opie-console | 69 | TARGET = opie-console |
70 | 70 | ||
71 | DEFINES += HAVE_OPENPTY | 71 | #DEFINES += HAVE_OPENPTY |
72 | 72 | #DEFINES += EAST FSCKED_DISTRI | |
73 | 73 | ||
74 | include ( $(OPIEDIR)/include.pro ) | 74 | include ( $(OPIEDIR)/include.pro ) |