summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/file_layer.h6
-rw-r--r--noncore/apps/opie-console/main.cpp102
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.cpp21
-rw-r--r--noncore/apps/opie-console/profiledialogwidget.h9
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp29
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp4
6 files changed, 147 insertions, 24 deletions
diff --git a/noncore/apps/opie-console/file_layer.h b/noncore/apps/opie-console/file_layer.h
index edb30e1..caa7478 100644
--- a/noncore/apps/opie-console/file_layer.h
+++ b/noncore/apps/opie-console/file_layer.h
@@ -1,94 +1,94 @@
1#ifndef OPIE_FILE_LAYER_H 1#ifndef OPIE_FILE_LAYER_H
2#define OPIE_FILE_LAYER_H 2#define OPIE_FILE_LAYER_H
3 3
4#include <qmap.h> 4#include <qmap.h>
5 5
6#include "io_layer.h" 6#include "io_layer.h"
7 7
8class QFile; 8class QFile;
9/** 9/**
10 * this is the layer for sending files 10 * this is the layer for sending files
11 */ 11 */
12class FileTransferLayer : public QObject { 12class FileTransferLayer : public QObject {
13 Q_OBJECT 13 Q_OBJECT
14 14
15public: 15public:
16 enum Errors{ 16 enum Errors{
17 NotSupported, 17 NotSupported,
18 StartError, 18 StartError,
19 NoError, 19 NoError,
20 Unknown, 20 Unknown,
21 Undefined, 21 Undefined,
22 Incomplete 22 Incomplete
23 }; 23 };
24 enum Features { 24 enum Features {
25 Append = 0, 25 Append = 0,
26 Twostop = 1, 26 Twostop = 1,
27 Escape = 2, 27 Escape = 2,
28 Rename = 4, 28 Rename = 4,
29 FullPath = 8, 29 FullPath = 8,
30 SendIfNewer = 16, 30 SendIfNewer = 16,
31 SendIfLonger = 32, 31 SendIfLonger = 32,
32 Resume = 64 32 Resume = 64
33 33
34 }; 34 };
35 enum Mode { 35 enum Mode {
36 Ascii = 0, 36 Ascii = 0,
37 Binary 37 Binary
38 }; 38 };
39 enum BlockSize { 39 enum BlockSize {
40 Block_1k, 40 Block_1k,
41 Block_4k, 41 Block_4k,
42 Block_8k 42 Block_8k
43 }; 43 };
44 /** 44 /**
45 *the io layer to be used 45 *the io layer to be used
46 */ 46 */
47 FileTransferLayer( IOLayer* ); 47 FileTransferLayer( IOLayer* );
48 virtual ~FileTransferLayer(); 48 virtual ~FileTransferLayer();
49 49
50public slots: 50public slots:
51 51
52 virtual void sendFile( const QString& file, 52 virtual void sendFile( const QString&,
53 Mode mode, BlockSize blk, 53 Mode, BlockSize,
54 Features feat ) {}; 54 Features ) {};
55 55
56 /** 56 /**
57 * send a file over the layer 57 * send a file over the layer
58 */ 58 */
59 virtual void sendFile( const QString& file ) = 0; 59 virtual void sendFile( const QString& file ) = 0;
60 virtual void sendFile( const QFile& ) = 0; 60 virtual void sendFile( const QFile& ) = 0;
61 virtual void cancel() = 0; 61 virtual void cancel() = 0;
62 62
63signals: 63signals:
64 /** 64 /**
65 * sent the file 65 * sent the file
66 */ 66 */
67 void sent(); 67 void sent();
68 68
69 /** 69 /**
70 * an error occured 70 * an error occured
71 */ 71 */
72 72
73 void error( int, const QString& ); 73 void error( int, const QString& );
74 74
75 /* 75 /*
76 * @param file The file to send 76 * @param file The file to send
77 * @param progress the progress made from 0-100 77 * @param progress the progress made from 0-100
78 * @param speed Speed in bps 78 * @param speed Speed in bps
79 * @param hours The hours it take to finish 79 * @param hours The hours it take to finish
80 * @param minutes The minutes it takes to finish 80 * @param minutes The minutes it takes to finish
81 * @param send The seconds... 81 * @param send The seconds...
82 * 82 *
83 */ 83 */
84 void progress( const QString& file, int progress, int speed, int hours, int minutes, int seconds ); 84 void progress( const QString& file, int progress, int speed, int hours, int minutes, int seconds );
85 85
86protected: 86protected:
87 IOLayer* layer(); 87 IOLayer* layer();
88 88
89private: 89private:
90 IOLayer* m_layer; 90 IOLayer* m_layer;
91 91
92}; 92};
93 93
94#endif 94#endif
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp
index 350bb3e..78a91a2 100644
--- a/noncore/apps/opie-console/main.cpp
+++ b/noncore/apps/opie-console/main.cpp
@@ -1,13 +1,113 @@
1#include <sys/types.h>
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <signal.h>
6
7#include <qfile.h>
8
1#include <qpe/qpeapplication.h> 9#include <qpe/qpeapplication.h>
2 10
3#include "mainwindow.h" 11#include "mainwindow.h"
4 12
13//#define FSCKED_DISTRIBUTION 1
14#ifdef FSCKED_DISTRIBUTION
15/*
16 * The Zaurus rom
17 */
18class FixIt {
19public:
20 FixIt();
21 ~FixIt();
22 void fixIt();
23 /* no real interested in implementing it */
24 void breakIt() {
25
26 };
27 char* m_file;
28};
29
30FixIt::FixIt() {
31 /* the new inittab */
32 m_file = "#\n# /etc/inittab
33#
34
35# 0 - halt (Do NOT set initdefault to this)
36# 1 - Single user mode
37# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
38# 3 - Full multiuser mode
39# 4 - JavaVM(Intent) developer mode
40# 5 - JavaVM(Intent)
41# 6 - reboot (Do NOT set initdefault to this)
42#
43id:5:initdefault:
44
45# Specify things to do when starting
46si::sysinit:/etc/rc.d/rc.sysinit
47
48l0:0:wait:/root/etc/rc.d/rc 0
49l1:1:wait:/etc/rc.d/rc 1
50l2:2:wait:/etc/rc.d/rc 2
51l3:3:wait:/etc/rc.d/rc 3
52l4:4:wait:/etc/rc.d/rc 4
53l5:5:wait:/etc/rc.d/rc 5
54l6:6:wait:/root/etc/rc.d/rc 6
55
56# Specify things to do before rebooting
57um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1
58sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1
59
60# Specify program to run on ttyS0
61s0:24:respawn:/sbin/getty 9600 ttyS0
62#pd:5:respawn:/etc/sync/serialctl
63
64# Specify program to run on tty1
651:2:respawn:/sbin/getty 9600 tty1
66ln:345:respawn:survive -l 6 /sbin/launch
67#qt:5:respawn:/sbin/qt
68
69# collie sp.
70sy::respawn:/sbin/shsync\n";
71
72
73}
74FixIt::~FixIt() {
75}
76/*
77 * the retail Zaurus is broken in many ways
78 * one is that pppd is listening on our port...
79 * we've to stop it from that and then do kill(SIGHUP,1);
80 */
81void FixIt::fixIt() {
82 ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" );
83 QFile file( "/etc/inittab" );
84 if ( file.open(IO_WriteOnly | IO_Raw ) ) {
85 file.writeBlock(m_file,strlen(m_file) );
86 }
87 file.close();
88 ::kill( SIGHUP, 1 );
89}
90#endif
91
92
5int main(int argc, char **argv) { 93int main(int argc, char **argv) {
6 QPEApplication app( argc, argv ); 94 QPEApplication app( argc, argv );
7 95
96#ifdef FSCKED_DISTRIBUTION
97 qWarning("fscked");
98 FixIt it;
99 it.fixIt();
100#endif
101
8 MainWindow mw; 102 MainWindow mw;
9 mw.setCaption(QObject::tr("Opie console") ); 103 mw.setCaption(QObject::tr("Opie console") );
10 app.showMainWidget( &mw ); 104 app.showMainWidget( &mw );
11 105
12 return app.exec(); 106 int ap = app.exec();
107
108#ifdef FSCKED_DISTRIBUTION
109 /* should add a signal handler too */
110 it.breakIt();
111#endif
112 return ap;
13} 113}
diff --git a/noncore/apps/opie-console/profiledialogwidget.cpp b/noncore/apps/opie-console/profiledialogwidget.cpp
index caad998..c356535 100644
--- a/noncore/apps/opie-console/profiledialogwidget.cpp
+++ b/noncore/apps/opie-console/profiledialogwidget.cpp
@@ -1,43 +1,62 @@
1#include <qlayout.h>
2#include <qlabel.h>
3
1#include "profiledialogwidget.h" 4#include "profiledialogwidget.h"
2 5
3ProfileDialogWidget::ProfileDialogWidget( const QString&, QWidget* parent, 6ProfileDialogWidget::ProfileDialogWidget( const QString&, QWidget* parent,
4 const char* name ) 7 const char* name )
5 : QWidget( parent, name ) { 8 : QWidget( parent, name ) {
6} 9}
7ProfileDialogWidget::~ProfileDialogWidget() { 10ProfileDialogWidget::~ProfileDialogWidget() {
8} 11}
9 12
10ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na, 13ProfileDialogTerminalWidget::ProfileDialogTerminalWidget( const QString& na,
11 QWidget* parent, 14 QWidget* parent,
12 const char* name ) 15 const char* name )
13 : ProfileDialogWidget( na, parent, name ) 16 : ProfileDialogWidget( na, parent, name )
14{ 17{
15} 18}
16ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() { 19ProfileDialogTerminalWidget::~ProfileDialogTerminalWidget() {
17} 20}
18ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const { 21ProfileDialogWidget::Type ProfileDialogTerminalWidget::type()const {
19 return Terminal; 22 return Terminal;
20} 23}
21 24
22ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na, 25ProfileDialogConnectionWidget::ProfileDialogConnectionWidget( const QString& na,
23 QWidget* parent, 26 QWidget* parent,
24 const char* name ) 27 const char* name )
25 : ProfileDialogWidget(na, parent, name ) 28 : ProfileDialogWidget(na, parent, name )
26{ 29{
27} 30}
28ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() { 31ProfileDialogConnectionWidget::~ProfileDialogConnectionWidget() {
29} 32}
30ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const { 33ProfileDialogWidget::Type ProfileDialogConnectionWidget::type()const {
31 return Connection; 34 return Connection;
32} 35}
33ProfileDialogKeyWidget::ProfileDialogKeyWidget( const QString &na, 36ProfileDialogKeyWidget::ProfileDialogKeyWidget( const QString &na,
34 QWidget *parent, 37 QWidget *parent,
35 const char *name) 38 const char *name)
36 : ProfileDialogWidget(na, parent, name ) 39 : ProfileDialogWidget(na, parent, name )
37{ 40{
38} 41}
39ProfileDialogKeyWidget::~ProfileDialogKeyWidget() { 42ProfileDialogKeyWidget::~ProfileDialogKeyWidget() {
40} 43}
41ProfileDialogWidget::Type ProfileDialogKeyWidget::type() const{ 44ProfileDialogWidget::Type ProfileDialogKeyWidget::type() const{
42 return Keyboard; 45 return Keyboard;
43} 46}
47
48NoOptions::NoOptions( const QString& name, QWidget* parent, const char* na )
49 : ProfileDialogWidget( name, parent, na ) {
50 QHBoxLayout* lay = new QHBoxLayout(this);
51 QLabel* lbl = new QLabel( this );
52 lbl->setText( tr("This Plugin does not support any configurations") );
53 lbl->setTextFormat( RichText );
54
55 lay->addWidget( lbl );
56}
57void NoOptions::load( const Profile& ) {
58
59}
60void NoOptions::save( Profile& ) {
61
62}
diff --git a/noncore/apps/opie-console/profiledialogwidget.h b/noncore/apps/opie-console/profiledialogwidget.h
index 9d2d5ec..68f2162 100644
--- a/noncore/apps/opie-console/profiledialogwidget.h
+++ b/noncore/apps/opie-console/profiledialogwidget.h
@@ -1,59 +1,68 @@
1#ifndef OPIE_PROFILE_DIALOG_WIDGET_H 1#ifndef OPIE_PROFILE_DIALOG_WIDGET_H
2#define OPIE_PROFILE_DIALOG_WIDGET_H 2#define OPIE_PROFILE_DIALOG_WIDGET_H
3 3
4#include <qwidget.h> 4#include <qwidget.h>
5 5
6#include "profile.h" 6#include "profile.h"
7 7
8class ProfileDialogWidget : public QWidget { 8class ProfileDialogWidget : public QWidget {
9 Q_OBJECT 9 Q_OBJECT
10public: 10public:
11 enum Type { 11 enum Type {
12 Connection, 12 Connection,
13 Terminal, 13 Terminal,
14 Keyboard 14 Keyboard
15 }; 15 };
16 ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l); 16 ProfileDialogWidget( const QString& name, QWidget* parent, const char* name = 0l);
17 ~ProfileDialogWidget(); 17 ~ProfileDialogWidget();
18 18
19 /* 19 /*
20 * load data from a Profile into 20 * load data from a Profile into
21 * the DialogWidget 21 * the DialogWidget
22 */ 22 */
23 virtual void load( const Profile& ) = 0; 23 virtual void load( const Profile& ) = 0;
24 24
25 /* 25 /*
26 * save data into a profile 26 * save data into a profile
27 * from the DialogWidget 27 * from the DialogWidget
28 */ 28 */
29 virtual void save( Profile& ) = 0; 29 virtual void save( Profile& ) = 0;
30 30
31 virtual Type type()const = 0; 31 virtual Type type()const = 0;
32}; 32};
33class ProfileDialogTerminalWidget : public ProfileDialogWidget { 33class ProfileDialogTerminalWidget : public ProfileDialogWidget {
34 Q_OBJECT 34 Q_OBJECT
35public: 35public:
36 ProfileDialogTerminalWidget( const QString& name, QWidget* widget, 36 ProfileDialogTerminalWidget( const QString& name, QWidget* widget,
37 const char* name =0l); 37 const char* name =0l);
38 ~ProfileDialogTerminalWidget(); 38 ~ProfileDialogTerminalWidget();
39 Type type()const; 39 Type type()const;
40}; 40};
41class ProfileDialogConnectionWidget : public ProfileDialogWidget { 41class ProfileDialogConnectionWidget : public ProfileDialogWidget {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 ProfileDialogConnectionWidget( const QString& name, QWidget* parent, 44 ProfileDialogConnectionWidget( const QString& name, QWidget* parent,
45 const char* name =0l); 45 const char* name =0l);
46 ~ProfileDialogConnectionWidget(); 46 ~ProfileDialogConnectionWidget();
47 Type type() const; 47 Type type() const;
48 48
49}; 49};
50class ProfileDialogKeyWidget : public ProfileDialogWidget { 50class ProfileDialogKeyWidget : public ProfileDialogWidget {
51 Q_OBJECT 51 Q_OBJECT
52public: 52public:
53 ProfileDialogKeyWidget( const QString &name, QWidget* parent, 53 ProfileDialogKeyWidget( const QString &name, QWidget* parent,
54 const char *name =0l); 54 const char *name =0l);
55 ~ProfileDialogKeyWidget(); 55 ~ProfileDialogKeyWidget();
56 Type type() const; 56 Type type() const;
57}; 57};
58 58
59class NoOptions : public ProfileDialogWidget {
60 Q_OBJECT
61 public:
62 NoOptions( const QString& name, QWidget* parent, const char* na );
63 ~NoOptions() {}
64 void load( const Profile& );
65 void save( Profile& );
66 Type type()const{ return Connection; };
67};
59#endif 68#endif
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 2dfc0fd..413e80b 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,115 +1,113 @@
1#include <qlayout.h> 1#include <qlayout.h>
2#include <qlineedit.h> 2#include <qlineedit.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qmessagebox.h> 4#include <qmessagebox.h>
5#include <qstringlist.h> 5#include <qstringlist.h>
6#include <qcombobox.h> 6#include <qcombobox.h>
7#include <qcheckbox.h> 7#include <qcheckbox.h>
8 8
9 9
10//#include "profileeditorplugins.h" 10//#include "profileeditorplugins.h"
11#include "metafactory.h" 11#include "metafactory.h"
12#include "profileeditordialog.h" 12#include "profileeditordialog.h"
13 13
14namespace { 14namespace {
15 void setCurrent( const QString& str, QComboBox* bo ) { 15 void setCurrent( const QString& str, QComboBox* bo ) {
16 for (uint i = 0; i < bo->count(); i++ ) { 16 for (int i = 0; i < bo->count(); i++ ) {
17 if ( bo->text(i) == str ) { 17 if ( bo->text(i) == str ) {
18 bo->setCurrentItem( i ); 18 bo->setCurrentItem( i );
19 } 19 }
20 } 20 }
21 } 21 };
22
23
24} 22}
25 23
26ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, 24ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
27 const Profile& prof ) 25 const Profile& prof )
28 : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) 26 : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
29{ 27{
30 initUI(); 28 initUI();
31 29
32 // Apply current profile 30 // Apply current profile
33 // plugin_plugin->load(profile); 31 // plugin_plugin->load(profile);
34 // ... (reset profile name line edit etc.) 32 // ... (reset profile name line edit etc.)
35} 33}
36 34
37ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) 35ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
38 : QDialog(0, 0, TRUE), m_fact( fact ) 36 : QDialog(0, 0, TRUE), m_fact( fact )
39{ 37{
40 // Default profile 38 // Default profile
41 m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); 39 m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102);
42 40
43 initUI(); 41 initUI();
44 42
45 // Apply current profile 43 // Apply current profile
46 // plugin_plugin->load(profile); 44 // plugin_plugin->load(profile);
47} 45}
48 46
49Profile ProfileEditorDialog::profile() const 47Profile ProfileEditorDialog::profile() const
50{ 48{
51 return m_prof; 49 return m_prof;
52} 50}
53 51
54void ProfileEditorDialog::initUI() 52void ProfileEditorDialog::initUI()
55{ 53{
56 m_con = m_term = m_key = 0l; 54 m_con = m_term = m_key = 0l;
57 55
58 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 56 QVBoxLayout *mainLayout = new QVBoxLayout( this );
59 tabWidget = new OTabWidget( this ); 57 tabWidget = new OTabWidget( this );
60 tabWidget->setTabStyle(OTabWidget::TextTab); 58 tabWidget->setTabStyle(OTabWidget::TextTab);
61 mainLayout->add(tabWidget); 59 mainLayout->add(tabWidget);
62 60
63 /* base tabs */ 61 /* base tabs */
64 tabprof = new QWidget(this); 62 tabprof = new QWidget(this);
65 m_tabTerm = new QWidget(this); 63 m_tabTerm = new QWidget(this);
66 m_tabCon = new QWidget(this); 64 m_tabCon = new QWidget(this);
67 m_tabKey = new QWidget(this); 65 m_tabKey = new QWidget(this);
68 66
69 /* base layout for tabs */ 67 /* base layout for tabs */
70 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 68 m_layCon = new QHBoxLayout( m_tabCon , 2 );
71 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 69 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
72 m_layKey = new QHBoxLayout( m_tabKey, 2 ); 70 m_layKey = new QHBoxLayout( m_tabKey, 2 );
73 71
74 // profile tab 72 // profile tab
75 73
76 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 74 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
77 m_name = new QLineEdit(tabprof); 75 m_name = new QLineEdit(tabprof);
78 QLabel *con = new QLabel(tr("Connection"), tabprof ); 76 QLabel *con = new QLabel(tr("Connection"), tabprof );
79 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 77 QLabel *term = new QLabel(tr("Terminal"), tabprof );
80 m_conCmb = new QComboBox( tabprof ); 78 m_conCmb = new QComboBox( tabprof );
81 m_termCmb = new QComboBox( tabprof ); 79 m_termCmb = new QComboBox( tabprof );
82 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); 80 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof);
83 81
84 // layouting 82 // layouting
85 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 83 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
86 vbox3->add(name); 84 vbox3->add(name);
87 vbox3->add(m_name); 85 vbox3->add(m_name);
88 vbox3->add(con ); 86 vbox3->add(con );
89 vbox3->add(m_conCmb ); 87 vbox3->add(m_conCmb );
90 vbox3->add(term ); 88 vbox3->add(term );
91 vbox3->add(m_termCmb ); 89 vbox3->add(m_termCmb );
92 vbox3->add(m_autoConnect); 90 vbox3->add(m_autoConnect);
93 vbox3->addStretch(1); 91 vbox3->addStretch(1);
94 92
95 m_showconntab = 0; 93 m_showconntab = 0;
96 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 94 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
97 //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); 95 //tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
98 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); 96 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
99 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); 97 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
100 tabWidget->setCurrentTab( tabprof ); 98 tabWidget->setCurrentTab( tabprof );
101 99
102 100
103 // fill the comboboxes 101 // fill the comboboxes
104 QStringList list = m_fact->connectionWidgets(); 102 QStringList list = m_fact->connectionWidgets();
105 QStringList::Iterator it; 103 QStringList::Iterator it;
106 for (it =list.begin(); it != list.end(); ++it ) { 104 for (it =list.begin(); it != list.end(); ++it ) {
107 m_conCmb->insertItem( (*it) ); 105 m_conCmb->insertItem( (*it) );
108 } 106 }
109 list = m_fact->terminalWidgets(); 107 list = m_fact->terminalWidgets();
110 for (it =list.begin(); it != list.end(); ++it ) { 108 for (it =list.begin(); it != list.end(); ++it ) {
111 m_termCmb->insertItem( (*it) ); 109 m_termCmb->insertItem( (*it) );
112 } 110 }
113 111
114 // load profile values 112 // load profile values
115 m_name->setText(m_prof.name()); 113 m_name->setText(m_prof.name());
@@ -120,103 +118,98 @@ void ProfileEditorDialog::initUI()
120 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 118 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
121 m_autoConnect->setChecked(m_prof.autoConnect()); 119 m_autoConnect->setChecked(m_prof.autoConnect());
122 120
123 121
124 // signal and slots 122 // signal and slots
125 connect(m_conCmb, SIGNAL(activated(const QString& ) ), 123 connect(m_conCmb, SIGNAL(activated(const QString& ) ),
126 this, SLOT(slotConActivated(const QString&) ) ); 124 this, SLOT(slotConActivated(const QString&) ) );
127 connect(m_termCmb, SIGNAL(activated(const QString& ) ), 125 connect(m_termCmb, SIGNAL(activated(const QString& ) ),
128 this, SLOT(slotTermActivated(const QString& ) ) ); 126 this, SLOT(slotTermActivated(const QString& ) ) );
129 127
130} 128}
131 129
132ProfileEditorDialog::~ProfileEditorDialog() { 130ProfileEditorDialog::~ProfileEditorDialog() {
133 131
134} 132}
135void ProfileEditorDialog::accept() 133void ProfileEditorDialog::accept()
136{ 134{
137 if(profName().isEmpty()) 135 if(profName().isEmpty())
138 { 136 {
139 QMessageBox::information(this, 137 QMessageBox::information(this,
140 QObject::tr("Invalid profile"), 138 QObject::tr("Invalid profile"),
141 QObject::tr("Please enter a profile name.")); 139 QObject::tr("Please enter a profile name."));
142 return; 140 return;
143 } 141 }
144 // Save profile and plugin profile 142 // Save profile and plugin profile
145 //if(plugin_plugin) plugin_plugin->save(); 143 //if(plugin_plugin) plugin_plugin->save();
146 144
147 // Save general values 145 // Save general values
148 m_prof.setName(profName()); 146 m_prof.setName(profName());
149 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); 147 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
150 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); 148 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
151 m_prof.setAutoConnect( m_autoConnect->isChecked() ); 149 m_prof.setAutoConnect( m_autoConnect->isChecked() );
152 150
153 if (m_con ) 151 if (m_con )
154 m_con->save( m_prof ); 152 m_con->save( m_prof );
155 if (m_term ) 153 if (m_term )
156 m_term->save( m_prof ); 154 m_term->save( m_prof );
157 if (m_key) 155 if (m_key)
158 m_key->save( m_prof ); 156 m_key->save( m_prof );
159 157
160 QDialog::accept(); 158 QDialog::accept();
161} 159}
162 160
163 161
164QString ProfileEditorDialog::profName()const 162QString ProfileEditorDialog::profName()const
165{ 163{
166 return m_name->text(); 164 return m_name->text();
167} 165}
168 166
169QCString ProfileEditorDialog::profType()const 167QCString ProfileEditorDialog::profType()const
170{ 168{
171 /*QStringList w = m_fact->configWidgets(); 169 /*QStringList w = m_fact->configWidgets();
172 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 170 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
173 if(device_box->currentText() == m_fact->name((*it))) return (*it); 171 if(device_box->currentText() == m_fact->name((*it))) return (*it);
174 */ 172 */
175 return QCString(); 173 return QCString();
176} 174}
177/* 175/*
178 * we need to switch the widget 176 * we need to switch the widget
179 */ 177 */
180void ProfileEditorDialog::slotConActivated( const QString& str ) { 178void ProfileEditorDialog::slotConActivated( const QString& str ) {
181 delete m_con; 179 delete m_con;
182 m_con = m_fact->newConnectionPlugin( str, m_tabCon ); 180 m_con = m_fact->newConnectionPlugin( str, m_tabCon );
183 181
184 if ( m_con ) { 182 if ( !m_con ) {
185 m_con->load( m_prof ); 183 m_con = new NoOptions( str, m_tabCon, "name");
186 m_layCon->addWidget( m_con );
187
188 if(!m_showconntab)
189 {
190 tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") );
191 tabWidget->setCurrentTab( tabprof );
192 m_showconntab = 1;
193 }
194 } else {
195 tabWidget->removePage( m_tabCon );
196 m_showconntab = 0;
197 } 184 }
185 m_con->load( m_prof );
186 m_layCon->addWidget( m_con );
187
188 tabWidget->addTab( m_tabCon, "", QObject::tr("Connection") );
189 tabWidget->setCurrentTab( tabprof );
190
198} 191}
199/* 192/*
200 * we need to switch the widget 193 * we need to switch the widget
201 */ 194 */
202void ProfileEditorDialog::slotTermActivated( const QString& str ) { 195void ProfileEditorDialog::slotTermActivated( const QString& str ) {
203 delete m_term; 196 delete m_term;
204 m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); 197 m_term = m_fact->newTerminalPlugin( str, m_tabTerm );
205 198
206 if (m_term) { 199 if (m_term) {
207 m_term->load(m_prof ); 200 m_term->load(m_prof );
208 m_layTerm->addWidget( m_term ); 201 m_layTerm->addWidget( m_term );
209 } 202 }
210} 203}
211 204
212void ProfileEditorDialog::slotKeyActivated(const QString &str) { 205void ProfileEditorDialog::slotKeyActivated(const QString &str) {
213 delete m_key; 206 delete m_key;
214 m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); 207 m_key = m_fact->newKeyboardPlugin( str, m_tabKey );
215 208
216 if (m_key) { 209 if (m_key) {
217 210
218 m_key->load(m_prof); 211 m_key->load(m_prof);
219 m_layKey->addWidget(m_key); 212 m_layKey->addWidget(m_key);
220 } 213 }
221 214
222} 215}
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index 1e97a24..bd0312a 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -35,113 +35,115 @@ SerialConfigWidget::SerialConfigWidget( const QString& name,
35 35
36 m_lay->addWidget( m_device ); 36 m_lay->addWidget( m_device );
37 m_lay->addWidget( m_deviceCmb ); 37 m_lay->addWidget( m_deviceCmb );
38 m_lay->addWidget( m_base ); 38 m_lay->addWidget( m_base );
39 39
40 m_deviceCmb->insertItem( "/dev/ttyS0" ); 40 m_deviceCmb->insertItem( "/dev/ttyS0" );
41 m_deviceCmb->insertItem( "/dev/ttyS1" ); 41 m_deviceCmb->insertItem( "/dev/ttyS1" );
42 m_deviceCmb->insertItem( "/dev/ttySA0"); 42 m_deviceCmb->insertItem( "/dev/ttySA0");
43 m_deviceCmb->insertItem( "/dev/ttySA1"); 43 m_deviceCmb->insertItem( "/dev/ttySA1");
44 44
45} 45}
46SerialConfigWidget::~SerialConfigWidget() { 46SerialConfigWidget::~SerialConfigWidget() {
47 47
48} 48}
49void SerialConfigWidget::load( const Profile& prof ) { 49void SerialConfigWidget::load( const Profile& prof ) {
50 int rad_flow = prof.readNumEntry("Flow"); 50 int rad_flow = prof.readNumEntry("Flow");
51 int rad_parity = prof.readNumEntry("Parity"); 51 int rad_parity = prof.readNumEntry("Parity");
52 int speed = prof.readNumEntry("Speed"); 52 int speed = prof.readNumEntry("Speed");
53 53
54 if (rad_flow == 1) { 54 if (rad_flow == 1) {
55 m_base->setFlow( IOLayerBase::Hardware ); 55 m_base->setFlow( IOLayerBase::Hardware );
56 } else if (rad_flow == 2) { 56 } else if (rad_flow == 2) {
57 m_base->setFlow( IOLayerBase::Software ); 57 m_base->setFlow( IOLayerBase::Software );
58 } else { 58 } else {
59 m_base->setFlow( IOLayerBase::None ); 59 m_base->setFlow( IOLayerBase::None );
60 } 60 }
61 61
62 if (rad_parity == 1) { 62 if (rad_parity == 1) {
63 m_base->setParity( IOLayerBase::Even ); 63 m_base->setParity( IOLayerBase::Even );
64 } else if ( rad_parity == 2 ) { 64 } else if ( rad_parity == 2 ) {
65 m_base->setParity( IOLayerBase::Odd ); 65 m_base->setParity( IOLayerBase::Odd );
66 } else { 66 } else {
67 m_base->setParity( IOLayerBase::NonePar ); 67 m_base->setParity( IOLayerBase::NonePar );
68 } 68 }
69 69
70 switch( speed ) { 70 switch( speed ) {
71 case 115200: 71 case 115200:
72 m_base->setSpeed(IOLayerBase::Baud_115200 ); 72 m_base->setSpeed(IOLayerBase::Baud_115200 );
73 break; 73 break;
74 case 57600: 74 case 57600:
75 m_base->setSpeed( IOLayerBase::Baud_57600 ); 75 m_base->setSpeed( IOLayerBase::Baud_57600 );
76 break; 76 break;
77 case 38400: 77 case 38400:
78 m_base->setSpeed(IOLayerBase::Baud_38400 ); 78 m_base->setSpeed(IOLayerBase::Baud_38400 );
79 break; 79 break;
80 case 19200: 80 case 19200:
81 m_base->setSpeed( IOLayerBase::Baud_19200 ); 81 m_base->setSpeed( IOLayerBase::Baud_19200 );
82 break; 82 break;
83 case 9600: 83 case 9600:
84 default: 84 default:
85 m_base->setSpeed(IOLayerBase::Baud_9600 ); 85 m_base->setSpeed(IOLayerBase::Baud_9600 );
86 break; 86 break;
87 } 87 }
88 88
89 if ( prof.readEntry("Device").isEmpty() ) return; 89 if ( prof.readEntry("Device").isEmpty() ) return;
90 setCurrent( prof.readEntry("Device"), m_deviceCmb ); 90 setCurrent( prof.readEntry("Device"), m_deviceCmb );
91 91
92} 92}
93/* 93/*
94 * save speed, 94 * save speed,
95 * flow, 95 * flow,
96 * parity 96 * parity
97 */ 97 */
98void SerialConfigWidget::save( Profile& prof ) { 98void SerialConfigWidget::save( Profile& prof ) {
99 int flow, parity, speed; 99 int flow, parity, speed ;
100 flow = parity = speed = 0;
100 prof.writeEntry("Device", m_deviceCmb->currentText() ); 101 prof.writeEntry("Device", m_deviceCmb->currentText() );
101 102
102 switch( m_base->flow() ) { 103 switch( m_base->flow() ) {
103 case IOLayerBase::None: 104 case IOLayerBase::None:
104 flow = 0; 105 flow = 0;
105 break; 106 break;
106 case IOLayerBase::Software: 107 case IOLayerBase::Software:
107 flow = 2; 108 flow = 2;
108 break; 109 break;
109 case IOLayerBase::Hardware: 110 case IOLayerBase::Hardware:
110 flow = 1; 111 flow = 1;
111 break; 112 break;
112 } 113 }
113 114
114 switch( m_base->parity() ) { 115 switch( m_base->parity() ) {
115 case IOLayerBase::Odd: 116 case IOLayerBase::Odd:
116 parity = 2; 117 parity = 2;
117 break; 118 break;
118 case IOLayerBase::Even: 119 case IOLayerBase::Even:
119 parity = 1; 120 parity = 1;
120 break; 121 break;
121 case IOLayerBase::NonePar: 122 case IOLayerBase::NonePar:
122 parity = 0; 123 parity = 0;
123 break; 124 break;
124 } 125 }
125 126
126 switch( m_base->speed() ) { 127 switch( m_base->speed() ) {
127 case IOLayerBase::Baud_115200: 128 case IOLayerBase::Baud_115200:
128 speed = 115200; 129 speed = 115200;
129 break; 130 break;
130 case IOLayerBase::Baud_57600: 131 case IOLayerBase::Baud_57600:
131 speed = 57600; 132 speed = 57600;
132 break; 133 break;
133 case IOLayerBase::Baud_38400: 134 case IOLayerBase::Baud_38400:
134 speed = 38400; 135 speed = 38400;
135 break; 136 break;
136 case IOLayerBase::Baud_19200: 137 case IOLayerBase::Baud_19200:
137 speed = 19200; 138 speed = 19200;
138 break; 139 break;
140 default:
139 case IOLayerBase::Baud_9600: 141 case IOLayerBase::Baud_9600:
140 speed = 9600; 142 speed = 9600;
141 break; 143 break;
142 } 144 }
143 145
144 prof.writeEntry("Flow", flow); 146 prof.writeEntry("Flow", flow);
145 prof.writeEntry("Parity", parity); 147 prof.writeEntry("Parity", parity);
146 prof.writeEntry("Speed", speed); 148 prof.writeEntry("Speed", speed);
147} 149}