summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp3
-rw-r--r--noncore/apps/opie-console/emulation_handler.h1
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp41
-rw-r--r--noncore/apps/opie-console/mainwindow.h9
5 files changed, 55 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 07be30b..b817062 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,106 +1,107 @@
1 2005-??-??Opie 1.2.2 1 2005-??-??Opie 1.2.2
2 2
3 3
4 New Features 4 New Features
5 ------------ 5 ------------
6 6
7 7
8 Fixed Bugs 8 Fixed Bugs
9 ---------- 9 ----------
10 * #1695 - Date selector use too small fontsize on VGA screen (hrw) 10 * #1695 - Date selector use too small fontsize on VGA screen (hrw)
11 * #1686 - opie-console lack UI setting for switching scrollbar (hrw)
11 * n.a. - remove hardcoded font size from wellenreiter (hrw) 12 * n.a. - remove hardcoded font size from wellenreiter (hrw)
12 * n.a. - added patch to build QT/E 2.3.10 with gc 4.x.x (hrw) 13 * n.a. - added patch to build QT/E 2.3.10 with gc 4.x.x (hrw)
13 14
14 2005-09-11Opie 1.2.1 15 2005-09-11Opie 1.2.1
15 16
16 17
17 New Features 18 New Features
18 ------------ 19 ------------
19 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) 20 * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
20 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) 21 * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly)
21 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) 22 * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer)
22 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) 23 * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl)
23 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl) 24 * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl)
24 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl) 25 * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl)
25 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw) 26 * Checkbook: Added configuration option to use smaller font for checkbook transaction tab (hrw)
26 * ZSafe: Made UI conform to Opie standards (drw) 27 * ZSafe: Made UI conform to Opie standards (drw)
27 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw) 28 * Today Addressbook plugin: Fixed configuration to show/not show birthdays, use checkboxes for selection (hrw)
28 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl) 29 * Opie-Console: Read initial fixed font configuration from qpe.conf (mickeyl)
29 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl) 30 * Opie-PcmciaApplet: Configure insert/resume actions and bind unsupported cards (mickeyl)
30 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl) 31 * SysInfo: Remove CPU tab and add Devices tab instead (mickeyl)
31 * Opie-smb: Added Opie front end for Samba (ljp) 32 * Opie-smb: Added Opie front end for Samba (ljp)
32 * Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie) 33 * Opie-Bluetooth: Replace obex send implementation and patch libopieobex and the bluetoothapplet (Michael Haynie)
33 * Opieplayer: rudimentary podcast support (ljp) 34 * Opieplayer: rudimentary podcast support (ljp)
34 35
35 Fixed Bugs 36 Fixed Bugs
36 ---------- 37 ----------
37 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl) 38 * #1377 - Suspend Powermanagement when switched to another VT (mickeyl)
38 - We actually suspend the complete Opie now in that case. 39 - We actually suspend the complete Opie now in that case.
39 * #1384 - Battery status updated improperly when charging (skyhusker) 40 * #1384 - Battery status updated improperly when charging (skyhusker)
40 * #1476 - Wrong order of application entries in the O-menu (skyhusker) 41 * #1476 - Wrong order of application entries in the O-menu (skyhusker)
41 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl) 42 * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl)
42 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) 43 * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
43 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw) 44 * #1543 - Time Settings: "predict" tab is displayed twice after reopen (hrw)
44 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker) 45 * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker)
45 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker) 46 * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker)
46 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) 47 * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
47 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) 48 * #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
48 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker) 49 * #1635 - opie-today, datebook-plugin does not show notes (skyhusker)
49 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker) 50 * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker)
50 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker) 51 * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker)
51 * #1667 - Opie-IRC does not show messages from !channel (skyhusker) 52 * #1667 - Opie-IRC does not show messages from !channel (skyhusker)
52 * #1679 - Security PIN plugin is QVGA sized (hrw) 53 * #1679 - Security PIN plugin is QVGA sized (hrw)
53 * #1682 - Properly resize tab control in OTabWidget (drw) 54 * #1682 - Properly resize tab control in OTabWidget (drw)
54 * n.a. - always show volume and wireless applet popups inside visible screen (deller) 55 * n.a. - always show volume and wireless applet popups inside visible screen (deller)
55 * n.a. - scale O-Menu-Applets appropriately (mickeyl) 56 * n.a. - scale O-Menu-Applets appropriately (mickeyl)
56 * n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) 57 * n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
57 * n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl) 58 * n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl)
58 * n.a. - scale BluezApplet appropriately and use larger icons (mickeyl) 59 * n.a. - scale BluezApplet appropriately and use larger icons (mickeyl)
59 * n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) 60 * n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
60 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) 61 * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl)
61 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw) 62 * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw)
62 * n.a. - remove hardcoded font size from netsystemtime (hrw) 63 * n.a. - remove hardcoded font size from netsystemtime (hrw)
63 * n.a. - remove hardcoded font size from checkbook graphs (hrw) 64 * n.a. - remove hardcoded font size from checkbook graphs (hrw)
64 * n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw) 65 * n.a. - Dagger - fixes for Sword 1.5.8, morph tag x-refs, closing last tab crash (drw)
65 66
66 67
67 Internal 68 Internal
68 -------- 69 --------
69 * Make BluezApplet use OTaskbarApplet (mickeyl) 70 * Make BluezApplet use OTaskbarApplet (mickeyl)
70 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl) 71 * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl)
71 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl) 72 * libopiecore: add ODirNotification - recursive directory notifications (mickeyl)
72 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) 73 * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl)
73 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) 74 * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl)
74 * libopienet: Miscellaneous API cleanups (mickeyl) 75 * libopienet: Miscellaneous API cleanups (mickeyl)
75 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl) 76 * libopiecore: Add linux pcmcia system abstraction classes (mickeyl)
76 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl) 77 * libopiecore: ODevice now knows the default gfx driver to use (mteira,mickeyl)
77 * libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl) 78 * libopiecore: Add support for the Sharp SL-C3100 "Borzoi" (mickeyl)
78 * libopiecore: Add support for the new Linux Inputsystem Switches type [necessary for auto rotation in 2.6.13] (mickeyl) 79 * libopiecore: Add support for the new Linux Inputsystem Switches type [necessary for auto rotation in 2.6.13] (mickeyl)
79 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl) 80 * Remove assumptions about default gfx driver ("Transformed") all over the place (mteira,mickeyl)
80 * Fix / Optimize number of scanned directories (ljp) 81 * Fix / Optimize number of scanned directories (ljp)
81 * Use five point mouse calibration to make calibrated mouse drivers work on newer Zaurii (rp,mickeyl) 82 * Use five point mouse calibration to make calibrated mouse drivers work on newer Zaurii (rp,mickeyl)
82 83
83 2005-03-25Opie 1.2.0 84 2005-03-25Opie 1.2.0
84 85
85 Fixed Bugs 86 Fixed Bugs
86 ---------- 87 ----------
87 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) 88 * #1613 - AdvancedFM - scale toolbar icons appropriately (drw)
88 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) 89 * #1620 - OFileSelector - show the button on press and not on press on hold (alwin)
89 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) 90 * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke)
90 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) 91 * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw)
91 * n.a.- make qpeglobal.h include qglobal.h (zecke) 92 * n.a.- make qpeglobal.h include qglobal.h (zecke)
92 93
93 2005-03-20Opie 1.2.0-rc1 94 2005-03-20Opie 1.2.0-rc1
94 95
95 96
96 New Features 97 New Features
97 ------------ 98 ------------
98 * Launcher: Support a static background pixmap (mickeyl) 99 * Launcher: Support a static background pixmap (mickeyl)
99 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) 100 * LauncherSettings: Choose whether to have a static background pixmap (mickeyl)
100 * PackageManager supports the 'lists_dir' ipkg configuration option (drw) 101 * PackageManager supports the 'lists_dir' ipkg configuration option (drw)
101 * Added hi-res inline images for large resolution devices (drw) 102 * Added hi-res inline images for large resolution devices (drw)
102 * Improved launcher icons for consistency (ar) 103 * Improved launcher icons for consistency (ar)
103 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) 104 * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin)
104 105
105 Fixed Bugs 106 Fixed Bugs
106 ---------- 107 ----------
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index 2087f57..d5a435e 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -157,96 +157,99 @@ QColor EmulationHandler::foreColor(int col) {
157 co = Qt::black; 157 co = Qt::black;
158 break; 158 break;
159 case Profile::Green: 159 case Profile::Green:
160 co = Qt::green; 160 co = Qt::green;
161 break; 161 break;
162 case Profile::Orange: 162 case Profile::Orange:
163 co.setRgb( 231, 184, 98 ); 163 co.setRgb( 231, 184, 98 );
164 break; 164 break;
165 } 165 }
166 166
167 return co; 167 return co;
168} 168}
169QColor EmulationHandler::backColor(int col ) { 169QColor EmulationHandler::backColor(int col ) {
170 QColor co; 170 QColor co;
171 /* we need to switch it */ 171 /* we need to switch it */
172 switch( col ) { 172 switch( col ) {
173 default: 173 default:
174 case Profile::White: 174 case Profile::White:
175 /* color is white */ 175 /* color is white */
176 co = Qt::black; 176 co = Qt::black;
177 break; 177 break;
178 case Profile::Black: 178 case Profile::Black:
179 co = Qt::white; 179 co = Qt::white;
180 break; 180 break;
181 case Profile::Green: 181 case Profile::Green:
182 co = Qt::black; 182 co = Qt::black;
183 break; 183 break;
184 case Profile::Orange: 184 case Profile::Orange:
185 co = Qt::black; 185 co = Qt::black;
186 break; 186 break;
187 } 187 }
188 188
189 return co; 189 return co;
190} 190}
191 191
192QPushButton* EmulationHandler::cornerButton() { 192QPushButton* EmulationHandler::cornerButton() {
193 return m_teWid->cornerButton(); 193 return m_teWid->cornerButton();
194} 194}
195 195
196 196
197Script *EmulationHandler::script() { 197Script *EmulationHandler::script() {
198 return m_script; 198 return m_script;
199} 199}
200 200
201bool EmulationHandler::isRecording() { 201bool EmulationHandler::isRecording() {
202 return (m_script != 0); 202 return (m_script != 0);
203} 203}
204 204
205bool EmulationHandler::isLogging() { 205bool EmulationHandler::isLogging() {
206 return (m_log != 0); 206 return (m_log != 0);
207} 207}
208 208
209void EmulationHandler::startRecording() { 209void EmulationHandler::startRecording() {
210 if (!isRecording()) 210 if (!isRecording())
211 m_script = new Script(); 211 m_script = new Script();
212} 212}
213 213
214void EmulationHandler::startLogging(const QString fileName) { 214void EmulationHandler::startLogging(const QString fileName) {
215 m_logFileName = fileName; 215 m_logFileName = fileName;
216 if (!isLogging()) 216 if (!isLogging())
217 m_log = new Logger(m_logFileName); 217 m_log = new Logger(m_logFileName);
218} 218}
219 219
220QString EmulationHandler::logFileName() { 220QString EmulationHandler::logFileName() {
221 return m_logFileName; 221 return m_logFileName;
222} 222}
223 223
224void EmulationHandler::clearScript() { 224void EmulationHandler::clearScript() {
225 if (isRecording()) { 225 if (isRecording()) {
226 delete m_script; 226 delete m_script;
227 m_script = 0; 227 m_script = 0;
228 } 228 }
229} 229}
230 230
231void EmulationHandler::clearLog() { 231void EmulationHandler::clearLog() {
232 if (isLogging()) { 232 if (isLogging()) {
233 delete m_log; 233 delete m_log;
234 m_log = 0; 234 m_log = 0;
235 } 235 }
236} 236}
237 237
238void EmulationHandler::runScript(const Script *script) { 238void EmulationHandler::runScript(const Script *script) {
239 emit send(script->script()); 239 emit send(script->script());
240} 240}
241 241
242void EmulationHandler::copy() { 242void EmulationHandler::copy() {
243 m_teWid->emitSelection(); 243 m_teWid->emitSelection();
244} 244}
245void EmulationHandler::paste() { 245void EmulationHandler::paste() {
246 m_teWid->pasteClipboard(); 246 m_teWid->pasteClipboard();
247} 247}
248 248
249void EmulationHandler::setWrap(int columns) { 249void EmulationHandler::setWrap(int columns) {
250 m_teWid->setWrapAt(columns); 250 m_teWid->setWrapAt(columns);
251} 251}
252 252
253void EmulationHandler::setScrollbarLocation(int index) {
254 m_teWid->setScrollbarLocation(index);
255}
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 1092c82..dabdb15 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -1,111 +1,112 @@
1#ifndef OPIE_EMULATION_HANDLER_H 1#ifndef OPIE_EMULATION_HANDLER_H
2#define OPIE_EMULATION_HANDLER_H 2#define OPIE_EMULATION_HANDLER_H
3 3
4#include <qobject.h> 4#include <qobject.h>
5#include <qcolor.h> 5#include <qcolor.h>
6#include <qcstring.h> 6#include <qcstring.h>
7 7
8/* 8/*
9 * Badly ibotty lacks the time to finish 9 * Badly ibotty lacks the time to finish
10 * his widget in time.. 10 * his widget in time..
11 * Never the less we've to have an EmulationWidget 11 * Never the less we've to have an EmulationWidget
12 * This is why I'm taking the inferior not cleaned 12 * This is why I'm taking the inferior not cleaned
13 * up TE* KDE STUFF 13 * up TE* KDE STUFF
14 */ 14 */
15 15
16/** 16/**
17 * This is the layer above the IOLayer* 17 * This is the layer above the IOLayer*
18 * This nice QObject here will get stuff from 18 * This nice QObject here will get stuff from
19 * got a slot and a signal 19 * got a slot and a signal
20 * the signal for data 20 * the signal for data
21 * the slot for receiving 21 * the slot for receiving
22 * it'll set up the widget internally 22 * it'll set up the widget internally
23 * and manage the communication between 23 * and manage the communication between
24 * the pre QByteArray world! 24 * the pre QByteArray world!
25 */ 25 */
26class Profile; 26class Profile;
27class QWidget; 27class QWidget;
28class QPushButton; 28class QPushButton;
29class TEWidget; 29class TEWidget;
30class QFile; 30class QFile;
31class TEmulation; 31class TEmulation;
32class QFont; 32class QFont;
33class QTextStream; 33class QTextStream;
34class Script; 34class Script;
35class Logger; 35class Logger;
36 36
37class EmulationHandler : public QObject { 37class EmulationHandler : public QObject {
38 Q_OBJECT 38 Q_OBJECT
39public: 39public:
40 /** 40 /**
41 * simple c'tor the parent of the TEWdiget 41 * simple c'tor the parent of the TEWdiget
42 * and a name 42 * and a name
43 * and a Profile 43 * and a Profile
44 */ 44 */
45 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l ); 45 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l );
46 46
47 /** 47 /**
48 * delete all components 48 * delete all components
49 */ 49 */
50 ~EmulationHandler(); 50 ~EmulationHandler();
51 51
52 void load( const Profile& ); 52 void load( const Profile& );
53 QWidget* widget(); 53 QWidget* widget();
54 TEmulation *emulation(); 54 TEmulation *emulation();
55 void setColor( const QColor& fore, const QColor& back ); 55 void setColor( const QColor& fore, const QColor& back );
56 QPushButton* cornerButton(); 56 QPushButton* cornerButton();
57 57
58 /* Scripts */ 58 /* Scripts */
59 /* Create a new script and record all typed characters */ 59 /* Create a new script and record all typed characters */
60 void startRecording(); 60 void startRecording();
61 61
62 void startLogging(const QString); 62 void startLogging(const QString);
63 63
64 /* Return whether we are currently recording a script */ 64 /* Return whether we are currently recording a script */
65 bool isRecording(); 65 bool isRecording();
66 66
67 /* Return whether we are currently recording a log */ 67 /* Return whether we are currently recording a log */
68 bool isLogging(); 68 bool isLogging();
69 69
70 QString logFileName(); 70 QString logFileName();
71 71
72 /* Return the current script (or NULL) */ 72 /* Return the current script (or NULL) */
73 Script *script(); 73 Script *script();
74 74
75 /* Stop recording and remove the current script from memory */ 75 /* Stop recording and remove the current script from memory */
76 void clearScript(); 76 void clearScript();
77 77
78 /* Stop logging and remove the current log from memory */ 78 /* Stop logging and remove the current log from memory */
79 void clearLog(); 79 void clearLog();
80 80
81 /* Run a script by forwarding its keys to the EmulationLayer */ 81 /* Run a script by forwarding its keys to the EmulationLayer */
82 void runScript(const Script *); 82 void runScript(const Script *);
83 83
84 /* Propagate change to widget */ 84 /* Propagate change to widget */
85 void setWrap(int columns); 85 void setWrap(int columns);
86 void setScrollbarLocation(int index);
86signals: 87signals:
87 void send( const QByteArray& ); 88 void send( const QByteArray& );
88 void changeSize(int rows, int cols ); 89 void changeSize(int rows, int cols );
89 90
90 91
91public slots: 92public slots:
92 void recv( const QByteArray& ); 93 void recv( const QByteArray& );
93 void paste(); 94 void paste();
94 void copy(); 95 void copy();
95 96
96private slots: 97private slots:
97 void recvEmulation( const char*, int len ); 98 void recvEmulation( const char*, int len );
98private: 99private:
99 QFont font( int ); 100 QFont font( int );
100 QColor foreColor(int ); 101 QColor foreColor(int );
101 QColor backColor(int ); 102 QColor backColor(int );
102 103
103private: 104private:
104 TEWidget* m_teWid; 105 TEWidget* m_teWid;
105 TEmulation* m_teEmu; 106 TEmulation* m_teEmu;
106 Script * m_script; 107 Script * m_script;
107 Logger *m_log; 108 Logger *m_log;
108 QString m_logFileName; 109 QString m_logFileName;
109}; 110};
110 111
111#endif 112#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 45a662c..18c0434 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,262 +1,274 @@
1#include "TEmulation.h" 1#include "TEmulation.h"
2#include "profileeditordialog.h" 2#include "profileeditordialog.h"
3#include "configdialog.h" 3#include "configdialog.h"
4#include "default.h" 4#include "default.h"
5#include "profilemanager.h" 5#include "profilemanager.h"
6#include "mainwindow.h" 6#include "mainwindow.h"
7#include "tabwidget.h" 7#include "tabwidget.h"
8#include "transferdialog.h" 8#include "transferdialog.h"
9#include "function_keyboard.h" 9#include "function_keyboard.h"
10#include "emulation_handler.h" 10#include "emulation_handler.h"
11#include "script.h" 11#include "script.h"
12#include "fixit.h" 12#include "fixit.h"
13 13
14/* OPIE */ 14/* OPIE */
15#include <opie2/ofiledialog.h> 15#include <opie2/ofiledialog.h>
16#include <opie2/oresource.h> 16#include <opie2/oresource.h>
17#include <qpe/filemanager.h> 17#include <qpe/filemanager.h>
18using namespace Opie::Ui; 18using namespace Opie::Ui;
19 19
20/* QT */ 20/* QT */
21#include <qaction.h> 21#include <qaction.h>
22#include <qmenubar.h> 22#include <qmenubar.h>
23#include <qtoolbar.h> 23#include <qtoolbar.h>
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qfileinfo.h> 26#include <qfileinfo.h>
27 27
28/* STD */ 28/* STD */
29#include <assert.h> 29#include <assert.h>
30 30
31#include <opie2/oconfig.h> 31#include <opie2/oconfig.h>
32 32
33MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { 33MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
34 34
35#ifdef FSCKED_DISTRI 35#ifdef FSCKED_DISTRI
36 FixIt fix; 36 FixIt fix;
37 fix.fixIt(); 37 fix.fixIt();
38#endif 38#endif
39 39
40 setCaption(QObject::tr("Opie Console") ); 40 setCaption(QObject::tr("Opie Console") );
41 KeyTrans::loadAll(); 41 KeyTrans::loadAll();
42 for (int i = 0; i < KeyTrans::count(); i++ ) { 42 for (int i = 0; i < KeyTrans::count(); i++ ) {
43 KeyTrans* s = KeyTrans::find(i ); 43 KeyTrans* s = KeyTrans::find(i );
44 assert( s ); 44 assert( s );
45 } 45 }
46 m_factory = new MetaFactory(); 46 m_factory = new MetaFactory();
47 Default def(m_factory); 47 Default def(m_factory);
48 m_sessions.setAutoDelete( TRUE ); 48 m_sessions.setAutoDelete( TRUE );
49 m_curSession = 0; 49 m_curSession = 0;
50 m_manager = new ProfileManager( m_factory ); 50 m_manager = new ProfileManager( m_factory );
51 m_manager->load(); 51 m_manager->load();
52 m_scriptsData.setAutoDelete(TRUE); 52 m_scriptsData.setAutoDelete(TRUE);
53 53
54 initUI(); 54 initUI();
55 populateProfiles(); 55 populateProfiles();
56 populateScripts(); 56 populateScripts();
57} 57}
58 58
59void MainWindow::initUI() { 59void MainWindow::initUI() {
60 60
61 setToolBarsMovable( FALSE ); 61 setToolBarsMovable( FALSE );
62 62
63 /* tool bar for the menu */ 63 /* tool bar for the menu */
64 m_tool = new QToolBar( this ); 64 m_tool = new QToolBar( this );
65 m_tool->setHorizontalStretchable( TRUE ); 65 m_tool->setHorizontalStretchable( TRUE );
66 66
67 m_bar = new QMenuBar( m_tool ); 67 m_bar = new QMenuBar( m_tool );
68 m_console = new QPopupMenu( this ); 68 m_console = new QPopupMenu( this );
69 m_scripts = new QPopupMenu( this ); 69 m_scripts = new QPopupMenu( this );
70 m_sessionsPop= new QPopupMenu( this ); 70 m_sessionsPop= new QPopupMenu( this );
71 m_scriptsPop = new QPopupMenu( this ); 71 m_scriptsPop = new QPopupMenu( this );
72 m_scrollbar = new QPopupMenu( this );
72 73
73 /* add a toolbar for icons */ 74 /* add a toolbar for icons */
74 m_icons = new QToolBar(this); 75 m_icons = new QToolBar(this);
75 76
76 /* 77 /*
77 * the settings action 78 * the settings action
78 */ 79 */
79 m_setProfiles = new QAction(tr("Configure Profiles"), 80 m_setProfiles = new QAction(tr("Configure Profiles"),
80 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), 81 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
81 QString::null, 0, this, 0); 82 QString::null, 0, this, 0);
82 m_setProfiles->addTo( m_console ); 83 m_setProfiles->addTo( m_console );
83 connect( m_setProfiles, SIGNAL(activated() ), 84 connect( m_setProfiles, SIGNAL(activated() ),
84 this, SLOT(slotConfigure() ) ); 85 this, SLOT(slotConfigure() ) );
85 86
86 m_console->insertSeparator(); 87 m_console->insertSeparator();
87 /* 88 /*
88 * new Action for new sessions 89 * new Action for new sessions
89 */ 90 */
90 QAction* newCon = new QAction(tr("New Profile"), 91 QAction* newCon = new QAction(tr("New Profile"),
91 Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), 92 Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
92 QString::null, 0, this, 0); 93 QString::null, 0, this, 0);
93 newCon->addTo( m_console ); 94 newCon->addTo( m_console );
94 connect( newCon, SIGNAL(activated() ), 95 connect( newCon, SIGNAL(activated() ),
95 this, SLOT(slotNew() ) ); 96 this, SLOT(slotNew() ) );
96 97
97 m_console->insertSeparator(); 98 m_console->insertSeparator();
98 99
99 QAction *saveCon = new QAction( tr("Save Profile" ), 100 QAction *saveCon = new QAction( tr("Save Profile" ),
100 Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null, 101 Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null,
101 0, this, 0 ); 102 0, this, 0 );
102 saveCon->addTo( m_console ); 103 saveCon->addTo( m_console );
103 connect( saveCon, SIGNAL(activated() ), 104 connect( saveCon, SIGNAL(activated() ),
104 this, SLOT(slotSaveSession() ) ); 105 this, SLOT(slotSaveSession() ) );
105 m_console->insertSeparator(); 106 m_console->insertSeparator();
106 107
107 /* 108 /*
108 * connect action 109 * connect action
109 */ 110 */
110 m_connect = new QAction( tr("Connect"), Opie::Core::OResource::loadPixmap("console/connected", 111 m_connect = new QAction( tr("Connect"), Opie::Core::OResource::loadPixmap("console/connected",
111 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); 112 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
112 m_connect->addTo( m_console ); 113 m_connect->addTo( m_console );
113 connect(m_connect, SIGNAL(activated() ), 114 connect(m_connect, SIGNAL(activated() ),
114 this, SLOT(slotConnect() ) ); 115 this, SLOT(slotConnect() ) );
115 116
116 /* 117 /*
117 * disconnect action 118 * disconnect action
118 */ 119 */
119 m_disconnect = new QAction( tr("Disconnect"), Opie::Core::OResource::loadPixmap("console/notconnected", 120 m_disconnect = new QAction( tr("Disconnect"), Opie::Core::OResource::loadPixmap("console/notconnected",
120 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); 121 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
121 m_disconnect->addTo( m_console ); 122 m_disconnect->addTo( m_console );
122 connect(m_disconnect, SIGNAL(activated() ), 123 connect(m_disconnect, SIGNAL(activated() ),
123 this, SLOT(slotDisconnect() ) ); 124 this, SLOT(slotDisconnect() ) );
124 125
125 m_console->insertSeparator(); 126 m_console->insertSeparator();
126 127
127#ifndef EAST 128#ifndef EAST
128 m_quickLaunch = new QAction( tr("QuickLaunch"), 129 m_quickLaunch = new QAction( tr("QuickLaunch"),
129 Opie::Core::OResource::loadPixmap("console/konsole_mini", Opie::Core::OResource::SmallIcon ), 130 Opie::Core::OResource::loadPixmap("console/konsole_mini", Opie::Core::OResource::SmallIcon ),
130 QString::null, 0, this, 0 ); 131 QString::null, 0, this, 0 );
131 m_quickLaunch->addTo( m_icons ); 132 m_quickLaunch->addTo( m_icons );
132 connect( m_quickLaunch, SIGNAL( activated() ), 133 connect( m_quickLaunch, SIGNAL( activated() ),
133 this, SLOT( slotQuickLaunch() ) ); 134 this, SLOT( slotQuickLaunch() ) );
134#endif 135#endif
135 136
136 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); 137 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
137 138
138 m_transfer = new QAction( tr("Transfer file..."), Opie::Core::OResource::loadPixmap("pass", Opie::Core::OResource::SmallIcon ), 139 m_transfer = new QAction( tr("Transfer file..."), Opie::Core::OResource::loadPixmap("pass", Opie::Core::OResource::SmallIcon ),
139 QString::null, 0, this, 0 ); 140 QString::null, 0, this, 0 );
140 m_transfer->addTo( m_console ); 141 m_transfer->addTo( m_console );
141 connect(m_transfer, SIGNAL(activated() ), 142 connect(m_transfer, SIGNAL(activated() ),
142 this, SLOT(slotTransfer() ) ); 143 this, SLOT(slotTransfer() ) );
143 144
144 145
145 146
146 /* 147 /*
147 * immediate change of line wrap policy 148 * immediate change of line wrap policy
148 */ 149 */
149 m_isWrapped = true; 150 m_isWrapped = true;
150 m_wrap = new QAction( tr("Line wrap"), Opie::Core::OResource::loadPixmap( "linewrap", Opie::Core::OResource::SmallIcon ), 151 m_wrap = new QAction( tr("Line wrap"), Opie::Core::OResource::loadPixmap( "linewrap", Opie::Core::OResource::SmallIcon ),
151 QString::null, 0, this, 0, true ); 152 QString::null, 0, this, 0, true );
152 m_wrap->addTo( m_console ); 153 m_wrap->addTo( m_console );
153 m_wrap->setOn( true ); 154 m_wrap->setOn( true );
154 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); 155 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
155 156
156 /* 157 /*
157 * fullscreen 158 * fullscreen
158 */ 159 */
159 m_isFullscreen = false; 160 m_isFullscreen = false;
160 161
161 m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen", 162 m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen",
162 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); 163 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
163 m_fullscreen->addTo( m_console ); 164 m_fullscreen->addTo( m_console );
164 connect( m_fullscreen, SIGNAL( activated() ), 165 connect( m_fullscreen, SIGNAL( activated() ),
165 this, SLOT( slotFullscreen() ) ); 166 this, SLOT( slotFullscreen() ) );
166 167
168 /*
169 * scrollbar
170 */
171 sm_none = m_scrollbar->insertItem(tr( "None" ));
172 sm_left = m_scrollbar->insertItem(tr( "Left" ));
173 sm_right = m_scrollbar->insertItem(tr( "Right" ));
174
175 m_console->insertItem(tr("Scrollbar"), m_scrollbar, -1, 0);
176 connect( m_scrollbar, SIGNAL(activated(int)),
177 this, SLOT(slotScrollbarSelected(int)));
178
167 m_console->insertSeparator(); 179 m_console->insertSeparator();
168 180
169 m_recordLog = new QAction(); 181 m_recordLog = new QAction();
170 m_recordLog->setText( tr("Start log") ); 182 m_recordLog->setText( tr("Start log") );
171 m_recordLog->addTo( m_console ); 183 m_recordLog->addTo( m_console );
172 connect(m_recordLog, SIGNAL(activated() ), 184 connect(m_recordLog, SIGNAL(activated() ),
173 this, SLOT( slotSaveLog() ) ); 185 this, SLOT( slotSaveLog() ) );
174 m_recordingLog = false; 186 m_recordingLog = false;
175 187
176 QAction *a = new QAction(); 188 QAction *a = new QAction();
177 a->setText( tr("Save history") ); 189 a->setText( tr("Save history") );
178 a->addTo( m_console ); 190 a->addTo( m_console );
179 connect(a, SIGNAL(activated() ), 191 connect(a, SIGNAL(activated() ),
180 this, SLOT(slotSaveHistory() ) ); 192 this, SLOT(slotSaveHistory() ) );
181 /* 193 /*
182 * terminate action 194 * terminate action
183 */ 195 */
184 m_terminate = new QAction(); 196 m_terminate = new QAction();
185 m_terminate->setText( tr("Terminate") ); 197 m_terminate->setText( tr("Terminate") );
186 m_terminate->addTo( m_console ); 198 m_terminate->addTo( m_console );
187 connect(m_terminate, SIGNAL(activated() ), 199 connect(m_terminate, SIGNAL(activated() ),
188 this, SLOT(slotTerminate() ) ); 200 this, SLOT(slotTerminate() ) );
189 201
190 m_closewindow = new QAction(); 202 m_closewindow = new QAction();
191 m_closewindow->setText( tr("Close Window") ); 203 m_closewindow->setText( tr("Close Window") );
192 m_closewindow->addTo( m_console ); 204 m_closewindow->addTo( m_console );
193 connect( m_closewindow, SIGNAL(activated() ), 205 connect( m_closewindow, SIGNAL(activated() ),
194 this, SLOT(slotClose() ) ); 206 this, SLOT(slotClose() ) );
195 207
196 208
197 /* 209 /*
198 * script actions 210 * script actions
199 */ 211 */
200 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); 212 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
201 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); 213 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
202 214
203 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 215 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
204 m_recordScript->addTo(m_scripts); 216 m_recordScript->addTo(m_scripts);
205 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 217 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
206 218
207 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 219 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
208 m_saveScript->addTo(m_scripts); 220 m_saveScript->addTo(m_scripts);
209 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 221 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
210 222
211 223
212 224
213 225
214 /* 226 /*
215 * action that open/closes the keyboard 227 * action that open/closes the keyboard
216 */ 228 */
217 m_openKeys = new QAction (tr("Open Keyboard..."), 229 m_openKeys = new QAction (tr("Open Keyboard..."),
218 Opie::Core::OResource::loadPixmap( "console/keys/keyboard_icon", Opie::Core::OResource::SmallIcon ), 230 Opie::Core::OResource::loadPixmap( "console/keys/keyboard_icon", Opie::Core::OResource::SmallIcon ),
219 QString::null, 0, this, 0); 231 QString::null, 0, this, 0);
220 m_openKeys->setToggleAction(true); 232 m_openKeys->setToggleAction(true);
221 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); 233 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
222 234
223 /* insert the submenu */ 235 /* insert the submenu */
224 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 236 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
225 -1, 0); 237 -1, 0);
226 238
227 /* insert the connection menu */ 239 /* insert the connection menu */
228 m_bar->insertItem( tr("Connection"), m_console ); 240 m_bar->insertItem( tr("Connection"), m_console );
229 241
230 /* the scripts menu */ 242 /* the scripts menu */
231#ifdef EAST 243#ifdef EAST
232 Opie::Core::OConfig cfg("opie-console"); 244 Opie::Core::OConfig cfg("opie-console");
233 cfg.setGroup("10east"); 245 cfg.setGroup("10east");
234 if( !cfg.readEntry("scripthide",0) ) { 246 if( !cfg.readEntry("scripthide",0) ) {
235 m_bar->insertItem( tr("Scripts"), m_scripts ); 247 m_bar->insertItem( tr("Scripts"), m_scripts );
236 } 248 }
237#endif 249#endif
238 250
239 /* and the keyboard */ 251 /* and the keyboard */
240 m_keyBar = new QToolBar(this); 252 m_keyBar = new QToolBar(this);
241 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 253 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
242 m_keyBar->setHorizontalStretchable( TRUE ); 254 m_keyBar->setHorizontalStretchable( TRUE );
243 m_keyBar->hide(); 255 m_keyBar->hide();
244 256
245 m_kb = new FunctionKeyboard(m_keyBar); 257 m_kb = new FunctionKeyboard(m_keyBar);
246 connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)), 258 connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
247 this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool))); 259 this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool)));
248 260
249 261
250 a = new QAction(tr("Copy"), 262 a = new QAction(tr("Copy"),
251 Opie::Core::OResource::loadPixmap("copy", Opie::Core::OResource::SmallIcon ), QString::null, 263 Opie::Core::OResource::loadPixmap("copy", Opie::Core::OResource::SmallIcon ), QString::null,
252 0, this, 0 ); 264 0, this, 0 );
253 //a->addTo( m_icons ); 265 //a->addTo( m_icons );
254 connect( a, SIGNAL(activated() ), 266 connect( a, SIGNAL(activated() ),
255 this, SLOT(slotCopy() ) ); 267 this, SLOT(slotCopy() ) );
256 268
257 QAction *paste = new QAction(tr("Paste"), 269 QAction *paste = new QAction(tr("Paste"),
258 Opie::Core::OResource::loadPixmap("paste", Opie::Core::OResource::SmallIcon ), QString::null, 270 Opie::Core::OResource::loadPixmap("paste", Opie::Core::OResource::SmallIcon ), QString::null,
259 0, this, 0 ); 271 0, this, 0 );
260 connect( paste, SIGNAL(activated() ), 272 connect( paste, SIGNAL(activated() ),
261 this, SLOT(slotPaste() ) ); 273 this, SLOT(slotPaste() ) );
262 274
@@ -600,192 +612,221 @@ void MainWindow::slotOpenButtons( bool state ) {
600 if ( state ) { 612 if ( state ) {
601 m_buttonBar->show(); 613 m_buttonBar->show();
602 } else { 614 } else {
603 m_buttonBar->hide(); 615 m_buttonBar->hide();
604 } 616 }
605} 617}
606 618
607 619
608 620
609void MainWindow::slotSessionChanged( Session* ses ) { 621void MainWindow::slotSessionChanged( Session* ses ) {
610 if(m_curSession) 622 if(m_curSession)
611 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 623 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
612 if(ses) 624 if(ses)
613 if(ses->transferDialog()) ses->transferDialog()->show(); 625 if(ses->transferDialog()) ses->transferDialog()->show();
614 626
615 if ( ses ) { 627 if ( ses ) {
616 m_curSession = ses; 628 m_curSession = ses;
617 if ( m_curSession->layer()->isConnected() ) { 629 if ( m_curSession->layer()->isConnected() ) {
618 m_connect->setEnabled( false ); 630 m_connect->setEnabled( false );
619 m_disconnect->setEnabled( true ); 631 m_disconnect->setEnabled( true );
620 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); 632 m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording());
621 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); 633 m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording());
622 m_scripts->setItemEnabled(m_runScript_id, true); 634 m_scripts->setItemEnabled(m_runScript_id, true);
623 } else { 635 } else {
624 m_connect->setEnabled( true ); 636 m_connect->setEnabled( true );
625 m_disconnect->setEnabled( false ); 637 m_disconnect->setEnabled( false );
626 m_recordScript->setEnabled( false ); 638 m_recordScript->setEnabled( false );
627 m_saveScript->setEnabled( false ); 639 m_saveScript->setEnabled( false );
628 m_scripts->setItemEnabled(m_runScript_id, false); 640 m_scripts->setItemEnabled(m_runScript_id, false);
629 } 641 }
630 642
631 if ( ( currentSession()->emulationHandler()->isLogging() ) ) { 643 if ( ( currentSession()->emulationHandler()->isLogging() ) ) {
632 m_recordLog->setText( tr("Stop log") ); 644 m_recordLog->setText( tr("Stop log") );
633 } else { 645 } else {
634 m_recordLog->setText( tr("Start log") ); 646 m_recordLog->setText( tr("Start log") );
635 } 647 }
636 648
637 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 649 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
638 m_transfer->setEnabled( false ); 650 m_transfer->setEnabled( false );
639 } else { 651 } else {
640 m_transfer->setEnabled( true ); 652 m_transfer->setEnabled( true );
641 } 653 }
642 654
643 QWidget *w = m_curSession->widget(); 655 QWidget *w = m_curSession->widget();
644 if(w) w->setFocus(); 656 if(w) w->setFocus();
645 657
646 if(currentSession()->profile().readNumEntry("Wrap", 80)){ 658 if(currentSession()->profile().readNumEntry("Wrap", 80)){
647 m_isWrapped = true; 659 m_isWrapped = true;
648 } else { 660 } else {
649 m_isWrapped = false; 661 m_isWrapped = false;
650 } 662 }
651 663
652 m_kb->load(currentSession()->profile()); 664 m_kb->load(currentSession()->profile());
653 } 665 }
654} 666}
655 667
656void MainWindow::slotWrap() 668void MainWindow::slotWrap()
657{ 669{
658 if(m_curSession) 670 if(m_curSession)
659 { 671 {
660 EmulationHandler *e = m_curSession->emulationHandler(); 672 EmulationHandler *e = m_curSession->emulationHandler();
661 if(e) 673 if(e)
662 { 674 {
663 e->setWrap( m_isWrapped ? 80:0 ); 675 e->setWrap( m_isWrapped ? 80:0 );
664 m_isWrapped = !m_isWrapped; 676 m_isWrapped = !m_isWrapped;
665 } 677 }
666 } 678 }
667} 679}
668 680
669void MainWindow::slotFullscreen() { 681void MainWindow::slotFullscreen() {
670 682
671 683
672 684
673 if ( m_isFullscreen ) { 685 if ( m_isFullscreen ) {
674 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); 686 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
675 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); 687 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
676 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 688 ( m_curSession->emulationHandler() )->cornerButton()->hide();
677 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 689 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
678 690
679 } else { 691 } else {
680 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 692 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
681 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 693 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
682 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 694 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
683 , QPoint(0,0), false ); 695 , QPoint(0,0), false );
684 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 696 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
685 ( m_curSession->widgetStack() )->setFocus(); 697 ( m_curSession->widgetStack() )->setFocus();
686 ( m_curSession->widgetStack() )->show(); 698 ( m_curSession->widgetStack() )->show();
687 699
688 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 700 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
689 701
690 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 702 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
691 } 703 }
692 704
693 m_isFullscreen = !m_isFullscreen; 705 m_isFullscreen = !m_isFullscreen;
694} 706}
695 707
708void MainWindow::slotScrollbarSelected(int index)
709{
710 int loc;
711
712 Config cfg( "Konsole" );
713 cfg.setGroup("ScrollBar");
714 if(index == sm_none)
715 {
716 loc = 0;
717 }
718 else if(index == sm_left)
719 {
720 loc = 1;
721 }
722 else if(index == sm_right)
723 {
724 loc = 2;
725 }
726
727 cfg.writeEntry("Position", loc);
728
729 if (currentSession()) {
730 currentSession()->emulationHandler()->setScrollbarLocation(loc);
731 }
732
733 m_scrollbar->setItemChecked(sm_none, index == sm_none);
734 m_scrollbar->setItemChecked(sm_left, index == sm_left);
735 m_scrollbar->setItemChecked(sm_right, index == sm_right);
736}
696 737
697void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 738void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
698 739
699 if ( m_curSession ) { 740 if ( m_curSession ) {
700 741
701 QEvent::Type state; 742 QEvent::Type state;
702 743
703 if (pressed) state = QEvent::KeyPress; 744 if (pressed) state = QEvent::KeyPress;
704 else state = QEvent::KeyRelease; 745 else state = QEvent::KeyRelease;
705 746
706 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 747 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
707 748
708 // is this the best way to do this? cant figure out any other way to work 749 // is this the best way to do this? cant figure out any other way to work
709 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); 750 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
710 ke.ignore(); 751 ke.ignore();
711 } 752 }
712} 753}
713void MainWindow::slotCopy() { 754void MainWindow::slotCopy() {
714 if (!currentSession() ) return; 755 if (!currentSession() ) return;
715 currentSession()->emulationHandler()->copy(); 756 currentSession()->emulationHandler()->copy();
716} 757}
717void MainWindow::slotPaste() { 758void MainWindow::slotPaste() {
718 if (!currentSession() ) return; 759 if (!currentSession() ) return;
719 currentSession()->emulationHandler()->paste(); 760 currentSession()->emulationHandler()->paste();
720} 761}
721 762
722/* 763/*
723 * Save the session 764 * Save the session
724 */ 765 */
725 766
726void MainWindow::slotSaveSession() { 767void MainWindow::slotSaveSession() {
727 if (!currentSession() ) { 768 if (!currentSession() ) {
728 QMessageBox::information(this, tr("Save Connection"), 769 QMessageBox::information(this, tr("Save Connection"),
729 tr("<qt>There is no Connection.</qt>"), 1 ); 770 tr("<qt>There is no Connection.</qt>"), 1 );
730 return; 771 return;
731 } 772 }
732 manager()->add( currentSession()->profile() ); 773 manager()->add( currentSession()->profile() );
733 manager()->save(); 774 manager()->save();
734 populateProfiles(); 775 populateProfiles();
735} 776}
736 777
737 778
738 779
739void MainWindow::slotSaveLog() { 780void MainWindow::slotSaveLog() {
740 781
741 if( currentSession()->emulationHandler()->isLogging() ) { 782 if( currentSession()->emulationHandler()->isLogging() ) {
742 DocLnk nf; 783 DocLnk nf;
743 QString m_logName = currentSession()->emulationHandler()->logFileName(); 784 QString m_logName = currentSession()->emulationHandler()->logFileName();
744 QFileInfo info(m_logName); 785 QFileInfo info(m_logName);
745 nf.setType("text/plain"); 786 nf.setType("text/plain");
746 nf.setFile(m_logName); 787 nf.setFile(m_logName);
747 nf.setName(info.fileName()); 788 nf.setName(info.fileName());
748 nf.writeLink(); 789 nf.writeLink();
749 m_recordLog->setText( tr("Start log") ); 790 m_recordLog->setText( tr("Start log") );
750 m_recordingLog = false; 791 m_recordingLog = false;
751 currentSession()->emulationHandler()->clearLog(); 792 currentSession()->emulationHandler()->clearLog();
752 } else { 793 } else {
753 QMap<QString, QStringList> map; 794 QMap<QString, QStringList> map;
754 QStringList text; 795 QStringList text;
755 text << "text/plain"; 796 text << "text/plain";
756 map.insert(tr("Log"), text ); 797 map.insert(tr("Log"), text );
757 Opie::Core::OConfig cfg("opie-console"); 798 Opie::Core::OConfig cfg("opie-console");
758 cfg.setGroup("defaults"); 799 cfg.setGroup("defaults");
759 QString startDir = cfg.readEntry("defaultlogdir", QPEApplication::documentDir() ); 800 QString startDir = cfg.readEntry("defaultlogdir", QPEApplication::documentDir() );
760 QString m_logName = OFileDialog::getSaveFileName(2, startDir, QString::null, map, 0, startDir); 801 QString m_logName = OFileDialog::getSaveFileName(2, startDir, QString::null, map, 0, startDir);
761 if (m_logName.isEmpty() ) return; 802 if (m_logName.isEmpty() ) return;
762 803
763 m_recordLog->setText( tr("Stop log") ); 804 m_recordLog->setText( tr("Stop log") );
764 m_recordingLog = true; 805 m_recordingLog = true;
765 currentSession()->emulationHandler()->startLogging(m_logName); 806 currentSession()->emulationHandler()->startLogging(m_logName);
766 } 807 }
767} 808}
768 809
769void MainWindow::slotSaveHistory() { 810void MainWindow::slotSaveHistory() {
770 QMap<QString, QStringList> map; 811 QMap<QString, QStringList> map;
771 QStringList text; 812 QStringList text;
772 text << "text/plain"; 813 text << "text/plain";
773 map.insert(tr("History"), text ); 814 map.insert(tr("History"), text );
774 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 815 QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
775 if (filename.isEmpty() ) return; 816 if (filename.isEmpty() ) return;
776 817
777 QFileInfo info(filename); 818 QFileInfo info(filename);
778 819
779 DocLnk nf; 820 DocLnk nf;
780 nf.setType("text/plain"); 821 nf.setType("text/plain");
781 nf.setFile(filename); 822 nf.setFile(filename);
782 nf.setName(info.fileName()); 823 nf.setName(info.fileName());
783 824
784 825
785 QFile file(filename); 826 QFile file(filename);
786 file.open(IO_WriteOnly ); 827 file.open(IO_WriteOnly );
787 QTextStream str(&file ); 828 QTextStream str(&file );
788 if ( currentSession() ) 829 if ( currentSession() )
789 currentSession()->emulationHandler()->emulation()->streamHistory(&str); 830 currentSession()->emulationHandler()->emulation()->streamHistory(&str);
790 831
791 file.close(); 832 file.close();
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index f3c8b81..abdf6ee 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -1,143 +1,152 @@
1#ifndef OPIE_MAIN_WINDOW_H 1#ifndef OPIE_MAIN_WINDOW_H
2#define OPIE_MAIN_WINDOW_H 2#define OPIE_MAIN_WINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlist.h> 5#include <qlist.h>
6#include <qfile.h> 6#include <qfile.h>
7 7
8#include "session.h" 8#include "session.h"
9 9
10/** 10/**
11 * this is the MainWindow of the new opie console 11 * this is the MainWindow of the new opie console
12 * it's also the dispatcher between the different 12 * it's also the dispatcher between the different
13 * actions supported by the gui 13 * actions supported by the gui
14 */ 14 */
15class QToolBar; 15class QToolBar;
16class QToolButton; 16class QToolButton;
17class QMenuBar; 17class QMenuBar;
18class QAction; 18class QAction;
19class MetaFactory; 19class MetaFactory;
20class TabWidget; 20class TabWidget;
21class ProfileManager; 21class ProfileManager;
22class Profile; 22class Profile;
23class FunctionKeyboard; 23class FunctionKeyboard;
24class FKey; 24class FKey;
25class DocLnk; 25class DocLnk;
26 26
27
27class MainWindow : public QMainWindow { 28class MainWindow : public QMainWindow {
28 Q_OBJECT 29 Q_OBJECT
29public: 30public:
30 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); 31 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
31 ~MainWindow(); 32 ~MainWindow();
32 static QString appName() {return QString::fromLatin1("opie-console"); } 33 static QString appName() {return QString::fromLatin1("opie-console"); }
33 34
34 /** 35 /**
35 * our factory to generate IOLayer and so on 36 * our factory to generate IOLayer and so on
36 * 37 *
37 */ 38 */
38 MetaFactory* factory(); 39 MetaFactory* factory();
39 40
40 /** 41 /**
41 * A session contains a QWidget*, 42 * A session contains a QWidget*,
42 * an IOLayer* and some infos for us 43 * an IOLayer* and some infos for us
43 */ 44 */
44 Session* currentSession(); 45 Session* currentSession();
45 46
46 /** 47 /**
47 * the session list 48 * the session list
48 */ 49 */
49 QList<Session> sessions(); 50 QList<Session> sessions();
50 51
51 /** 52 /**
52 * 53 *
53 */ 54 */
54 ProfileManager* manager(); 55 ProfileManager* manager();
55 TabWidget* tabWidget(); 56 TabWidget* tabWidget();
56 57
57private slots: 58private slots:
58 void slotNew(); 59 void slotNew();
59 void slotConnect(); 60 void slotConnect();
60 void slotDisconnect(); 61 void slotDisconnect();
61 void slotTerminate(); 62 void slotTerminate();
62 void slotConfigure(); 63 void slotConfigure();
63 void slotClose(); 64 void slotClose();
64 void slotProfile(int); 65 void slotProfile(int);
65 void slotTransfer(); 66 void slotTransfer();
66 void slotOpenKeb(bool); 67 void slotOpenKeb(bool);
67 void slotOpenButtons(bool); 68 void slotOpenButtons(bool);
68 void slotRecordScript(); 69 void slotRecordScript();
69 void slotSaveScript(); 70 void slotSaveScript();
70 void slotRunScript(int); 71 void slotRunScript(int);
71 void slotFullscreen(); 72 void slotFullscreen();
72 void slotQuickLaunch(); 73 void slotQuickLaunch();
73 void slotWrap(); 74 void slotWrap();
74 void slotSessionChanged( Session* ); 75 void slotSessionChanged( Session* );
75 void slotKeyReceived(FKey, ushort, ushort, bool); 76 void slotKeyReceived(FKey, ushort, ushort, bool);
76 void slotSaveHistory(); 77 void slotSaveHistory();
77 void slotSaveLog(); 78 void slotSaveLog();
79 void slotScrollbarSelected(int);
78 80
79 /* what could these both slot do? */ 81 /* what could these both slot do? */
80 void slotCopy(); 82 void slotCopy();
81 void slotPaste(); 83 void slotPaste();
82 84
83 /* save the currentSession() to Profiles */ 85 /* save the currentSession() to Profiles */
84 void slotSaveSession(); 86 void slotSaveSession();
85 87
86private: 88private:
87 void initUI(); 89 void initUI();
88 void populateProfiles(); 90 void populateProfiles();
89 void populateScripts(); 91 void populateScripts();
90 void create( const Profile& ); 92 void create( const Profile& );
91 /** 93 /**
92 * the current session 94 * the current session
93 */ 95 */
94 Session* m_curSession; 96 Session* m_curSession;
95 97
96 /** 98 /**
97 * the session list 99 * the session list
98 */ 100 */
99 QList<Session> m_sessions; 101 QList<Session> m_sessions;
100 QList<DocLnk> m_scriptsData; 102 QList<DocLnk> m_scriptsData;
101 103
102 /** 104 /**
103 * the metafactory 105 * the metafactory
104 */ 106 */
105 MetaFactory* m_factory; 107 MetaFactory* m_factory;
106 ProfileManager* m_manager; 108 ProfileManager* m_manager;
107 109
110 /*
111 * scrollbar
112 */
113
114 int sm_none, sm_left, sm_right;
115
108 TabWidget* m_consoleWindow; 116 TabWidget* m_consoleWindow;
109 QToolBar* m_tool; 117 QToolBar* m_tool;
110 QToolBar* m_icons; 118 QToolBar* m_icons;
111 QToolBar* m_keyBar; 119 QToolBar* m_keyBar;
112 QToolBar* m_buttonBar; 120 QToolBar* m_buttonBar;
113 QMenuBar* m_bar; 121 QMenuBar* m_bar;
114 QPopupMenu* m_console; 122 QPopupMenu* m_console;
115 QPopupMenu* m_sessionsPop; 123 QPopupMenu* m_sessionsPop;
116 QPopupMenu* m_scriptsPop; 124 QPopupMenu* m_scriptsPop;
117 QPopupMenu* m_scripts; 125 QPopupMenu* m_scripts;
126 QPopupMenu* m_scrollbar;
118 QAction* m_connect; 127 QAction* m_connect;
119 QAction* m_disconnect; 128 QAction* m_disconnect;
120 QAction* m_quickLaunch; 129 QAction* m_quickLaunch;
121 QAction* m_terminate; 130 QAction* m_terminate;
122 QAction* m_transfer; 131 QAction* m_transfer;
123 QAction* m_setProfiles; 132 QAction* m_setProfiles;
124 QAction* m_openKeys; 133 QAction* m_openKeys;
125 QAction* m_openButtons; 134 QAction* m_openButtons;
126 QAction* m_recordScript; 135 QAction* m_recordScript;
127 QAction* m_saveScript; 136 QAction* m_saveScript;
128 QAction* m_fullscreen; 137 QAction* m_fullscreen;
129 QAction* m_wrap; 138 QAction* m_wrap;
130 QAction* m_closewindow; 139 QAction* m_closewindow;
131 QAction* m_recordLog; 140 QAction* m_recordLog;
132 141
133 FunctionKeyboard *m_kb; 142 FunctionKeyboard *m_kb;
134 int m_runScript_id; 143 int m_runScript_id;
135 bool m_isFullscreen; 144 bool m_isFullscreen;
136 bool m_isWrapped; 145 bool m_isWrapped;
137 bool m_recordingLog; 146 bool m_recordingLog;
138 147
139 QWidget* savedParentFullscreen; 148 QWidget* savedParentFullscreen;
140}; 149};
141 150
142 151
143#endif 152#endif