21 files changed, 135 insertions, 93 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index a37f980..6d57703 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp | |||
@@ -42,83 +42,87 @@ | |||
42 | 42 | ||
43 | [NOTE: much of the technical stuff below will be replaced by forkpty.] | 43 | [NOTE: much of the technical stuff below will be replaced by forkpty.] |
44 | 44 | ||
45 | publish the SIGCHLD signal if not related to an instance. | 45 | publish the SIGCHLD signal if not related to an instance. |
46 | 46 | ||
47 | clearify TEPty::done vs. TEPty::~TEPty semantics. | 47 | clearify TEPty::done vs. TEPty::~TEPty semantics. |
48 | check if pty is restartable via run after done. | 48 | check if pty is restartable via run after done. |
49 | 49 | ||
50 | \par Pseudo terminals | 50 | \par Pseudo terminals |
51 | 51 | ||
52 | Pseudo terminals are a unique feature of UNIX, and always come in form of | 52 | Pseudo terminals are a unique feature of UNIX, and always come in form of |
53 | pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each | 53 | pairs of devices (/dev/ptyXX and /dev/ttyXX), which are connected to each |
54 | other by the operating system. One may think of them as two serial devices | 54 | other by the operating system. One may think of them as two serial devices |
55 | linked by a null-modem cable. Being based on devices the number of | 55 | linked by a null-modem cable. Being based on devices the number of |
56 | simultanous instances of this class is (globally) limited by the number of | 56 | simultanous instances of this class is (globally) limited by the number of |
57 | those device pairs, which is 256. | 57 | those device pairs, which is 256. |
58 | 58 | ||
59 | Another technic are UNIX 98 PTY's. These are supported also, and prefered | 59 | Another technic are UNIX 98 PTY's. These are supported also, and prefered |
60 | over the (obsolete) predecessor. | 60 | over the (obsolete) predecessor. |
61 | 61 | ||
62 | There's a sinister ioctl(2), signal(2) and job control stuff | 62 | There's a sinister ioctl(2), signal(2) and job control stuff |
63 | nessesary to make everything work as it should. | 63 | nessesary to make everything work as it should. |
64 | */ | 64 | */ |
65 | 65 | ||
66 | #include "procctl.h" | ||
67 | #include "MyPty.h" | ||
66 | 68 | ||
69 | /* OPIE */ | ||
70 | #include <opie2/odebug.h> | ||
71 | using namespace Opie::Core; | ||
72 | |||
73 | /* QT */ | ||
67 | #include <qsocketnotifier.h> | 74 | #include <qsocketnotifier.h> |
68 | #include <qfile.h> | 75 | #include <qfile.h> |
69 | 76 | ||
77 | /* STD */ | ||
70 | #include <stdlib.h> | 78 | #include <stdlib.h> |
71 | #include <stdio.h> | 79 | #include <stdio.h> |
72 | #include <signal.h> | 80 | #include <signal.h> |
73 | #include <fcntl.h> | 81 | #include <fcntl.h> |
74 | #include <unistd.h> | 82 | #include <unistd.h> |
75 | #include <termios.h> | 83 | #include <termios.h> |
76 | #include <sys/types.h> | 84 | #include <sys/types.h> |
77 | #include <sys/ioctl.h> | 85 | #include <sys/ioctl.h> |
78 | #include <sys/wait.h> | 86 | #include <sys/wait.h> |
79 | 87 | ||
80 | #ifdef HAVE_OPENPTY | 88 | #ifdef HAVE_OPENPTY |
81 | #include <pty.h> | 89 | #include <pty.h> |
82 | #endif | 90 | #endif |
83 | 91 | ||
84 | #include "procctl.h" | ||
85 | #include "MyPty.h" | ||
86 | |||
87 | |||
88 | #undef VERBOSE_DEBUG | 92 | #undef VERBOSE_DEBUG |
89 | 93 | ||
90 | 94 | ||
91 | /* -------------------------------------------------------------------------- */ | 95 | /* -------------------------------------------------------------------------- */ |
92 | 96 | ||
93 | /*! | 97 | /*! |
94 | Informs the client program about the | 98 | Informs the client program about the |
95 | actual size of the window. | 99 | actual size of the window. |
96 | */ | 100 | */ |
97 | 101 | ||
98 | void MyPty::setSize(int lines, int columns) | 102 | void MyPty::setSize(int lines, int columns) |
99 | { | 103 | { |
100 | qWarning("setting size"); | 104 | owarn << "setting size" << oendl; |
101 | struct winsize wsize; | 105 | struct winsize wsize; |
102 | wsize.ws_row = (unsigned short)lines; | 106 | wsize.ws_row = (unsigned short)lines; |
103 | wsize.ws_col = (unsigned short)columns; | 107 | wsize.ws_col = (unsigned short)columns; |
104 | if(m_fd < 0) return; | 108 | if(m_fd < 0) return; |
105 | ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); | 109 | ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); |
106 | } | 110 | } |
107 | 111 | ||
108 | 112 | ||
109 | void MyPty::donePty() | 113 | void MyPty::donePty() |
110 | { | 114 | { |
111 | // This is code from the Qt DumbTerminal example | 115 | // This is code from the Qt DumbTerminal example |
112 | 116 | ||
113 | ::close(m_fd); | 117 | ::close(m_fd); |
114 | 118 | ||
115 | if (m_cpid) { | 119 | if (m_cpid) { |
116 | kill(m_cpid, SIGHUP); | 120 | kill(m_cpid, SIGHUP); |
117 | //waitpid(m_cpid, &status, 0); | 121 | //waitpid(m_cpid, &status, 0); |
118 | delete m_sn_e; | 122 | delete m_sn_e; |
119 | delete m_sn_r; | 123 | delete m_sn_r; |
120 | m_sn_e = 0l; | 124 | m_sn_e = 0l; |
121 | m_sn_r = 0l; | 125 | m_sn_r = 0l; |
122 | } | 126 | } |
123 | 127 | ||
124 | m_cpid = 0; | 128 | m_cpid = 0; |
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp index e535296..d168a5e 100644 --- a/noncore/apps/opie-console/TEWidget.cpp +++ b/noncore/apps/opie-console/TEWidget.cpp | |||
@@ -1008,92 +1008,92 @@ void TEWidget::onClearSelection() | |||
1008 | // For auto-hide, we need to get keypress-events, but we only get them when | 1008 | // For auto-hide, we need to get keypress-events, but we only get them when |
1009 | // we have focus. | 1009 | // we have focus. |
1010 | 1010 | ||
1011 | void TEWidget::doScroll(int lines) | 1011 | void TEWidget::doScroll(int lines) |
1012 | { | 1012 | { |
1013 | scrollbar->setValue(scrollbar->value()+lines); | 1013 | scrollbar->setValue(scrollbar->value()+lines); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | 1016 | bool TEWidget::eventFilter( QObject *obj, QEvent *e ) |
1017 | { | 1017 | { |
1018 | if ( (e->type() == QEvent::Accel || | 1018 | if ( (e->type() == QEvent::Accel || |
1019 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { | 1019 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { |
1020 | static_cast<QKeyEvent *>( e )->ignore(); | 1020 | static_cast<QKeyEvent *>( e )->ignore(); |
1021 | return true; | 1021 | return true; |
1022 | } | 1022 | } |
1023 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) | 1023 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) |
1024 | return FALSE; // not us | 1024 | return FALSE; // not us |
1025 | if ( e->type() == QEvent::Wheel) { | 1025 | if ( e->type() == QEvent::Wheel) { |
1026 | QApplication::sendEvent(scrollbar, e); | 1026 | QApplication::sendEvent(scrollbar, e); |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | #ifdef FAKE_CTRL_AND_ALT | 1029 | #ifdef FAKE_CTRL_AND_ALT |
1030 | static bool control = FALSE; | 1030 | static bool control = FALSE; |
1031 | static bool alt = FALSE; | 1031 | static bool alt = FALSE; |
1032 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 1032 | // odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; |
1033 | bool dele=FALSE; | 1033 | bool dele=FALSE; |
1034 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1034 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1035 | QKeyEvent* ke = (QKeyEvent*)e; | 1035 | QKeyEvent* ke = (QKeyEvent*)e; |
1036 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 1036 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
1037 | switch (ke->key()) { | 1037 | switch (ke->key()) { |
1038 | case Key_F9: // let this be "Control" | 1038 | case Key_F9: // let this be "Control" |
1039 | control = keydown; | 1039 | control = keydown; |
1040 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 1040 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
1041 | dele=TRUE; | 1041 | dele=TRUE; |
1042 | break; | 1042 | break; |
1043 | case Key_F13: // let this be "Alt" | 1043 | case Key_F13: // let this be "Alt" |
1044 | alt = keydown; | 1044 | alt = keydown; |
1045 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 1045 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
1046 | dele=TRUE; | 1046 | dele=TRUE; |
1047 | break; | 1047 | break; |
1048 | default: | 1048 | default: |
1049 | if ( control ) { | 1049 | if ( control ) { |
1050 | int a = toupper(ke->ascii())-64; | 1050 | int a = toupper(ke->ascii())-64; |
1051 | if ( a >= 0 && a < ' ' ) { | 1051 | if ( a >= 0 && a < ' ' ) { |
1052 | e = new QKeyEvent(e->type(), ke->key(), | 1052 | e = new QKeyEvent(e->type(), ke->key(), |
1053 | a, ke->state()|ControlButton, QChar(a,0)); | 1053 | a, ke->state()|ControlButton, QChar(a,0)); |
1054 | dele=TRUE; | 1054 | dele=TRUE; |
1055 | } | 1055 | } |
1056 | } | 1056 | } |
1057 | if ( alt ) { | 1057 | if ( alt ) { |
1058 | e = new QKeyEvent(e->type(), ke->key(), | 1058 | e = new QKeyEvent(e->type(), ke->key(), |
1059 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1059 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1060 | dele=TRUE; | 1060 | dele=TRUE; |
1061 | } | 1061 | } |
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | #endif | 1064 | #endif |
1065 | 1065 | ||
1066 | if ( e->type() == QEvent::KeyPress ) { | 1066 | if ( e->type() == QEvent::KeyPress ) { |
1067 | QKeyEvent* ke = (QKeyEvent*)e; | 1067 | QKeyEvent* ke = (QKeyEvent*)e; |
1068 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1068 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1069 | // know where the current selection is. | 1069 | // know where the current selection is. |
1070 | 1070 | ||
1071 | // qDebug("key pressed is 0x%x",ke->key()); | 1071 | // odebug << "key pressed is 0x" << ke->key() << "" << oendl; |
1072 | 1072 | ||
1073 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker | 1073 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker |
1074 | 1074 | ||
1075 | // qDebug("key pressed 2 is 0x%x",ke->key()); | 1075 | // odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl; |
1076 | emitText("\\"); // expose | 1076 | emitText("\\"); // expose |
1077 | } else | 1077 | } else |
1078 | emit keyPressedSignal(ke); // expose | 1078 | emit keyPressedSignal(ke); // expose |
1079 | ke->accept(); | 1079 | ke->accept(); |
1080 | #ifdef FAKE_CTRL_AND_ALT | 1080 | #ifdef FAKE_CTRL_AND_ALT |
1081 | if ( dele ) delete e; | 1081 | if ( dele ) delete e; |
1082 | #endif | 1082 | #endif |
1083 | return true; // stop the event | 1083 | return true; // stop the event |
1084 | } | 1084 | } |
1085 | if ( e->type() == QEvent::Enter ) { | 1085 | if ( e->type() == QEvent::Enter ) { |
1086 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), | 1086 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), |
1087 | this, SLOT(onClearSelection()) ); | 1087 | this, SLOT(onClearSelection()) ); |
1088 | } | 1088 | } |
1089 | if ( e->type() == QEvent::Leave ) { | 1089 | if ( e->type() == QEvent::Leave ) { |
1090 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 1090 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
1091 | this, SLOT(onClearSelection()) ); | 1091 | this, SLOT(onClearSelection()) ); |
1092 | } | 1092 | } |
1093 | return QFrame::eventFilter( obj, e ); | 1093 | return QFrame::eventFilter( obj, e ); |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | /* ------------------------------------------------------------------------- */ | 1096 | /* ------------------------------------------------------------------------- */ |
1097 | /* */ | 1097 | /* */ |
1098 | /* Frame */ | 1098 | /* Frame */ |
1099 | /* */ | 1099 | /* */ |
diff --git a/noncore/apps/opie-console/TEmulation.cpp b/noncore/apps/opie-console/TEmulation.cpp index d0169d7..6ff73af 100644 --- a/noncore/apps/opie-console/TEmulation.cpp +++ b/noncore/apps/opie-console/TEmulation.cpp | |||
@@ -49,48 +49,54 @@ | |||
49 | 49 | ||
50 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. | 50 | We use a refreshing algorithm here that has been adoped from rxvt/kvt. |
51 | 51 | ||
52 | By this, refreshing is driven by a timer, which is (re)started whenever | 52 | By this, refreshing is driven by a timer, which is (re)started whenever |
53 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. | 53 | a new bunch of data to be interpreted by the emulation arives at `onRcvBlock'. |
54 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger | 54 | As soon as no more data arrive for `BULK_TIMEOUT' milliseconds, we trigger |
55 | refresh. This rule suits both bulk display operation as done by curses as | 55 | refresh. This rule suits both bulk display operation as done by curses as |
56 | well as individual characters typed. | 56 | well as individual characters typed. |
57 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). | 57 | (BULK_TIMEOUT < 1000 / max characters received from keyboard per second). |
58 | 58 | ||
59 | Additionally, we trigger refreshing by newlines comming in to make visual | 59 | Additionally, we trigger refreshing by newlines comming in to make visual |
60 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby | 60 | snapshots of lists as produced by `cat', `ls' and likely programs, thereby |
61 | producing the illusion of a permanent and immediate display operation. | 61 | producing the illusion of a permanent and immediate display operation. |
62 | 62 | ||
63 | As a sort of catch-all needed for cases where none of the above | 63 | As a sort of catch-all needed for cases where none of the above |
64 | conditions catch, the screen refresh is also triggered by a count | 64 | conditions catch, the screen refresh is also triggered by a count |
65 | of incoming bulks (`bulk_incnt'). | 65 | of incoming bulks (`bulk_incnt'). |
66 | */ | 66 | */ |
67 | 67 | ||
68 | /* FIXME | 68 | /* FIXME |
69 | - evtl. the bulk operations could be made more transparent. | 69 | - evtl. the bulk operations could be made more transparent. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | #include "TEmulation.h" | 72 | #include "TEmulation.h" |
73 | |||
74 | /* OPIE */ | ||
75 | #include <opie2/odebug.h> | ||
76 | using namespace Opie::Core; | ||
77 | |||
78 | /* STD */ | ||
73 | #include <stdio.h> | 79 | #include <stdio.h> |
74 | #include <stdlib.h> | 80 | #include <stdlib.h> |
75 | #include <unistd.h> | 81 | #include <unistd.h> |
76 | 82 | ||
77 | 83 | ||
78 | /* ------------------------------------------------------------------------- */ | 84 | /* ------------------------------------------------------------------------- */ |
79 | /* */ | 85 | /* */ |
80 | /* TEmulation */ | 86 | /* TEmulation */ |
81 | /* */ | 87 | /* */ |
82 | /* ------------------------------------------------------------------------- */ | 88 | /* ------------------------------------------------------------------------- */ |
83 | 89 | ||
84 | #define CNTL(c) ((c)-'@') | 90 | #define CNTL(c) ((c)-'@') |
85 | 91 | ||
86 | /*! | 92 | /*! |
87 | */ | 93 | */ |
88 | 94 | ||
89 | TEmulation::TEmulation(TEWidget* gui) | 95 | TEmulation::TEmulation(TEWidget* gui) |
90 | : decoder((QTextDecoder*)NULL) | 96 | : decoder((QTextDecoder*)NULL) |
91 | { | 97 | { |
92 | this->gui = gui; | 98 | this->gui = gui; |
93 | 99 | ||
94 | screen[0] = new TEScreen(gui->Lines(),gui->Columns()); | 100 | screen[0] = new TEScreen(gui->Lines(),gui->Columns()); |
95 | screen[1] = new TEScreen(gui->Lines(),gui->Columns()); | 101 | screen[1] = new TEScreen(gui->Lines(),gui->Columns()); |
96 | scr = screen[0]; | 102 | scr = screen[0]; |
@@ -183,49 +189,49 @@ void TEmulation::onRcvChar(int c) | |||
183 | { | 189 | { |
184 | c &= 0xff; | 190 | c &= 0xff; |
185 | switch (c) | 191 | switch (c) |
186 | { | 192 | { |
187 | case '\b' : scr->BackSpace(); break; | 193 | case '\b' : scr->BackSpace(); break; |
188 | case '\t' : scr->Tabulate(); break; | 194 | case '\t' : scr->Tabulate(); break; |
189 | case '\n' : scr->NewLine(); break; | 195 | case '\n' : scr->NewLine(); break; |
190 | case '\r' : scr->Return(); break; | 196 | case '\r' : scr->Return(); break; |
191 | case 0x07 : gui->Bell(); break; | 197 | case 0x07 : gui->Bell(); break; |
192 | default : scr->ShowCharacter(c); break; | 198 | default : scr->ShowCharacter(c); break; |
193 | }; | 199 | }; |
194 | } | 200 | } |
195 | 201 | ||
196 | /* ------------------------------------------------------------------------- */ | 202 | /* ------------------------------------------------------------------------- */ |
197 | /* */ | 203 | /* */ |
198 | /* Keyboard Handling */ | 204 | /* Keyboard Handling */ |
199 | /* */ | 205 | /* */ |
200 | /* ------------------------------------------------------------------------- */ | 206 | /* ------------------------------------------------------------------------- */ |
201 | 207 | ||
202 | /*! | 208 | /*! |
203 | */ | 209 | */ |
204 | 210 | ||
205 | void TEmulation::onKeyPress( QKeyEvent* ev ) | 211 | void TEmulation::onKeyPress( QKeyEvent* ev ) |
206 | { | 212 | { |
207 | qWarning("onKeyPress,...."); | 213 | owarn << "onKeyPress,...." << oendl; |
208 | if (!connected) return; // someone else gets the keys | 214 | if (!connected) return; // someone else gets the keys |
209 | if (scr->getHistCursor() != scr->getHistLines()); | 215 | if (scr->getHistCursor() != scr->getHistLines()); |
210 | scr->setHistCursor(scr->getHistLines()); | 216 | scr->setHistCursor(scr->getHistLines()); |
211 | if (!ev->text().isEmpty()) | 217 | if (!ev->text().isEmpty()) |
212 | { // A block of text | 218 | { // A block of text |
213 | // Note that the text is proper unicode. | 219 | // Note that the text is proper unicode. |
214 | // We should do a conversion here, but since this | 220 | // We should do a conversion here, but since this |
215 | // routine will never be used, we simply emit plain ascii. | 221 | // routine will never be used, we simply emit plain ascii. |
216 | emit sndBlock(ev->text().ascii(),ev->text().length()); | 222 | emit sndBlock(ev->text().ascii(),ev->text().length()); |
217 | } | 223 | } |
218 | else if (ev->ascii()>0) | 224 | else if (ev->ascii()>0) |
219 | { unsigned char c[1]; | 225 | { unsigned char c[1]; |
220 | c[0] = ev->ascii(); | 226 | c[0] = ev->ascii(); |
221 | emit sndBlock((char*)c,1); | 227 | emit sndBlock((char*)c,1); |
222 | } | 228 | } |
223 | } | 229 | } |
224 | 230 | ||
225 | // Unblocking, Byte to Unicode translation --------------------------------- -- | 231 | // Unblocking, Byte to Unicode translation --------------------------------- -- |
226 | 232 | ||
227 | /* | 233 | /* |
228 | We are doing code conversion from locale to unicode first. | 234 | We are doing code conversion from locale to unicode first. |
229 | */ | 235 | */ |
230 | 236 | ||
231 | void TEmulation::onRcvBlock(const char *s, int len) | 237 | void TEmulation::onRcvBlock(const char *s, int len) |
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp index 8e91b9e..c998f96 100644 --- a/noncore/apps/opie-console/atconfigdialog.cpp +++ b/noncore/apps/opie-console/atconfigdialog.cpp | |||
@@ -1,37 +1,40 @@ | |||
1 | #include "atconfigdialog.h" | ||
2 | #include "io_modem.h" | ||
1 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
6 | using namespace Opie::Core; | ||
7 | |||
8 | /* QT */ | ||
2 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
3 | #include <qspinbox.h> | 10 | #include <qspinbox.h> |
4 | #include <qlayout.h> | 11 | #include <qlayout.h> |
5 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
6 | #include <qtabwidget.h> | 13 | #include <qtabwidget.h> |
7 | #include <qlabel.h> | 14 | #include <qlabel.h> |
8 | #include <qscrollview.h> | 15 | #include <qscrollview.h> |
9 | 16 | ||
10 | #include "atconfigdialog.h" | ||
11 | #include "io_modem.h" | ||
12 | |||
13 | |||
14 | ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 17 | ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
15 | : QDialog( parent, name, modal, fl ) { | 18 | : QDialog( parent, name, modal, fl ) { |
16 | 19 | ||
17 | 20 | ||
18 | setCaption( tr( "Dialing parameter setup" ) ); | 21 | setCaption( tr( "Dialing parameter setup" ) ); |
19 | 22 | ||
20 | QVBoxLayout *layout = new QVBoxLayout( this ); | 23 | QVBoxLayout *layout = new QVBoxLayout( this ); |
21 | QTabWidget *tabWidget = new QTabWidget( this ); | 24 | QTabWidget *tabWidget = new QTabWidget( this ); |
22 | 25 | ||
23 | tabWidget->addTab( tab0( this ), tr("Settings1") ); | 26 | tabWidget->addTab( tab0( this ), tr("Settings1") ); |
24 | tabWidget->addTab( tab1( this ), tr("Settings2") ); | 27 | tabWidget->addTab( tab1( this ), tr("Settings2") ); |
25 | 28 | ||
26 | layout->addWidget( tabWidget ); | 29 | layout->addWidget( tabWidget ); |
27 | 30 | ||
28 | } | 31 | } |
29 | 32 | ||
30 | QWidget* ATConfigDialog::tab0( QWidget* parent) { | 33 | QWidget* ATConfigDialog::tab0( QWidget* parent) { |
31 | 34 | ||
32 | 35 | ||
33 | QScrollView* sv = new QScrollView( parent ); | 36 | QScrollView* sv = new QScrollView( parent ); |
34 | 37 | ||
35 | QWidget *returnWidget = new QWidget( sv->viewport() ); | 38 | QWidget *returnWidget = new QWidget( sv->viewport() ); |
36 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 39 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
37 | // sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 40 | // sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
@@ -131,49 +134,49 @@ QWidget* ATConfigDialog::tab1( QWidget* parent ) { | |||
131 | layout->addWidget( bpsDetectBox, 4, 1 ); | 134 | layout->addWidget( bpsDetectBox, 4, 1 ); |
132 | bpsDetectBox->insertItem( tr("No") ); | 135 | bpsDetectBox->insertItem( tr("No") ); |
133 | bpsDetectBox->insertItem( tr("Yes") ); | 136 | bpsDetectBox->insertItem( tr("Yes") ); |
134 | 137 | ||
135 | QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); | 138 | QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget ); |
136 | dcdLinesBox = new QComboBox( returnWidget ); | 139 | dcdLinesBox = new QComboBox( returnWidget ); |
137 | layout->addWidget( dcdLinesLabel, 5, 0 ); | 140 | layout->addWidget( dcdLinesLabel, 5, 0 ); |
138 | layout->addWidget( dcdLinesBox, 5, 1 ); | 141 | layout->addWidget( dcdLinesBox, 5, 1 ); |
139 | dcdLinesBox->insertItem( tr("No") ); | 142 | dcdLinesBox->insertItem( tr("No") ); |
140 | dcdLinesBox->insertItem( tr("Yes") ); | 143 | dcdLinesBox->insertItem( tr("Yes") ); |
141 | 144 | ||
142 | QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); | 145 | QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget ); |
143 | multiLineUntagBox = new QComboBox( returnWidget ); | 146 | multiLineUntagBox = new QComboBox( returnWidget ); |
144 | layout->addWidget( multiLineUntagLabel, 6, 0 ); | 147 | layout->addWidget( multiLineUntagLabel, 6, 0 ); |
145 | layout->addWidget( multiLineUntagBox, 6, 1 ); | 148 | layout->addWidget( multiLineUntagBox, 6, 1 ); |
146 | multiLineUntagBox->insertItem( tr("No") ); | 149 | multiLineUntagBox->insertItem( tr("No") ); |
147 | multiLineUntagBox->insertItem( tr("Yes") ); | 150 | multiLineUntagBox->insertItem( tr("Yes") ); |
148 | 151 | ||
149 | return returnWidget; | 152 | return returnWidget; |
150 | 153 | ||
151 | } | 154 | } |
152 | 155 | ||
153 | 156 | ||
154 | void ATConfigDialog::readConfig( const Profile& config ) { | 157 | void ATConfigDialog::readConfig( const Profile& config ) { |
155 | qWarning("config in atconfigdialog"); | 158 | owarn << "config in atconfigdialog" << oendl; |
156 | 159 | ||
157 | initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); | 160 | initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); |
158 | resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); | 161 | resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); |
159 | dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 162 | dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
160 | dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 163 | dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
161 | dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 164 | dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
162 | dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 165 | dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
163 | dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 166 | dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
164 | dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 167 | dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
165 | connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); | 168 | connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) ); |
166 | hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); | 169 | hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); |
167 | dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); | 170 | dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) ); |
168 | delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) ); | 171 | delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) ); |
169 | numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) ); | 172 | numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) ); |
170 | dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) ); | 173 | dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) ); |
171 | bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); | 174 | bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) ); |
172 | dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); | 175 | dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) ); |
173 | multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); | 176 | multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) ); |
174 | 177 | ||
175 | // Not implemented yet | 178 | // Not implemented yet |
176 | resetStringLine->setEnabled(false); | 179 | resetStringLine->setEnabled(false); |
177 | dialSuf1Line->setEnabled(false); | 180 | dialSuf1Line->setEnabled(false); |
178 | dialPref2Line->setEnabled(false); | 181 | dialPref2Line->setEnabled(false); |
179 | dialSuf2Line->setEnabled(false); | 182 | dialSuf2Line->setEnabled(false); |
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index 67ad10e..7010594 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -1,41 +1,46 @@ | |||
1 | #include "dialer.h" | 1 | #include "dialer.h" |
2 | #include "io_modem.h" | ||
3 | |||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
6 | using namespace Opie::Core; | ||
2 | 7 | ||
8 | /* QT */ | ||
3 | #include <qlayout.h> | 9 | #include <qlayout.h> |
4 | #include <qprogressbar.h> | 10 | #include <qprogressbar.h> |
5 | #include <qlabel.h> | 11 | #include <qlabel.h> |
6 | #include <qpushbutton.h> | 12 | #include <qpushbutton.h> |
7 | #include <qapp.h> | 13 | #include <qapp.h> |
8 | #include <qtimer.h> | 14 | #include <qtimer.h> |
9 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
10 | 16 | ||
17 | /* STD */ | ||
11 | #include <unistd.h> | 18 | #include <unistd.h> |
12 | #include <string.h> | 19 | #include <string.h> |
13 | #include <fcntl.h> | 20 | #include <fcntl.h> |
14 | #include <errno.h> | 21 | #include <errno.h> |
15 | 22 | ||
16 | #include "io_modem.h" | ||
17 | |||
18 | // State machine: | When an error occurs, we don't have to | 23 | // State machine: | When an error occurs, we don't have to |
19 | // | reset everything. | 24 | // | reset everything. |
20 | // (init) <------+ | But if the user wants to reset, | 25 | // (init) <------+ | But if the user wants to reset, |
21 | // | | | we stop dialing immediately. | 26 | // | | | we stop dialing immediately. |
22 | // v | | | 27 | // v | | |
23 | // (options) ----+ | Following the state machine is necessary | 28 | // (options) ----+ | Following the state machine is necessary |
24 | // | \ | to get determinable results. | 29 | // | \ | to get determinable results. |
25 | // v ^ | | 30 | // v ^ | |
26 | // (dial) ----+ | | 31 | // (dial) ----+ | |
27 | // | ^ | | 32 | // | ^ | |
28 | // v | | | 33 | // v | | |
29 | // (online) --+ | | 34 | // (online) --+ | |
30 | // | | | 35 | // | | |
31 | // v | | 36 | // v | |
32 | 37 | ||
33 | 38 | ||
34 | // from atconfigdialog | 39 | // from atconfigdialog |
35 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); | 40 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); |
36 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); | 41 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); |
37 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 42 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
38 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 43 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
39 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 44 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
40 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 45 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
41 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 46 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
@@ -83,196 +88,196 @@ Dialer::~Dialer() | |||
83 | { | 88 | { |
84 | } | 89 | } |
85 | 90 | ||
86 | void Dialer::setHangupOnly() | 91 | void Dialer::setHangupOnly() |
87 | { | 92 | { |
88 | state = state_cancel; | 93 | state = state_cancel; |
89 | usercancel = 1; | 94 | usercancel = 1; |
90 | send( m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING )+"\r" ); | 95 | send( m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING )+"\r" ); |
91 | } | 96 | } |
92 | 97 | ||
93 | void Dialer::slotCancel() | 98 | void Dialer::slotCancel() |
94 | { | 99 | { |
95 | if(state != state_online) | 100 | if(state != state_online) |
96 | { | 101 | { |
97 | usercancel = 1; | 102 | usercancel = 1; |
98 | reset(); | 103 | reset(); |
99 | } | 104 | } |
100 | else { | 105 | else { |
101 | accept(); | 106 | accept(); |
102 | } | 107 | } |
103 | } | 108 | } |
104 | 109 | ||
105 | void Dialer::reset() | 110 | void Dialer::reset() |
106 | { | 111 | { |
107 | qWarning("reset"); | 112 | owarn << "reset" << oendl; |
108 | switchState(state_cancel); | 113 | switchState(state_cancel); |
109 | } | 114 | } |
110 | 115 | ||
111 | void Dialer::slotAutostart() | 116 | void Dialer::slotAutostart() |
112 | { | 117 | { |
113 | //state = state_preinit; | 118 | //state = state_preinit; |
114 | dial(m_profile.readEntry("Number")); | 119 | dial(m_profile.readEntry("Number")); |
115 | } | 120 | } |
116 | 121 | ||
117 | void Dialer::dial(const QString& number) | 122 | void Dialer::dial(const QString& number) |
118 | { | 123 | { |
119 | while(state != state_online) | 124 | while(state != state_online) |
120 | { | 125 | { |
121 | if(!usercancel) | 126 | if(!usercancel) |
122 | { | 127 | { |
123 | state = state_preinit; | 128 | state = state_preinit; |
124 | trydial(number); | 129 | trydial(number); |
125 | } | 130 | } |
126 | else break; | 131 | else break; |
127 | } | 132 | } |
128 | 133 | ||
129 | if(usercancel) | 134 | if(usercancel) |
130 | { | 135 | { |
131 | // modem hangup | 136 | // modem hangup |
132 | trydial(QString::null); | 137 | trydial(QString::null); |
133 | reject(); | 138 | reject(); |
134 | } | 139 | } |
135 | } | 140 | } |
136 | 141 | ||
137 | void Dialer::trydial(const QString& number) | 142 | void Dialer::trydial(const QString& number) |
138 | { | 143 | { |
139 | qWarning("TryDial:%s", number.latin1() ); | 144 | owarn << "TryDial:" << number.latin1() << "" << oendl; |
140 | if(state != state_cancel) switchState(state_preinit); | 145 | if(state != state_cancel) switchState(state_preinit); |
141 | if(cleanshutdown) | 146 | if(cleanshutdown) |
142 | { | 147 | { |
143 | qWarning("HangupString " + m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING)); | 148 | owarn << "HangupString " << m_profile.readEntry("HangupString") << oendl; |
144 | send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); | 149 | send(m_profile.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) + "\r"); |
145 | } | 150 | } |
146 | 151 | ||
147 | if(state != state_cancel) | 152 | if(state != state_cancel) |
148 | { | 153 | { |
149 | switchState(state_init); | 154 | switchState(state_init); |
150 | // qWarning("Init String " + m_profile.readEntry("InitString") ); | 155 | // owarn << "Init String " + m_profile.readEntry("InitString") << oendl; |
151 | send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); | 156 | send(m_profile.readEntry("InitString",MODEM_DEFAULT_INIT_STRING ) + "\r"); |
152 | QString response2 = receive(); | 157 | QString response2 = receive(); |
153 | if(!response2.contains("\nOK\r")) | 158 | if(!response2.contains("\nOK\r")) |
154 | reset(); | 159 | reset(); |
155 | } | 160 | } |
156 | 161 | ||
157 | /*if(state != state_cancel) | 162 | /*if(state != state_cancel) |
158 | { | 163 | { |
159 | switchState(state_options); | 164 | switchState(state_options); |
160 | 165 | ||
161 | qWarning("ATM3l3"); | 166 | owarn << "ATM3l3" << oendl; |
162 | send("ATM3L3\r"); | 167 | send("ATM3L3\r"); |
163 | QString response3 = receive(); | 168 | QString response3 = receive(); |
164 | if(!response3.contains("\nOK\r")) | 169 | if(!response3.contains("\nOK\r")) |
165 | reset(); | 170 | reset(); |
166 | } | 171 | } |
167 | */ | 172 | */ |
168 | 173 | ||
169 | if(state != state_cancel) | 174 | if(state != state_cancel) |
170 | { | 175 | { |
171 | switchState(state_dialtone); | 176 | switchState(state_dialtone); |
172 | 177 | ||
173 | send("ATX1\r"); | 178 | send("ATX1\r"); |
174 | QString response4 = receive(); | 179 | QString response4 = receive(); |
175 | if(!response4.contains("\nOK\r")) | 180 | if(!response4.contains("\nOK\r")) |
176 | reset(); | 181 | reset(); |
177 | } | 182 | } |
178 | 183 | ||
179 | if(state != state_cancel) | 184 | if(state != state_cancel) |
180 | { | 185 | { |
181 | qWarning("progress"); | 186 | owarn << "progress" << oendl; |
182 | switchState(state_dialing); | 187 | switchState(state_dialing); |
183 | 188 | ||
184 | // send(QString("ATDT %1\r").arg(number)); | 189 | // send(QString("ATDT %1\r").arg(number)); |
185 | send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) | 190 | send(QString("%1 %2\r").arg(m_profile.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 )) |
186 | .arg(number)); | 191 | .arg(number)); |
187 | 192 | ||
188 | QString response5 = receive(); | 193 | QString response5 = receive(); |
189 | if(!response5.contains("CONNECT") ) | 194 | if(!response5.contains("CONNECT") ) |
190 | { | 195 | { |
191 | if(response5.contains("BUSY")) | 196 | if(response5.contains("BUSY")) |
192 | switchState(state_dialing); | 197 | switchState(state_dialing); |
193 | else | 198 | else |
194 | { | 199 | { |
195 | QMessageBox::warning(this, | 200 | QMessageBox::warning(this, |
196 | QObject::tr("Failure"), | 201 | QObject::tr("Failure"), |
197 | QObject::tr("Dialing the number failed.")); | 202 | QObject::tr("Dialing the number failed.")); |
198 | slotCancel(); | 203 | slotCancel(); |
199 | } | 204 | } |
200 | } | 205 | } |
201 | } | 206 | } |
202 | 207 | ||
203 | 208 | ||
204 | if(state != state_cancel) | 209 | if(state != state_cancel) |
205 | { | 210 | { |
206 | state = state_online; | 211 | state = state_online; |
207 | slotCancel(); | 212 | slotCancel(); |
208 | } | 213 | } |
209 | } | 214 | } |
210 | 215 | ||
211 | void Dialer::send(const QString& msg) | 216 | void Dialer::send(const QString& msg) |
212 | { | 217 | { |
213 | QString m = msg; | 218 | QString m = msg; |
214 | int bytes; | 219 | int bytes; |
215 | QString termination; | 220 | QString termination; |
216 | 221 | ||
217 | qWarning("Sending: %s", m.latin1()); | 222 | owarn << "Sending: " << m.latin1() << "" << oendl; |
218 | 223 | ||
219 | /*termination = "\r"; | 224 | /*termination = "\r"; |
220 | //termination = m_profile.readEntry("Termination"); | 225 | //termination = m_profile.readEntry("Termination"); |
221 | if(termination == "\n") m = m + "\n"; | 226 | if(termination == "\n") m = m + "\n"; |
222 | else if(termination == "\r") m = m + "\r"; | 227 | else if(termination == "\r") m = m + "\r"; |
223 | else m = m + "\r\n"; | 228 | else m = m + "\r\n"; |
224 | */ | 229 | */ |
225 | m = m.replace(QRegExp("\n"), "\r"); | 230 | m = m.replace(QRegExp("\n"), "\r"); |
226 | 231 | ||
227 | bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); | 232 | bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); |
228 | if(bytes < 0) | 233 | if(bytes < 0) |
229 | { | 234 | { |
230 | reset(); | 235 | reset(); |
231 | } | 236 | } |
232 | } | 237 | } |
233 | 238 | ||
234 | QString Dialer::receive() | 239 | QString Dialer::receive() |
235 | { | 240 | { |
236 | QString buf; | 241 | QString buf; |
237 | char buffer[1024]; | 242 | char buffer[1024]; |
238 | int ret; | 243 | int ret; |
239 | int counter = 0; | 244 | int counter = 0; |
240 | 245 | ||
241 | while(1) | 246 | while(1) |
242 | { | 247 | { |
243 | ret = ::read(m_fd, buffer, sizeof(buffer)); | 248 | ret = ::read(m_fd, buffer, sizeof(buffer)); |
244 | 249 | ||
245 | if(ret > 0) | 250 | if(ret > 0) |
246 | { | 251 | { |
247 | for(int i = 0; i < ret; i++) | 252 | for(int i = 0; i < ret; i++) |
248 | buffer[i] = buffer[i] & 0x7F; | 253 | buffer[i] = buffer[i] & 0x7F; |
249 | buffer[ret] = 0; | 254 | buffer[ret] = 0; |
250 | qWarning("Got: %s", buffer); | 255 | owarn << "Got: " << buffer << "" << oendl; |
251 | buf.append(QString(buffer)); | 256 | buf.append(QString(buffer)); |
252 | if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) | 257 | if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) |
253 | { | 258 | { |
254 | //qWarning("Receiving: '%s'", buf.latin1()); | 259 | //owarn << "Receiving: '" << buf.latin1() << "'" << oendl; |
255 | cleanshutdown = 1; | 260 | cleanshutdown = 1; |
256 | return buf; | 261 | return buf; |
257 | }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { | 262 | }else if (buf.contains("NO CARRIER") || buf.contains("NO DIALTONE") ) { |
258 | cleanshutdown = 1; | 263 | cleanshutdown = 1; |
259 | return QString::null; | 264 | return QString::null; |
260 | } | 265 | } |
261 | } | 266 | } |
262 | else if(ret < 0) | 267 | else if(ret < 0) |
263 | { | 268 | { |
264 | if(errno != EAGAIN) reset(); | 269 | if(errno != EAGAIN) reset(); |
265 | else if(!(counter++ % 100)) qApp->processEvents(); | 270 | else if(!(counter++ % 100)) qApp->processEvents(); |
266 | } | 271 | } |
267 | else if(!(counter++ % 100)) qApp->processEvents(); | 272 | else if(!(counter++ % 100)) qApp->processEvents(); |
268 | 273 | ||
269 | if(usercancel) return QString::null; | 274 | if(usercancel) return QString::null; |
270 | } | 275 | } |
271 | 276 | ||
272 | cleanshutdown = 1; | 277 | cleanshutdown = 1; |
273 | return QString::null; | 278 | return QString::null; |
274 | } | 279 | } |
275 | 280 | ||
276 | void Dialer::switchState(int newstate) | 281 | void Dialer::switchState(int newstate) |
277 | { | 282 | { |
278 | int oldstate = state; | 283 | int oldstate = state; |
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 99d069f..89b70c6 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp | |||
@@ -1,31 +1,33 @@ | |||
1 | |||
2 | #include "TEmuVt102.h" | 1 | #include "TEmuVt102.h" |
3 | |||
4 | #include "profile.h" | 2 | #include "profile.h" |
5 | #include "emulation_handler.h" | 3 | #include "emulation_handler.h" |
6 | #include "script.h" | 4 | #include "script.h" |
7 | 5 | ||
6 | /* OPIE */ | ||
7 | #include <opie2/odebug.h> | ||
8 | using namespace Opie::Core; | ||
9 | |||
8 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) | 10 | EmulationHandler::EmulationHandler( const Profile& prof, QWidget* parent,const char* name ) |
9 | : QObject(0, name ) | 11 | : QObject(0, name ) |
10 | { | 12 | { |
11 | m_teWid = new TEWidget( parent, "TerminalMain"); | 13 | m_teWid = new TEWidget( parent, "TerminalMain"); |
12 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) | 14 | // use setWrapAt(0) for classic behaviour (wrap at screen width, no scrollbar) |
13 | // use setWrapAt(80) for normal console with scrollbar | 15 | // use setWrapAt(80) for normal console with scrollbar |
14 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); | 16 | setWrap(prof.readNumEntry("Wrap", 0) ? 0 : 80); |
15 | m_teWid->setMinimumSize(150, 70 ); | 17 | m_teWid->setMinimumSize(150, 70 ); |
16 | m_script = 0; | 18 | m_script = 0; |
17 | parent->resize( m_teWid->calcSize(80, 24 ) ); | 19 | parent->resize( m_teWid->calcSize(80, 24 ) ); |
18 | m_teEmu = new TEmuVt102(m_teWid ); | 20 | m_teEmu = new TEmuVt102(m_teWid ); |
19 | 21 | ||
20 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), | 22 | connect(m_teEmu,SIGNAL(ImageSizeChanged(int,int) ), |
21 | this, SIGNAL(changeSize(int,int) ) ); | 23 | this, SIGNAL(changeSize(int,int) ) ); |
22 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), | 24 | connect(m_teEmu, SIGNAL(sndBlock(const char*,int) ), |
23 | this, SLOT(recvEmulation(const char*,int) ) ); | 25 | this, SLOT(recvEmulation(const char*,int) ) ); |
24 | m_teEmu->setConnect( true ); | 26 | m_teEmu->setConnect( true ); |
25 | m_teEmu->setHistory( TRUE ); | 27 | m_teEmu->setHistory( TRUE ); |
26 | load( prof ); | 28 | load( prof ); |
27 | 29 | ||
28 | 30 | ||
29 | 31 | ||
30 | } | 32 | } |
31 | TEmulation* EmulationHandler::emulation() { | 33 | TEmulation* EmulationHandler::emulation() { |
@@ -107,77 +109,77 @@ QFont EmulationHandler::font( int id ) { | |||
107 | size = 7; | 109 | size = 7; |
108 | break; | 110 | break; |
109 | case 2: | 111 | case 2: |
110 | name = QString::fromLatin1("Fixed"); | 112 | name = QString::fromLatin1("Fixed"); |
111 | size = 12; | 113 | size = 12; |
112 | break; | 114 | break; |
113 | } | 115 | } |
114 | QFont font(name, size, QFont::Normal ); | 116 | QFont font(name, size, QFont::Normal ); |
115 | font.setFixedPitch(TRUE ); | 117 | font.setFixedPitch(TRUE ); |
116 | return font; | 118 | return font; |
117 | } | 119 | } |
118 | QColor EmulationHandler::foreColor(int col) { | 120 | QColor EmulationHandler::foreColor(int col) { |
119 | QColor co; | 121 | QColor co; |
120 | /* we need to switch it */ | 122 | /* we need to switch it */ |
121 | switch( col ) { | 123 | switch( col ) { |
122 | default: | 124 | default: |
123 | case Profile::White: | 125 | case Profile::White: |
124 | /* color is black */ | 126 | /* color is black */ |
125 | co = Qt::white; | 127 | co = Qt::white; |
126 | break; | 128 | break; |
127 | case Profile::Black: | 129 | case Profile::Black: |
128 | co = Qt::black; | 130 | co = Qt::black; |
129 | break; | 131 | break; |
130 | case Profile::Green: | 132 | case Profile::Green: |
131 | qWarning("Foreground green"); | 133 | owarn << "Foreground green" << oendl; |
132 | co = Qt::green; | 134 | co = Qt::green; |
133 | break; | 135 | break; |
134 | case Profile::Orange: | 136 | case Profile::Orange: |
135 | qWarning("Foreground orange"); | 137 | owarn << "Foreground orange" << oendl; |
136 | co.setRgb( 231, 184, 98 ); | 138 | co.setRgb( 231, 184, 98 ); |
137 | break; | 139 | break; |
138 | } | 140 | } |
139 | 141 | ||
140 | return co; | 142 | return co; |
141 | } | 143 | } |
142 | QColor EmulationHandler::backColor(int col ) { | 144 | QColor EmulationHandler::backColor(int col ) { |
143 | QColor co; | 145 | QColor co; |
144 | /* we need to switch it */ | 146 | /* we need to switch it */ |
145 | switch( col ) { | 147 | switch( col ) { |
146 | default: | 148 | default: |
147 | case Profile::White: | 149 | case Profile::White: |
148 | /* color is white */ | 150 | /* color is white */ |
149 | co = Qt::black; | 151 | co = Qt::black; |
150 | break; | 152 | break; |
151 | case Profile::Black: | 153 | case Profile::Black: |
152 | co = Qt::white; | 154 | co = Qt::white; |
153 | break; | 155 | break; |
154 | case Profile::Green: | 156 | case Profile::Green: |
155 | qWarning("Background black"); | 157 | owarn << "Background black" << oendl; |
156 | co = Qt::black; | 158 | co = Qt::black; |
157 | break; | 159 | break; |
158 | case Profile::Orange: | 160 | case Profile::Orange: |
159 | qWarning("Background black"); | 161 | owarn << "Background black" << oendl; |
160 | co = Qt::black; | 162 | co = Qt::black; |
161 | break; | 163 | break; |
162 | } | 164 | } |
163 | 165 | ||
164 | return co; | 166 | return co; |
165 | } | 167 | } |
166 | 168 | ||
167 | QPushButton* EmulationHandler::cornerButton() { | 169 | QPushButton* EmulationHandler::cornerButton() { |
168 | return m_teWid->cornerButton(); | 170 | return m_teWid->cornerButton(); |
169 | } | 171 | } |
170 | 172 | ||
171 | 173 | ||
172 | Script *EmulationHandler::script() { | 174 | Script *EmulationHandler::script() { |
173 | return m_script; | 175 | return m_script; |
174 | } | 176 | } |
175 | 177 | ||
176 | bool EmulationHandler::isRecording() { | 178 | bool EmulationHandler::isRecording() { |
177 | return (m_script != 0); | 179 | return (m_script != 0); |
178 | } | 180 | } |
179 | 181 | ||
180 | void EmulationHandler::startRecording() { | 182 | void EmulationHandler::startRecording() { |
181 | if (!isRecording()) | 183 | if (!isRecording()) |
182 | m_script = new Script(); | 184 | m_script = new Script(); |
183 | } | 185 | } |
diff --git a/noncore/apps/opie-console/emulation_widget.cpp b/noncore/apps/opie-console/emulation_widget.cpp index ad8ecba..4688551 100644 --- a/noncore/apps/opie-console/emulation_widget.cpp +++ b/noncore/apps/opie-console/emulation_widget.cpp | |||
@@ -203,97 +203,97 @@ void EmulationWidget::paintEvent( QPaintEvent* pe ) | |||
203 | int cb = m_image[loc(x,y)].b; | 203 | int cb = m_image[loc(x,y)].b; |
204 | int cr = m_image[loc(x,y)].r; | 204 | int cr = m_image[loc(x,y)].r; |
205 | while (x+len <= rlx && | 205 | while (x+len <= rlx && |
206 | m_image[loc(x+len,y)].f == cf && | 206 | m_image[loc(x+len,y)].f == cf && |
207 | m_image[loc(x+len,y)].b == cb && | 207 | m_image[loc(x+len,y)].b == cb && |
208 | m_image[loc(x+len,y)].r == cr ) | 208 | m_image[loc(x+len,y)].r == cr ) |
209 | { | 209 | { |
210 | disstrU[len] = vt100extended(m_image[loc(x+len,y)].c); | 210 | disstrU[len] = vt100extended(m_image[loc(x+len,y)].c); |
211 | len += 1; | 211 | len += 1; |
212 | } | 212 | } |
213 | QString unistr(disstrU,len); | 213 | QString unistr(disstrU,len); |
214 | 214 | ||
215 | drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false ); | 215 | drawAttrString( unistr, painter, QRect( m_blX+tLx+f_width*x,m_bY+tLy+f_height*y,f_width*len,f_height ), m_image[loc(x ,y )], pm != 0l, false ); |
216 | x +=len -1; | 216 | x +=len -1; |
217 | } | 217 | } |
218 | delete [] disstrU; | 218 | delete [] disstrU; |
219 | drawFrame( &painter ); | 219 | drawFrame( &painter ); |
220 | painter.end(); | 220 | painter.end(); |
221 | } | 221 | } |
222 | 222 | ||
223 | void EmulationWidget::calcGeometry() | 223 | void EmulationWidget::calcGeometry() |
224 | { | 224 | { |
225 | m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); | 225 | m_scrollbar->resize(QApplication::style().scrollBarExtent().width(), contentsRect().height() ); |
226 | 226 | ||
227 | qDebug( QString(" TEST").arg( contentsRect().width() ) ); | 227 | odebug << QString(" TEST").arg( contentsRect().width() ) << oendl; |
228 | qDebug( QString(" TEST").arg( contentsRect().height() ) ); | 228 | odebug << QString(" TEST").arg( contentsRect().height() ) << oendl; |
229 | qDebug("NEUER TESTT!!!!!!!!"); | 229 | odebug << "NEUER TESTT!!!!!!!!" << oendl; |
230 | 230 | ||
231 | switch( scrollLoc ) | 231 | switch( scrollLoc ) |
232 | { | 232 | { |
233 | case SCRNONE : | 233 | case SCRNONE : |
234 | m_columns = ( contentsRect().width() -2 * rimX ) / f_width; | 234 | m_columns = ( contentsRect().width() -2 * rimX ) / f_width; |
235 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; | 235 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) ) / 2; |
236 | m_brX = m_blX; | 236 | m_brX = m_blX; |
237 | m_scrollbar->hide(); | 237 | m_scrollbar->hide(); |
238 | break; | 238 | break; |
239 | case SCRLEFT : | 239 | case SCRLEFT : |
240 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; | 240 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; |
241 | m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; | 241 | m_brX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; |
242 | m_blX = m_brX + m_scrollbar->width(); | 242 | m_blX = m_brX + m_scrollbar->width(); |
243 | m_scrollbar->move( contentsRect().topLeft() ); | 243 | m_scrollbar->move( contentsRect().topLeft() ); |
244 | m_scrollbar->show(); | 244 | m_scrollbar->show(); |
245 | break; | 245 | break; |
246 | case SCRIGHT: | 246 | case SCRIGHT: |
247 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; | 247 | m_columns = ( contentsRect().width() - 2 * rimX - m_scrollbar->width() ) / f_width; |
248 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; | 248 | m_blX = ( contentsRect().width() - ( m_columns*f_width ) - m_scrollbar->width() ) / 2; |
249 | m_brX = m_blX; | 249 | m_brX = m_blX; |
250 | m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); | 250 | m_scrollbar->move( contentsRect().topRight() - QPoint (m_scrollbar->width()-1,0 ) ); |
251 | m_scrollbar->show(); | 251 | m_scrollbar->show(); |
252 | break; | 252 | break; |
253 | } | 253 | } |
254 | 254 | ||
255 | m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; | 255 | m_lines = ( contentsRect().height() - 2 * rimY ) / f_height; |
256 | m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; | 256 | m_bY = ( contentsRect().height() - (m_lines * f_height ) ) / 2; |
257 | } | 257 | } |
258 | 258 | ||
259 | void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) | 259 | void EmulationWidget::drawAttrString( QString& string, QPainter &painter, QRect rect, Character attr, bool usePixmap, bool clear ) |
260 | { | 260 | { |
261 | qWarning("Color1 %s", color_table[attr.b].color.name().latin1() ); | 261 | owarn << "Color1 " << color_table[attr.b].color.name().latin1() << "" << oendl; |
262 | if ( usePixmap && color_table[attr.b].transparent ) | 262 | if ( usePixmap && color_table[attr.b].transparent ) |
263 | { | 263 | { |
264 | painter.setBackgroundMode( TransparentMode ); | 264 | painter.setBackgroundMode( TransparentMode ); |
265 | if ( clear ) | 265 | if ( clear ) |
266 | erase( rect ); | 266 | erase( rect ); |
267 | } | 267 | } |
268 | else | 268 | else |
269 | { | 269 | { |
270 | if ( blinking ) | 270 | if ( blinking ) |
271 | painter.fillRect( rect, color_table[attr.b].color ); | 271 | painter.fillRect( rect, color_table[attr.b].color ); |
272 | else | 272 | else |
273 | { | 273 | { |
274 | painter.setBackgroundMode( OpaqueMode ); | 274 | painter.setBackgroundMode( OpaqueMode ); |
275 | qWarning("Color %s", color_table[attr.b].color.name().latin1() ); | 275 | owarn << "Color " << color_table[attr.b].color.name().latin1() << "" << oendl; |
276 | painter.setBackgroundColor( color_table[attr.b].color ); | 276 | painter.setBackgroundColor( color_table[attr.b].color ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | if ( color_table[attr.f].bold ) | 279 | if ( color_table[attr.f].bold ) |
280 | painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); | 280 | painter.setPen( QColor( 0x8F, 0x00, 0x00 ) ); |
281 | else | 281 | else |
282 | painter.setPen( color_table[attr.f].color ); | 282 | painter.setPen( color_table[attr.f].color ); |
283 | painter.drawText( rect.x(), rect.y() + f_ascent, string ); | 283 | painter.drawText( rect.x(), rect.y() + f_ascent, string ); |
284 | 284 | ||
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | /////////////////////// | 288 | /////////////////////// |
289 | // scrollbar | 289 | // scrollbar |
290 | // //////////////////// | 290 | // //////////////////// |
291 | 291 | ||
292 | void EmulationWidget::scroll( int value ) | 292 | void EmulationWidget::scroll( int value ) |
293 | { | 293 | { |
294 | } | 294 | } |
295 | 295 | ||
296 | void EmulationWidget::setScroll( int cursor, int slines ) | 296 | void EmulationWidget::setScroll( int cursor, int slines ) |
297 | { | 297 | { |
298 | } | 298 | } |
299 | 299 | ||
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp index eb32551..6613183 100644 --- a/noncore/apps/opie-console/function_keyboard.cpp +++ b/noncore/apps/opie-console/function_keyboard.cpp | |||
@@ -1,64 +1,69 @@ | |||
1 | #include "function_keyboard.h" | 1 | #include "function_keyboard.h" |
2 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
7 | /* QT */ | ||
3 | #include <qlayout.h> | 8 | #include <qlayout.h> |
4 | #include <qlistbox.h> | 9 | #include <qlistbox.h> |
5 | #include <qlabel.h> | 10 | #include <qlabel.h> |
6 | #include <qdir.h> | 11 | #include <qdir.h> |
7 | 12 | ||
8 | #define DEFAULT_ROWS 2 | 13 | #define DEFAULT_ROWS 2 |
9 | #define DEFAULT_COLS 12 | 14 | #define DEFAULT_COLS 12 |
10 | 15 | ||
11 | /* FunctionKeyboard {{{1 */ | 16 | /* FunctionKeyboard {{{1 */ |
12 | 17 | ||
13 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : | 18 | FunctionKeyboard::FunctionKeyboard(QWidget *parent) : |
14 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), | 19 | QFrame(parent), numRows(DEFAULT_ROWS), numCols(DEFAULT_COLS), |
15 | pressedRow(0), pressedCol(0) { | 20 | pressedRow(0), pressedCol(0) { |
16 | 21 | ||
17 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); | 22 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); |
18 | 23 | ||
19 | /* | 24 | /* |
20 | * all the saving/loading is now done in a profile. downside is that you cant modify | 25 | * all the saving/loading is now done in a profile. downside is that you cant modify |
21 | * the keyboard for all profiles, but must do it on a profile-basis | 26 | * the keyboard for all profiles, but must do it on a profile-basis |
22 | * | 27 | * |
23 | 28 | ||
24 | Config conf("opie-console-keys"); | 29 | Config conf("opie-console-keys"); |
25 | conf.setGroup("keys"); | 30 | conf.setGroup("keys"); |
26 | for (uint r = 0; r < numRows; r++) | 31 | for (uint r = 0; r < numRows; r++) |
27 | for (uint c = 0; c < numCols; c++) { | 32 | for (uint c = 0; c < numCols; c++) { |
28 | 33 | ||
29 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); | 34 | QString handle = "r" + QString::number(r) + "c" + QString::number(c); |
30 | QStringList value_list = conf.readListEntry( handle, '|'); | 35 | QStringList value_list = conf.readListEntry( handle, '|'); |
31 | 36 | ||
32 | if (value_list.isEmpty()) continue; | 37 | if (value_list.isEmpty()) continue; |
33 | 38 | ||
34 | keys.insert( | 39 | keys.insert( |
35 | 40 | ||
36 | handle, | 41 | handle, |
37 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) | 42 | FKey (value_list[0], value_list[1], value_list[2].toUShort(), value_list[3].toUShort()) |
38 | ); | 43 | ); |
39 | } | 44 | } |
40 | //qWarning("loaded %d keys", keys.count()); | 45 | //owarn << "loaded " << keys.count() << " keys" << oendl; |
41 | */ | 46 | */ |
42 | if (keys.isEmpty()) loadDefaults(); | 47 | if (keys.isEmpty()) loadDefaults(); |
43 | 48 | ||
44 | 49 | ||
45 | 50 | ||
46 | } | 51 | } |
47 | 52 | ||
48 | FunctionKeyboard::~FunctionKeyboard() {} | 53 | FunctionKeyboard::~FunctionKeyboard() {} |
49 | 54 | ||
50 | void FunctionKeyboard::changeRows(int r) { | 55 | void FunctionKeyboard::changeRows(int r) { |
51 | 56 | ||
52 | numRows = r; | 57 | numRows = r; |
53 | 58 | ||
54 | // have to do this so the whole thing gets redrawn | 59 | // have to do this so the whole thing gets redrawn |
55 | hide(); show(); | 60 | hide(); show(); |
56 | } | 61 | } |
57 | void FunctionKeyboard::changeCols(int c) { | 62 | void FunctionKeyboard::changeCols(int c) { |
58 | 63 | ||
59 | numCols = c; | 64 | numCols = c; |
60 | keyWidth = (double)width()/numCols; // have to reset this thing too | 65 | keyWidth = (double)width()/numCols; // have to reset this thing too |
61 | repaint(false); | 66 | repaint(false); |
62 | } | 67 | } |
63 | void FunctionKeyboard::load (const Profile& prof) { | 68 | void FunctionKeyboard::load (const Profile& prof) { |
64 | 69 | ||
@@ -235,49 +240,49 @@ void FunctionKeyboard::loadDefaults() { | |||
235 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); | 240 | keys.insert( "r0c11", FKey ("Esc", 0, Qt::Key_Escape, 0xfff)); |
236 | 241 | ||
237 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); | 242 | keys.insert( "r1c0", FKey ("F1", 0, 4144, 0)); |
238 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); | 243 | keys.insert( "r1c1", FKey ("F2", 0, 4145, 0)); |
239 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); | 244 | keys.insert( "r1c2", FKey ("F3", 0, 4146, 0)); |
240 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); | 245 | keys.insert( "r1c3", FKey ("F4", 0, 4147, 0)); |
241 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); | 246 | keys.insert( "r1c4", FKey ("F5", 0, 4148, 0)); |
242 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); | 247 | keys.insert( "r1c5", FKey ("F6", 0, 4149, 0)); |
243 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); | 248 | keys.insert( "r1c6", FKey ("F7", 0, 4150, 0)); |
244 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); | 249 | keys.insert( "r1c7", FKey ("F8", 0, 4151, 0)); |
245 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); | 250 | keys.insert( "r1c8", FKey ("F9", 0, 4152, 0)); |
246 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); | 251 | keys.insert( "r1c9", FKey ("F10", 0, 4153, 0)); |
247 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); | 252 | keys.insert( "r1c10", FKey ("F11", 0, 4154, 0)); |
248 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); | 253 | keys.insert( "r1c11", FKey ("F12", 0, 4155, 0)); |
249 | 254 | ||
250 | 255 | ||
251 | } | 256 | } |
252 | 257 | ||
253 | /* FunctionKeyboardConfig {{{1 */ | 258 | /* FunctionKeyboardConfig {{{1 */ |
254 | 259 | ||
255 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) | 260 | FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* parent, const char* na ) |
256 | : ProfileDialogKeyWidget(name, parent, na), | 261 | : ProfileDialogKeyWidget(name, parent, na), |
257 | selectedRow(0), selectedCol(0) | 262 | selectedRow(0), selectedCol(0) |
258 | { | 263 | { |
259 | qWarning("FunctionKeyboardConfig"); | 264 | owarn << "FunctionKeyboardConfig" << oendl; |
260 | 265 | ||
261 | 266 | ||
262 | kb = new FunctionKeyboard(this); | 267 | kb = new FunctionKeyboard(this); |
263 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), | 268 | connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), |
264 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); | 269 | this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool))); |
265 | 270 | ||
266 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); | 271 | QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this); |
267 | QLabel *l = new QLabel("Rows", dimentions); | 272 | QLabel *l = new QLabel("Rows", dimentions); |
268 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); | 273 | m_rowBox = new QSpinBox(1, 15, 1, dimentions); |
269 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); | 274 | connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int))); |
270 | l = new QLabel("Columns", dimentions); | 275 | l = new QLabel("Columns", dimentions); |
271 | m_colBox = new QSpinBox(1, 15, 1, dimentions); | 276 | m_colBox = new QSpinBox(1, 15, 1, dimentions); |
272 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); | 277 | connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int))); |
273 | 278 | ||
274 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); | 279 | QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this); |
275 | l = new QLabel("Label", editKey); | 280 | l = new QLabel("Label", editKey); |
276 | m_labels = new QComboBox(true, editKey); | 281 | m_labels = new QComboBox(true, editKey); |
277 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); | 282 | m_labels->setInsertionPolicy(QComboBox::AtCurrent); |
278 | m_labels->insertItem(""); | 283 | m_labels->insertItem(""); |
279 | 284 | ||
280 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); | 285 | QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList(); |
281 | 286 | ||
282 | for (uint i = 0; i < files.count(); i++) { | 287 | for (uint i = 0; i < files.count(); i++) { |
283 | 288 | ||
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp index a29fa8e..c102427 100644 --- a/noncore/apps/opie-console/io_bt.cpp +++ b/noncore/apps/opie-console/io_bt.cpp | |||
@@ -1,93 +1,96 @@ | |||
1 | 1 | ||
2 | #include "io_bt.h" | 2 | #include "io_bt.h" |
3 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
4 | using namespace Opie::Core; | 6 | using namespace Opie::Core; |
7 | |||
5 | IOBt::IOBt( const Profile &config ) : IOSerial( config ) { | 8 | IOBt::IOBt( const Profile &config ) : IOSerial( config ) { |
6 | m_attach = 0; | 9 | m_attach = 0; |
7 | } | 10 | } |
8 | 11 | ||
9 | 12 | ||
10 | IOBt::~IOBt() { | 13 | IOBt::~IOBt() { |
11 | if ( m_attach ) { | 14 | if ( m_attach ) { |
12 | delete m_attach; | 15 | delete m_attach; |
13 | } | 16 | } |
14 | } | 17 | } |
15 | 18 | ||
16 | 19 | ||
17 | void IOBt::close() { | 20 | void IOBt::close() { |
18 | 21 | ||
19 | IOSerial::close(); | 22 | IOSerial::close(); |
20 | // still need error handling | 23 | // still need error handling |
21 | if ( m_attach ) { | 24 | if ( m_attach ) { |
22 | delete m_attach; | 25 | delete m_attach; |
23 | m_attach = 0; | 26 | m_attach = 0; |
24 | } | 27 | } |
25 | } | 28 | } |
26 | 29 | ||
27 | bool IOBt::open() { | 30 | bool IOBt::open() { |
28 | bool ret = false; | 31 | bool ret = false; |
29 | 32 | ||
30 | // only set up bt stuff if mac address was set, otherwise use the device set | 33 | // only set up bt stuff if mac address was set, otherwise use the device set |
31 | if ( !m_mac.isEmpty() ) { | 34 | if ( !m_mac.isEmpty() ) { |
32 | 35 | ||
33 | // now it should also be checked, if there is a connection to the device with that mac allready | 36 | // now it should also be checked, if there is a connection to the device with that mac allready |
34 | // hciattach here | 37 | // hciattach here |
35 | m_attach = new OProcess(); | 38 | m_attach = new OProcess(); |
36 | *m_attach << "hciattach /dev/ttyS2 any 57600"; | 39 | *m_attach << "hciattach /dev/ttyS2 any 57600"; |
37 | 40 | ||
38 | // then start hcid, then rcfomm handling (m_mac) | 41 | // then start hcid, then rcfomm handling (m_mac) |
39 | 42 | ||
40 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), | 43 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), |
41 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 44 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
42 | 45 | ||
43 | if ( m_attach->start() ) { | 46 | if ( m_attach->start() ) { |
44 | ret = IOSerial::open(); | 47 | ret = IOSerial::open(); |
45 | } else { | 48 | } else { |
46 | qWarning("could not attach to device"); | 49 | owarn << "could not attach to device" << oendl; |
47 | delete m_attach; | 50 | delete m_attach; |
48 | m_attach = 0; | 51 | m_attach = 0; |
49 | } | 52 | } |
50 | } else { | 53 | } else { |
51 | // directly to the normal serial | 54 | // directly to the normal serial |
52 | // TODO: look first if the connection really exists. ( is set up ) | 55 | // TODO: look first if the connection really exists. ( is set up ) |
53 | 56 | ||
54 | ret =IOSerial::open(); | 57 | ret =IOSerial::open(); |
55 | } | 58 | } |
56 | return ret; | 59 | return ret; |
57 | } | 60 | } |
58 | 61 | ||
59 | void IOBt::reload( const Profile &config ) { | 62 | void IOBt::reload( const Profile &config ) { |
60 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); | 63 | m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); |
61 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); | 64 | m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); |
62 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); | 65 | m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); |
63 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); | 66 | m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); |
64 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); | 67 | m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); |
65 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); | 68 | m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); |
66 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); | 69 | m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); |
67 | } | 70 | } |
68 | 71 | ||
69 | 72 | ||
70 | QString IOBt::identifier() const { | 73 | QString IOBt::identifier() const { |
71 | return "bluetooth"; | 74 | return "bluetooth"; |
72 | } | 75 | } |
73 | 76 | ||
74 | QString IOBt::name() const { | 77 | QString IOBt::name() const { |
75 | return "BLuetooth IO Layer"; | 78 | return "BLuetooth IO Layer"; |
76 | } | 79 | } |
77 | 80 | ||
78 | void IOBt::slotExited( OProcess* proc ){ | 81 | void IOBt::slotExited( OProcess* proc ){ |
79 | close(); | 82 | close(); |
80 | delete proc; | 83 | delete proc; |
81 | } | 84 | } |
82 | 85 | ||
83 | QBitArray IOBt::supports() const { | 86 | QBitArray IOBt::supports() const { |
84 | return QBitArray( 3 ); | 87 | return QBitArray( 3 ); |
85 | } | 88 | } |
86 | 89 | ||
87 | bool IOBt::isConnected() { | 90 | bool IOBt::isConnected() { |
88 | return false; | 91 | return false; |
89 | } | 92 | } |
90 | 93 | ||
91 | void IOBt::send(const QByteArray &data) { | 94 | void IOBt::send(const QByteArray &data) { |
92 | qDebug( "Please overload me..." ); | 95 | odebug << "Please overload me..." << oendl; |
93 | } | 96 | } |
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp index 07c2b62..38542f5 100644 --- a/noncore/apps/opie-console/io_irda.cpp +++ b/noncore/apps/opie-console/io_irda.cpp | |||
@@ -1,78 +1,80 @@ | |||
1 | |||
2 | #include "io_irda.h" | 1 | #include "io_irda.h" |
3 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
4 | using namespace Opie::Core; | 5 | using namespace Opie::Core; |
6 | |||
5 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { | 7 | IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { |
6 | m_attach = 0; | 8 | m_attach = 0; |
7 | } | 9 | } |
8 | 10 | ||
9 | 11 | ||
10 | IOIrda::~IOIrda() { | 12 | IOIrda::~IOIrda() { |
11 | if ( m_attach ) { | 13 | if ( m_attach ) { |
12 | delete m_attach; | 14 | delete m_attach; |
13 | } | 15 | } |
14 | } | 16 | } |
15 | 17 | ||
16 | 18 | ||
17 | void IOIrda::close() { | 19 | void IOIrda::close() { |
18 | 20 | ||
19 | IOSerial::close(); | 21 | IOSerial::close(); |
20 | // still need error handling | 22 | // still need error handling |
21 | delete m_attach; | 23 | delete m_attach; |
22 | } | 24 | } |
23 | 25 | ||
24 | bool IOIrda::open() { | 26 | bool IOIrda::open() { |
25 | bool ret; | 27 | bool ret; |
26 | 28 | ||
27 | // irdaattach here | 29 | // irdaattach here |
28 | m_attach = new OProcess(); | 30 | m_attach = new OProcess(); |
29 | *m_attach << "irattach /dev/ttyS2 -s"; | 31 | *m_attach << "irattach /dev/ttyS2 -s"; |
30 | 32 | ||
31 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), | 33 | connect( m_attach, SIGNAL( processExited(Opie::Core::OProcess*) ), |
32 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); | 34 | this, SLOT( slotExited(Opie::Core::OProcess*) ) ); |
33 | 35 | ||
34 | if ( m_attach->start() ) { | 36 | if ( m_attach->start() ) { |
35 | ret= IOSerial::open(); | 37 | ret= IOSerial::open(); |
36 | } else { | 38 | } else { |
37 | // emit error!!! | 39 | // emit error!!! |
38 | qWarning("could not attach to device"); | 40 | owarn << "could not attach to device" << oendl; |
39 | delete m_attach; | 41 | delete m_attach; |
40 | m_attach = 0l; | 42 | m_attach = 0l; |
41 | } | 43 | } |
42 | return ret; | 44 | return ret; |
43 | } | 45 | } |
44 | 46 | ||
45 | void IOIrda::reload( const Profile &config ) { | 47 | void IOIrda::reload( const Profile &config ) { |
46 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); | 48 | m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); |
47 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); | 49 | m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); |
48 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); | 50 | m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); |
49 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); | 51 | m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); |
50 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); | 52 | m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); |
51 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); | 53 | m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); |
52 | } | 54 | } |
53 | 55 | ||
54 | 56 | ||
55 | QString IOIrda::identifier() const { | 57 | QString IOIrda::identifier() const { |
56 | return "irda"; | 58 | return "irda"; |
57 | } | 59 | } |
58 | 60 | ||
59 | QString IOIrda::name() const { | 61 | QString IOIrda::name() const { |
60 | return "Irda IO Layer"; | 62 | return "Irda IO Layer"; |
61 | } | 63 | } |
62 | 64 | ||
63 | void IOIrda::slotExited(OProcess* proc ){ | 65 | void IOIrda::slotExited(OProcess* proc ){ |
64 | close(); | 66 | close(); |
65 | delete proc; | 67 | delete proc; |
66 | } | 68 | } |
67 | 69 | ||
68 | QBitArray IOIrda::supports()const { | 70 | QBitArray IOIrda::supports()const { |
69 | return QBitArray( 3 ); | 71 | return QBitArray( 3 ); |
70 | } | 72 | } |
71 | 73 | ||
72 | bool IOIrda::isConnected() { | 74 | bool IOIrda::isConnected() { |
73 | return false; | 75 | return false; |
74 | } | 76 | } |
75 | 77 | ||
76 | void IOIrda::send(const QByteArray &data) { | 78 | void IOIrda::send(const QByteArray &data) { |
77 | qDebug( "Please overload me..." ); | 79 | odebug << "Please overload me..." << oendl; |
78 | } | 80 | } |
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index b74d076..c499dfe 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp | |||
@@ -1,39 +1,39 @@ | |||
1 | 1 | ||
2 | #include "io_modem.h" | 2 | #include "io_modem.h" |
3 | |||
4 | #include "dialer.h" | 3 | #include "dialer.h" |
5 | 4 | ||
5 | /* OPIE */ | ||
6 | #include <opie2/odebug.h> | ||
6 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
7 | using namespace Opie::Core; | 8 | |
8 | IOModem::IOModem( const Profile &profile ) | 9 | IOModem::IOModem( const Profile &profile ) |
9 | : IOSerial( profile ) { | 10 | : IOSerial( profile ) { |
10 | m_profile = profile; | 11 | m_profile = profile; |
11 | } | 12 | } |
12 | 13 | ||
13 | 14 | ||
14 | IOModem::~IOModem() { | 15 | IOModem::~IOModem() { |
15 | |||
16 | } | 16 | } |
17 | 17 | ||
18 | 18 | ||
19 | void IOModem::close() { | 19 | void IOModem::close() { |
20 | // Hangup, discarding result | 20 | // Hangup, discarding result |
21 | //int fd = rawIO(); | 21 | //int fd = rawIO(); |
22 | internDetach(); | 22 | internDetach(); |
23 | Dialer d(m_profile, m_fd); | 23 | Dialer d(m_profile, m_fd); |
24 | d.setHangupOnly(); | 24 | d.setHangupOnly(); |
25 | //d.exec(); | 25 | //d.exec(); |
26 | internAttach(); | 26 | internAttach(); |
27 | //closeRawIO(fd); | 27 | //closeRawIO(fd); |
28 | 28 | ||
29 | IOSerial::close(); | 29 | IOSerial::close(); |
30 | } | 30 | } |
31 | 31 | ||
32 | bool IOModem::open() { | 32 | bool IOModem::open() { |
33 | bool ret = IOSerial::open(); | 33 | bool ret = IOSerial::open(); |
34 | if(!ret) return false; | 34 | if(!ret) return false; |
35 | 35 | ||
36 | //int fd = rawIO(); | 36 | //int fd = rawIO(); |
37 | internDetach(); | 37 | internDetach(); |
38 | Dialer d(m_profile, m_fd); | 38 | Dialer d(m_profile, m_fd); |
39 | 39 | ||
@@ -83,26 +83,26 @@ void IOModem::reload( const Profile &config ) { | |||
83 | 83 | ||
84 | QString IOModem::identifier() const { | 84 | QString IOModem::identifier() const { |
85 | return "modem"; | 85 | return "modem"; |
86 | } | 86 | } |
87 | 87 | ||
88 | QString IOModem::name() const { | 88 | QString IOModem::name() const { |
89 | return "Modem IO Layer"; | 89 | return "Modem IO Layer"; |
90 | } | 90 | } |
91 | 91 | ||
92 | void IOModem::slotExited(OProcess* proc ){ | 92 | void IOModem::slotExited(OProcess* proc ){ |
93 | close(); | 93 | close(); |
94 | /* delete it afterwards */ | 94 | /* delete it afterwards */ |
95 | delete proc; | 95 | delete proc; |
96 | } | 96 | } |
97 | 97 | ||
98 | QBitArray IOModem::supports()const { | 98 | QBitArray IOModem::supports()const { |
99 | return QBitArray( 3 ); | 99 | return QBitArray( 3 ); |
100 | } | 100 | } |
101 | 101 | ||
102 | bool IOModem::isConnected() { | 102 | bool IOModem::isConnected() { |
103 | return false; | 103 | return false; |
104 | } | 104 | } |
105 | 105 | ||
106 | void IOModem::send(const QByteArray &data) { | 106 | void IOModem::send(const QByteArray &data) { |
107 | qDebug( "Please overload me..." ); | 107 | odebug << "Please overload me..." << oendl; |
108 | } | 108 | } |
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index dfb2f83..1bd4338 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp | |||
@@ -70,41 +70,41 @@ FixIt::FixIt() { | |||
70 | } | 70 | } |
71 | FixIt::~FixIt() { | 71 | FixIt::~FixIt() { |
72 | } | 72 | } |
73 | /* | 73 | /* |
74 | * the retail Zaurus is broken in many ways | 74 | * the retail Zaurus is broken in many ways |
75 | * one is that pppd is listening on our port... | 75 | * one is that pppd is listening on our port... |
76 | * we've to stop it from that and then do kill(SIGHUP,1); | 76 | * we've to stop it from that and then do kill(SIGHUP,1); |
77 | */ | 77 | */ |
78 | void FixIt::fixIt() { | 78 | void FixIt::fixIt() { |
79 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | 79 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); |
80 | QFile file( "/etc/inittab" ); | 80 | QFile file( "/etc/inittab" ); |
81 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | 81 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { |
82 | file.writeBlock(m_file,strlen(m_file) ); | 82 | file.writeBlock(m_file,strlen(m_file) ); |
83 | } | 83 | } |
84 | file.close(); | 84 | file.close(); |
85 | ::kill( SIGHUP, 1 ); | 85 | ::kill( SIGHUP, 1 ); |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | int main(int argc, char **argv) { | 89 | int main(int argc, char **argv) { |
90 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; | 90 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; |
91 | QPEApplication app( argc, argv ); | 91 | QPEApplication app( argc, argv ); |
92 | 92 | ||
93 | #ifdef FSCKED_DISTRIBUTION | 93 | #ifdef FSCKED_DISTRIBUTION |
94 | qWarning("fscked"); | 94 | owarn << "fscked" << oendl; |
95 | FixIt it; | 95 | FixIt it; |
96 | it.fixIt(); | 96 | it.fixIt(); |
97 | #endif | 97 | #endif |
98 | 98 | ||
99 | MainWindow mw; | 99 | MainWindow mw; |
100 | mw.setCaption(QObject::tr("Opie Console") ); | 100 | mw.setCaption(QObject::tr("Opie Console") ); |
101 | app.showMainWidget( &mw ); | 101 | app.showMainWidget( &mw ); |
102 | 102 | ||
103 | int ap = app.exec(); | 103 | int ap = app.exec(); |
104 | 104 | ||
105 | #ifdef FSCKED_DISTRIBUTION | 105 | #ifdef FSCKED_DISTRIBUTION |
106 | /* should add a signal handler too */ | 106 | /* should add a signal handler too */ |
107 | it.breakIt(); | 107 | it.breakIt(); |
108 | #endif | 108 | #endif |
109 | return ap; | 109 | return ap; |
110 | } | 110 | } |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 06a8f7d..b403b4d 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,51 +1,54 @@ | |||
1 | #include <assert.h> | ||
2 | |||
3 | #include <qaction.h> | ||
4 | #include <qmenubar.h> | ||
5 | #include <qtoolbar.h> | ||
6 | #include <qmessagebox.h> | ||
7 | #include <qwhatsthis.h> | ||
8 | #include <qfileinfo.h> | ||
9 | |||
10 | #include <qpe/filemanager.h> | ||
11 | |||
12 | #include <opie2/ofiledialog.h> | ||
13 | |||
14 | #include "TEmulation.h" | 1 | #include "TEmulation.h" |
15 | #include "profileeditordialog.h" | 2 | #include "profileeditordialog.h" |
16 | #include "configdialog.h" | 3 | #include "configdialog.h" |
17 | #include "default.h" | 4 | #include "default.h" |
18 | #include "profilemanager.h" | 5 | #include "profilemanager.h" |
19 | #include "mainwindow.h" | 6 | #include "mainwindow.h" |
20 | #include "tabwidget.h" | 7 | #include "tabwidget.h" |
21 | #include "transferdialog.h" | 8 | #include "transferdialog.h" |
22 | #include "function_keyboard.h" | 9 | #include "function_keyboard.h" |
23 | #include "emulation_handler.h" | 10 | #include "emulation_handler.h" |
24 | #include "script.h" | 11 | #include "script.h" |
25 | 12 | ||
26 | 13 | /* OPIE */ | |
14 | #include <opie2/odebug.h> | ||
15 | #include <opie2/ofiledialog.h> | ||
16 | #include <qpe/filemanager.h> | ||
17 | using namespace Opie::Core; | ||
27 | using namespace Opie::Ui; | 18 | using namespace Opie::Ui; |
19 | |||
20 | /* QT */ | ||
21 | #include <qaction.h> | ||
22 | #include <qmenubar.h> | ||
23 | #include <qtoolbar.h> | ||
24 | #include <qmessagebox.h> | ||
25 | #include <qwhatsthis.h> | ||
26 | #include <qfileinfo.h> | ||
27 | |||
28 | /* STD */ | ||
29 | #include <assert.h> | ||
30 | |||
28 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 31 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
29 | KeyTrans::loadAll(); | 32 | KeyTrans::loadAll(); |
30 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 33 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
31 | KeyTrans* s = KeyTrans::find(i ); | 34 | KeyTrans* s = KeyTrans::find(i ); |
32 | assert( s ); | 35 | assert( s ); |
33 | } | 36 | } |
34 | m_factory = new MetaFactory(); | 37 | m_factory = new MetaFactory(); |
35 | Default def(m_factory); | 38 | Default def(m_factory); |
36 | m_sessions.setAutoDelete( TRUE ); | 39 | m_sessions.setAutoDelete( TRUE ); |
37 | m_curSession = 0; | 40 | m_curSession = 0; |
38 | m_manager = new ProfileManager( m_factory ); | 41 | m_manager = new ProfileManager( m_factory ); |
39 | m_manager->load(); | 42 | m_manager->load(); |
40 | m_scriptsData.setAutoDelete(TRUE); | 43 | m_scriptsData.setAutoDelete(TRUE); |
41 | 44 | ||
42 | initUI(); | 45 | initUI(); |
43 | populateProfiles(); | 46 | populateProfiles(); |
44 | populateScripts(); | 47 | populateScripts(); |
45 | } | 48 | } |
46 | 49 | ||
47 | void MainWindow::initUI() { | 50 | void MainWindow::initUI() { |
48 | 51 | ||
49 | setToolBarsMovable( FALSE ); | 52 | setToolBarsMovable( FALSE ); |
50 | 53 | ||
51 | /* tool bar for the menu */ | 54 | /* tool bar for the menu */ |
@@ -425,55 +428,55 @@ void MainWindow::slotQuickLaunch() { | |||
425 | 428 | ||
426 | void MainWindow::slotConfigure() { | 429 | void MainWindow::slotConfigure() { |
427 | ConfigDialog conf( manager()->all(), factory() ); | 430 | ConfigDialog conf( manager()->all(), factory() ); |
428 | 431 | ||
429 | int ret = QPEApplication::execDialog( &conf ); | 432 | int ret = QPEApplication::execDialog( &conf ); |
430 | 433 | ||
431 | if ( QDialog::Accepted == ret ) { | 434 | if ( QDialog::Accepted == ret ) { |
432 | manager()->setProfiles( conf.list() ); | 435 | manager()->setProfiles( conf.list() ); |
433 | manager()->save(); | 436 | manager()->save(); |
434 | populateProfiles(); | 437 | populateProfiles(); |
435 | } | 438 | } |
436 | } | 439 | } |
437 | /* | 440 | /* |
438 | * we will remove | 441 | * we will remove |
439 | * this window from the tabwidget | 442 | * this window from the tabwidget |
440 | * remove it from the list | 443 | * remove it from the list |
441 | * delete it | 444 | * delete it |
442 | * and set the currentSession() | 445 | * and set the currentSession() |
443 | */ | 446 | */ |
444 | void MainWindow::slotClose() { | 447 | void MainWindow::slotClose() { |
445 | if (!currentSession() ) | 448 | if (!currentSession() ) |
446 | return; | 449 | return; |
447 | 450 | ||
448 | Session* ses = currentSession(); | 451 | Session* ses = currentSession(); |
449 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 452 | owarn << "removing! currentSession " << currentSession()->name().latin1() << "" << oendl; |
450 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 453 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
451 | m_curSession = NULL; | 454 | m_curSession = NULL; |
452 | tabWidget()->remove( /*currentSession()*/ses ); | 455 | tabWidget()->remove( /*currentSession()*/ses ); |
453 | /*it's autodelete */ | 456 | /*it's autodelete */ |
454 | m_sessions.remove( ses ); | 457 | m_sessions.remove( ses ); |
455 | qWarning("after remove!!"); | 458 | owarn << "after remove!!" << oendl; |
456 | 459 | ||
457 | if (!currentSession() ) { | 460 | if (!currentSession() ) { |
458 | m_connect->setEnabled( false ); | 461 | m_connect->setEnabled( false ); |
459 | m_disconnect->setEnabled( false ); | 462 | m_disconnect->setEnabled( false ); |
460 | m_terminate->setEnabled( false ); | 463 | m_terminate->setEnabled( false ); |
461 | m_transfer->setEnabled( false ); | 464 | m_transfer->setEnabled( false ); |
462 | m_recordScript->setEnabled( false ); | 465 | m_recordScript->setEnabled( false ); |
463 | m_saveScript->setEnabled( false ); | 466 | m_saveScript->setEnabled( false ); |
464 | m_scripts->setItemEnabled(m_runScript_id, false); | 467 | m_scripts->setItemEnabled(m_runScript_id, false); |
465 | m_fullscreen->setEnabled( false ); | 468 | m_fullscreen->setEnabled( false ); |
466 | m_wrap->setEnabled( false ); | 469 | m_wrap->setEnabled( false ); |
467 | m_closewindow->setEnabled( false ); | 470 | m_closewindow->setEnabled( false ); |
468 | } | 471 | } |
469 | 472 | ||
470 | m_kb->loadDefaults(); | 473 | m_kb->loadDefaults(); |
471 | } | 474 | } |
472 | 475 | ||
473 | /* | 476 | /* |
474 | * We will get the name | 477 | * We will get the name |
475 | * Then the profile | 478 | * Then the profile |
476 | * and then we will make a profile | 479 | * and then we will make a profile |
477 | */ | 480 | */ |
478 | void MainWindow::slotProfile( int id) { | 481 | void MainWindow::slotProfile( int id) { |
479 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 482 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
@@ -549,58 +552,58 @@ void MainWindow::slotTransfer() | |||
549 | } | 552 | } |
550 | } | 553 | } |
551 | 554 | ||
552 | 555 | ||
553 | void MainWindow::slotOpenKeb(bool state) { | 556 | void MainWindow::slotOpenKeb(bool state) { |
554 | 557 | ||
555 | if (state) m_keyBar->show(); | 558 | if (state) m_keyBar->show(); |
556 | else m_keyBar->hide(); | 559 | else m_keyBar->hide(); |
557 | 560 | ||
558 | } | 561 | } |
559 | 562 | ||
560 | 563 | ||
561 | void MainWindow::slotOpenButtons( bool state ) { | 564 | void MainWindow::slotOpenButtons( bool state ) { |
562 | 565 | ||
563 | if ( state ) { | 566 | if ( state ) { |
564 | m_buttonBar->show(); | 567 | m_buttonBar->show(); |
565 | } else { | 568 | } else { |
566 | m_buttonBar->hide(); | 569 | m_buttonBar->hide(); |
567 | } | 570 | } |
568 | } | 571 | } |
569 | 572 | ||
570 | 573 | ||
571 | 574 | ||
572 | void MainWindow::slotSessionChanged( Session* ses ) { | 575 | void MainWindow::slotSessionChanged( Session* ses ) { |
573 | qWarning("changed!"); | 576 | owarn << "changed!" << oendl; |
574 | 577 | ||
575 | if(m_curSession) | 578 | if(m_curSession) |
576 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 579 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
577 | if(ses) | 580 | if(ses) |
578 | if(ses->transferDialog()) ses->transferDialog()->show(); | 581 | if(ses->transferDialog()) ses->transferDialog()->show(); |
579 | 582 | ||
580 | if ( ses ) { | 583 | if ( ses ) { |
581 | m_curSession = ses; | 584 | m_curSession = ses; |
582 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 585 | odebug << QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) << oendl; |
583 | if ( m_curSession->layer()->isConnected() ) { | 586 | if ( m_curSession->layer()->isConnected() ) { |
584 | m_connect->setEnabled( false ); | 587 | m_connect->setEnabled( false ); |
585 | m_disconnect->setEnabled( true ); | 588 | m_disconnect->setEnabled( true ); |
586 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 589 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
587 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 590 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
588 | m_scripts->setItemEnabled(m_runScript_id, true); | 591 | m_scripts->setItemEnabled(m_runScript_id, true); |
589 | } else { | 592 | } else { |
590 | m_connect->setEnabled( true ); | 593 | m_connect->setEnabled( true ); |
591 | m_disconnect->setEnabled( false ); | 594 | m_disconnect->setEnabled( false ); |
592 | m_recordScript->setEnabled( false ); | 595 | m_recordScript->setEnabled( false ); |
593 | m_saveScript->setEnabled( false ); | 596 | m_saveScript->setEnabled( false ); |
594 | m_scripts->setItemEnabled(m_runScript_id, false); | 597 | m_scripts->setItemEnabled(m_runScript_id, false); |
595 | } | 598 | } |
596 | 599 | ||
597 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 600 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
598 | m_transfer->setEnabled( false ); | 601 | m_transfer->setEnabled( false ); |
599 | } else { | 602 | } else { |
600 | m_transfer->setEnabled( true ); | 603 | m_transfer->setEnabled( true ); |
601 | } | 604 | } |
602 | 605 | ||
603 | QWidget *w = m_curSession->widget(); | 606 | QWidget *w = m_curSession->widget(); |
604 | if(w) w->setFocus(); | 607 | if(w) w->setFocus(); |
605 | 608 | ||
606 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 609 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index 3466e3a..9fdaf73 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,36 +1,39 @@ | |||
1 | #include "modemconfigwidget.h" | ||
2 | #include "dialdialog.h" | ||
1 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <opie2/odebug.h> | ||
2 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | using namespace Opie::Core; | ||
3 | 8 | ||
9 | /* QT */ | ||
4 | #include <qlabel.h> | 10 | #include <qlabel.h> |
5 | #include <qlayout.h> | 11 | #include <qlayout.h> |
6 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
7 | #include <qpushbutton.h> | 13 | #include <qpushbutton.h> |
8 | #include <qhbox.h> | 14 | #include <qhbox.h> |
9 | 15 | ||
10 | #include "modemconfigwidget.h" | ||
11 | #include "dialdialog.h" | ||
12 | |||
13 | namespace { | 16 | namespace { |
14 | void setCurrent( const QString& str, QComboBox* bo ) { | 17 | void setCurrent( const QString& str, QComboBox* bo ) { |
15 | uint b = bo->count(); | 18 | uint b = bo->count(); |
16 | for (int i = 0; i < bo->count(); i++ ) { | 19 | for (int i = 0; i < bo->count(); i++ ) { |
17 | if ( bo->text(i) == str ) { | 20 | if ( bo->text(i) == str ) { |
18 | bo->setCurrentItem( i ); | 21 | bo->setCurrentItem( i ); |
19 | return; | 22 | return; |
20 | } | 23 | } |
21 | } | 24 | } |
22 | bo->insertItem( str ); | 25 | bo->insertItem( str ); |
23 | bo->setCurrentItem( b ); | 26 | bo->setCurrentItem( b ); |
24 | } | 27 | } |
25 | } | 28 | } |
26 | 29 | ||
27 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | 30 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
28 | const char* na ) | 31 | const char* na ) |
29 | : ProfileDialogConnectionWidget( name, parent, na ) { | 32 | : ProfileDialogConnectionWidget( name, parent, na ) { |
30 | 33 | ||
31 | m_lay = new QVBoxLayout( this ); | 34 | m_lay = new QVBoxLayout( this ); |
32 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); | 35 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
33 | m_deviceCmb = new QComboBox(this ); | 36 | m_deviceCmb = new QComboBox(this ); |
34 | m_deviceCmb->setEditable( TRUE ); | 37 | m_deviceCmb->setEditable( TRUE ); |
35 | 38 | ||
36 | QLabel* telLabel = new QLabel( this ); | 39 | QLabel* telLabel = new QLabel( this ); |
@@ -114,49 +117,49 @@ void ModemConfigWidget::load( const Profile& prof ) { | |||
114 | } | 117 | } |
115 | 118 | ||
116 | 119 | ||
117 | if ( dbits == 5) { | 120 | if ( dbits == 5) { |
118 | m_base->setData( IOLayerBase::Data_Five ); | 121 | m_base->setData( IOLayerBase::Data_Five ); |
119 | } else if (rad_flow == 6) { | 122 | } else if (rad_flow == 6) { |
120 | m_base->setData( IOLayerBase::Data_Six ); | 123 | m_base->setData( IOLayerBase::Data_Six ); |
121 | } else if (rad_flow == 7) { | 124 | } else if (rad_flow == 7) { |
122 | m_base->setData( IOLayerBase::Data_Seven ); | 125 | m_base->setData( IOLayerBase::Data_Seven ); |
123 | } else { | 126 | } else { |
124 | m_base->setData( IOLayerBase::Data_Eight ); | 127 | m_base->setData( IOLayerBase::Data_Eight ); |
125 | } | 128 | } |
126 | 129 | ||
127 | if ( sbits == 2) { | 130 | if ( sbits == 2) { |
128 | m_base->setStop( IOLayerBase::Stop_Two ); | 131 | m_base->setStop( IOLayerBase::Stop_Two ); |
129 | } else if ( sbits == 15 ) { | 132 | } else if ( sbits == 15 ) { |
130 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); | 133 | m_base->setStop( IOLayerBase::Stop_OnePointFive ); |
131 | } else { | 134 | } else { |
132 | m_base->setStop( IOLayerBase::Stop_One ); | 135 | m_base->setStop( IOLayerBase::Stop_One ); |
133 | } | 136 | } |
134 | 137 | ||
135 | 138 | ||
136 | atConf->readConfig( prof ); | 139 | atConf->readConfig( prof ); |
137 | if ( prof.readEntry( "Device" ).isEmpty() ) { | 140 | if ( prof.readEntry( "Device" ).isEmpty() ) { |
138 | qWarning("device empty!"); | 141 | owarn << "device empty!" << oendl; |
139 | return; | 142 | return; |
140 | } | 143 | } |
141 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); | 144 | setCurrent( prof.readEntry( "Device" ), m_deviceCmb ); |
142 | 145 | ||
143 | 146 | ||
144 | } | 147 | } |
145 | 148 | ||
146 | /* | 149 | /* |
147 | * save speed, | 150 | * save speed, |
148 | * flow, | 151 | * flow, |
149 | * parity | 152 | * parity |
150 | */ | 153 | */ |
151 | void ModemConfigWidget::save( Profile& prof ) { | 154 | void ModemConfigWidget::save( Profile& prof ) { |
152 | int flow, parity, speed, data, stop; | 155 | int flow, parity, speed, data, stop; |
153 | flow = parity = speed = data = stop = 0; | 156 | flow = parity = speed = data = stop = 0; |
154 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); | 157 | prof.writeEntry( "Device", m_deviceCmb->currentText() ); |
155 | 158 | ||
156 | 159 | ||
157 | switch( m_base->flow() ) { | 160 | switch( m_base->flow() ) { |
158 | case IOLayerBase::None: | 161 | case IOLayerBase::None: |
159 | flow = 0; | 162 | flow = 0; |
160 | break; | 163 | break; |
161 | case IOLayerBase::Software: | 164 | case IOLayerBase::Software: |
162 | flow = 2; | 165 | flow = 2; |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 7a15828..f7e33e9 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -1,28 +1,26 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | TMAKE_CXXFLAGS += -DHAVE_OPENPTY | ||
3 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
4 | #CONFIG = qt | ||
5 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
6 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ | 4 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ |
7 | file_layer.h filetransfer.h \ | 5 | file_layer.h filetransfer.h \ |
8 | metafactory.h \ | 6 | metafactory.h \ |
9 | session.h \ | 7 | session.h \ |
10 | mainwindow.h \ | 8 | mainwindow.h \ |
11 | profile.h \ | 9 | profile.h \ |
12 | profileconfig.h \ | 10 | profileconfig.h \ |
13 | profilemanager.h \ | 11 | profilemanager.h \ |
14 | tabwidget.h \ | 12 | tabwidget.h \ |
15 | configdialog.h \ | 13 | configdialog.h \ |
16 | keytrans.h \ | 14 | keytrans.h \ |
17 | transferdialog.h \ | 15 | transferdialog.h \ |
18 | profiledialogwidget.h \ | 16 | profiledialogwidget.h \ |
19 | profileeditordialog.h \ | 17 | profileeditordialog.h \ |
20 | default.h \ | 18 | default.h \ |
21 | iolayerbase.h \ | 19 | iolayerbase.h \ |
22 | serialconfigwidget.h irdaconfigwidget.h \ | 20 | serialconfigwidget.h irdaconfigwidget.h \ |
23 | btconfigwidget.h modemconfigwidget.h \ | 21 | btconfigwidget.h modemconfigwidget.h \ |
24 | atconfigdialog.h dialdialog.h \ | 22 | atconfigdialog.h dialdialog.h \ |
25 | procctl.h \ | 23 | procctl.h \ |
26 | function_keyboard.h \ | 24 | function_keyboard.h \ |
27 | receive_layer.h filereceive.h \ | 25 | receive_layer.h filereceive.h \ |
28 | script.h \ | 26 | script.h \ |
@@ -49,28 +47,28 @@ SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ | |||
49 | profiledialogwidget.cpp \ | 47 | profiledialogwidget.cpp \ |
50 | profileeditordialog.cpp \ | 48 | profileeditordialog.cpp \ |
51 | iolayerbase.cpp \ | 49 | iolayerbase.cpp \ |
52 | serialconfigwidget.cpp irdaconfigwidget.cpp \ | 50 | serialconfigwidget.cpp irdaconfigwidget.cpp \ |
53 | btconfigwidget.cpp modemconfigwidget.cpp \ | 51 | btconfigwidget.cpp modemconfigwidget.cpp \ |
54 | atconfigdialog.cpp dialdialog.cpp \ | 52 | atconfigdialog.cpp dialdialog.cpp \ |
55 | default.cpp procctl.cpp \ | 53 | default.cpp procctl.cpp \ |
56 | function_keyboard.cpp \ | 54 | function_keyboard.cpp \ |
57 | receive_layer.cpp filereceive.cpp \ | 55 | receive_layer.cpp filereceive.cpp \ |
58 | script.cpp \ | 56 | script.cpp \ |
59 | dialer.cpp \ | 57 | dialer.cpp \ |
60 | terminalwidget.cpp \ | 58 | terminalwidget.cpp \ |
61 | emulation_handler.cpp TEHistory.cpp \ | 59 | emulation_handler.cpp TEHistory.cpp \ |
62 | TEScreen.cpp TEWidget.cpp \ | 60 | TEScreen.cpp TEWidget.cpp \ |
63 | TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ | 61 | TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ |
64 | consoleconfigwidget.cpp | 62 | consoleconfigwidget.cpp |
65 | 63 | ||
66 | 64 | ||
67 | INTERFACES = configurebase.ui editbase.ui | 65 | INTERFACES = configurebase.ui editbase.ui |
68 | INCLUDEPATH += $(OPIEDIR)/include | 66 | INCLUDEPATH += $(OPIEDIR)/include |
69 | DEPENDPATH += $(OPIEDIR)/include | 67 | DEPENDPATH += $(OPIEDIR)/include |
70 | LIBS += -lqpe -lopiecore2 -lopieui2 -lutil | 68 | LIBS += -lqpe -lopiecore2 -lopieui2 -lutil |
71 | TARGET = opie-console | 69 | TARGET = opie-console |
72 | 70 | ||
73 | 71 | DEFINES += HAVE_OPENPTY | |
74 | 72 | ||
75 | 73 | ||
76 | include ( $(OPIEDIR)/include.pro ) | 74 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index fbc5306..f505998 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp | |||
@@ -20,67 +20,67 @@ void SzTransfer::sendFile(const QFile& file) { | |||
20 | sendFile(file.name()); | 20 | sendFile(file.name()); |
21 | } | 21 | } |
22 | 22 | ||
23 | void SzTransfer::sendFile(const QString& file) { | 23 | void SzTransfer::sendFile(const QString& file) { |
24 | 24 | ||
25 | //setcbreak(2); /* raw no echo */ | 25 | //setcbreak(2); /* raw no echo */ |
26 | 26 | ||
27 | proc = new OProcess; | 27 | proc = new OProcess; |
28 | *proc << "sz"; | 28 | *proc << "sz"; |
29 | *proc << "-v" << "-v" << "-b" << file; | 29 | *proc << "-v" << "-v" << "-b" << file; |
30 | connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)), | 30 | connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)), |
31 | this, SLOT(sent())); | 31 | this, SLOT(sent())); |
32 | connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), | 32 | connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), |
33 | this, SLOT(SzReceivedStdout(Opie::Core::OProcess*,char*,int))); | 33 | this, SLOT(SzReceivedStdout(Opie::Core::OProcess*,char*,int))); |
34 | connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), | 34 | connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), |
35 | this, SLOT(SzReceivedStderr(Opie::Core::OProcess*,char*,int))); | 35 | this, SLOT(SzReceivedStderr(Opie::Core::OProcess*,char*,int))); |
36 | connect(layer(), SIGNAL(received(const QByteArray&)), | 36 | connect(layer(), SIGNAL(received(const QByteArray&)), |
37 | this, SLOT(receivedStdin(const QByteArray&))); | 37 | this, SLOT(receivedStdin(const QByteArray&))); |
38 | proc->start(OProcess::NotifyOnExit, OProcess::All); | 38 | proc->start(OProcess::NotifyOnExit, OProcess::All); |
39 | 39 | ||
40 | } | 40 | } |
41 | 41 | ||
42 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { | 42 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { |
43 | 43 | ||
44 | qWarning("recieved from sz on stdout %d bytes", buflen); | 44 | owarn << "recieved from sz on stdout " << buflen << " bytes" << oendl; |
45 | 45 | ||
46 | QByteArray data(buflen); | 46 | QByteArray data(buflen); |
47 | data.fill(*buffer, buflen); | 47 | data.fill(*buffer, buflen); |
48 | for (uint i = 0; i < data.count(); i++ ) { | 48 | for (uint i = 0; i < data.count(); i++ ) { |
49 | printf("%c", buffer[i] ); | 49 | printf("%c", buffer[i] ); |
50 | } | 50 | } |
51 | printf("\n"); | 51 | printf("\n"); |
52 | 52 | ||
53 | // send out through the io layer | 53 | // send out through the io layer |
54 | layer()->send(data); | 54 | layer()->send(data); |
55 | } | 55 | } |
56 | 56 | ||
57 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { | 57 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { |
58 | 58 | ||
59 | // parse and show data in a progress dialog/widget | 59 | // parse and show data in a progress dialog/widget |
60 | printf("stderr:\n"); | 60 | printf("stderr:\n"); |
61 | //for (int i = 0; i < length; i++) | 61 | //for (int i = 0; i < length; i++) |
62 | // printf("%c", buffer[i]); | 62 | // printf("%c", buffer[i]); |
63 | //printf("\n"); | 63 | //printf("\n"); |
64 | } | 64 | } |
65 | 65 | ||
66 | void SzTransfer::receivedStdin(const QByteArray &data) { | 66 | void SzTransfer::receivedStdin(const QByteArray &data) { |
67 | 67 | ||
68 | qWarning("recieved from io_serial %d bytes", data.size()); | 68 | owarn << "recieved from io_serial " << data.size() << " bytes" << oendl; |
69 | 69 | ||
70 | // recieved data from the io layer goes to sz | 70 | // recieved data from the io layer goes to sz |
71 | proc->writeStdin(data.data(), data.size()); | 71 | proc->writeStdin(data.data(), data.size()); |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | void SzTransfer::sent() { | 75 | void SzTransfer::sent() { |
76 | 76 | ||
77 | qWarning("sent file"); | 77 | owarn << "sent file" << oendl; |
78 | 78 | ||
79 | //setcbreak(0); /* default */ | 79 | //setcbreak(0); /* default */ |
80 | 80 | ||
81 | 81 | ||
82 | delete proc; | 82 | delete proc; |
83 | disconnect(layer(), SIGNAL(received(const QByteArray&)), | 83 | disconnect(layer(), SIGNAL(received(const QByteArray&)), |
84 | this, SLOT(receivedStdin(const QByteArray&))); | 84 | this, SLOT(receivedStdin(const QByteArray&))); |
85 | 85 | ||
86 | } | 86 | } |
diff --git a/noncore/apps/opie-console/tabwidget.cpp b/noncore/apps/opie-console/tabwidget.cpp index 6429e3c..41a91ed 100644 --- a/noncore/apps/opie-console/tabwidget.cpp +++ b/noncore/apps/opie-console/tabwidget.cpp | |||
@@ -1,39 +1,42 @@ | |||
1 | |||
2 | #include "tabwidget.h" | 1 | #include "tabwidget.h" |
3 | 2 | ||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
4 | using namespace Opie::Ui; | 6 | using namespace Opie::Ui; |
7 | |||
5 | TabWidget::TabWidget( QWidget* parent, const char* name ) | 8 | TabWidget::TabWidget( QWidget* parent, const char* name ) |
6 | : OTabWidget( parent, name ) { | 9 | : OTabWidget( parent, name ) { |
7 | connect(this, SIGNAL( currentChanged(QWidget*) ), | 10 | connect(this, SIGNAL( currentChanged(QWidget*) ), |
8 | this, SLOT( slotCurChanged(QWidget*) ) ); | 11 | this, SLOT( slotCurChanged(QWidget*) ) ); |
9 | } | 12 | } |
10 | 13 | ||
11 | TabWidget::~TabWidget() { | 14 | TabWidget::~TabWidget() { |
12 | } | 15 | } |
13 | 16 | ||
14 | void TabWidget::add( Session* ses ) { | 17 | void TabWidget::add( Session* ses ) { |
15 | qWarning("session ses " + ses->name() ); | 18 | owarn << "session ses " + ses->name() << oendl; |
16 | if ( !ses->widgetStack() ) return; | 19 | if ( !ses->widgetStack() ) return; |
17 | //reparent( ses->widgetStack(), QPoint() ); | 20 | //reparent( ses->widgetStack(), QPoint() ); |
18 | addTab( ses->widgetStack(), "console/konsole", ses->name() ); | 21 | addTab( ses->widgetStack(), "console/konsole", ses->name() ); |
19 | //addTab( ses->widgetStack(), ses->name() ); | 22 | //addTab( ses->widgetStack(), ses->name() ); |
20 | m_map.insert( ses->widgetStack(), ses ); | 23 | m_map.insert( ses->widgetStack(), ses ); |
21 | } | 24 | } |
22 | 25 | ||
23 | void TabWidget::remove( Session* ses ) { | 26 | void TabWidget::remove( Session* ses ) { |
24 | m_map.remove( ses->widgetStack() ); | 27 | m_map.remove( ses->widgetStack() ); |
25 | removePage( ses->widgetStack() ); | 28 | removePage( ses->widgetStack() ); |
26 | } | 29 | } |
27 | 30 | ||
28 | void TabWidget::slotCurChanged( QWidget* wid ) { | 31 | void TabWidget::slotCurChanged( QWidget* wid ) { |
29 | QMap<QWidget*, Session*>::Iterator it; | 32 | QMap<QWidget*, Session*>::Iterator it; |
30 | it = m_map.find( wid ); | 33 | it = m_map.find( wid ); |
31 | if ( it == m_map.end() ) { | 34 | if ( it == m_map.end() ) { |
32 | return; | 35 | return; |
33 | } | 36 | } |
34 | 37 | ||
35 | emit activated( it.data() ); | 38 | emit activated( it.data() ); |
36 | } | 39 | } |
37 | void TabWidget::setCurrent( Session* ses ) { | 40 | void TabWidget::setCurrent( Session* ses ) { |
38 | if (!ses ) | 41 | if (!ses ) |
39 | return; | 42 | return; |
diff --git a/noncore/apps/opie-console/terminalwidget.cpp b/noncore/apps/opie-console/terminalwidget.cpp index 6870487..087476b 100644 --- a/noncore/apps/opie-console/terminalwidget.cpp +++ b/noncore/apps/opie-console/terminalwidget.cpp | |||
@@ -1,34 +1,39 @@ | |||
1 | #include "terminalwidget.h" | ||
2 | |||
3 | /* OPIE */ | ||
4 | #include <opie2/odebug.h> | ||
5 | using namespace Opie::Core; | ||
6 | |||
7 | /* QT */ | ||
1 | #include <qlabel.h> | 8 | #include <qlabel.h> |
2 | #include <qcheckbox.h> | 9 | #include <qcheckbox.h> |
3 | #include <qcombobox.h> | 10 | #include <qcombobox.h> |
4 | #include <qradiobutton.h> | 11 | #include <qradiobutton.h> |
5 | #include <qhgroupbox.h> | 12 | #include <qhgroupbox.h> |
6 | #include <qhbuttongroup.h> | 13 | #include <qhbuttongroup.h> |
7 | #include <qlayout.h> | 14 | #include <qlayout.h> |
8 | 15 | ||
9 | #include "terminalwidget.h" | ||
10 | |||
11 | namespace { | 16 | namespace { |
12 | enum TermIds { | 17 | enum TermIds { |
13 | id_term_vt100 = 0, | 18 | id_term_vt100 = 0, |
14 | id_term_vt102, | 19 | id_term_vt102, |
15 | id_term_linux, | 20 | id_term_linux, |
16 | id_term_xterm | 21 | id_term_xterm |
17 | }; | 22 | }; |
18 | 23 | ||
19 | enum ColourIds { | 24 | enum ColourIds { |
20 | id_term_black, | 25 | id_term_black, |
21 | id_term_white, | 26 | id_term_white, |
22 | id_term_green, | 27 | id_term_green, |
23 | id_term_orange | 28 | id_term_orange |
24 | }; | 29 | }; |
25 | 30 | ||
26 | enum FontIds { | 31 | enum FontIds { |
27 | id_size_small, | 32 | id_size_small, |
28 | id_size_medium, | 33 | id_size_medium, |
29 | id_size_large | 34 | id_size_large |
30 | }; | 35 | }; |
31 | }; | 36 | }; |
32 | 37 | ||
33 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | 38 | TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, |
34 | const char* na ) | 39 | const char* na ) |
@@ -48,49 +53,49 @@ TerminalWidget::TerminalWidget( const QString& name, QWidget* parent, | |||
48 | m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); | 53 | m_convInbound = new QCheckBox( tr("Inbound"), m_groupConv ); |
49 | m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); | 54 | m_convOutbound = new QCheckBox( tr("Outbound"), m_groupConv ); |
50 | 55 | ||
51 | m_groupOptions = new QHGroupBox( tr("Options"), this ); | 56 | m_groupOptions = new QHGroupBox( tr("Options"), this ); |
52 | m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); | 57 | m_optionEcho = new QCheckBox( tr("Local echo"), m_groupOptions ); |
53 | m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); | 58 | m_optionWrap = new QCheckBox( tr("Line wrap"), m_groupOptions ); |
54 | 59 | ||
55 | m_lroot = new QVBoxLayout( this ); | 60 | m_lroot = new QVBoxLayout( this ); |
56 | m_typeBox = new QVBoxLayout( m_lroot ); | 61 | m_typeBox = new QVBoxLayout( m_lroot ); |
57 | m_colorBox = new QVBoxLayout( m_lroot ); | 62 | m_colorBox = new QVBoxLayout( m_lroot ); |
58 | 63 | ||
59 | // Layout | 64 | // Layout |
60 | m_typeBox->add( m_terminal ); | 65 | m_typeBox->add( m_terminal ); |
61 | m_typeBox->add( m_terminalBox ); | 66 | m_typeBox->add( m_terminalBox ); |
62 | m_lroot->add( m_groupSize ); | 67 | m_lroot->add( m_groupSize ); |
63 | 68 | ||
64 | m_colorBox->add( m_colorLabel ); | 69 | m_colorBox->add( m_colorLabel ); |
65 | m_colorBox->add( m_colorCmb ); | 70 | m_colorBox->add( m_colorCmb ); |
66 | 71 | ||
67 | m_lroot->add( m_groupConv ); | 72 | m_lroot->add( m_groupConv ); |
68 | m_lroot->add( m_groupOptions ); | 73 | m_lroot->add( m_groupOptions ); |
69 | m_lroot->addStretch( 0 ); | 74 | m_lroot->addStretch( 0 ); |
70 | 75 | ||
71 | // Fill in some options | 76 | // Fill in some options |
72 | qWarning("Options for terminal box"); | 77 | owarn << "Options for terminal box" << oendl; |
73 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); | 78 | m_terminalBox->insertItem( tr("VT 100"), 0 ); // /*, id_term_vt100*/ ); |
74 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); | 79 | m_terminalBox->insertItem( tr("VT 102"), 1 ); // /* , id_term_vt102 */); |
75 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); | 80 | m_terminalBox->insertItem( tr("Linux Console"), 2 ); //, id_term_linux ); |
76 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); | 81 | m_terminalBox->insertItem( tr("X-Terminal"), 3 ); //, id_term_xterm ); |
77 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); | 82 | //m_terminalBox->insertItem( tr("ANSI"), id_term_ansi ); |
78 | 83 | ||
79 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); | 84 | m_colorCmb->insertItem( tr("black on white"), id_term_black ); |
80 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); | 85 | m_colorCmb->insertItem( tr("white on black"), id_term_white ); |
81 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); | 86 | m_colorCmb->insertItem( tr("green on black"), id_term_green ); |
82 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); | 87 | m_colorCmb->insertItem( tr("orange on black"), id_term_orange ); |
83 | 88 | ||
84 | // signals + slots | 89 | // signals + slots |
85 | /* | 90 | /* |
86 | connect(m_terminalBox, SIGNAL(activated(int) ), | 91 | connect(m_terminalBox, SIGNAL(activated(int) ), |
87 | this, SLOT(slotTermTerm(int) ) ); | 92 | this, SLOT(slotTermTerm(int) ) ); |
88 | connect(m_colorBox, SIGNAL(activated(int) ), | 93 | connect(m_colorBox, SIGNAL(activated(int) ), |
89 | tis, SLOT(slotTermColor(int) ) ); | 94 | tis, SLOT(slotTermColor(int) ) ); |
90 | connect(m_groupSize, SIGNAL(activated(int) ), | 95 | connect(m_groupSize, SIGNAL(activated(int) ), |
91 | this, SLOT(slotTermFont(int) ) ); | 96 | this, SLOT(slotTermFont(int) ) ); |
92 | 97 | ||
93 | connect(m_optionEcho, SIGNAL(toggled(bool) ), | 98 | connect(m_optionEcho, SIGNAL(toggled(bool) ), |
94 | this, SLOT(slotTermEcho(bool) ) ); | 99 | this, SLOT(slotTermEcho(bool) ) ); |
95 | connect(m_optionWrap, SIGNAL(toggled(bool) ), | 100 | connect(m_optionWrap, SIGNAL(toggled(bool) ), |
96 | this, SLOT(slotTermWrap(bool) ) ); | 101 | this, SLOT(slotTermWrap(bool) ) ); |
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index df27055..45fd11d 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -5,75 +5,75 @@ | |||
5 | 5 | ||
6 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
8 | 8 | ||
9 | #include "../profile.h" | 9 | #include "../profile.h" |
10 | #include "../io_serial.h" | 10 | #include "../io_serial.h" |
11 | #include "../filetransfer.h" | 11 | #include "../filetransfer.h" |
12 | #include "../filereceive.h" | 12 | #include "../filereceive.h" |
13 | 13 | ||
14 | #include <opie2/oprocess.h> | 14 | #include <opie2/oprocess.h> |
15 | 15 | ||
16 | #include "senderui.h" | 16 | #include "senderui.h" |
17 | 17 | ||
18 | using namespace Opie::Core; | 18 | using namespace Opie::Core; |
19 | using namespace Opie::Core; | 19 | using namespace Opie::Core; |
20 | SenderUI::SenderUI() | 20 | SenderUI::SenderUI() |
21 | : Sender() { | 21 | : Sender() { |
22 | 22 | ||
23 | /* we do that manually */ | 23 | /* we do that manually */ |
24 | Profile prof; | 24 | Profile prof; |
25 | QString str = "/dev/bty0"; | 25 | QString str = "/dev/bty0"; |
26 | prof.writeEntry("Device",str ); | 26 | prof.writeEntry("Device",str ); |
27 | prof.writeEntry("Baud", 19200 ); | 27 | prof.writeEntry("Baud", 19200 ); |
28 | 28 | ||
29 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 29 | owarn << "prof " + prof.readEntry("Device") + " " + str << oendl; |
30 | ser = new IOSerial(prof); | 30 | ser = new IOSerial(prof); |
31 | connect(ser, SIGNAL(received(const QByteArray&) ), | 31 | connect(ser, SIGNAL(received(const QByteArray&) ), |
32 | this, SLOT(got(const QByteArray&) ) ); | 32 | this, SLOT(got(const QByteArray&) ) ); |
33 | 33 | ||
34 | if ( ser->open() ) | 34 | if ( ser->open() ) |
35 | qWarning("opened!!!"); | 35 | owarn << "opened!!!" << oendl; |
36 | else | 36 | else |
37 | qWarning("could not open"); | 37 | owarn << "could not open" << oendl; |
38 | 38 | ||
39 | 39 | ||
40 | } | 40 | } |
41 | SenderUI::~SenderUI() { | 41 | SenderUI::~SenderUI() { |
42 | 42 | ||
43 | } | 43 | } |
44 | void SenderUI::slotSendFile() { | 44 | void SenderUI::slotSendFile() { |
45 | 45 | ||
46 | sz = new FileTransfer(FileTransfer::SY, ser); | 46 | sz = new FileTransfer(FileTransfer::SY, ser); |
47 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); | 47 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); |
48 | 48 | ||
49 | connect (sz, SIGNAL(sent()), | 49 | connect (sz, SIGNAL(sent()), |
50 | this, SLOT(fileTransComplete())); | 50 | this, SLOT(fileTransComplete())); |
51 | } | 51 | } |
52 | 52 | ||
53 | void SenderUI::slotSend() { | 53 | void SenderUI::slotSend() { |
54 | QCString str = MultiLineEdit1->text().utf8(); | 54 | QCString str = MultiLineEdit1->text().utf8(); |
55 | qWarning("sending: %s", str.data() ); | 55 | owarn << "sending: " << str.data() << "" << oendl; |
56 | str = str.replace( QRegExp("\n"), "\r"); | 56 | str = str.replace( QRegExp("\n"), "\r"); |
57 | ser->send( str ); | 57 | ser->send( str ); |
58 | } | 58 | } |
59 | void SenderUI::got(const QByteArray& ar) { | 59 | void SenderUI::got(const QByteArray& ar) { |
60 | qWarning("got:"); | 60 | owarn << "got:" << oendl; |
61 | for ( uint i = 0; i < ar.count(); i++ ) { | 61 | for ( uint i = 0; i < ar.count(); i++ ) { |
62 | printf("%c", ar[i] ); | 62 | printf("%c", ar[i] ); |
63 | } | 63 | } |
64 | printf("\n"); | 64 | printf("\n"); |
65 | } | 65 | } |
66 | 66 | ||
67 | void SenderUI::fileTransComplete() { | 67 | void SenderUI::fileTransComplete() { |
68 | 68 | ||
69 | qWarning("file transfer complete"); | 69 | owarn << "file transfer complete" << oendl; |
70 | } | 70 | } |
71 | void SenderUI::send() { | 71 | void SenderUI::send() { |
72 | 72 | ||
73 | } | 73 | } |
74 | void SenderUI::slotRev(){ | 74 | void SenderUI::slotRev(){ |
75 | qWarning("Going to receive!"); | 75 | owarn << "Going to receive!" << oendl; |
76 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); | 76 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); |
77 | rev->receive(); | 77 | rev->receive(); |
78 | 78 | ||
79 | } | 79 | } |
diff --git a/noncore/apps/opie-console/widget.cpp b/noncore/apps/opie-console/widget.cpp index e17dfd4..c51983f 100644 --- a/noncore/apps/opie-console/widget.cpp +++ b/noncore/apps/opie-console/widget.cpp | |||
@@ -974,92 +974,92 @@ void Widget::onClearSelection() | |||
974 | // For auto-hide, we need to get keypress-events, but we only get them when | 974 | // For auto-hide, we need to get keypress-events, but we only get them when |
975 | // we have focus. | 975 | // we have focus. |
976 | 976 | ||
977 | void Widget::doScroll(int lines) | 977 | void Widget::doScroll(int lines) |
978 | { | 978 | { |
979 | scrollbar->setValue(scrollbar->value()+lines); | 979 | scrollbar->setValue(scrollbar->value()+lines); |
980 | } | 980 | } |
981 | 981 | ||
982 | bool Widget::eventFilter( QObject *obj, QEvent *e ) | 982 | bool Widget::eventFilter( QObject *obj, QEvent *e ) |
983 | { | 983 | { |
984 | if ( (e->type() == QEvent::Accel || | 984 | if ( (e->type() == QEvent::Accel || |
985 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { | 985 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { |
986 | static_cast<QKeyEvent *>( e )->ignore(); | 986 | static_cast<QKeyEvent *>( e )->ignore(); |
987 | return true; | 987 | return true; |
988 | } | 988 | } |
989 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) | 989 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) |
990 | return FALSE; // not us | 990 | return FALSE; // not us |
991 | if ( e->type() == QEvent::Wheel) { | 991 | if ( e->type() == QEvent::Wheel) { |
992 | QApplication::sendEvent(scrollbar, e); | 992 | QApplication::sendEvent(scrollbar, e); |
993 | } | 993 | } |
994 | 994 | ||
995 | #ifdef FAKE_CTRL_AND_ALT | 995 | #ifdef FAKE_CTRL_AND_ALT |
996 | static bool control = FALSE; | 996 | static bool control = FALSE; |
997 | static bool alt = FALSE; | 997 | static bool alt = FALSE; |
998 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 998 | // odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; |
999 | bool dele=FALSE; | 999 | bool dele=FALSE; |
1000 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1000 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1001 | QKeyEvent* ke = (QKeyEvent*)e; | 1001 | QKeyEvent* ke = (QKeyEvent*)e; |
1002 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 1002 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
1003 | switch (ke->key()) { | 1003 | switch (ke->key()) { |
1004 | case Key_F9: // let this be "Control" | 1004 | case Key_F9: // let this be "Control" |
1005 | control = keydown; | 1005 | control = keydown; |
1006 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 1006 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
1007 | dele=TRUE; | 1007 | dele=TRUE; |
1008 | break; | 1008 | break; |
1009 | case Key_F13: // let this be "Alt" | 1009 | case Key_F13: // let this be "Alt" |
1010 | alt = keydown; | 1010 | alt = keydown; |
1011 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 1011 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
1012 | dele=TRUE; | 1012 | dele=TRUE; |
1013 | break; | 1013 | break; |
1014 | default: | 1014 | default: |
1015 | if ( control ) { | 1015 | if ( control ) { |
1016 | int a = toupper(ke->ascii())-64; | 1016 | int a = toupper(ke->ascii())-64; |
1017 | if ( a >= 0 && a < ' ' ) { | 1017 | if ( a >= 0 && a < ' ' ) { |
1018 | e = new QKeyEvent(e->type(), ke->key(), | 1018 | e = new QKeyEvent(e->type(), ke->key(), |
1019 | a, ke->state()|ControlButton, QChar(a,0)); | 1019 | a, ke->state()|ControlButton, QChar(a,0)); |
1020 | dele=TRUE; | 1020 | dele=TRUE; |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | if ( alt ) { | 1023 | if ( alt ) { |
1024 | e = new QKeyEvent(e->type(), ke->key(), | 1024 | e = new QKeyEvent(e->type(), ke->key(), |
1025 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1025 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1026 | dele=TRUE; | 1026 | dele=TRUE; |
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | #endif | 1030 | #endif |
1031 | 1031 | ||
1032 | if ( e->type() == QEvent::KeyPress ) { | 1032 | if ( e->type() == QEvent::KeyPress ) { |
1033 | QKeyEvent* ke = (QKeyEvent*)e; | 1033 | QKeyEvent* ke = (QKeyEvent*)e; |
1034 | actSel=0; // Key stroke implies a screen update, so Widget won't | 1034 | actSel=0; // Key stroke implies a screen update, so Widget won't |
1035 | // know where the current selection is. | 1035 | // know where the current selection is. |
1036 | 1036 | ||
1037 | // qDebug("key pressed is 0x%x",ke->key()); | 1037 | // odebug << "key pressed is 0x" << ke->key() << "" << oendl; |
1038 | 1038 | ||
1039 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker | 1039 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker |
1040 | 1040 | ||
1041 | // qDebug("key pressed 2 is 0x%x",ke->key()); | 1041 | // odebug << "key pressed 2 is 0x" << ke->key() << "" << oendl; |
1042 | emitText("\\"); // expose | 1042 | emitText("\\"); // expose |
1043 | } else | 1043 | } else |
1044 | emit keyPressedSignal(ke); // expose | 1044 | emit keyPressedSignal(ke); // expose |
1045 | ke->accept(); | 1045 | ke->accept(); |
1046 | #ifdef FAKE_CTRL_AND_ALT | 1046 | #ifdef FAKE_CTRL_AND_ALT |
1047 | if ( dele ) delete e; | 1047 | if ( dele ) delete e; |
1048 | #endif | 1048 | #endif |
1049 | return true; // stop the event | 1049 | return true; // stop the event |
1050 | } | 1050 | } |
1051 | if ( e->type() == QEvent::Enter ) { | 1051 | if ( e->type() == QEvent::Enter ) { |
1052 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), | 1052 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), |
1053 | this, SLOT(onClearSelection()) ); | 1053 | this, SLOT(onClearSelection()) ); |
1054 | } | 1054 | } |
1055 | if ( e->type() == QEvent::Leave ) { | 1055 | if ( e->type() == QEvent::Leave ) { |
1056 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 1056 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
1057 | this, SLOT(onClearSelection()) ); | 1057 | this, SLOT(onClearSelection()) ); |
1058 | } | 1058 | } |
1059 | return QFrame::eventFilter( obj, e ); | 1059 | return QFrame::eventFilter( obj, e ); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | /* ------------------------------------------------------------------------- */ | 1062 | /* ------------------------------------------------------------------------- */ |
1063 | /* */ | 1063 | /* */ |
1064 | /* Frame */ | 1064 | /* Frame */ |
1065 | /* */ | 1065 | /* */ |
diff --git a/noncore/apps/opie-console/widget_layer.cpp b/noncore/apps/opie-console/widget_layer.cpp index 96dda1c..ab25919 100644 --- a/noncore/apps/opie-console/widget_layer.cpp +++ b/noncore/apps/opie-console/widget_layer.cpp | |||
@@ -54,89 +54,89 @@ QSize WidgetLayer::sizeHint() | |||
54 | return size(); | 54 | return size(); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | /* --------------------------------- audio ---------------------------------- */ | 58 | /* --------------------------------- audio ---------------------------------- */ |
59 | 59 | ||
60 | void WidgetLayer::bell() | 60 | void WidgetLayer::bell() |
61 | { | 61 | { |
62 | QApplication::beep(); | 62 | QApplication::beep(); |
63 | } | 63 | } |
64 | 64 | ||
65 | bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) | 65 | bool WidgetLayer::eventFilter( QObject *obj, QEvent *e ) |
66 | { | 66 | { |
67 | if ( (e->type() == QEvent::Accel || | 67 | if ( (e->type() == QEvent::Accel || |
68 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { | 68 | e->type() == QEvent::AccelAvailable ) && qApp->focusWidget() == this ) { |
69 | static_cast<QKeyEvent *>( e )->ignore(); | 69 | static_cast<QKeyEvent *>( e )->ignore(); |
70 | return true; | 70 | return true; |
71 | } | 71 | } |
72 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) | 72 | if ( obj != this /* when embedded */ && obj != parent() /* when standalone */ ) |
73 | return false; // not us | 73 | return false; // not us |
74 | 74 | ||
75 | #ifdef FAKE_CTRL_AND_ALT | 75 | #ifdef FAKE_CTRL_AND_ALT |
76 | static bool control = false; | 76 | static bool control = false; |
77 | static bool alt = false; | 77 | static bool alt = false; |
78 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 78 | // odebug << " Has a keyboard with no CTRL and ALT keys, but we fake it:" << oendl; |
79 | bool dele = false; | 79 | bool dele = false; |
80 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 80 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
81 | QKeyEvent* ke = (QKeyEvent*)e; | 81 | QKeyEvent* ke = (QKeyEvent*)e; |
82 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 82 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
83 | switch (ke->key()) { | 83 | switch (ke->key()) { |
84 | case Key_F9: // let this be "Control" | 84 | case Key_F9: // let this be "Control" |
85 | control = keydown; | 85 | control = keydown; |
86 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 86 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
87 | dele=TRUE; | 87 | dele=TRUE; |
88 | break; | 88 | break; |
89 | case Key_F13: // let this be "Alt" | 89 | case Key_F13: // let this be "Alt" |
90 | alt = keydown; | 90 | alt = keydown; |
91 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 91 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
92 | dele=TRUE; | 92 | dele=TRUE; |
93 | break; | 93 | break; |
94 | default: | 94 | default: |
95 | if ( control ) { | 95 | if ( control ) { |
96 | int a = toupper(ke->ascii())-64; | 96 | int a = toupper(ke->ascii())-64; |
97 | if ( a >= 0 && a < ' ' ) { | 97 | if ( a >= 0 && a < ' ' ) { |
98 | e = new QKeyEvent(e->type(), ke->key(), | 98 | e = new QKeyEvent(e->type(), ke->key(), |
99 | a, ke->state()|ControlButton, | 99 | a, ke->state()|ControlButton, |
100 | QChar(a,0)); | 100 | QChar(a,0)); |
101 | dele=TRUE; | 101 | dele=TRUE; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | if ( alt ) { | 104 | if ( alt ) { |
105 | e = new QKeyEvent(e->type(), ke->key(), | 105 | e = new QKeyEvent(e->type(), ke->key(), |
106 | ke->ascii(), ke->state()|AltButton, ke->text()); | 106 | ke->ascii(), ke->state()|AltButton, ke->text()); |
107 | dele=TRUE; | 107 | dele=TRUE; |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } | 110 | } |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | if ( e->type() == QEvent::KeyPress ) { | 113 | if ( e->type() == QEvent::KeyPress ) { |
114 | QKeyEvent* ke = (QKeyEvent*)e; | 114 | QKeyEvent* ke = (QKeyEvent*)e; |
115 | //actSel=0; // Key stroke implies a screen update, so Widget won't | 115 | //actSel=0; // Key stroke implies a screen update, so Widget won't |
116 | // know where the current selection is. | 116 | // know where the current selection is. |
117 | 117 | ||
118 | // qDebug("key pressed is 0x%x",ke->key()); | 118 | // odebug << "key pressed is 0x" << ke->key() << "" << oendl; |
119 | 119 | ||
120 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker | 120 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker |
121 | insertText("\\"); // expose | 121 | insertText("\\"); // expose |
122 | } else | 122 | } else |
123 | emit keyPressed( ke ); // expose | 123 | emit keyPressed( ke ); // expose |
124 | ke->accept(); | 124 | ke->accept(); |
125 | #ifdef FAKE_CTRL_AND_ALT | 125 | #ifdef FAKE_CTRL_AND_ALT |
126 | if ( dele ) delete e; | 126 | if ( dele ) delete e; |
127 | #endif | 127 | #endif |
128 | return true; // stop the event | 128 | return true; // stop the event |
129 | } | 129 | } |
130 | return QFrame::eventFilter( obj, e ); | 130 | return QFrame::eventFilter( obj, e ); |
131 | } | 131 | } |
132 | 132 | ||
133 | 133 | ||
134 | /* --------------------------------- screen --------------------------------- */ | 134 | /* --------------------------------- screen --------------------------------- */ |
135 | 135 | ||
136 | 136 | ||
137 | void WidgetLayer::propagateSize() | 137 | void WidgetLayer::propagateSize() |
138 | { | 138 | { |
139 | QArray<Character> oldimage = m_image.copy(); | 139 | QArray<Character> oldimage = m_image.copy(); |
140 | int oldlines = m_lines; | 140 | int oldlines = m_lines; |
141 | int oldcolumns = m_columns; | 141 | int oldcolumns = m_columns; |
142 | 142 | ||