summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-17 17:39:06 (UTC)
committer harlekin <harlekin>2002-10-17 17:39:06 (UTC)
commitec202e5d2956f2cde0f2a6be5c452bd67347e21f (patch) (unidiff)
tree54d5868f9c71ad953360b911f9c50ff21e070d03
parentfb44c86f420d9a77d7364ac8b8bbd25b0f6ab09a (diff)
downloadopie-ec202e5d2956f2cde0f2a6be5c452bd67347e21f.zip
opie-ec202e5d2956f2cde0f2a6be5c452bd67347e21f.tar.gz
opie-ec202e5d2956f2cde0f2a6be5c452bd67347e21f.tar.bz2
only show connection tab in profile config dialog if the current layer has connections - for local console mode
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp8
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h2
-rw-r--r--noncore/apps/opie-console/serialconfigwidget.cpp2
3 files changed, 7 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index b709cf3..5c5c2b3 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,26 +1,24 @@
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 7
8 8
9#include <opie/otabwidget.h>
10
11#include "profileeditorplugins.h" 9#include "profileeditorplugins.h"
12#include "metafactory.h" 10#include "metafactory.h"
13#include "profileeditordialog.h" 11#include "profileeditordialog.h"
14 12
15namespace { 13namespace {
16 void setCurrent( const QString& str, QComboBox* bo ) { 14 void setCurrent( const QString& str, QComboBox* bo ) {
17 for (uint i = 0; i < bo->count(); i++ ) { 15 for (uint i = 0; i < bo->count(); i++ ) {
18 if ( bo->text(i) == str ) { 16 if ( bo->text(i) == str ) {
19 bo->setCurrentItem( i ); 17 bo->setCurrentItem( i );
20 } 18 }
21 } 19 }
22 } 20 }
23 21
24 22
25} 23}
26 24
@@ -44,33 +42,33 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
44 initUI(); 42 initUI();
45 43
46 // Apply current profile 44 // Apply current profile
47 // plugin_plugin->load(profile); 45 // plugin_plugin->load(profile);
48} 46}
49 47
50Profile ProfileEditorDialog::profile() const 48Profile ProfileEditorDialog::profile() const
51{ 49{
52 return m_prof; 50 return m_prof;
53} 51}
54 52
55void ProfileEditorDialog::initUI() 53void ProfileEditorDialog::initUI()
56{ 54{
57 m_con = m_term = 0l; 55 m_con = m_term = 0l;
58 56
59 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 57 QVBoxLayout *mainLayout = new QVBoxLayout( this );
60 OTabWidget *tabWidget = new OTabWidget( this ); 58 tabWidget = new OTabWidget( this );
61 tabWidget->setTabStyle(OTabWidget::TextTab); 59 tabWidget->setTabStyle(OTabWidget::TextTab);
62 mainLayout->add(tabWidget); 60 mainLayout->add(tabWidget);
63 61
64 QWidget *tabprof; 62 QWidget *tabprof;
65 63
66 /* base tabs */ 64 /* base tabs */
67 tabprof = new QWidget(this); 65 tabprof = new QWidget(this);
68 m_tabTerm = new QWidget(this); 66 m_tabTerm = new QWidget(this);
69 m_tabCon = new QWidget(this); 67 m_tabCon = new QWidget(this);
70 68
71 /* base layout for tabs */ 69 /* base layout for tabs */
72 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 70 m_layCon = new QHBoxLayout( m_tabCon , 2 );
73 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 71 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
74 72
75 // profile tab 73 // profile tab
76 74
@@ -160,34 +158,36 @@ QString ProfileEditorDialog::profName()const
160 158
161QCString ProfileEditorDialog::profType()const 159QCString ProfileEditorDialog::profType()const
162{ 160{
163 /*QStringList w = m_fact->configWidgets(); 161 /*QStringList w = m_fact->configWidgets();
164 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 162 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
165 if(device_box->currentText() == m_fact->name((*it))) return (*it); 163 if(device_box->currentText() == m_fact->name((*it))) return (*it);
166 */ 164 */
167 return QCString(); 165 return QCString();
168} 166}
169/* 167/*
170 * we need to switch the widget 168 * we need to switch the widget
171 */ 169 */
172void ProfileEditorDialog::slotConActivated( const QString& str ) { 170void ProfileEditorDialog::slotConActivated( const QString& str ) {
173 delete m_con; 171 delete m_con;
174 m_con = m_fact->newConnectionPlugin( str, m_tabCon ); 172 m_con = m_fact->newConnectionPlugin( str, m_tabCon );
175 173
176 if (m_con ) { 174 if ( m_con ) {
177 m_con->load( m_prof ); 175 m_con->load( m_prof );
178 m_layCon->addWidget( m_con ); 176 m_layCon->addWidget( m_con );
177 } else {
178 tabWidget->removePage( m_tabCon );
179 } 179 }
180} 180}
181/* 181/*
182 * we need to switch the widget 182 * we need to switch the widget
183 */ 183 */
184void ProfileEditorDialog::slotTermActivated( const QString& str ) { 184void ProfileEditorDialog::slotTermActivated( const QString& str ) {
185 delete m_term; 185 delete m_term;
186 m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); 186 m_term = m_fact->newTerminalPlugin( str, m_tabTerm );
187 187
188 if (m_term) { 188 if (m_term) {
189 m_term->load(m_prof ); 189 m_term->load(m_prof );
190 m_layTerm->addWidget( m_term ); 190 m_layTerm->addWidget( m_term );
191 } 191 }
192} 192}
193 193
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 3b67bb3..6fde839 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -1,20 +1,21 @@
1#ifndef PROFILE_EDITOR_DIALOG 1#ifndef PROFILE_EDITOR_DIALOG
2#define PROFILE_EDITOR_DIALOG 2#define PROFILE_EDITOR_DIALOG
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5#include <opie/otabwidget.h>
5 6
6#include "profile.h" 7#include "profile.h"
7 8
8class MetaFactory; 9class MetaFactory;
9class EditBase; 10class EditBase;
10class QTabWidget; 11class QTabWidget;
11class QHBoxLayout; 12class QHBoxLayout;
12class QLineEdit; 13class QLineEdit;
13class QComboBox; 14class QComboBox;
14class QLabel; 15class QLabel;
15class ProfileDialogWidget; 16class ProfileDialogWidget;
16 17
17class ProfileEditorDialog : public QDialog { 18class ProfileEditorDialog : public QDialog {
18 Q_OBJECT 19 Q_OBJECT
19public: 20public:
20 ProfileEditorDialog(MetaFactory* fact, 21 ProfileEditorDialog(MetaFactory* fact,
@@ -33,19 +34,20 @@ private slots:
33 void slotTermActivated( const QString& ); 34 void slotTermActivated( const QString& );
34private: 35private:
35 void initUI(); 36 void initUI();
36 QString profName()const; 37 QString profName()const;
37 QCString profType()const; 38 QCString profType()const;
38 39
39 MetaFactory* m_fact; 40 MetaFactory* m_fact;
40 QHBoxLayout* m_lay; 41 QHBoxLayout* m_lay;
41 Profile m_prof; 42 Profile m_prof;
42 43
43 QLineEdit *m_name; 44 QLineEdit *m_name;
44 QComboBox *m_conCmb, *m_termCmb; 45 QComboBox *m_conCmb, *m_termCmb;
45 46
46 QWidget *m_tabCon, *m_tabTerm; 47 QWidget *m_tabCon, *m_tabTerm;
47 ProfileDialogWidget* m_con, *m_term; 48 ProfileDialogWidget* m_con, *m_term;
48 QHBoxLayout *m_layCon, *m_layTerm; 49 QHBoxLayout *m_layCon, *m_layTerm;
50 OTabWidget *tabWidget;
49}; 51};
50 52
51#endif 53#endif
diff --git a/noncore/apps/opie-console/serialconfigwidget.cpp b/noncore/apps/opie-console/serialconfigwidget.cpp
index d216c92..1e97a24 100644
--- a/noncore/apps/opie-console/serialconfigwidget.cpp
+++ b/noncore/apps/opie-console/serialconfigwidget.cpp
@@ -43,33 +43,33 @@ SerialConfigWidget::SerialConfigWidget( const QString& name,
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 );