-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 | |||
@@ -72,32 +72,33 @@ using namespace Opie::Core; | |||
72 | 72 | ||
73 | /* QT */ | 73 | /* QT */ |
74 | #include <qsocketnotifier.h> | 74 | #include <qsocketnotifier.h> |
75 | #include <qfile.h> | 75 | #include <qfile.h> |
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. |
100 | */ | 101 | */ |
101 | 102 | ||
102 | void MyPty::setSize(int lines, int columns) | 103 | void MyPty::setSize(int lines, int columns) |
103 | { | 104 | { |
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,95 +1,108 @@ | |||
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) ), |
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 | } |
33 | TEmulation* EmulationHandler::emulation() { | 39 | TEmulation* EmulationHandler::emulation() { |
34 | return m_teEmu; | 40 | return m_teEmu; |
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 ); |
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) ); |
53 | 60 | ||
54 | int term = prof.readNumEntry("Terminal", 0) ; | 61 | int term = prof.readNumEntry("Terminal", 0) ; |
55 | switch(term) { | 62 | switch(term) { |
56 | default: | 63 | default: |
57 | case Profile::VT102: | 64 | case Profile::VT102: |
58 | case Profile::VT100: | 65 | case Profile::VT100: |
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 | } |
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 | */ |
86 | void EmulationHandler::setColor( const QColor& fore, const QColor& back ) { | 99 | void 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 ) { |
92 | table[i].color = fore; | 105 | table[i].color = fore; |
93 | }else if ( i == 1 || i == 11 ) { | 106 | }else if ( i == 1 || i == 11 ) { |
94 | table[i].color = back; | 107 | table[i].color = back; |
95 | table[i].transparent = 0; | 108 | table[i].transparent = 0; |
@@ -171,43 +184,64 @@ QColor EmulationHandler::backColor(int col ) { | |||
171 | return co; | 184 | return co; |
172 | } | 185 | } |
173 | 186 | ||
174 | QPushButton* EmulationHandler::cornerButton() { | 187 | QPushButton* EmulationHandler::cornerButton() { |
175 | return m_teWid->cornerButton(); | 188 | return m_teWid->cornerButton(); |
176 | } | 189 | } |
177 | 190 | ||
178 | 191 | ||
179 | Script *EmulationHandler::script() { | 192 | Script *EmulationHandler::script() { |
180 | return m_script; | 193 | return m_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(); |
205 | } | 239 | } |
206 | void EmulationHandler::paste() { | 240 | void EmulationHandler::paste() { |
207 | m_teWid->pasteClipboard(); | 241 | m_teWid->pasteClipboard(); |
208 | } | 242 | } |
209 | 243 | ||
210 | void EmulationHandler::setWrap(int columns) { | 244 | void EmulationHandler::setWrap(int columns) { |
211 | m_teWid->setWrapAt(columns); | 245 | m_teWid->setWrapAt(columns); |
212 | } | 246 | } |
213 | 247 | ||
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 | |||
@@ -14,82 +14,98 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * This is the layer above the IOLayer* | 17 | * This is the layer above the IOLayer* |
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 | */ |
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 |
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 |
45 | */ | 49 | */ |
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); |
72 | signals: | 86 | signals: |
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 | ||
77 | public slots: | 91 | public slots: |
78 | void recv( const QByteArray& ); | 92 | void recv( const QByteArray& ); |
79 | void paste(); | 93 | void paste(); |
80 | void copy(); | 94 | void copy(); |
81 | 95 | ||
82 | private slots: | 96 | private slots: |
83 | void recvEmulation( const char*, int len ); | 97 | void recvEmulation( const char*, int len ); |
84 | private: | 98 | private: |
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 | ||
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 | |||
@@ -17,35 +17,36 @@ | |||
17 | #include <qpe/filemanager.h> | 17 | #include <qpe/filemanager.h> |
18 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
19 | using namespace Opie::Ui; | 19 | using namespace Opie::Ui; |
20 | 20 | ||
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 | ||
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 ); |
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; |
48 | m_manager = new ProfileManager( m_factory ); | 49 | m_manager = new ProfileManager( m_factory ); |
49 | m_manager->load(); | 50 | m_manager->load(); |
50 | m_scriptsData.setAutoDelete(TRUE); | 51 | m_scriptsData.setAutoDelete(TRUE); |
51 | 52 | ||
@@ -109,37 +110,38 @@ void MainWindow::initUI() { | |||
109 | QString::null, 0, this, 0 ); | 110 | QString::null, 0, this, 0 ); |
110 | m_connect->addTo( m_console ); | 111 | m_connect->addTo( m_console ); |
111 | connect(m_connect, SIGNAL(activated() ), | 112 | connect(m_connect, SIGNAL(activated() ), |
112 | this, SLOT(slotConnect() ) ); | 113 | this, SLOT(slotConnect() ) ); |
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 | /* |
142 | * immediate change of line wrap policy | 144 | * immediate change of line wrap policy |
143 | */ | 145 | */ |
144 | m_isWrapped = true; | 146 | m_isWrapped = true; |
145 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); | 147 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true ); |
@@ -147,32 +149,39 @@ void MainWindow::initUI() { | |||
147 | m_wrap->setOn( true ); | 149 | m_wrap->setOn( true ); |
148 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 150 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
149 | 151 | ||
150 | /* | 152 | /* |
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() ), |
175 | this, SLOT(slotTerminate() ) ); | 184 | this, SLOT(slotTerminate() ) ); |
176 | 185 | ||
177 | m_closewindow = new QAction(); | 186 | m_closewindow = new QAction(); |
178 | m_closewindow->setText( tr("Close Window") ); | 187 | m_closewindow->setText( tr("Close Window") ); |
@@ -409,46 +418,45 @@ void MainWindow::slotDisconnect() { | |||
409 | m_recordScript->setEnabled( false); | 418 | m_recordScript->setEnabled( false); |
410 | m_saveScript->setEnabled( false ); | 419 | m_saveScript->setEnabled( false ); |
411 | m_scripts->setItemEnabled(m_runScript_id, false); | 420 | m_scripts->setItemEnabled(m_runScript_id, false); |
412 | } | 421 | } |
413 | } | 422 | } |
414 | 423 | ||
415 | void MainWindow::slotTerminate() { | 424 | void 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 | |||
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 ); |
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 | } |
451 | } | 459 | } |
452 | /* | 460 | /* |
453 | * we will remove | 461 | * we will remove |
454 | * this window from the tabwidget | 462 | * this window from the tabwidget |
@@ -595,32 +603,38 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
595 | m_curSession = ses; | 603 | m_curSession = ses; |
596 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; | 604 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; |
597 | if ( m_curSession->layer()->isConnected() ) { | 605 | if ( m_curSession->layer()->isConnected() ) { |
598 | m_connect->setEnabled( false ); | 606 | m_connect->setEnabled( false ); |
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 { |
623 | m_isWrapped = false; | 637 | m_isWrapped = false; |
624 | } | 638 | } |
625 | 639 | ||
626 | m_kb->load(currentSession()->profile()); | 640 | m_kb->load(currentSession()->profile()); |
@@ -694,32 +708,62 @@ void MainWindow::slotPaste() { | |||
694 | } | 708 | } |
695 | 709 | ||
696 | /* | 710 | /* |
697 | * Save the session | 711 | * Save the session |
698 | */ | 712 | */ |
699 | 713 | ||
700 | void MainWindow::slotSaveSession() { | 714 | void 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 | |||
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); |
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"); |
722 | nf.setFile(filename); | 766 | nf.setFile(filename); |
723 | nf.setName(info.fileName()); | 767 | nf.setName(info.fileName()); |
724 | 768 | ||
725 | 769 | ||
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,21 +1,22 @@ | |||
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 | */ |
14 | class QToolBar; | 15 | class QToolBar; |
15 | class QToolButton; | 16 | class QToolButton; |
16 | class QMenuBar; | 17 | class QMenuBar; |
17 | class QAction; | 18 | class QAction; |
18 | class MetaFactory; | 19 | class MetaFactory; |
19 | class TabWidget; | 20 | class TabWidget; |
20 | class ProfileManager; | 21 | class ProfileManager; |
21 | class Profile; | 22 | class Profile; |
@@ -60,32 +61,33 @@ private slots: | |||
60 | void slotTerminate(); | 61 | void slotTerminate(); |
61 | void slotConfigure(); | 62 | void slotConfigure(); |
62 | void slotClose(); | 63 | void slotClose(); |
63 | void slotProfile(int); | 64 | void slotProfile(int); |
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 | ||
84 | private: | 86 | private: |
85 | void initUI(); | 87 | void initUI(); |
86 | void populateProfiles(); | 88 | void populateProfiles(); |
87 | void populateScripts(); | 89 | void populateScripts(); |
88 | void create( const Profile& ); | 90 | void create( const Profile& ); |
89 | /** | 91 | /** |
90 | * the current session | 92 | * the current session |
91 | */ | 93 | */ |
@@ -113,27 +115,29 @@ private: | |||
113 | QPopupMenu* m_sessionsPop; | 115 | QPopupMenu* m_sessionsPop; |
114 | QPopupMenu* m_scriptsPop; | 116 | QPopupMenu* m_scriptsPop; |
115 | QPopupMenu* m_scripts; | 117 | QPopupMenu* m_scripts; |
116 | QAction* m_connect; | 118 | QAction* m_connect; |
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 @@ | |||
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 | |||
@@ -10,65 +10,65 @@ HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ | |||
10 | profilemanager.h \ | 10 | profilemanager.h \ |
11 | tabwidget.h \ | 11 | tabwidget.h \ |
12 | configdialog.h \ | 12 | configdialog.h \ |
13 | keytrans.h \ | 13 | keytrans.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 | ||
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 \ |
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 | ||
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 ) |