author | zecke <zecke> | 2002-10-21 21:43:43 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-21 21:43:43 (UTC) |
commit | 21d29dbf8a9c1a12c7c23f96b80307e87ffaa50a (patch) (unidiff) | |
tree | 98586789ecce5eea1f1d3eb1e5a2184412f90a06 | |
parent | e2f94235dae5ec84a5e888e4114ce0bdd91db7e7 (diff) | |
download | opie-21d29dbf8a9c1a12c7c23f96b80307e87ffaa50a.zip opie-21d29dbf8a9c1a12c7c23f96b80307e87ffaa50a.tar.gz opie-21d29dbf8a9c1a12c7c23f96b80307e87ffaa50a.tar.bz2 |
add a quirk mode into main. if you -DFSCKED_DISTRIBUTION
opie-console will take care of some magic...
Add a No Configuration Widget instead of a big fat gray thing
above my beloved OTabWidget
Fix some compiler warning
-rw-r--r-- | noncore/apps/opie-console/file_layer.h | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/main.cpp | 102 | ||||
-rw-r--r-- | noncore/apps/opie-console/profiledialogwidget.cpp | 21 | ||||
-rw-r--r-- | noncore/apps/opie-console/profiledialogwidget.h | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 29 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 4 |
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 | |||
@@ -50,7 +50,7 @@ public: | |||
50 | public slots: | 50 | public 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 | /** |
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 | */ | ||
18 | class FixIt { | ||
19 | public: | ||
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 | |||
30 | FixIt::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 | # | ||
43 | id:5:initdefault: | ||
44 | |||
45 | # Specify things to do when starting | ||
46 | si::sysinit:/etc/rc.d/rc.sysinit | ||
47 | |||
48 | l0:0:wait:/root/etc/rc.d/rc 0 | ||
49 | l1:1:wait:/etc/rc.d/rc 1 | ||
50 | l2:2:wait:/etc/rc.d/rc 2 | ||
51 | l3:3:wait:/etc/rc.d/rc 3 | ||
52 | l4:4:wait:/etc/rc.d/rc 4 | ||
53 | l5:5:wait:/etc/rc.d/rc 5 | ||
54 | l6:6:wait:/root/etc/rc.d/rc 6 | ||
55 | |||
56 | # Specify things to do before rebooting | ||
57 | um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1 | ||
58 | sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1 | ||
59 | |||
60 | # Specify program to run on ttyS0 | ||
61 | s0:24:respawn:/sbin/getty 9600 ttyS0 | ||
62 | #pd:5:respawn:/etc/sync/serialctl | ||
63 | |||
64 | # Specify program to run on tty1 | ||
65 | 1:2:respawn:/sbin/getty 9600 tty1 | ||
66 | ln:345:respawn:survive -l 6 /sbin/launch | ||
67 | #qt:5:respawn:/sbin/qt | ||
68 | |||
69 | # collie sp. | ||
70 | sy::respawn:/sbin/shsync\n"; | ||
71 | |||
72 | |||
73 | } | ||
74 | FixIt::~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 | */ | ||
81 | void 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 | |||
5 | int main(int argc, char **argv) { | 93 | int 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,2 +1,5 @@ | |||
1 | #include <qlayout.h> | ||
2 | #include <qlabel.h> | ||
3 | |||
1 | #include "profiledialogwidget.h" | 4 | #include "profiledialogwidget.h" |
2 | 5 | ||
@@ -34,5 +37,5 @@ ProfileDialogKeyWidget::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 | } |
@@ -42,2 +45,18 @@ ProfileDialogWidget::Type ProfileDialogKeyWidget::type() const{ | |||
42 | return Keyboard; | 45 | return Keyboard; |
43 | } | 46 | } |
47 | |||
48 | NoOptions::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 | } | ||
57 | void NoOptions::load( const Profile& ) { | ||
58 | |||
59 | } | ||
60 | void 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 | |||
@@ -57,3 +57,12 @@ public: | |||
57 | }; | 57 | }; |
58 | 58 | ||
59 | class 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 | |||
@@ -14,12 +14,10 @@ | |||
14 | namespace { | 14 | namespace { |
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 | ||
@@ -49,5 +47,5 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) | |||
49 | Profile ProfileEditorDialog::profile() const | 47 | Profile ProfileEditorDialog::profile() const |
50 | { | 48 | { |
51 | return m_prof; | 49 | return m_prof; |
52 | } | 50 | } |
53 | 51 | ||
@@ -182,18 +180,13 @@ void ProfileEditorDialog::slotConActivated( const QString& str ) { | |||
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 | /* |
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 | |||
@@ -97,5 +97,6 @@ void SerialConfigWidget::load( const Profile& prof ) { | |||
97 | */ | 97 | */ |
98 | void SerialConfigWidget::save( Profile& prof ) { | 98 | void 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 | ||
@@ -137,4 +138,5 @@ void SerialConfigWidget::save( Profile& prof ) { | |||
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; |