summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-08 16:37:37 (UTC)
committer zecke <zecke>2002-10-08 16:37:37 (UTC)
commit76fb8a57bf9fbae3a7073c8b0be1216f34adf99c (patch) (unidiff)
tree3f486d66ce474039b1a0fc4ade770e6e8a7c32b3
parentfaeb94a4000dc539577af465107b5d10903f92d6 (diff)
downloadopie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.zip
opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.tar.gz
opie-76fb8a57bf9fbae3a7073c8b0be1216f34adf99c.tar.bz2
SzModem:
Make it compile remove = 0 from sendFile Add a Type to Sz so it could cover SX,SY too MetaFactory: take QCString name QString uiString so Carsten will be able to translate and users can switch Language without losing profiles Default It's aware of all Default/BuiltIn Plugins and adds them to the factory Common typedef bool BOOL TT is not using bool because it wasn't available at that time they use uint : 1... maybe we should change UINT_8 to Q_UINT8... MainWindow: give the factory to the config widget use Default IOLayer reload should take Profile not Config ConfigDialog: make use of Factory and do not do new MetaFactory.. i should make the c'tor private and add MainWindow as friend ProfileEditorDialog: Huge clean ups to the architecture. I still need to convert the widgets. Use the factory right
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/common.h2
-rw-r--r--noncore/apps/opie-console/configdialog.cpp10
-rw-r--r--noncore/apps/opie-console/configdialog.h5
-rw-r--r--noncore/apps/opie-console/default.cpp65
-rw-r--r--noncore/apps/opie-console/default.h30
-rw-r--r--noncore/apps/opie-console/io_layer.h2
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp4
-rw-r--r--noncore/apps/opie-console/metafactory.cpp76
-rw-r--r--noncore/apps/opie-console/metafactory.h60
-rw-r--r--noncore/apps/opie-console/opie-console.pro16
-rw-r--r--noncore/apps/opie-console/profile.cpp21
-rw-r--r--noncore/apps/opie-console/profile.h11
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.cpp32
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.h50
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp239
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h25
-rw-r--r--noncore/apps/opie-console/profileeditorplugins.h142
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp6
-rw-r--r--noncore/apps/opie-console/sz_transfer.cpp2
-rw-r--r--noncore/apps/opie-console/sz_transfer.h12
20 files changed, 544 insertions, 266 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h
index ac0e2cf..979c2bd 100644
--- a/noncore/apps/opie-console/common.h
+++ b/noncore/apps/opie-console/common.h
@@ -26,7 +26,7 @@
26#include <qcolor.h> 26#include <qcolor.h>
27 27
28#ifndef BOOL 28#ifndef BOOL
29typedef int BOOL; 29typedef bool BOOL;
30#endif 30#endif
31 31
32#ifndef FALSE 32#ifndef FALSE
diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp
index ee1ffb4..50512b6 100644
--- a/noncore/apps/opie-console/configdialog.cpp
+++ b/noncore/apps/opie-console/configdialog.cpp
@@ -29,8 +29,9 @@ Profile ConfigListItem::profile()const {
29 29
30/* Dialog */ 30/* Dialog */
31 31
32ConfigDialog::ConfigDialog( const Profile::ValueList& lis, QWidget* parent ) 32ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa,
33 : ConfigureBase( parent, 0, TRUE ) 33 QWidget* parent )
34 : ConfigureBase( parent, 0, TRUE ), m_fact( fa )
34{ 35{
35 //init(); 36 //init();
36 { 37 {
@@ -71,7 +72,7 @@ void ConfigDialog::slotEdit() {
71 // Load profile 72 // Load profile
72 p = ((ConfigListItem*)lstView->currentItem())->profile(); 73 p = ((ConfigListItem*)lstView->currentItem())->profile();
73 74
74 ProfileEditorDialog dlg(new MetaFactory(), p); 75 ProfileEditorDialog dlg(m_fact, p);
75 76
76 dlg.setCaption("Edit Connection Profile"); 77 dlg.setCaption("Edit Connection Profile");
77 dlg.showMaximized(); 78 dlg.showMaximized();
@@ -90,7 +91,8 @@ void ConfigDialog::slotEdit() {
90 91
91 92
92void ConfigDialog::slotAdd() { 93void ConfigDialog::slotAdd() {
93 ProfileEditorDialog dlg(new MetaFactory()); 94 qWarning("slotAdd");
95 ProfileEditorDialog dlg(m_fact);
94 96
95 dlg.setCaption("New Connection"); 97 dlg.setCaption("New Connection");
96 dlg.showMaximized(); 98 dlg.showMaximized();
diff --git a/noncore/apps/opie-console/configdialog.h b/noncore/apps/opie-console/configdialog.h
index a0c40d0..b81a004 100644
--- a/noncore/apps/opie-console/configdialog.h
+++ b/noncore/apps/opie-console/configdialog.h
@@ -6,10 +6,11 @@
6#include "configurebase.h" 6#include "configurebase.h"
7#include "profile.h" 7#include "profile.h"
8 8
9class MetaFactory;
9class ConfigDialog : public ConfigureBase { 10class ConfigDialog : public ConfigureBase {
10 Q_OBJECT 11 Q_OBJECT
11public: 12public:
12 ConfigDialog( const Profile::ValueList&, QWidget* parent = 0l); 13 ConfigDialog( const Profile::ValueList&, MetaFactory*, QWidget* parent = 0l);
13 ~ConfigDialog(); 14 ~ConfigDialog();
14 15
15 Profile::ValueList list()const; 16 Profile::ValueList list()const;
@@ -17,6 +18,8 @@ protected slots:
17 void slotRemove(); 18 void slotRemove();
18 void slotEdit(); 19 void slotEdit();
19 void slotAdd(); 20 void slotAdd();
21private:
22 MetaFactory* m_fact;
20 23
21}; 24};
22 25
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
new file mode 100644
index 0000000..78495d2
--- a/dev/null
+++ b/noncore/apps/opie-console/default.cpp
@@ -0,0 +1,65 @@
1#include "io_serial.h"
2#include "sz_transfer.h"
3
4#include "default.h"
5
6extern "C" {
7 // FILE Transfer Stuff
8 FileTransferLayer* newSZTransfer(IOLayer* lay) {
9 return new SzTransfer( SzTransfer::SZ, lay );
10 }
11 FileTransferLayer* newSYTransfer(IOLayer* lay) {
12 return new SzTransfer( SzTransfer::SY, lay );
13 }
14 FileTransferLayer* newSXTransfer(IOLayer* lay) {
15 return new SzTransfer( SzTransfer::SX, lay );
16 }
17
18 // Layer stuff
19 IOLayer* newSerialLayer( const Profile& prof) {
20 return new IOSerial( prof );
21 }
22 IOLayer* newBTLayer( const Profile& ) {
23 return 0l;
24 }
25 IOLayer* newIrDaLayer( const Profile& ) {
26 return 0l;
27 }
28
29 // Connection Widgets
30 ProfileDialogWidget* newSerialWidget(const QString& str, QWidget* ) {
31 return 0l;
32 }
33 ProfileDialogWidget* newIrDaWidget( const QString& str, QWidget* wid) {
34 return newSerialWidget(str, wid);
35 }
36 ProfileDialogWidget* newBTWidget( const QString& str, QWidget* wid) {
37 return newSerialWidget(str, wid );
38 }
39
40 // Terminal Widget(s)
41 ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* ) {
42 return 0l;
43 }
44
45};
46
47Default::Default( MetaFactory* fact ) {
48 fact->addFileTransferLayer( "SZ", QObject::tr("Z-Modem"), newSZTransfer );
49 fact->addFileTransferLayer( "SY", QObject::tr("Y-Modem"), newSYTransfer );
50 fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
51
52 fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
53 fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
54 fact->addIOLayerFactory( "bt", QObject::tr("Bluetooth"), newBTLayer );
55
56 fact->addConnectionWidgetFactory( "serial", QObject::tr("Serial"), newSerialWidget );
57 fact->addConnectionWidgetFactory( "irda", QObject::tr("Infrared"), newIrDaWidget );
58 fact->addConnectionWidgetFactory( "bt", QObject::tr("Bluetooth"), newBTWidget );
59
60 fact->addTerminalWidgetFactory( "default", QObject::tr("Default Terminal"), newTerminalWidget );
61
62}
63Default::~Default() {
64
65}
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h
new file mode 100644
index 0000000..ed78986
--- a/dev/null
+++ b/noncore/apps/opie-console/default.h
@@ -0,0 +1,30 @@
1#ifndef OPIE_DEFAULT_H
2#define OPIE_DEFAULT_H
3
4#include "metafactory.h"
5
6extern "C" {
7 FileTransferLayer* newSZTransfer(IOLayer*);
8 FileTransferLayer* newSYTransfer(IOLayer*);
9 FileTransferLayer* newSXTransfer(IOLayer*);
10
11 IOLayer* newSerialLayer(const Profile&);
12 IOLayer* newBTLayer(const Profile& );
13 IOLayer* newIrDaLayer(const Profile& );
14
15 ProfileDialogWidget* newSerialWidget(const QString&, QWidget* );
16 ProfileDialogWidget* newIrDaWidget (const QString&, QWidget* );
17 ProfileDialogWidget* newBTWidget (const QString&, QWidget* );
18
19 ProfileDialogWidget* newTerminalWidget(const QString&, QWidget* );
20};
21
22class MetaFactory;
23struct Default {
24public:
25 Default(MetaFactory* );
26 ~Default();
27};
28
29
30#endif
diff --git a/noncore/apps/opie-console/io_layer.h b/noncore/apps/opie-console/io_layer.h
index 2f1ceef..b891b2b 100644
--- a/noncore/apps/opie-console/io_layer.h
+++ b/noncore/apps/opie-console/io_layer.h
@@ -81,7 +81,7 @@ public slots:
81 /** 81 /**
82 * closes and reloads the settings 82 * closes and reloads the settings
83 */ 83 */
84 virtual void reload( const Config& ) = 0; 84 virtual void reload( const Profile& ) = 0;
85}; 85};
86 86
87#endif 87#endif
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 31f1138..647a331 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -6,6 +6,7 @@
6#include <qtoolbar.h> 6#include <qtoolbar.h>
7 7
8#include "configdialog.h" 8#include "configdialog.h"
9#include "default.h"
9#include "metafactory.h" 10#include "metafactory.h"
10#include "profilemanager.h" 11#include "profilemanager.h"
11#include "mainwindow.h" 12#include "mainwindow.h"
@@ -13,6 +14,7 @@
13 14
14MainWindow::MainWindow() { 15MainWindow::MainWindow() {
15 m_factory = new MetaFactory(); 16 m_factory = new MetaFactory();
17 Default def(m_factory);
16 m_sessions.setAutoDelete( TRUE ); 18 m_sessions.setAutoDelete( TRUE );
17 m_curSession = 0; 19 m_curSession = 0;
18 m_manager = new ProfileManager( m_factory ); 20 m_manager = new ProfileManager( m_factory );
@@ -156,7 +158,7 @@ void MainWindow::slotTerminate() {
156 158
157void MainWindow::slotConfigure() { 159void MainWindow::slotConfigure() {
158 qWarning("configure"); 160 qWarning("configure");
159 ConfigDialog conf( manager()->all() ); 161 ConfigDialog conf( manager()->all(), factory() );
160 conf.showMaximized(); 162 conf.showMaximized();
161 163
162 int ret = conf.exec(); 164 int ret = conf.exec();
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index b69d6da..077b418 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -6,18 +6,28 @@ MetaFactory::MetaFactory() {
6MetaFactory::~MetaFactory() { 6MetaFactory::~MetaFactory() {
7 7
8} 8}
9void MetaFactory::addConfigWidgetFactory( const QString& str, 9void MetaFactory::addConnectionWidgetFactory( const QCString& name,
10 const QString& name, 10 const QString& str,
11 configWidget wid) { 11 configWidget wid) {
12 m_namemap.insert ( str, name ); 12 m_strings.insert( str, name );
13 m_confFact.insert( str, wid ); 13 m_conFact.insert( str, wid );
14} 14}
15void MetaFactory::addIOLayerFactory( const QString& str, 15void MetaFactory::addTerminalWidgetFactory( const QCString& name,
16 const QString& str,
17 configWidget wid ) {
18 m_strings.insert( str, name );
19 m_termFact.insert( str, wid );
20}
21void MetaFactory::addIOLayerFactory( const QCString& name,
22 const QString& str,
16 iolayer lay) { 23 iolayer lay) {
24 m_strings.insert( str, name );
17 m_layerFact.insert( str, lay ); 25 m_layerFact.insert( str, lay );
18} 26}
19void MetaFactory::addFileTransferLayer( const QString& str, 27void MetaFactory::addFileTransferLayer( const QCString& name,
28 const QString& str,
20 filelayer lay) { 29 filelayer lay) {
30 m_strings.insert(str, name );
21 m_fileFact.insert( str, lay ); 31 m_fileFact.insert( str, lay );
22} 32}
23QStringList MetaFactory::ioLayers()const { 33QStringList MetaFactory::ioLayers()const {
@@ -28,10 +38,18 @@ QStringList MetaFactory::ioLayers()const {
28 } 38 }
29 return list; 39 return list;
30} 40}
31QStringList MetaFactory::configWidgets()const { 41QStringList MetaFactory::connectionWidgets()const {
42 QStringList list;
43 QMap<QString, configWidget>::ConstIterator it;
44 for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) {
45 list << it.key();
46 }
47 return list;
48}
49QStringList MetaFactory::terminalWidgets()const {
32 QStringList list; 50 QStringList list;
33 QMap<QString, configWidget>::ConstIterator it; 51 QMap<QString, configWidget>::ConstIterator it;
34 for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) { 52 for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) {
35 list << it.key(); 53 list << it.key();
36 } 54 }
37 return list; 55 return list;
@@ -60,17 +78,37 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) {
60 return lay; 78 return lay;
61} 79}
62 80
63ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) { 81ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) {
64 ProfileEditorPlugin *p = NULL; 82 ProfileDialogWidget* wid = 0l;
65 configWidget c;
66 83
67 c = m_confFact[str]; 84 QMap<QString, configWidget>::Iterator it;
68 if(c) p = c(parent, prof); 85 it = m_conFact.find( str );
69 86 if ( it != m_conFact.end() ) {
70 return p; 87 wid = (*(it.data() ) )(str,parent);
88 }
89 return wid;
71} 90}
91ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) {
92 if (str.isEmpty() )
93 return 0l;
94 ProfileDialogWidget* wid = 0l;
95 qWarning("new terminalPlugin %s %l", str.latin1(), parent );
72 96
73QString MetaFactory::name( const QString& str ) { 97 QMap<QString, configWidget>::Iterator it;
74 return m_namemap[str]; 98 it = m_termFact.find( str );
99 if ( it != m_conFact.end() ) {
100 wid = (*(it.data() ) )(str,parent);
101 }
102 return wid;
103}
104QCString MetaFactory::internal( const QString& str )const {
105 return m_strings[str];
106}
107QString MetaFactory::external( const QCString& str )const {
108 QMap<QString, QCString>::ConstIterator it;
109 for ( it = m_strings.begin(); it != m_strings.end(); ++it ) {
110 if ( it.data() == str )
111 return it.key();
112 }
113 return QString::null;
75} 114}
76
diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h
index 216de03..3f7ddce 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -14,37 +14,71 @@
14#include "io_layer.h" 14#include "io_layer.h"
15#include "file_layer.h" 15#include "file_layer.h"
16#include "profile.h" 16#include "profile.h"
17#include "profileeditorplugins.h" 17#include "profiledialogwidget.h"
18 18
19class MetaFactory { 19class MetaFactory {
20public: 20public:
21 typedef ProfileEditorPlugin* (*configWidget)(QWidget* parent, Profile* prof); 21 typedef ProfileDialogWidget* (*configWidget)(const QString&, QWidget* parent);
22 typedef IOLayer* (*iolayer)(const Profile& ); 22 typedef IOLayer* (*iolayer)(const Profile& );
23 typedef FileTransferLayer* (*filelayer)(IOLayer*); 23 typedef FileTransferLayer* (*filelayer)(IOLayer*);
24 24
25 MetaFactory(); 25 MetaFactory();
26 ~MetaFactory(); 26 ~MetaFactory();
27 27
28 void addConfigWidgetFactory( const QString&, 28 /**
29 const QString&, 29 * add a ProfileDialogWidget to the factory
30 configWidget ); 30 * name is the name shown to the user
31 void addIOLayerFactory(const QString&, 31 */
32 iolayer ); 32 void addConnectionWidgetFactory( const QCString& internalName,
33 void addFileTransferLayer( const QString&, 33 const QString& uiString,
34 configWidget );
35 void addTerminalWidgetFactory ( const QCString& internalName,
36 const QString& name,
37 configWidget );
38
39 /**
40 * adds an IOLayer factory
41 */
42 void addIOLayerFactory( const QCString&,
43 const QString&,
44 iolayer );
45
46 /**
47 * adds a FileTransfer Layer
48 */
49 void addFileTransferLayer( const QCString& name,
50 const QString&,
34 filelayer ); 51 filelayer );
52
53 /* translated UI Strings */
35 QStringList ioLayers()const; 54 QStringList ioLayers()const;
36 QStringList configWidgets()const; 55 QStringList connectionWidgets()const;
56 QStringList terminalWidgets()const;
37 QStringList fileTransferLayers()const; 57 QStringList fileTransferLayers()const;
38 IOLayer* newIOLayer( const QString&,const Profile& ); 58 IOLayer* newIOLayer( const QString&,const Profile& );
39 ProfileEditorPlugin *newConfigPlugin ( const QString&, QWidget*, Profile* ); 59 ProfileDialogWidget *newConnectionPlugin ( const QString&, QWidget* );
60 ProfileDialogWidget* newTerminalPlugin( const QString&, QWidget* );
61
62 /*
63 * internal takes the maybe translated
64 * public QString and maps it to the internal
65 * not translatable QCString
66 */
67 QCString internal( const QString& )const;
68
69 /*
70 * external takes the internal name
71 * it returns a translated name
72 */
73 QString external( const QCString& )const;
40 74
41 QString name( const QString& );
42 75
43private: 76private:
44 QMap<QString, configWidget> m_confFact; 77 QMap<QString, QCString> m_strings;
78 QMap<QString, configWidget> m_conFact;
79 QMap<QString, configWidget> m_termFact;
45 QMap<QString, iolayer> m_layerFact; 80 QMap<QString, iolayer> m_layerFact;
46 QMap<QString, filelayer> m_fileFact; 81 QMap<QString, filelayer> m_fileFact;
47 QMap<QString, QString> m_namemap;
48}; 82};
49 83
50 84
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro
index 768e453..984072a 100644
--- a/noncore/apps/opie-console/opie-console.pro
+++ b/noncore/apps/opie-console/opie-console.pro
@@ -13,8 +13,6 @@ HEADERS = io_layer.h io_serial.h \
13 configwidget.h \ 13 configwidget.h \
14 tabwidget.h \ 14 tabwidget.h \
15 configdialog.h \ 15 configdialog.h \
16 profileeditordialog.h \
17 profileeditorplugins.h \
18 emulation_layer.h \ 16 emulation_layer.h \
19 widget.h \ 17 widget.h \
20 vt102emulation.h \ 18 vt102emulation.h \
@@ -23,11 +21,14 @@ HEADERS = io_layer.h io_serial.h \
23 screen.h \ 21 screen.h \
24 keytrans.h \ 22 keytrans.h \
25 widget_layer.h \ 23 widget_layer.h \
26 transferdialog.h 24 transferdialog.h \
25 profiledialogwidget.h \
26 profileeditordialog.h \
27 default.h
27 28
28SOURCES = io_layer.cpp io_serial.cpp \ 29SOURCES = io_layer.cpp io_serial.cpp \
29 file_layer.cpp sz_transfer.cpp \ 30 file_layer.cpp sz_transfer.cpp \
30 main.cpp \ 31 main.cpp \
31 metafactory.cpp \ 32 metafactory.cpp \
32 session.cpp \ 33 session.cpp \
33 mainwindow.cpp \ 34 mainwindow.cpp \
@@ -36,8 +37,6 @@ SOURCES = io_layer.cpp io_serial.cpp \
36 profilemanager.cpp \ 37 profilemanager.cpp \
37 tabwidget.cpp \ 38 tabwidget.cpp \
38 configdialog.cpp \ 39 configdialog.cpp \
39 profileeditordialog.cpp \
40 profileeditorplugins.cpp \
41 emulation_layer.cpp \ 40 emulation_layer.cpp \
42 widget.cpp \ 41 widget.cpp \
43 vt102emulation.cpp \ 42 vt102emulation.cpp \
@@ -45,7 +44,10 @@ SOURCES = io_layer.cpp io_serial.cpp \
45 screen.cpp \ 44 screen.cpp \
46 keytrans.cpp \ 45 keytrans.cpp \
47 widget_layer.cpp \ 46 widget_layer.cpp \
48 transferdialog.cpp 47 transferdialog.cpp \
48 profiledialogwidget.cpp \
49 profileeditordialog.cpp \
50 default.cpp
49 51
50INTERFACES = configurebase.ui editbase.ui 52INTERFACES = configurebase.ui editbase.ui
51INCLUDEPATH += $(OPIEDIR)/include 53INCLUDEPATH += $(OPIEDIR)/include
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp
index c8f5eb0..1a94619 100644
--- a/noncore/apps/opie-console/profile.cpp
+++ b/noncore/apps/opie-console/profile.cpp
@@ -4,14 +4,14 @@ Profile::Profile() {
4 4
5} 5}
6Profile::Profile( const QString& name, 6Profile::Profile( const QString& name,
7 const QString& iolayerName, 7 const QCString& iolayerName,
8 const QCString& termName,
8 int background, 9 int background,
9 int foreground, 10 int foreground,
10 int terminal ) 11 int terminal )
11 : m_name( name ), m_ioLayer( iolayerName ), m_back( background ), 12 : m_name( name ), m_ioLayer( iolayerName ), m_term( termName),
12 m_fore( foreground ), m_terminal( terminal ) 13 m_back( background ), m_fore( foreground ), m_terminal( terminal )
13{ 14{}
14}
15Profile::Profile( const Profile& prof ) 15Profile::Profile( const Profile& prof )
16{ 16{
17 (*this) = prof; 17 (*this) = prof;
@@ -28,6 +28,7 @@ Profile &Profile::operator=( const Profile& prof ) {
28 m_fore = prof.m_fore; 28 m_fore = prof.m_fore;
29 m_terminal = prof.m_terminal; 29 m_terminal = prof.m_terminal;
30 m_conf = prof.m_conf; 30 m_conf = prof.m_conf;
31 m_term = prof.m_term;
31 32
32 return *this; 33 return *this;
33} 34}
@@ -39,9 +40,12 @@ QMap<QString, QString> Profile::conf()const {
39QString Profile::name()const { 40QString Profile::name()const {
40 return m_name; 41 return m_name;
41} 42}
42QString Profile::ioLayerName()const { 43QCString Profile::ioLayerName()const {
43 return m_ioLayer; 44 return m_ioLayer;
44} 45}
46QCString Profile::terminalName( )const {
47 return m_term;
48}
45int Profile::foreground()const { 49int Profile::foreground()const {
46 return m_fore; 50 return m_fore;
47} 51}
@@ -54,9 +58,12 @@ int Profile::terminal()const {
54void Profile::setName( const QString& str ) { 58void Profile::setName( const QString& str ) {
55 m_name = str; 59 m_name = str;
56} 60}
57void Profile::setIOLayer( const QString& name ) { 61void Profile::setIOLayer( const QCString& name ) {
58 m_ioLayer = name; 62 m_ioLayer = name;
59} 63}
64void Profile::setTerminalName( const QCString& str ) {
65 m_term = str;
66}
60void Profile::setBackground( int back ) { 67void Profile::setBackground( int back ) {
61 m_back = back; 68 m_back = back;
62} 69}
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
index 5652ac5..78fe6ab 100644
--- a/noncore/apps/opie-console/profile.h
+++ b/noncore/apps/opie-console/profile.h
@@ -22,7 +22,8 @@ public:
22 enum Font { Micro = 0, Small, Medium }; 22 enum Font { Micro = 0, Small, Medium };
23 Profile(); 23 Profile();
24 Profile( const QString& name, 24 Profile( const QString& name,
25 const QString& iolayerName, 25 const QCString& iolayerName,
26 const QCString& termName,
26 int background, 27 int background,
27 int foreground, 28 int foreground,
28 int terminal); 29 int terminal);
@@ -32,7 +33,8 @@ public:
32 33
33 ~Profile(); 34 ~Profile();
34 QString name()const; 35 QString name()const;
35 QString ioLayerName()const; 36 QCString ioLayerName()const;
37 QCString terminalName()const;
36 int foreground()const; 38 int foreground()const;
37 int background()const; 39 int background()const;
38 int terminal()const; 40 int terminal()const;
@@ -51,7 +53,8 @@ public:
51 bool readBoolEntry( const QString& key, bool = FALSE )const; 53 bool readBoolEntry( const QString& key, bool = FALSE )const;
52 54
53 void setName( const QString& ); 55 void setName( const QString& );
54 void setIOLayer( const QString& ); 56 void setIOLayer( const QCString& );
57 void setTerminalName( const QCString& );
55 void setBackground( int back ); 58 void setBackground( int back );
56 void setForeground( int fore ); 59 void setForeground( int fore );
57 void setTerminal( int term ); 60 void setTerminal( int term );
@@ -59,7 +62,7 @@ public:
59private: 62private:
60 QMap<QString, QString> m_conf; 63 QMap<QString, QString> m_conf;
61 QString m_name; 64 QString m_name;
62 QString m_ioLayer; 65 QCString m_ioLayer, m_term;
63 int m_back; 66 int m_back;
64 int m_fore; 67 int m_fore;
65 int m_terminal; 68 int m_terminal;
diff --git a/noncore/apps/opie-console/profiledialogwidget.cpp b/noncore/apps/opie-console/profiledialogwidget.cpp
new file mode 100644
index 0000000..24d59bf
--- a/dev/null
+++ b/noncore/apps/opie-console/profiledialogwidget.cpp
@@ -0,0 +1,32 @@
1#include "profiledialogwidget.h"
2
3ProfileDialogWidget::ProfileDialogWidget( const QString&, QWidget* parent,
4 const char* name )
5 : QWidget( parent, name ) {
6}
7ProfileDialogWidget::~ProfileDialogWidget() {
8}
9
10ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na,
11 QWidget* parent,
12 const char* name )
13 : ProfileDialogWidget( na, parent, name )
14{
15}
16ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() {
17}
18ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const {
19 return Terminal;
20}
21
22ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na,
23 QWidget* parent,
24 const char* name )
25 : ProfileDialogWidget(na, parent, name )
26{
27}
28ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() {
29}
30ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const {
31 return Connection;
32}
diff --git a/noncore/apps/opie-console/profiledialogwidget.h b/noncore/apps/opie-console/profiledialogwidget.h
new file mode 100644
index 0000000..5d279e6
--- a/dev/null
+++ b/noncore/apps/opie-console/profiledialogwidget.h
@@ -0,0 +1,50 @@
1#ifndef OPIE_PROFILE_DIALOG_WIDGET_H
2#define OPIE_PROFILE_DIALOG_WIDGET_H
3
4#include <qwidget.h>
5
6#include "profile.h"
7
8class ProfileDialogWidget : public QWidget {
9 Q_OBJECT
10public:
11 enum Type {
12 Connection,
13 Terminal
14 };
15 ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
16 ~ProfileDialogWidget();
17
18 /*
19 * load data from a Profile into
20 * the DialogWidget
21 */
22 virtual void load( const Profile& ) = 0;
23
24 /*
25 * save data into a profile
26 * from the DialogWidget
27 */
28 virtual void save( Profile& ) = 0;
29
30 virtual Type type()const = 0;
31};
32class ProfileDialogTerminalWidget : public ProfileDialogWidget {
33 Q_OBJECT
34public:
35 ProfileDialogTerminalWidget( const QString& name, QWidget* widget,
36 const char* name =0l);
37 ~ProfileDialogTerminalWidget();
38 Type type()const;
39};
40class ProfileDialogConnectionWidget : public ProfileDialogWidget {
41 Q_OBJECT
42public:
43 ProfileDialogConnectionWidget( const QString& name, QWidget* parent,
44 const char* name =0l);
45 ~ProfileDialogConnectionWidget();
46 Type type() const;
47
48};
49
50#endif
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 3843943..061b1c2 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,16 +1,28 @@
1#include <qlayout.h>
2#include <qlineedit.h>
3#include <qlabel.h>
4#include <qmessagebox.h>
5#include <qstringlist.h>
6#include <qcombobox.h>
1 7
2#include <opie/otabwidget.h>
3#include "profileeditordialog.h"
4 8
5#include "qlayout.h" 9#include <opie/otabwidget.h>
6#include "qlineedit.h"
7#include "qlabel.h"
8#include "qmessagebox.h"
9#include "qstringlist.h"
10#include "qcombobox.h"
11 10
12#include "profileeditorplugins.h" 11#include "profileeditorplugins.h"
13#include "metafactory.h" 12#include "metafactory.h"
13#include "profileeditordialog.h"
14
15namespace {
16 void setCurrent( const QString& str, QComboBox* bo ) {
17 for (uint i = 0; i < bo->count(); i++ ) {
18 if ( bo->text(i) == str ) {
19 bo->setCurrentItem( i );
20 }
21 }
22 }
23
24
25}
14 26
15ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, 27ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
16 const Profile& prof ) 28 const Profile& prof )
@@ -27,7 +39,7 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
27 : QDialog(0, 0, TRUE), m_fact( fact ) 39 : QDialog(0, 0, TRUE), m_fact( fact )
28{ 40{
29 // Default profile 41 // Default profile
30 m_prof = Profile(QString::null, "serial", Profile::Black, Profile::White, Profile::VT102); 42 m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102);
31 43
32 initUI(); 44 initUI();
33 45
@@ -42,119 +54,85 @@ Profile ProfileEditorDialog::profile() const
42 54
43void ProfileEditorDialog::initUI() 55void ProfileEditorDialog::initUI()
44{ 56{
57 m_con = m_term = 0l;
45 58
46 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 59 QVBoxLayout *mainLayout = new QVBoxLayout( this );
47 OTabWidget *tabWidget = new OTabWidget( this ); 60 OTabWidget *tabWidget = new OTabWidget( this );
48 mainLayout->add(tabWidget); 61 mainLayout->add(tabWidget);
49 62
50 QWidget *tabterm, *tabconn, *tabprof; 63 QWidget *tabprof;
51 64
52 tabprof = new QWidget(this); 65 /* base tabs */
53 tabterm = new QWidget(this); 66 tabprof = new QWidget(this);
54 tabconn = new QWidget(this); 67 m_tabTerm = new QWidget(this);
55 68 m_tabCon = new QWidget(this);
56 // for the time being: fake factory 69
57 70 /* base layout for tabs */
58 m_fact->addConfigWidgetFactory("serial", QObject::tr("Serial cable"), factory_serial); 71 m_layCon = new QHBoxLayout( m_tabCon , 2 );
59 m_fact->addConfigWidgetFactory("irda", QObject::tr("IrDA port"), factory_irda); 72 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
60 m_fact->addConfigWidgetFactory("modem", QObject::tr("Serial via modem"), factory_modem); 73
61 74 // profile tab
62 // profile tab 75
63 76 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
64 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 77 m_name = new QLineEdit(tabprof);
65 78 QLabel *con = new QLabel(tr("Connection"), tabprof );
66 name_line = new QLineEdit(tabprof); 79 QLabel *term = new QLabel(tr("Terminal"), tabprof );
67 80 m_conCmb = new QComboBox( tabprof );
68 // connection tab, fixed part 81 m_termCmb = new QComboBox( tabprof );
69 82
70 QLabel *device = new QLabel(QObject::tr("Device"), tabconn); 83 // layouting
71 84 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
72 device_box = new QComboBox(tabconn); 85 vbox3->add(name);
73 86 vbox3->add(m_name);
74 QStringList w = m_fact->configWidgets(); 87 vbox3->add(con );
75 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 88 vbox3->add(m_conCmb );
76 device_box->insertItem(m_fact->name((*it))); 89 vbox3->add(term );
77 90 vbox3->add(m_termCmb );
78 // connection tab, factory part 91 vbox3->addStretch(1);
79 plugin_base = new QWidget(tabconn); 92
80 plugin_layout = new QHBoxLayout(plugin_base, 0); 93 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
81 94 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
82 plugin_plugin = m_fact->newConfigPlugin("serial", plugin_base, &m_prof); 95 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
83 plugin_layout->add(plugin_plugin->widget()); 96 tabWidget->setCurrentTab( tabprof );
84 97
85 // connection tab, general part 98
99 // fill the comboboxes
100 QStringList list = m_fact->connectionWidgets();
101 QStringList::Iterator it;
102 for (it =list.begin(); it != list.end(); ++it ) {
103 m_conCmb->insertItem( (*it) );
104 }
105 list = m_fact->terminalWidgets();
106 for (it =list.begin(); it != list.end(); ++it ) {
107 m_termCmb->insertItem( (*it) );
108 }
109
110 // load profile values
111 m_name->setText(m_prof.name());
112 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
113 slotTermActivated( m_fact->external(m_prof.terminalName() ) );
114 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
115 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
116
117 qWarning("Layer: %s %s", m_prof.ioLayerName().data(),
118 m_fact->external(m_prof.ioLayerName() ).latin1() );
119 qWarning("Term: %s %s", m_prof.terminalName().data(),
120 m_fact->external(m_prof.terminalName() ).latin1() );
121
122 // signal and slots
123 connect(m_conCmb, SIGNAL(activated(const QString& ) ),
124 this, SLOT(slotConActivated(const QString&) ) );
125 connect(m_termCmb, SIGNAL(activated(const QString& ) ),
126 this, SLOT(slotTermActivated(const QString& ) ) );
86 127
87 QWidget *conn_widget = plugin_plugin->connection_widget();
88 conn_widget->reparent(tabconn, 0, QPoint(), true);
89
90 // terminal tab
91
92 QWidget *term_widget = plugin_plugin->terminal_widget();
93 term_widget->reparent(tabterm, 0, QPoint(), true);
94
95 // layouting
96
97 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
98 vbox3->add(name);
99 vbox3->add(name_line);
100 vbox3->addStretch(1);
101
102 QVBoxLayout *vbox = new QVBoxLayout(tabconn, 2);
103 vbox->add(device);
104 vbox->add(device_box);
105 vbox->add(plugin_base);
106 vbox->add(conn_widget);
107 vbox->setStretchFactor(device, 1);
108 vbox->setStretchFactor(device_box, 1);
109 vbox->setStretchFactor(plugin_base, 1);
110 vbox->setStretchFactor(conn_widget, 7);
111
112 QVBoxLayout *vbox2 = new QVBoxLayout(tabterm, 2);
113 vbox2->add(term_widget);
114
115 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
116 tabWidget->addTab(tabconn, "", QObject::tr("Connection"));
117 tabWidget->addTab(tabterm, "", QObject::tr("Terminal"));
118 tabWidget->setCurrentTab( tabprof );
119
120 // load profile values
121 name_line->setText(m_prof.name());
122 for(int i = 0; i < device_box->count(); i++)
123 {
124 device_box->setCurrentItem(i);
125 if(prof_type() == m_prof.ioLayerName())
126 {
127 slotDevice(i);
128 break;
129 }
130 }
131
132 // signals
133 connect(device_box, SIGNAL(activated(int)), SLOT(slotDevice(int)));
134} 128}
135 129
136ProfileEditorDialog::~ProfileEditorDialog() { 130ProfileEditorDialog::~ProfileEditorDialog() {
137 131
138} 132}
139
140void ProfileEditorDialog::slotDevice(int id)
141{
142 delete plugin_plugin;
143
144 plugin_plugin = m_fact->newConfigPlugin(prof_type(), plugin_base, &m_prof);
145 plugin_layout->add(plugin_plugin->widget());
146
147 // Reload profile associated to device, including e.g. conn_device()
148 // m_prof = plugin_plugin->profile()
149 // or, keeping the profile name: m_prof->reload(plugin_plugin->profile())
150
151 //plugin_plugin->show();
152 plugin_plugin->widget()->show();
153}
154
155void ProfileEditorDialog::accept() 133void ProfileEditorDialog::accept()
156{ 134{
157 if(prof_name().isEmpty()) 135 if(profName().isEmpty())
158 { 136 {
159 QMessageBox::information(this, 137 QMessageBox::information(this,
160 QObject::tr("Invalid profile"), 138 QObject::tr("Invalid profile"),
@@ -162,28 +140,51 @@ void ProfileEditorDialog::accept()
162 return; 140 return;
163 } 141 }
164 // Save profile and plugin profile 142 // Save profile and plugin profile
165 if(plugin_plugin) plugin_plugin->save(); 143 //if(plugin_plugin) plugin_plugin->save();
166 144
167 // Save general values 145 // Save general values
168 m_prof.setName(prof_name()); 146 m_prof.setName(profName());
169 m_prof.setIOLayer(prof_type()); 147 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
148 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
149 qWarning("Term %s %s", m_fact->internal(m_termCmb->currentText() ).data(),
150 m_termCmb->currentText().latin1() );
170 151
171 QDialog::accept(); 152 QDialog::accept();
172} 153}
173 154
174 155
175QString ProfileEditorDialog::prof_name() 156QString ProfileEditorDialog::profName()const
176{ 157{
177 return name_line->text(); 158 return m_name->text();
178} 159}
179 160
180QString ProfileEditorDialog::prof_type() 161QCString ProfileEditorDialog::profType()const
181{ 162{
182 QStringList w = m_fact->configWidgets(); 163 /*QStringList w = m_fact->configWidgets();
183 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 164 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
184 if(device_box->currentText() == m_fact->name((*it))) return (*it); 165 if(device_box->currentText() == m_fact->name((*it))) return (*it);
185 166 */
186 return QString::null; 167 return QCString();
168}
169/*
170 * we need to switch the widget
171 */
172void ProfileEditorDialog::slotConActivated( const QString& str ) {
173 delete m_con;
174 m_con = m_fact->newConnectionPlugin( str, m_tabCon );
175
176 if (m_con )
177 m_layCon->addWidget( m_con );
178}
179/*
180 * we need to switch the widget
181 */
182void ProfileEditorDialog::slotTermActivated( const QString& str ) {
183 delete m_term;
184 m_term = m_fact->newTerminalPlugin( str, 0l );
185 qWarning("past");
186
187 if (m_term)
188 m_layTerm->addWidget( m_term );
187} 189}
188
189 190
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 8e830f1..3b67bb3 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -12,7 +12,7 @@ class QHBoxLayout;
12class QLineEdit; 12class QLineEdit;
13class QComboBox; 13class QComboBox;
14class QLabel; 14class QLabel;
15class ProfileEditorPlugin; 15class ProfileDialogWidget;
16 16
17class ProfileEditorDialog : public QDialog { 17class ProfileEditorDialog : public QDialog {
18 Q_OBJECT 18 Q_OBJECT
@@ -20,31 +20,32 @@ public:
20 ProfileEditorDialog(MetaFactory* fact, 20 ProfileEditorDialog(MetaFactory* fact,
21 const Profile& prof ); 21 const Profile& prof );
22 ProfileEditorDialog(MetaFactory* fact ); 22 ProfileEditorDialog(MetaFactory* fact );
23 ~ProfileEditorDialog(); 23 ~ProfileEditorDialog();
24 Profile profile()const; 24 Profile profile()const;
25 25
26 QString prof_name(); 26
27 QString prof_type();
28 27
29public slots: 28public slots:
30 void accept(); 29 void accept();
31 void slotDevice(int id);
32 30
31private slots:
32 void slotConActivated(const QString& );
33 void slotTermActivated( const QString& );
33private: 34private:
34 void initUI(); 35 void initUI();
36 QString profName()const;
37 QCString profType()const;
35 38
36 MetaFactory* m_fact; 39 MetaFactory* m_fact;
37 EditBase* m_base;
38 QTabWidget* m_tab;
39 QHBoxLayout* m_lay; 40 QHBoxLayout* m_lay;
40 Profile m_prof; 41 Profile m_prof;
41 42
42 QLineEdit *name_line; 43 QLineEdit *m_name;
43 QComboBox *device_box; 44 QComboBox *m_conCmb, *m_termCmb;
44 45
45 QWidget *plugin_base; 46 QWidget *m_tabCon, *m_tabTerm;
46 ProfileEditorPlugin *plugin_plugin; 47 ProfileDialogWidget* m_con, *m_term;
47 QHBoxLayout *plugin_layout; 48 QHBoxLayout *m_layCon, *m_layTerm;
48}; 49};
49 50
50#endif 51#endif
diff --git a/noncore/apps/opie-console/profileeditorplugins.h b/noncore/apps/opie-console/profileeditorplugins.h
index 591163a..4ca780e 100644
--- a/noncore/apps/opie-console/profileeditorplugins.h
+++ b/noncore/apps/opie-console/profileeditorplugins.h
@@ -3,82 +3,82 @@
3 3
4#include "profile.h" 4#include "profile.h"
5 5
6#include "qobject.h" 6#include <qobject.h>
7 7
8class QWidget; 8class QWidget;
9 9
10class ProfileEditorPlugin : public QObject 10class ProfileEditorPlugin : public QObject
11{ 11{
12 Q_OBJECT 12 Q_OBJECT
13 public: 13public:
14 ProfileEditorPlugin(QWidget *parent, Profile *p); 14 ProfileEditorPlugin(QWidget *parent);
15 15
16 virtual ~ProfileEditorPlugin(); 16 virtual ~ProfileEditorPlugin();
17 17
18 virtual void save() = 0; 18 virtual void save() = 0;
19 19
20 virtual QWidget *widget() = 0; 20 virtual QWidget *widget() = 0;
21 21
22 QWidget *connection_widget(); 22 QWidget *connection_widget();
23 QWidget *terminal_widget(); 23 QWidget *terminal_widget();
24 24
25 public slots: 25public slots:
26 void slotConnFlow(int id); 26 void slotConnFlow(int id);
27 void slotConnParity(int id); 27 void slotConnParity(int id);
28 void slotConnSpeed(int id); 28 void slotConnSpeed(int id);
29 void slotTermTerm(int id); 29 void slotTermTerm(int id);
30 void slotTermColour(int id); 30 void slotTermColour(int id);
31 void slotTermFont(int id); 31 void slotTermFont(int id);
32 void slotTermEcho(bool on); 32 void slotTermEcho(bool on);
33 void slotTermWrap(bool on); 33 void slotTermWrap(bool on);
34 void slotTermInbound(bool on); 34 void slotTermInbound(bool on);
35 void slotTermOutbound(bool on); 35 void slotTermOutbound(bool on);
36 36
37 protected: 37protected:
38 QWidget *m_parent, *m_widget; 38 QWidget *m_parent, *m_widget;
39 Profile *m_profile; 39 Profile *m_profile;
40 40
41 private: 41private:
42 enum ParityIds 42 enum ParityIds
43 { 43 {
44 id_parity_odd, 44 id_parity_odd,
45 id_parity_even 45 id_parity_even
46 }; 46 };
47 47
48 enum FlowIds 48 enum FlowIds
49 { 49 {
50 id_flow_hw, 50 id_flow_hw,
51 id_flow_sw 51 id_flow_sw
52 }; 52 };
53 53
54 enum SpeedIds 54 enum SpeedIds
55 { 55 {
56 id_baud_115200, 56 id_baud_115200,
57 id_baud_57600, 57 id_baud_57600,
58 id_baud_38400, 58 id_baud_38400,
59 id_baud_19200, 59 id_baud_19200,
60 id_baud_9600 60 id_baud_9600
61 }; 61 };
62 62
63 enum TermIds 63 enum TermIds
64 { 64 {
65 id_term_vt100, 65 id_term_vt100,
66 id_term_vt220, 66 id_term_vt220,
67 id_term_ansi 67 id_term_ansi
68 }; 68 };
69 69
70 enum ColourIds 70 enum ColourIds
71 { 71 {
72 id_term_black, 72 id_term_black,
73 id_term_white 73 id_term_white
74 }; 74 };
75 75
76 enum FontIds 76 enum FontIds
77 { 77 {
78 id_size_small, 78 id_size_small,
79 id_size_medium, 79 id_size_medium,
80 id_size_large 80 id_size_large
81 }; 81 };
82}; 82};
83 83
84//#ifdef __cplusplus 84//#ifdef __cplusplus
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 72a5117..6ad08b5 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -28,7 +28,8 @@ void ProfileManager::load() {
28 conf.setGroup( (*it) ); 28 conf.setGroup( (*it) );
29 Profile prof; 29 Profile prof;
30 prof.setName( conf.readEntry("name") ); 30 prof.setName( conf.readEntry("name") );
31 prof.setIOLayer( conf.readEntry("iolayer") ); 31 prof.setIOLayer( conf.readEntry("iolayer").utf8() );
32 prof.setTerminalName( conf.readEntry("term").utf8() );
32 prof.setBackground( conf.readNumEntry("back") ); 33 prof.setBackground( conf.readNumEntry("back") );
33 prof.setForeground( conf.readNumEntry("fore") ); 34 prof.setForeground( conf.readNumEntry("fore") );
34 prof.setTerminal( conf.readNumEntry("terminal") ); 35 prof.setTerminal( conf.readNumEntry("terminal") );
@@ -65,7 +66,8 @@ void ProfileManager::save( ) {
65 for (it = m_list.begin(); it != m_list.end(); ++it ) { 66 for (it = m_list.begin(); it != m_list.end(); ++it ) {
66 conf.setGroup( (*it).name() ); 67 conf.setGroup( (*it).name() );
67 conf.writeEntry( "name", (*it).name() ); 68 conf.writeEntry( "name", (*it).name() );
68 conf.writeEntry( "ioplayer", (*it).ioLayerName() ); 69 conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) );
70 conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) );
69 conf.writeEntry( "back", (*it).background() ); 71 conf.writeEntry( "back", (*it).background() );
70 conf.writeEntry( "fore", (*it).foreground() ); 72 conf.writeEntry( "fore", (*it).foreground() );
71 conf.writeEntry( "terminal", (*it).terminal() ); 73 conf.writeEntry( "terminal", (*it).terminal() );
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp
index de321ae..10f3f7a 100644
--- a/noncore/apps/opie-console/sz_transfer.cpp
+++ b/noncore/apps/opie-console/sz_transfer.cpp
@@ -3,7 +3,7 @@
3#include <qfile.h> 3#include <qfile.h>
4#include <opie/oprocess.h> 4#include <opie/oprocess.h>
5 5
6SzTransfer::SzTransfer(IOLayer *layer) : FileTransferLayer(layer) 6SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t)
7{ 7{
8} 8}
9 9
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h
index 778d1d3..825680d 100644
--- a/noncore/apps/opie-console/sz_transfer.h
+++ b/noncore/apps/opie-console/sz_transfer.h
@@ -9,16 +9,21 @@ class SzTransfer : public FileTransferLayer {
9 Q_OBJECT 9 Q_OBJECT
10 10
11public: 11public:
12 enum Type {
13 SZ=0,
14 SX,
15 SY
16 };
12 17
13 SzTransfer( IOLayer * ); 18 SzTransfer( Type t, IOLayer * );
14 ~SzTransfer(); 19 ~SzTransfer();
15 20
16public slots: 21public slots:
17 /** 22 /**
18 * send a file over the layer 23 * send a file over the layer
19 */ 24 */
20 void sendFile( const QString& file ) = 0; 25 void sendFile( const QString& file ) ;
21 void sendFile( const QFile& ) = 0; 26 void sendFile( const QFile& );
22 27
23private slots: 28private slots:
24 void SzRecievedStdout(OProcess *, char *, int); 29 void SzRecievedStdout(OProcess *, char *, int);
@@ -27,6 +32,7 @@ private slots:
27 32
28private: 33private:
29 OProcess *proc; 34 OProcess *proc;
35 Type m_t;
30 36
31}; 37};
32 38