author | harlekin <harlekin> | 2002-10-17 17:39:06 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 17:39:06 (UTC) |
commit | ec202e5d2956f2cde0f2a6be5c452bd67347e21f (patch) (side-by-side diff) | |
tree | 54d5868f9c71ad953360b911f9c50ff21e070d03 | |
parent | fb44c86f420d9a77d7364ac8b8bbd25b0f6ab09a (diff) | |
download | opie-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
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/serialconfigwidget.cpp | 0 |
3 files changed, 5 insertions, 3 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,108 +1,106 @@ #include <qlayout.h> #include <qlineedit.h> #include <qlabel.h> #include <qmessagebox.h> #include <qstringlist.h> #include <qcombobox.h> -#include <opie/otabwidget.h> - #include "profileeditorplugins.h" #include "metafactory.h" #include "profileeditordialog.h" namespace { void setCurrent( const QString& str, QComboBox* bo ) { for (uint i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); } } } } ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, const Profile& prof ) : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) { initUI(); // Apply current profile // plugin_plugin->load(profile); // ... (reset profile name line edit etc.) } ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) : QDialog(0, 0, TRUE), m_fact( fact ) { // Default profile m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); initUI(); // Apply current profile // plugin_plugin->load(profile); } Profile ProfileEditorDialog::profile() const { return m_prof; } void ProfileEditorDialog::initUI() { m_con = m_term = 0l; QVBoxLayout *mainLayout = new QVBoxLayout( this ); - OTabWidget *tabWidget = new OTabWidget( this ); + tabWidget = new OTabWidget( this ); tabWidget->setTabStyle(OTabWidget::TextTab); mainLayout->add(tabWidget); QWidget *tabprof; /* base tabs */ tabprof = new QWidget(this); m_tabTerm = new QWidget(this); m_tabCon = new QWidget(this); /* base layout for tabs */ m_layCon = new QHBoxLayout( m_tabCon , 2 ); m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); // profile tab QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); m_name = new QLineEdit(tabprof); QLabel *con = new QLabel(tr("Connection"), tabprof ); QLabel *term = new QLabel(tr("Terminal"), tabprof ); m_conCmb = new QComboBox( tabprof ); m_termCmb = new QComboBox( tabprof ); // layouting QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); vbox3->add(name); vbox3->add(m_name); vbox3->add(con ); vbox3->add(m_conCmb ); vbox3->add(term ); vbox3->add(m_termCmb ); vbox3->addStretch(1); tabWidget->addTab(tabprof, "", QObject::tr("Profile")); tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); tabWidget->setCurrentTab( tabprof ); // fill the comboboxes QStringList list = m_fact->connectionWidgets(); QStringList::Iterator it; for (it =list.begin(); it != list.end(); ++it ) { m_conCmb->insertItem( (*it) ); } list = m_fact->terminalWidgets(); for (it =list.begin(); it != list.end(); ++it ) { m_termCmb->insertItem( (*it) ); @@ -131,63 +129,65 @@ void ProfileEditorDialog::accept() { if(profName().isEmpty()) { QMessageBox::information(this, QObject::tr("Invalid profile"), QObject::tr("Please enter a profile name.")); return; } // Save profile and plugin profile //if(plugin_plugin) plugin_plugin->save(); // Save general values m_prof.setName(profName()); m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); if (m_con ) m_con->save( m_prof ); if (m_term ) m_term->save( m_prof ); QDialog::accept(); } QString ProfileEditorDialog::profName()const { return m_name->text(); } QCString ProfileEditorDialog::profType()const { /*QStringList w = m_fact->configWidgets(); for(QStringList::Iterator it = w.begin(); it != w.end(); it++) if(device_box->currentText() == m_fact->name((*it))) return (*it); */ return QCString(); } /* * we need to switch the widget */ void ProfileEditorDialog::slotConActivated( const QString& str ) { delete m_con; m_con = m_fact->newConnectionPlugin( str, m_tabCon ); if (m_con ) { m_con->load( m_prof ); m_layCon->addWidget( m_con ); + } else { + tabWidget->removePage( m_tabCon ); } } /* * we need to switch the widget */ void ProfileEditorDialog::slotTermActivated( const QString& str ) { delete m_term; m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); if (m_term) { m_term->load(m_prof ); m_layTerm->addWidget( m_term ); } } 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,51 +1,53 @@ #ifndef PROFILE_EDITOR_DIALOG #define PROFILE_EDITOR_DIALOG #include <qdialog.h> +#include <opie/otabwidget.h> #include "profile.h" class MetaFactory; class EditBase; class QTabWidget; class QHBoxLayout; class QLineEdit; class QComboBox; class QLabel; class ProfileDialogWidget; class ProfileEditorDialog : public QDialog { Q_OBJECT public: ProfileEditorDialog(MetaFactory* fact, const Profile& prof ); ProfileEditorDialog(MetaFactory* fact ); ~ProfileEditorDialog(); Profile profile()const; public slots: void accept(); private slots: void slotConActivated(const QString& ); void slotTermActivated( const QString& ); private: void initUI(); QString profName()const; QCString profType()const; MetaFactory* m_fact; QHBoxLayout* m_lay; Profile m_prof; QLineEdit *m_name; QComboBox *m_conCmb, *m_termCmb; QWidget *m_tabCon, *m_tabTerm; ProfileDialogWidget* m_con, *m_term; QHBoxLayout *m_layCon, *m_layTerm; + OTabWidget *tabWidget; }; #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 |