summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/MyPty.cpp2
-rw-r--r--noncore/apps/opie-console/TEWidget.cpp27
-rw-r--r--noncore/apps/opie-console/TEWidget.h20
-rw-r--r--noncore/apps/opie-console/emulation_handler.cpp6
-rw-r--r--noncore/apps/opie-console/emulation_handler.h4
-rw-r--r--noncore/apps/opie-console/file_layer.cpp4
-rw-r--r--noncore/apps/opie-console/io_bt.cpp7
-rw-r--r--noncore/apps/opie-console/io_irda.cpp5
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp49
-rw-r--r--noncore/apps/opie-console/mainwindow.h7
-rw-r--r--noncore/apps/opie-console/opie-console.control2
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp4
-rw-r--r--noncore/apps/opie-console/receive_layer.cpp3
-rw-r--r--noncore/apps/opie-console/session.cpp7
-rw-r--r--noncore/apps/opie-console/session.h7
15 files changed, 123 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp
index 16bb5ff..984e347 100644
--- a/noncore/apps/opie-console/MyPty.cpp
+++ b/noncore/apps/opie-console/MyPty.cpp
@@ -89,49 +89,48 @@
89#undef VERBOSE_DEBUG 89#undef VERBOSE_DEBUG
90 90
91 91
92/* -------------------------------------------------------------------------- */ 92/* -------------------------------------------------------------------------- */
93 93
94/*! 94/*!
95 Informs the client program about the 95 Informs the client program about the
96 actual size of the window. 96 actual size of the window.
97*/ 97*/
98 98
99void MyPty::setSize(int lines, int columns) 99void MyPty::setSize(int lines, int columns)
100{ 100{
101 qWarning("setting size"); 101 qWarning("setting size");
102 struct winsize wsize; 102 struct winsize wsize;
103 wsize.ws_row = (unsigned short)lines; 103 wsize.ws_row = (unsigned short)lines;
104 wsize.ws_col = (unsigned short)columns; 104 wsize.ws_col = (unsigned short)columns;
105 if(m_fd < 0) return; 105 if(m_fd < 0) return;
106 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize); 106 ioctl(m_fd,TIOCSWINSZ,(char *)&wsize);
107} 107}
108 108
109 109
110void MyPty::donePty() 110void MyPty::donePty()
111{ 111{
112 // This is code from the Qt DumbTerminal example 112 // This is code from the Qt DumbTerminal example
113 int status = 0;
114 113
115 ::close(m_fd); 114 ::close(m_fd);
116 115
117 if (m_cpid) { 116 if (m_cpid) {
118 kill(m_cpid, SIGHUP); 117 kill(m_cpid, SIGHUP);
119 //waitpid(m_cpid, &status, 0); 118 //waitpid(m_cpid, &status, 0);
120 delete m_sn_e; 119 delete m_sn_e;
121 delete m_sn_r; 120 delete m_sn_r;
122 m_sn_e = 0l; 121 m_sn_e = 0l;
123 m_sn_r = 0l; 122 m_sn_r = 0l;
124 } 123 }
125 124
126 m_cpid = 0; 125 m_cpid = 0;
127 m_fd = -1; 126 m_fd = -1;
128// emit done(status); 127// emit done(status);
129} 128}
130 129
131 130
132const char* MyPty::deviceName() 131const char* MyPty::deviceName()
133{ 132{
134 return m_ttynam; 133 return m_ttynam;
135} 134}
136 135
137 136
@@ -236,48 +235,49 @@ int MyPty::openPty()
236/*! 235/*!
237 Create an instance. 236 Create an instance.
238*/ 237*/
239MyPty::MyPty(const Profile& prof) : m_cpid(0) 238MyPty::MyPty(const Profile& prof) : m_cpid(0)
240{ 239{
241 240
242 int term = prof.readNumEntry("Terminal", Profile::VT100 ); 241 int term = prof.readNumEntry("Terminal", Profile::VT100 );
243 switch( term ) { 242 switch( term ) {
244 default: 243 default:
245 case Profile::VT100: 244 case Profile::VT100:
246 case Profile::VT102: 245 case Profile::VT102:
247 m_term = "vt100"; 246 m_term = "vt100";
248 break; 247 break;
249 case Profile::Linux: 248 case Profile::Linux:
250 m_term = "linux"; 249 m_term = "linux";
251 break; 250 break;
252 case Profile::XTerm: 251 case Profile::XTerm:
253 m_term = "xterm"; 252 m_term = "xterm";
254 break; 253 break;
255 } 254 }
256 m_sn_e = 0l; 255 m_sn_e = 0l;
257 m_sn_r = 0l; 256 m_sn_r = 0l;
258 m_fd = openPty(); 257 m_fd = openPty();
259 ProcCtl* ctl = ProcCtl::self(); 258 ProcCtl* ctl = ProcCtl::self();
259 Q_UNUSED(ctl);
260} 260}
261 261
262/*! 262/*!
263 Destructor. 263 Destructor.
264 Note that the related client program is not killed 264 Note that the related client program is not killed
265 (yet) when a instance is deleted. 265 (yet) when a instance is deleted.
266*/ 266*/
267MyPty::~MyPty() 267MyPty::~MyPty()
268{ 268{
269 donePty(); 269 donePty();
270} 270}
271QString MyPty::identifier()const { 271QString MyPty::identifier()const {
272 return QString::fromLatin1("term"); 272 return QString::fromLatin1("term");
273} 273}
274QString MyPty::name()const{ 274QString MyPty::name()const{
275 return identifier(); 275 return identifier();
276} 276}
277bool MyPty::open() { 277bool MyPty::open() {
278 if (m_fd < 0) 278 if (m_fd < 0)
279 m_fd = openPty(); 279 m_fd = openPty();
280 280
281 start(); 281 start();
282 return true; 282 return true;
283} 283}
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp
index f3f462f..e4415dc 100644
--- a/noncore/apps/opie-console/TEWidget.cpp
+++ b/noncore/apps/opie-console/TEWidget.cpp
@@ -74,48 +74,73 @@
74 74
75 75
76 76
77// #include "TEWidget.moc" 77// #include "TEWidget.moc"
78//#include <kapp.h> 78//#include <kapp.h>
79//#include <kcursor.h> 79//#include <kcursor.h>
80//#include <kurl.h> 80//#include <kurl.h>
81//#include <kdebug.h> 81//#include <kdebug.h>
82//#include <klocale.h> 82//#include <klocale.h>
83 83
84#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__) 84#define HERE printf("%s(%d): %s\n",__FILE__,__LINE__,__FUNCTION__)
85#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); } 85#define HCNT(Name) // { static int cnt = 1; printf("%s(%d): %s %d\n",__FILE__,__LINE__,Name,cnt++); }
86 86
87#define loc(X,Y) ((Y)*columns+(X)) 87#define loc(X,Y) ((Y)*columns+(X))
88 88
89//FIXME: the rim should normally be 1, 0 only when running in full screen mode. 89//FIXME: the rim should normally be 1, 0 only when running in full screen mode.
90#define rimX 0 // left/right rim width 90#define rimX 0 // left/right rim width
91#define rimY 0 // top/bottom rim high 91#define rimY 0 // top/bottom rim high
92 92
93#define SCRWIDTH 16 // width of the scrollbar 93#define SCRWIDTH 16 // width of the scrollbar
94 94
95#define yMouseScroll 1 95#define yMouseScroll 1
96// scroll increment used when dragging selection at top/bottom of window. 96// scroll increment used when dragging selection at top/bottom of window.
97 97
98/* Button XPM */
99namespace {
100static char * menu_xpm[] = {
101"12 12 5 1",
102 " c None",
103 ".c #000000",
104 "+c #FFFDAD",
105 "@c #FFFF00",
106 "#c #E5E100",
107" ",
108" ",
109" ......... ",
110" .+++++++. ",
111" .+@@@@#. ",
112" .+@@@#. ",
113" .+@@#. ",
114" .+@#. ",
115" .+#. ",
116" .+. ",
117" .. ",
118" "};
119
120}
121
122
98/* ------------------------------------------------------------------------- */ 123/* ------------------------------------------------------------------------- */
99/* */ 124/* */
100/* Colors */ 125/* Colors */
101/* */ 126/* */
102/* ------------------------------------------------------------------------- */ 127/* ------------------------------------------------------------------------- */
103 128
104//FIXME: the default color table is in session.C now. 129//FIXME: the default color table is in session.C now.
105// We need a way to get rid of this one, here. 130// We need a way to get rid of this one, here.
106static const ColorEntry base_color_table[TABLE_COLORS] = 131static const ColorEntry base_color_table[TABLE_COLORS] =
107// The following are almost IBM standard color codes, with some slight 132// The following are almost IBM standard color codes, with some slight
108// gamma correction for the dim colors to compensate for bright X screens. 133// gamma correction for the dim colors to compensate for bright X screens.
109// It contains the 8 ansiterm/xterm colors in 2 intensities. 134// It contains the 8 ansiterm/xterm colors in 2 intensities.
110{ 135{
111 // Fixme: could add faint colors here, also. 136 // Fixme: could add faint colors here, also.
112 // normal 137 // normal
113 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback 138 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 1, 0 ), // Dfore, Dback
114 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red 139 ColorEntry(QColor(0x00,0x00,0x00), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0x18), 0, 0 ), // Black, Red
115 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow 140 ColorEntry(QColor(0x18,0xB2,0x18), 0, 0 ), ColorEntry( QColor(0xB2,0x68,0x18), 0, 0 ), // Green, Yellow
116 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta 141 ColorEntry(QColor(0x18,0x18,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0x18,0xB2), 0, 0 ), // Blue, Magenta
117 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White 142 ColorEntry(QColor(0x18,0xB2,0xB2), 0, 0 ), ColorEntry( QColor(0xB2,0xB2,0xB2), 0, 0 ), // Cyan, White
118 // intensiv 143 // intensiv
119 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ), 144 ColorEntry(QColor(0x00,0x00,0x00), 0, 1 ), ColorEntry( QColor(0xFF,0xFF,0xFF), 1, 0 ),
120 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ), 145 ColorEntry(QColor(0x68,0x68,0x68), 0, 0 ), ColorEntry( QColor(0xFF,0x54,0x54), 0, 0 ),
121 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ), 146 ColorEntry(QColor(0x54,0xFF,0x54), 0, 0 ), ColorEntry( QColor(0xFF,0xFF,0x54), 0, 0 ),
@@ -1220,49 +1245,49 @@ void TEWidget::dropEvent(QDropEvent* event)
1220 1245
1221 if (bPopup) 1246 if (bPopup)
1222 // m_drop->popup(pos() + event->pos()); 1247 // m_drop->popup(pos() + event->pos());
1223 m_drop->popup(mapToGlobal(event->pos())); 1248 m_drop->popup(mapToGlobal(event->pos()));
1224 else 1249 else
1225 { 1250 {
1226 if (currentSession) { 1251 if (currentSession) {
1227 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1252 currentSession->getEmulation()->sendString(dropText.local8Bit());
1228 } 1253 }
1229// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1254// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1230 } 1255 }
1231 } 1256 }
1232 } 1257 }
1233 else if(QTextDrag::decode(event, dropText)) { 1258 else if(QTextDrag::decode(event, dropText)) {
1234// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1259// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1235 if (currentSession) { 1260 if (currentSession) {
1236 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1261 currentSession->getEmulation()->sendString(dropText.local8Bit());
1237 } 1262 }
1238 // Paste it 1263 // Paste it
1239 } 1264 }
1240} 1265}
1241#endif 1266#endif
1242 1267
1243 1268
1244void TEWidget::drop_menu_activated(int item) 1269void TEWidget::drop_menu_activated(int)
1245{ 1270{
1246#ifndef QT_NO_DRAGANDDROP 1271#ifndef QT_NO_DRAGANDDROP
1247 switch (item) 1272 switch (item)
1248 { 1273 {
1249 case 0: // paste 1274 case 0: // paste
1250 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1275 currentSession->getEmulation()->sendString(dropText.local8Bit());
1251// KWM::activate((Window)this->winId()); 1276// KWM::activate((Window)this->winId());
1252 break; 1277 break;
1253 case 1: // cd ... 1278 case 1: // cd ...
1254 currentSession->getEmulation()->sendString("cd "); 1279 currentSession->getEmulation()->sendString("cd ");
1255 struct stat statbuf; 1280 struct stat statbuf;
1256 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) 1281 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 )
1257 { 1282 {
1258 if ( !S_ISDIR(statbuf.st_mode) ) 1283 if ( !S_ISDIR(statbuf.st_mode) )
1259 { 1284 {
1260/* 1285/*
1261 KURL url; 1286 KURL url;
1262 url.setPath( dropText ); 1287 url.setPath( dropText );
1263 dropText = url.directory( true, false ); // remove filename 1288 dropText = url.directory( true, false ); // remove filename
1264*/ 1289*/
1265 } 1290 }
1266 } 1291 }
1267 dropText.replace(QRegExp(" "), "\\ "); // escape spaces 1292 dropText.replace(QRegExp(" "), "\\ "); // escape spaces
1268 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1293 currentSession->getEmulation()->sendString(dropText.local8Bit());
diff --git a/noncore/apps/opie-console/TEWidget.h b/noncore/apps/opie-console/TEWidget.h
index 1b5300f..f03a16e 100644
--- a/noncore/apps/opie-console/TEWidget.h
+++ b/noncore/apps/opie-console/TEWidget.h
@@ -13,67 +13,49 @@
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14/* */ 14/* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16/* */ 16/* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18#ifndef TE_WIDGET_H 18#ifndef TE_WIDGET_H
19#define TE_WIDGET_H 19#define TE_WIDGET_H
20 20
21#include <qwidget.h> 21#include <qwidget.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qtimer.h> 23#include <qtimer.h>
24#include <qcolor.h> 24#include <qcolor.h>
25#include <qkeycode.h> 25#include <qkeycode.h>
26#include <qscrollbar.h> 26#include <qscrollbar.h>
27 27
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30 30
31#include "TECommon.h" 31#include "TECommon.h"
32 32
33extern unsigned short vt100_graphics[32]; 33extern unsigned short vt100_graphics[32];
34 34
35 35
36 36
37static char * menu_xpm[] = { 37
38"12 12 5 1",
39 " c None",
40 ".c #000000",
41 "+c #FFFDAD",
42 "@c #FFFF00",
43 "#c #E5E100",
44" ",
45" ",
46" ......... ",
47" .+++++++. ",
48" .+@@@@#. ",
49" .+@@@#. ",
50" .+@@#. ",
51" .+@#. ",
52" .+#. ",
53" .+. ",
54" .. ",
55" "};
56 38
57class TESession; 39class TESession;
58 40
59// class Konsole; 41// class Konsole;
60 42
61class TEWidget : public QFrame 43class TEWidget : public QFrame
62// a widget representing attributed text 44// a widget representing attributed text
63{ 45{
64 Q_OBJECT 46 Q_OBJECT
65 47
66// friend class Konsole; 48// friend class Konsole;
67 49
68public: 50public:
69 51
70 TEWidget(QWidget *parent=0, const char *name=0); 52 TEWidget(QWidget *parent=0, const char *name=0);
71 virtual ~TEWidget(); 53 virtual ~TEWidget();
72 54
73public: 55public:
74 56
75 QColor getDefaultBackColor(); 57 QColor getDefaultBackColor();
76 QPushButton *cornerButton(); 58 QPushButton *cornerButton();
77 59
78 const ColorEntry* getColorTable() const; 60 const ColorEntry* getColorTable() const;
79 const ColorEntry* getdefaultColorTable() const; 61 const ColorEntry* getdefaultColorTable() const;
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp
index bdc8b43..bb3dd28 100644
--- a/noncore/apps/opie-console/emulation_handler.cpp
+++ b/noncore/apps/opie-console/emulation_handler.cpp
@@ -171,24 +171,30 @@ QPushButton* EmulationHandler::cornerButton() {
171Script *EmulationHandler::script() { 171Script *EmulationHandler::script() {
172 return m_script; 172 return m_script;
173} 173}
174 174
175bool EmulationHandler::isRecording() { 175bool EmulationHandler::isRecording() {
176 return (m_script != 0); 176 return (m_script != 0);
177} 177}
178 178
179void EmulationHandler::startRecording() { 179void EmulationHandler::startRecording() {
180 if (!isRecording()) 180 if (!isRecording())
181 m_script = new Script(); 181 m_script = new Script();
182} 182}
183 183
184void EmulationHandler::clearScript() { 184void EmulationHandler::clearScript() {
185 if (isRecording()) { 185 if (isRecording()) {
186 delete m_script; 186 delete m_script;
187 m_script = 0; 187 m_script = 0;
188 } 188 }
189} 189}
190 190
191void EmulationHandler::runScript(const Script *script) { 191void EmulationHandler::runScript(const Script *script) {
192 emit send(script->script()); 192 emit send(script->script());
193} 193}
194 194
195void EmulationHandler::copy() {
196 m_teWid->emitSelection();
197}
198void EmulationHandler::paste() {
199 m_teWid->pasteClipboard();
200}
diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h
index 7ca2cf3..12abbc5 100644
--- a/noncore/apps/opie-console/emulation_handler.h
+++ b/noncore/apps/opie-console/emulation_handler.h
@@ -28,63 +28,65 @@ class QWidget;
28class QPushButton; 28class QPushButton;
29class TEWidget; 29class TEWidget;
30class TEmulation; 30class TEmulation;
31class QFont; 31class QFont;
32class Script; 32class Script;
33class EmulationHandler : public QObject { 33class EmulationHandler : public QObject {
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 /** 36 /**
37 * simple c'tor the parent of the TEWdiget 37 * simple c'tor the parent of the TEWdiget
38 * and a name 38 * and a name
39 * and a Profile 39 * and a Profile
40 */ 40 */
41 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l ); 41 EmulationHandler( const Profile&, QWidget* parent, const char* name = 0l );
42 42
43 /** 43 /**
44 * delete all components 44 * delete all components
45 */ 45 */
46 ~EmulationHandler(); 46 ~EmulationHandler();
47 47
48 void load( const Profile& ); 48 void load( const Profile& );
49 QWidget* widget(); 49 QWidget* widget();
50 void setColor( const QColor& fore, const QColor& back ); 50 void setColor( const QColor& fore, const QColor& back );
51 QPushButton* cornerButton(); 51 QPushButton* cornerButton();
52 52
53 /* Scripts */ 53 /* Scripts */
54 /* Create a new script and record all typed characters */ 54 /* Create a new script and record all typed characters */
55 void startRecording(); 55 void startRecording();
56 56
57 /* Return whether we are currently recording a script */ 57 /* Return whether we are currently recording a script */
58 bool isRecording(); 58 bool isRecording();
59 59
60 /* Return the current script (or NULL) */ 60 /* Return the current script (or NULL) */
61 Script *script(); 61 Script *script();
62 62
63 /* Stop recording and remove the current script from memory */ 63 /* Stop recording and remove the current script from memory */
64 void clearScript(); 64 void clearScript();
65 65
66 /* Run a script by forwarding its keys to the EmulationLayer */ 66 /* Run a script by forwarding its keys to the EmulationLayer */
67 void runScript(const Script *); 67 void runScript(const Script *);
68 68
69signals: 69signals:
70 void send( const QByteArray& ); 70 void send( const QByteArray& );
71 void changeSize(int rows, int cols ); 71 void changeSize(int rows, int cols );
72 72
73 73
74public slots: 74public slots:
75 void recv( const QByteArray& ); 75 void recv( const QByteArray& );
76 void paste();
77 void copy();
76 78
77private slots: 79private slots:
78 void recvEmulation( const char*, int len ); 80 void recvEmulation( const char*, int len );
79private: 81private:
80 QFont font( int ); 82 QFont font( int );
81 QColor foreColor(int ); 83 QColor foreColor(int );
82 QColor backColor(int ); 84 QColor backColor(int );
83 85
84private: 86private:
85 TEWidget* m_teWid; 87 TEWidget* m_teWid;
86 TEmulation* m_teEmu; 88 TEmulation* m_teEmu;
87 Script * m_script; 89 Script * m_script;
88}; 90};
89 91
90#endif 92#endif
diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp
index 43e9c8f..0c83700 100644
--- a/noncore/apps/opie-console/file_layer.cpp
+++ b/noncore/apps/opie-console/file_layer.cpp
@@ -1,23 +1,23 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <opie/oprocess.h> 2#include <opie/oprocess.h>
3 3
4#include "file_layer.h" 4#include "file_layer.h"
5 5
6FileTransferLayer::FileTransferLayer(IOLayer *layer) 6FileTransferLayer::FileTransferLayer(IOLayer *layer)
7 : QObject(), m_layer( layer ) 7 : QObject(), m_layer( layer )
8{ 8{
9} 9}
10 10
11FileTransferLayer::~FileTransferLayer() { 11FileTransferLayer::~FileTransferLayer() {
12} 12}
13 13
14void FileTransferLayer::sendFile(const QFile& file) { 14void FileTransferLayer::sendFile(const QFile&) {
15 15
16} 16}
17 17
18void FileTransferLayer::sendFile(const QString& file) { 18void FileTransferLayer::sendFile(const QString&) {
19} 19}
20 20
21IOLayer* FileTransferLayer::layer() { 21IOLayer* FileTransferLayer::layer() {
22 return m_layer; 22 return m_layer;
23} 23}
diff --git a/noncore/apps/opie-console/io_bt.cpp b/noncore/apps/opie-console/io_bt.cpp
index 4486eea..8dd8151 100644
--- a/noncore/apps/opie-console/io_bt.cpp
+++ b/noncore/apps/opie-console/io_bt.cpp
@@ -3,75 +3,78 @@
3 3
4IOBt::IOBt( const Profile &config ) : IOSerial( config ) { 4IOBt::IOBt( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 5 m_attach = 0;
6} 6}
7 7
8 8
9IOBt::~IOBt() { 9IOBt::~IOBt() {
10 if ( m_attach ) { 10 if ( m_attach ) {
11 delete m_attach; 11 delete m_attach;
12 } 12 }
13} 13}
14 14
15 15
16void IOBt::close() { 16void IOBt::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 if ( m_attach ) { 20 if ( m_attach ) {
21 delete m_attach; 21 delete m_attach;
22 m_attach = 0; 22 m_attach = 0;
23 } 23 }
24} 24}
25 25
26bool IOBt::open() { 26bool IOBt::open() {
27 bool ret = false;
27 28
28 // only set up bt stuff if mac address was set, otherwise use the device set 29 // only set up bt stuff if mac address was set, otherwise use the device set
29 if ( !m_mac.isEmpty() ) { 30 if ( !m_mac.isEmpty() ) {
30 31
31 // now it should also be checked, if there is a connection to the device with that mac allready 32 // now it should also be checked, if there is a connection to the device with that mac allready
32 // hciattach here 33 // hciattach here
33 m_attach = new OProcess(); 34 m_attach = new OProcess();
34 *m_attach << "hciattach /dev/ttyS2 any 57600"; 35 *m_attach << "hciattach /dev/ttyS2 any 57600";
35 36
36 // then start hcid, then rcfomm handling (m_mac) 37 // then start hcid, then rcfomm handling (m_mac)
37 38
38 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 39 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
39 this, SLOT( slotExited( OProcess* ) ) ); 40 this, SLOT( slotExited( OProcess* ) ) );
40 41
41 if ( m_attach->start() ) { 42 if ( m_attach->start() ) {
42 IOSerial::open(); 43 ret = IOSerial::open();
43 } else { 44 } else {
44 qWarning("could not attach to device"); 45 qWarning("could not attach to device");
45 delete m_attach; 46 delete m_attach;
46 m_attach = 0; 47 m_attach = 0;
47 } 48 }
48 } else { 49 } else {
49 // directly to the normal serial 50 // directly to the normal serial
50 // TODO: look first if the connection really exists. ( is set up ) 51 // TODO: look first if the connection really exists. ( is set up )
51 52
52 IOSerial::open(); 53 ret =IOSerial::open();
53 } 54 }
55 return ret;
54} 56}
55 57
56void IOBt::reload( const Profile &config ) { 58void IOBt::reload( const Profile &config ) {
57 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE); 59 m_device = config.readEntry("Device", BT_DEFAULT_DEVICE);
58 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC); 60 m_mac = config.readEntry("Mac", BT_DEFAULT_MAC);
59 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD); 61 m_baud = config.readNumEntry("Baud", BT_DEFAULT_BAUD);
60 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY); 62 m_parity = config.readNumEntry("Parity", BT_DEFAULT_PARITY);
61 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS); 63 m_dbits = config.readNumEntry("DataBits", BT_DEFAULT_DBITS);
62 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS); 64 m_sbits = config.readNumEntry("StopBits", BT_DEFAULT_SBITS);
63 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW); 65 m_flow = config.readNumEntry("Flow", BT_DEFAULT_FLOW);
64} 66}
65 67
66 68
67QString IOBt::identifier() const { 69QString IOBt::identifier() const {
68 return "bluetooth"; 70 return "bluetooth";
69} 71}
70 72
71QString IOBt::name() const { 73QString IOBt::name() const {
72 return "BLuetooth IO Layer"; 74 return "BLuetooth IO Layer";
73} 75}
74 76
75void IOBt::slotExited( OProcess* proc ){ 77void IOBt::slotExited( OProcess* proc ){
76 close(); 78 close();
79 delete proc;
77} 80}
diff --git a/noncore/apps/opie-console/io_irda.cpp b/noncore/apps/opie-console/io_irda.cpp
index 56a373c..b3b693f 100644
--- a/noncore/apps/opie-console/io_irda.cpp
+++ b/noncore/apps/opie-console/io_irda.cpp
@@ -1,62 +1,65 @@
1 1
2#include "io_irda.h" 2#include "io_irda.h"
3 3
4IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) { 4IOIrda::IOIrda( const Profile &config ) : IOSerial( config ) {
5 m_attach = 0; 5 m_attach = 0;
6} 6}
7 7
8 8
9IOIrda::~IOIrda() { 9IOIrda::~IOIrda() {
10 if ( m_attach ) { 10 if ( m_attach ) {
11 delete m_attach; 11 delete m_attach;
12 } 12 }
13} 13}
14 14
15 15
16void IOIrda::close() { 16void IOIrda::close() {
17 17
18 IOSerial::close(); 18 IOSerial::close();
19 // still need error handling 19 // still need error handling
20 delete m_attach; 20 delete m_attach;
21} 21}
22 22
23bool IOIrda::open() { 23bool IOIrda::open() {
24 bool ret;
24 25
25 // irdaattach here 26 // irdaattach here
26 m_attach = new OProcess(); 27 m_attach = new OProcess();
27 *m_attach << "irattach /dev/ttyS2 -s"; 28 *m_attach << "irattach /dev/ttyS2 -s";
28 29
29 connect( m_attach, SIGNAL( processExited( OProcess* ) ), 30 connect( m_attach, SIGNAL( processExited( OProcess* ) ),
30 this, SLOT( slotExited( OProcess* ) ) ); 31 this, SLOT( slotExited( OProcess* ) ) );
31 32
32 if ( m_attach->start() ) { 33 if ( m_attach->start() ) {
33 IOSerial::open(); 34 ret= IOSerial::open();
34 } else { 35 } else {
35 // emit error!!! 36 // emit error!!!
36 qWarning("could not attach to device"); 37 qWarning("could not attach to device");
37 delete m_attach; 38 delete m_attach;
38 m_attach = 0l; 39 m_attach = 0l;
39 } 40 }
41 return ret;
40} 42}
41 43
42void IOIrda::reload( const Profile &config ) { 44void IOIrda::reload( const Profile &config ) {
43 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE); 45 m_device = config.readEntry("Device", IRDA_DEFAULT_DEVICE);
44 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD); 46 m_baud = config.readNumEntry("Baud", IRDA_DEFAULT_BAUD);
45 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY); 47 m_parity = config.readNumEntry("Parity", IRDA_DEFAULT_PARITY);
46 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS); 48 m_dbits = config.readNumEntry("DataBits", IRDA_DEFAULT_DBITS);
47 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS); 49 m_sbits = config.readNumEntry("StopBits", IRDA_DEFAULT_SBITS);
48 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW); 50 m_flow = config.readNumEntry("Flow", IRDA_DEFAULT_FLOW);
49} 51}
50 52
51 53
52QString IOIrda::identifier() const { 54QString IOIrda::identifier() const {
53 return "irda"; 55 return "irda";
54} 56}
55 57
56QString IOIrda::name() const { 58QString IOIrda::name() const {
57 return "Irda IO Layer"; 59 return "Irda IO Layer";
58} 60}
59 61
60void IOIrda::slotExited(OProcess* proc ){ 62void IOIrda::slotExited(OProcess* proc ){
61 close(); 63 close();
64 delete proc;
62} 65}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index e2f4d12..02a3fa9 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -68,48 +68,58 @@ void MainWindow::initUI() {
68 /* 68 /*
69 * the settings action 69 * the settings action
70 */ 70 */
71 m_setProfiles = new QAction(tr("Configure Profiles"), 71 m_setProfiles = new QAction(tr("Configure Profiles"),
72 Resource::loadPixmap( "SettingsIcon" ), 72 Resource::loadPixmap( "SettingsIcon" ),
73 QString::null, 0, this, 0); 73 QString::null, 0, this, 0);
74 // m_setProfiles->addTo( m_settings ); 74 // m_setProfiles->addTo( m_settings );
75 m_setProfiles->addTo( m_icons ); 75 m_setProfiles->addTo( m_icons );
76 m_setProfiles->addTo( m_console ); 76 m_setProfiles->addTo( m_console );
77 connect( m_setProfiles, SIGNAL(activated() ), 77 connect( m_setProfiles, SIGNAL(activated() ),
78 this, SLOT(slotConfigure() ) ); 78 this, SLOT(slotConfigure() ) );
79 79
80 m_console->insertSeparator(); 80 m_console->insertSeparator();
81 /* 81 /*
82 * new Action for new sessions 82 * new Action for new sessions
83 */ 83 */
84 QAction* a = new QAction(tr("New Connection"), 84 QAction* a = new QAction(tr("New Connection"),
85 Resource::loadPixmap( "new" ), 85 Resource::loadPixmap( "new" ),
86 QString::null, 0, this, 0); 86 QString::null, 0, this, 0);
87 a->addTo( m_console ); 87 a->addTo( m_console );
88 a->addTo( m_icons ); 88 a->addTo( m_icons );
89 connect(a, SIGNAL(activated() ), 89 connect(a, SIGNAL(activated() ),
90 this, SLOT(slotNew() ) ); 90 this, SLOT(slotNew() ) );
91 91
92 m_console->insertSeparator();
93 /* save icon is not available */
94 a = new QAction(tr("Save Connection"),
95 Resource::loadPixmap("save"), QString::null,
96 0, this, 0 );
97 a->addTo( m_console );
98 connect(a, SIGNAL(activated() ),
99 this, SLOT(slotSaveSession() ) );
100 m_console->insertSeparator();
101
92 /* 102 /*
93 * connect action 103 * connect action
94 */ 104 */
95 m_connect = new QAction(); 105 m_connect = new QAction();
96 m_connect->setText( tr("Connect") ); 106 m_connect->setText( tr("Connect") );
97 m_connect->addTo( m_console ); 107 m_connect->addTo( m_console );
98 connect(m_connect, SIGNAL(activated() ), 108 connect(m_connect, SIGNAL(activated() ),
99 this, SLOT(slotConnect() ) ); 109 this, SLOT(slotConnect() ) );
100 110
101 /* 111 /*
102 * disconnect action 112 * disconnect action
103 */ 113 */
104 m_disconnect = new QAction(); 114 m_disconnect = new QAction();
105 m_disconnect->setText( tr("Disconnect") ); 115 m_disconnect->setText( tr("Disconnect") );
106 m_disconnect->addTo( m_console ); 116 m_disconnect->addTo( m_console );
107 connect(m_disconnect, SIGNAL(activated() ), 117 connect(m_disconnect, SIGNAL(activated() ),
108 this, SLOT(slotDisconnect() ) ); 118 this, SLOT(slotDisconnect() ) );
109 119
110 m_console->insertSeparator(); 120 m_console->insertSeparator();
111 121
112 m_transfer = new QAction(); 122 m_transfer = new QAction();
113 m_transfer->setText( tr("Transfer file...") ); 123 m_transfer->setText( tr("Transfer file...") );
114 m_transfer->addTo( m_console ); 124 m_transfer->addTo( m_console );
115 connect(m_transfer, SIGNAL(activated() ), 125 connect(m_transfer, SIGNAL(activated() ),
@@ -155,94 +165,108 @@ void MainWindow::initUI() {
155 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 165 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
156 m_saveScript->addTo(m_scripts); 166 m_saveScript->addTo(m_scripts);
157 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 167 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
158 168
159 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); 169 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
160 m_runScript->addTo(m_scripts); 170 m_runScript->addTo(m_scripts);
161 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); 171 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
162 172
163 /* 173 /*
164 * action that open/closes the keyboard 174 * action that open/closes the keyboard
165 */ 175 */
166 m_openKeys = new QAction (tr("Open Keyboard..."), 176 m_openKeys = new QAction (tr("Open Keyboard..."),
167 Resource::loadPixmap( "down" ), 177 Resource::loadPixmap( "down" ),
168 QString::null, 0, this, 0); 178 QString::null, 0, this, 0);
169 179
170 m_openKeys->setToggleAction(true); 180 m_openKeys->setToggleAction(true);
171 181
172 connect (m_openKeys, SIGNAL(toggled(bool)), 182 connect (m_openKeys, SIGNAL(toggled(bool)),
173 this, SLOT(slotOpenKeb(bool))); 183 this, SLOT(slotOpenKeb(bool)));
174 m_openKeys->addTo(m_icons); 184 m_openKeys->addTo(m_icons);
175 185
176 186
177 /* 187 /*
178 * action that open/closes the keyboard 188 * action that open/closes the keyboard
179 189
180 m_openButtons = new QAction ( tr( "Open Buttons..." ), 190 m_openButtons = new QAction ( tr( "Open Buttons..." ),
181 Resource::loadPixmap( "" ), 191 Resource::loadPixmap( "" ),
182 QString::null, 0, this, 0 ); 192 QString::null, 0, this, 0 );
183 193
184 m_openButtons->setToggleAction( true ); 194 m_openButtons->setToggleAction( true );
185 195
186 connect ( m_openButtons, SIGNAL( toggled( bool ) ), 196 connect ( m_openButtons, SIGNAL( toggled( bool ) ),
187 this, SLOT( slotOpenButtons( bool ) ) ); 197 this, SLOT( slotOpenButtons( bool ) ) );
188 m_openButtons->addTo( m_icons ); 198 m_openButtons->addTo( m_icons );
189 199
190 */ 200 */
191 201
192 /* insert the submenu */ 202 /* insert the submenu */
193 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 203 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
194 -1, 0); 204 -1, 0);
195 205
196 /* insert the connection menu */ 206 /* insert the connection menu */
197 m_bar->insertItem( tr("Connection"), m_console ); 207 m_bar->insertItem( tr("Connection"), m_console );
198 208
199 /* the scripts menu */ 209 /* the scripts menu */
200 m_bar->insertItem( tr("Scripts"), m_scripts ); 210 m_bar->insertItem( tr("Scripts"), m_scripts );
201 211
202 /* the settings menu */ 212 /* the settings menu */
203 // m_bar->insertItem( tr("Settings"), m_settings ); 213 // m_bar->insertItem( tr("Settings"), m_settings );
204 214
205 /* and the keyboard */ 215 /* and the keyboard */
206 m_keyBar = new QToolBar(this); 216 m_keyBar = new QToolBar(this);
207 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 217 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
208 m_keyBar->setHorizontalStretchable( TRUE ); 218 m_keyBar->setHorizontalStretchable( TRUE );
209 m_keyBar->hide(); 219 m_keyBar->hide();
210 220
211 m_kb = new FunctionKeyboard(m_keyBar); 221 m_kb = new FunctionKeyboard(m_keyBar);
212 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 222 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
213 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 223 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
214 224
215 m_buttonBar = new QToolBar( this ); 225 m_buttonBar = new QToolBar( this );
216 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); 226 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE );
217 m_buttonBar->setHorizontalStretchable( TRUE ); 227 m_buttonBar->setHorizontalStretchable( TRUE );
218 m_buttonBar->hide(); 228 m_buttonBar->hide();
219 229
220 /* 230 /*
221 m_qb = new QuickButton( m_buttonBar ); 231 m_qb = new QuickButton( m_buttonBar );
222 connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), 232 connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ),
223 this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); 233 this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) );
224 */ 234 */
235 /* now add the copy and paste actions */
236 a = new QAction(tr("Copy"),
237 Resource::loadPixmap("copy"), QString::null,
238 0, this, 0 );
239 //a->addTo( m_icons );
240 connect( a, SIGNAL(activated() ),
241 this, SLOT(slotCopy() ) );
242
243 a = new QAction(tr("Paste"),
244 Resource::loadPixmap("paste"), QString::null,
245 0, this, 0 );
246 a->addTo( m_icons );
247 connect( a, SIGNAL(activated() ),
248 this, SLOT(slotPaste() ) );
225 249
226 250
227 m_connect->setEnabled( false ); 251 m_connect->setEnabled( false );
228 m_disconnect->setEnabled( false ); 252 m_disconnect->setEnabled( false );
229 m_terminate->setEnabled( false ); 253 m_terminate->setEnabled( false );
230 m_transfer->setEnabled( false ); 254 m_transfer->setEnabled( false );
231 m_recordScript->setEnabled( false ); 255 m_recordScript->setEnabled( false );
232 m_saveScript->setEnabled( false ); 256 m_saveScript->setEnabled( false );
233 m_runScript->setEnabled( false ); 257 m_runScript->setEnabled( false );
234 m_fullscreen->setEnabled( false ); 258 m_fullscreen->setEnabled( false );
235 m_closewindow->setEnabled( false ); 259 m_closewindow->setEnabled( false );
236 260
237 /* 261 /*
238 * connect to the menu activation 262 * connect to the menu activation
239 */ 263 */
240 connect( m_sessionsPop, SIGNAL(activated( int ) ), 264 connect( m_sessionsPop, SIGNAL(activated( int ) ),
241 this, SLOT(slotProfile( int ) ) ); 265 this, SLOT(slotProfile( int ) ) );
242 266
243 m_consoleWindow = new TabWidget( this, "blah"); 267 m_consoleWindow = new TabWidget( this, "blah");
244 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 268 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
245 this, SLOT(slotSessionChanged(Session*) ) ); 269 this, SLOT(slotSessionChanged(Session*) ) );
246 setCentralWidget( m_consoleWindow ); 270 setCentralWidget( m_consoleWindow );
247 271
248} 272}
@@ -518,24 +542,47 @@ void MainWindow::slotFullscreen() {
518 542
519 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 543 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
520 } 544 }
521 545
522 m_isFullscreen = !m_isFullscreen; 546 m_isFullscreen = !m_isFullscreen;
523} 547}
524 548
525 549
526void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 550void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
527 551
528 if ( m_curSession ) { 552 if ( m_curSession ) {
529 553
530 QEvent::Type state; 554 QEvent::Type state;
531 555
532 if (pressed) state = QEvent::KeyPress; 556 if (pressed) state = QEvent::KeyPress;
533 else state = QEvent::KeyRelease; 557 else state = QEvent::KeyRelease;
534 558
535 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 559 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
536 560
537 // where should i send this event? doesnt work sending it here 561 // where should i send this event? doesnt work sending it here
538 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); 562 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
539 ke.ignore(); 563 ke.ignore();
540 } 564 }
541} 565}
566void MainWindow::slotCopy() {
567 if (!currentSession() ) return;
568 currentSession()->emulationHandler()->copy();
569}
570void MainWindow::slotPaste() {
571 if (!currentSession() ) return;
572 currentSession()->emulationHandler()->paste();
573}
574
575/*
576 * Save the session
577 */
578
579void MainWindow::slotSaveSession() {
580 if (!currentSession() ) {
581 QMessageBox::information(this, tr("Save Connection"),
582 tr("<qt>There is no Connection.</qt>"), 1 );
583 return;
584 }
585 manager()->add( currentSession()->profile() );
586 manager()->save();
587 populateProfiles();
588}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 0f52e76..16b6252 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -49,48 +49,55 @@ public:
49 /** 49 /**
50 * 50 *
51 */ 51 */
52 ProfileManager* manager(); 52 ProfileManager* manager();
53 TabWidget* tabWidget(); 53 TabWidget* tabWidget();
54 54
55private slots: 55private slots:
56 void slotNew(); 56 void slotNew();
57 void slotConnect(); 57 void slotConnect();
58 void slotDisconnect(); 58 void slotDisconnect();
59 void slotTerminate(); 59 void slotTerminate();
60 void slotConfigure(); 60 void slotConfigure();
61 void slotClose(); 61 void slotClose();
62 void slotProfile(int); 62 void slotProfile(int);
63 void slotTransfer(); 63 void slotTransfer();
64 void slotOpenKeb(bool); 64 void slotOpenKeb(bool);
65 void slotOpenButtons(bool); 65 void slotOpenButtons(bool);
66 void slotRecordScript(); 66 void slotRecordScript();
67 void slotSaveScript(); 67 void slotSaveScript();
68 void slotRunScript(); 68 void slotRunScript();
69 void slotFullscreen(); 69 void slotFullscreen();
70 void slotSessionChanged( Session* ); 70 void slotSessionChanged( Session* );
71 void slotKeyReceived(FKey, ushort, ushort, bool); 71 void slotKeyReceived(FKey, ushort, ushort, bool);
72 72
73 /* what could these both slot do? */
74 void slotCopy();
75 void slotPaste();
76
77 /* save the currentSession() to Profiles */
78 void slotSaveSession();
79
73private: 80private:
74 void initUI(); 81 void initUI();
75 void populateProfiles(); 82 void populateProfiles();
76 void create( const Profile& ); 83 void create( const Profile& );
77 /** 84 /**
78 * the current session 85 * the current session
79 */ 86 */
80 Session* m_curSession; 87 Session* m_curSession;
81 88
82 /** 89 /**
83 * the session list 90 * the session list
84 */ 91 */
85 QList<Session> m_sessions; 92 QList<Session> m_sessions;
86 93
87 /** 94 /**
88 * the metafactory 95 * the metafactory
89 */ 96 */
90 MetaFactory* m_factory; 97 MetaFactory* m_factory;
91 ProfileManager* m_manager; 98 ProfileManager* m_manager;
92 99
93 TabWidget* m_consoleWindow; 100 TabWidget* m_consoleWindow;
94 QToolBar* m_tool; 101 QToolBar* m_tool;
95 QToolBar* m_icons; 102 QToolBar* m_icons;
96 QToolBar* m_keyBar; 103 QToolBar* m_keyBar;
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control
index d41ef58..8541d22 100644
--- a/noncore/apps/opie-console/opie-console.control
+++ b/noncore/apps/opie-console/opie-console.control
@@ -1,10 +1,10 @@
1Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* etc/keytabs/default.Keytab 1Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* etc/keytabs/default.Keytab bin/sz bin/rz
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Opie team <opie@handhelds.org> 4Maintainer: Opie team <opie@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: 0.6-$SUB_VERSION 6Version: 0.6-$SUB_VERSION
7Depends: qpe-base ($QPE_VERSION), libopie ($QPE_VERSION), opie-console-help-en 7Depends: qpe-base ($QPE_VERSION), libopie ($QPE_VERSION), opie-console-help-en
8License: GPL 8License: GPL
9Description: Opie terminal app 9Description: Opie terminal app
10 10
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 5d39d96..cad2567 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -72,66 +72,70 @@ Profile::ValueList ProfileManager::all()const {
72 */ 72 */
73Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) { 73Session* ProfileManager::fromProfile( const Profile& prof, QWidget* parent) {
74/* TEST PROFILE!!! 74/* TEST PROFILE!!!
75 Profile prof; 75 Profile prof;
76 QString str = "/dev/ttyS0"; 76 QString str = "/dev/ttyS0";
77 prof.writeEntry("Device",str ); 77 prof.writeEntry("Device",str );
78 prof.writeEntry("Baud", 115200 ); 78 prof.writeEntry("Baud", 115200 );
79 prof.setIOLayer("serial"); 79 prof.setIOLayer("serial");
80 prof.setName( "test"); 80 prof.setName( "test");
81*/ 81*/
82 Session* session = new Session(); 82 Session* session = new Session();
83 session->setName( prof.name() ); 83 session->setName( prof.name() );
84 /* translate the internal name to the external */ 84 /* translate the internal name to the external */
85 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) , 85 session->setIOLayer(m_fact->newIOLayer( m_fact->external(prof.ioLayerName()) ,
86 prof) ); 86 prof) );
87 87
88 QWidgetStack *stack = new QWidgetStack( parent ); 88 QWidgetStack *stack = new QWidgetStack( parent );
89 session->setWidgetStack( stack ); 89 session->setWidgetStack( stack );
90 QWidget* dummy = new QHBox( stack ); 90 QWidget* dummy = new QHBox( stack );
91 stack->raiseWidget( dummy ); 91 stack->raiseWidget( dummy );
92 92
93 EmulationHandler* handler = new EmulationHandler(prof,dummy ); 93 EmulationHandler* handler = new EmulationHandler(prof,dummy );
94 session->setEmulationHandler( handler ); 94 session->setEmulationHandler( handler );
95 session->connect(); 95 session->connect();
96 session->setProfile( prof );
96 97
97 return session; 98 return session;
98} 99}
99void ProfileManager::save( ) { 100void ProfileManager::save( ) {
100 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); 101 QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) );
101 ProfileConfig conf("opie-console-profiles"); 102 ProfileConfig conf("opie-console-profiles");
102 Profile::ValueList::Iterator it2; 103 Profile::ValueList::Iterator it2;
103 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { 104 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
104 conf.setGroup( (*it2).name() ); 105 conf.setGroup( (*it2).name() );
105 106
106 /* now the config stuff */ 107 /* now the config stuff */
107 QMap<QString, QString> map = (*it2).conf(); 108 QMap<QString, QString> map = (*it2).conf();
108 QMap<QString, QString>::Iterator confIt; 109 QMap<QString, QString>::Iterator confIt;
109 for ( confIt = map.begin(); confIt != map.end(); ++confIt ) { 110 for ( confIt = map.begin(); confIt != map.end(); ++confIt ) {
110 conf.writeEntry( confIt.key(), confIt.data() ); 111 conf.writeEntry( confIt.key(), confIt.data() );
111 } 112 }
112 113
113 conf.writeEntry( "name", (*it2).name() ); 114 conf.writeEntry( "name", (*it2).name() );
114 QString str = QString::fromUtf8( (*it2).ioLayerName() ); 115 QString str = QString::fromUtf8( (*it2).ioLayerName() );
115 116
116 conf.writeEntry( "iolayer", str ); 117 conf.writeEntry( "iolayer", str );
117 conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) ); 118 conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) );
118 conf.writeEntry( "autoConnect", (*it2).autoConnect()); 119 conf.writeEntry( "autoConnect", (*it2).autoConnect());
119 conf.writeEntry( "back", (*it2).background() ); 120 conf.writeEntry( "back", (*it2).background() );
120 conf.writeEntry( "fore", (*it2).foreground() ); 121 conf.writeEntry( "fore", (*it2).foreground() );
121 conf.writeEntry( "terminal", (*it2).terminal() ); 122 conf.writeEntry( "terminal", (*it2).terminal() );
122 } 123 }
123} 124}
125void ProfileManager::add( const Profile& prof) {
126 m_list.append( prof );
127}
124void ProfileManager::setProfiles( const Profile::ValueList& list ) { 128void ProfileManager::setProfiles( const Profile::ValueList& list ) {
125 m_list = list; 129 m_list = list;
126}; 130};
127Profile ProfileManager::profile( const QString& name )const { 131Profile ProfileManager::profile( const QString& name )const {
128 Profile prof; 132 Profile prof;
129 Profile::ValueList::ConstIterator it; 133 Profile::ValueList::ConstIterator it;
130 for ( it = m_list.begin(); it != m_list.end(); ++it ) { 134 for ( it = m_list.begin(); it != m_list.end(); ++it ) {
131 if ( name == (*it).name() ) { 135 if ( name == (*it).name() ) {
132 prof = (*it); 136 prof = (*it);
133 break; 137 break;
134 } 138 }
135 } 139 }
136 return prof; 140 return prof;
137} 141}
diff --git a/noncore/apps/opie-console/receive_layer.cpp b/noncore/apps/opie-console/receive_layer.cpp
index 05e2c67..bbde339 100644
--- a/noncore/apps/opie-console/receive_layer.cpp
+++ b/noncore/apps/opie-console/receive_layer.cpp
@@ -1,33 +1,34 @@
1#include <unistd.h> 1#include <unistd.h>
2 2
3#include <qdir.h>
3#include <qstring.h> 4#include <qstring.h>
4#include <qfile.h> 5#include <qfile.h>
5 6
6#include "io_layer.h" 7#include "io_layer.h"
7#include "receive_layer.h" 8#include "receive_layer.h"
8 9
9ReceiveLayer::ReceiveLayer( IOLayer* lay, const QString& startDir ) 10ReceiveLayer::ReceiveLayer( IOLayer* lay, const QString& startDir )
10 : QObject(), m_curDir( startDir ), m_layer(lay ) 11 : QObject(), m_curDir( startDir ), m_layer(lay )
11{ 12{
12 13
13} 14}
14ReceiveLayer::~ReceiveLayer() { 15ReceiveLayer::~ReceiveLayer() {
15 16
16} 17}
17IOLayer* ReceiveLayer::layer() { 18IOLayer* ReceiveLayer::layer() {
18 return m_layer; 19 return m_layer;
19} 20}
20QString ReceiveLayer::currentDir()const{ 21QString ReceiveLayer::currentDir()const{
21 if (m_curDir.isEmpty() ) 22 if (m_curDir.isEmpty() )
22 return QString::fromLocal8Bit( ::getwd(NULL) ); 23 return QDir::currentDirPath();
23 return m_curDir; 24 return m_curDir;
24} 25}
25void ReceiveLayer::changeDir( const QString& str) { 26void ReceiveLayer::changeDir( const QString& str) {
26 ::chdir( str.latin1() ); 27 ::chdir( str.latin1() );
27} 28}
28void ReceiveLayer::receive( const QString& dir, Mode, Features ) { 29void ReceiveLayer::receive( const QString& dir, Mode, Features ) {
29 receive( dir ); 30 receive( dir );
30} 31}
31void ReceiveLayer::cancel() { 32void ReceiveLayer::cancel() {
32 33
33} 34}
diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp
index 03d0fcd..c166d95 100644
--- a/noncore/apps/opie-console/session.cpp
+++ b/noncore/apps/opie-console/session.cpp
@@ -1,68 +1,72 @@
1 1
2 2
3#include "profile.h"
3#include "io_layer.h" 4#include "io_layer.h"
4#include "file_layer.h" 5#include "file_layer.h"
5#include "emulation_handler.h" 6#include "emulation_handler.h"
6#include "session.h" 7#include "session.h"
7 8
8 9
9Session::Session() { 10Session::Session() {
10 m_widget = 0l; 11 m_widget = 0l;
11 m_layer = 0l; 12 m_layer = 0l;
12 m_emu = 0l; 13 m_emu = 0l;
13} 14}
14Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) 15Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay)
15 : m_name( na ), m_widget( widget ), m_layer( lay ) 16 : m_name( na ), m_widget( widget ), m_layer( lay )
16{ 17{
17// m_widLay = 0l; 18// m_widLay = 0l;
18// m_emLay = 0l; 19// m_emLay = 0l;
19 m_emu = 0l; 20 m_emu = 0l;
20} 21}
21Session::~Session() { 22Session::~Session() {
22 delete m_layer; 23 delete m_layer;
23 delete m_emu; 24 delete m_emu;
24 delete m_widget; 25 delete m_widget;
25 /* the widget layer should be deleted by the m_widget */ 26 /* the widget layer should be deleted by the m_widget */
26} 27}
27QString Session::name()const { 28QString Session::name()const {
28 return m_name; 29 return m_name;
29} 30}
30QWidgetStack* Session::widgetStack() { 31QWidgetStack* Session::widgetStack() {
31 return m_widget; 32 return m_widget;
32} 33}
33IOLayer* Session::layer() { 34IOLayer* Session::layer() {
34 return m_layer; 35 return m_layer;
35} 36}
36EmulationHandler* Session::emulationHandler() { 37EmulationHandler* Session::emulationHandler() {
37 return m_emu; 38 return m_emu;
38} 39}
39QWidget* Session::widget() { 40QWidget* Session::widget() {
40 if (!m_emu ) 41 if (!m_emu )
41 return 0l; 42 return 0l;
42 43
43 return m_emu->widget(); 44 return m_emu->widget();
44} 45}
46Profile Session::profile()const {
47 return m_prof;
48}
45/* 49/*
46WidgetLayer* Session::emulationWidget() { 50WidgetLayer* Session::emulationWidget() {
47 return m_widLay; 51 return m_widLay;
48} 52}
49*/ 53*/
50void Session::connect() { 54void Session::connect() {
51 if ( !m_layer || !m_emu ) 55 if ( !m_layer || !m_emu )
52 return; 56 return;
53 57
54 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ), 58 QObject::connect(m_layer, SIGNAL(received(const QByteArray&) ),
55 m_emu, SLOT(recv(const QByteArray&) ) ); 59 m_emu, SLOT(recv(const QByteArray&) ) );
56 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ), 60 QObject::connect(m_emu, SIGNAL(send(const QByteArray&) ),
57 m_layer, SLOT(send(const QByteArray&) ) ); 61 m_layer, SLOT(send(const QByteArray&) ) );
58 QObject::connect(m_emu, SIGNAL(changeSize(int, int) ), 62 QObject::connect(m_emu, SIGNAL(changeSize(int, int) ),
59 m_layer, SLOT(setSize(int, int) ) ); 63 m_layer, SLOT(setSize(int, int) ) );
60} 64}
61 65
62void Session::disconnect() { 66void Session::disconnect() {
63 67
64 if ( !m_layer || !m_emu ) 68 if ( !m_layer || !m_emu )
65 return; 69 return;
66 70
67 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ), 71 QObject::disconnect(m_layer, SIGNAL(received(const QByteArray&) ),
68 m_emu, SLOT(recv(const QByteArray&) ) ); 72 m_emu, SLOT(recv(const QByteArray&) ) );
@@ -70,31 +74,34 @@ void Session::disconnect() {
70 m_layer, SLOT(send(const QByteArray&) ) ); 74 m_layer, SLOT(send(const QByteArray&) ) );
71} 75}
72 76
73void Session::setName( const QString& na){ 77void Session::setName( const QString& na){
74 m_name = na; 78 m_name = na;
75} 79}
76 80
77void Session::setWidgetStack( QWidgetStack* wid ) { 81void Session::setWidgetStack( QWidgetStack* wid ) {
78 delete m_emu; 82 delete m_emu;
79 m_emu = 0l; 83 m_emu = 0l;
80 delete m_widget; 84 delete m_widget;
81 /* the EmulationLayer was destroyed... */ 85 /* the EmulationLayer was destroyed... */
82 86
83 m_widget = wid; 87 m_widget = wid;
84} 88}
85void Session::setIOLayer( IOLayer* lay ) { 89void Session::setIOLayer( IOLayer* lay ) {
86 delete m_layer; 90 delete m_layer;
87 m_layer = lay; 91 m_layer = lay;
88} 92}
89 93
90void Session::setEmulationHandler( EmulationHandler* lay ) { 94void Session::setEmulationHandler( EmulationHandler* lay ) {
91 delete m_emu; 95 delete m_emu;
92 m_emu = lay; 96 m_emu = lay;
93} 97}
98void Session::setProfile( const Profile& prof ) {
99 m_prof = prof;
100}
94/* 101/*
95void Session::setEmulationWidget( WidgetLayer* lay ) { 102void Session::setEmulationWidget( WidgetLayer* lay ) {
96 delete m_widLay; 103 delete m_widLay;
97 m_widLay = lay; 104 m_widLay = lay;
98} 105}
99*/ 106*/
100 107
diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h
index 83b2046..f60a6c0 100644
--- a/noncore/apps/opie-console/session.h
+++ b/noncore/apps/opie-console/session.h
@@ -1,72 +1,77 @@
1#ifndef OPIE_SESSION_H 1#ifndef OPIE_SESSION_H
2#define OPIE_SESSION_H 2#define OPIE_SESSION_H
3 3
4#include <qwidgetstack.h> 4#include <qwidgetstack.h>
5 5
6#include "profile.h"
7
6class IOLayer; 8class IOLayer;
7class EmulationHandler; 9class EmulationHandler;
8/** 10/**
9 * This is a Session. A session contains 11 * This is a Session. A session contains
10 * a QWidget pointer and a IOLayer 12 * a QWidget pointer and a IOLayer
11 * Imagine a session like a collection of what 13 * Imagine a session like a collection of what
12 * is needed to show your widget in a tab ;) 14 * is needed to show your widget in a tab ;)
13 */ 15 */
14class Session { 16class Session {
15public: 17public:
16 /** 18 /**
17 * c'tor with widget and layer 19 * c'tor with widget and layer
18 * ownership get's transfered 20 * ownership get's transfered
19 */ 21 */
20 Session(); 22 Session();
21 Session( const QString&, QWidgetStack* widget, IOLayer* ); 23 Session( const QString&, QWidgetStack* widget, IOLayer* );
22 ~Session(); 24 ~Session();
23 25
24 /** 26 /**
25 * return the name of the session 27 * return the name of the session
26 */ 28 */
27 QString name()const; 29 QString name()const;
28 30
29 /** 31 /**
30 * return the widgetstack 32 * return the widgetstack
31 * this is used to be semi modal 33 * this is used to be semi modal
32 * for FileTransfer 34 * for FileTransfer
33 * 35 *
34 * semi modal == SessionModal 36 * semi modal == SessionModal
35 */ 37 */
36 QWidgetStack* widgetStack(); 38 QWidgetStack* widgetStack();
37 QWidget* widget(); 39 QWidget* widget();
38 40
39 /** 41 /**
40 * return the layer 42 * return the layer
41 */ 43 */
42 IOLayer* layer(); 44 IOLayer* layer();
43 45
44 EmulationHandler* emulationHandler(); 46 EmulationHandler* emulationHandler();
47 Profile profile()const;
45 48
46 /* 49 /*
47 * connects the data flow from 50 * connects the data flow from
48 * the IOLayer to the EmulationLayer 51 * the IOLayer to the EmulationLayer
49 */ 52 */
50 void connect(); 53 void connect();
51 54
52 /* 55 /*
53 * disconnect the dataflow 56 * disconnect the dataflow
54 * this will be done for ft 57 * this will be done for ft
55 */ 58 */
56 void disconnect(); 59 void disconnect();
57 60
58 void setWidgetStack( QWidgetStack* widget ); 61 void setWidgetStack( QWidgetStack* widget );
59 void setEmulationHandler( EmulationHandler* lay ); 62 void setEmulationHandler( EmulationHandler* lay );
60 void setIOLayer( IOLayer* ); 63 void setIOLayer( IOLayer* );
61 void setName( const QString& ); 64 void setName( const QString& );
65 void setProfile( const Profile& );
62 66
63private: 67private:
64 QString m_name; 68 QString m_name;
65 QWidgetStack* m_widget; 69 QWidgetStack* m_widget;
66 IOLayer* m_layer; 70 IOLayer* m_layer;
67 EmulationHandler* m_emu; 71 EmulationHandler* m_emu;
68 bool m_connected; 72 bool m_connected : 1;
73 Profile m_prof;
69 74
70}; 75};
71 76
72#endif 77#endif