summaryrefslogtreecommitdiff
path: root/noncore/apps
Unidiff
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp40
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h3
2 files changed, 31 insertions, 12 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 1765d42..9890c3e 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -2,13 +2,13 @@
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#include <qscrollview.h>
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 {
@@ -50,28 +50,41 @@ Profile ProfileEditorDialog::profile() const
50} 50}
51 51
52void ProfileEditorDialog::initUI() 52void ProfileEditorDialog::initUI()
53{ 53{
54 m_con = m_term = m_key = 0l; 54 m_con = m_term = m_key = 0l;
55 55
56
56 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 57 QVBoxLayout *mainLayout = new QVBoxLayout( this );
57 tabWidget = new OTabWidget( this ); 58 tabWidget = new OTabWidget( this );
58 tabWidget->setTabStyle(OTabWidget::TextTab); 59 tabWidget->setTabStyle(OTabWidget::TextTab);
59 mainLayout->add(tabWidget); 60 mainLayout->add(tabWidget);
60 61
61 /* base tabs */ 62 /* base tabs */
62 tabprof = new QWidget(this); 63 tabprof = new QWidget(this);
63 m_tabTerm = new QWidget(this); 64 m_tabTerm = new QWidget(this);
64 m_tabCon = new QWidget(this); 65 m_tabCon = new QWidget(this);
65 m_tabKey = new QWidget(this); 66 m_tabKey = new QWidget(this);
66 67
68 m_svCon = new QScrollView( m_tabCon );
69 m_svCon->setResizePolicy( QScrollView::AutoOneFit );
70 m_svCon->setHScrollBarMode( QScrollView::AlwaysOff );
71 m_svCon->setFrameShape( QFrame::NoFrame );
72 m_svTerm = new QScrollView( m_tabTerm );
73 m_svTerm->setResizePolicy( QScrollView::AutoOneFit );
74 m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff );
75 m_svTerm->setFrameShape( QFrame::NoFrame );
76
67 /* base layout for tabs */ 77 /* base layout for tabs */
68 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 78 m_layCon = new QHBoxLayout( m_tabCon , 2 );
69 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 79 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
70 m_layKey = new QHBoxLayout( m_tabKey, 2 ); 80 m_layKey = new QHBoxLayout( m_tabKey, 2 );
71 81
82 m_layCon->addWidget( m_svCon );
83 m_layTerm->addWidget( m_svTerm );
84
72 // profile tab 85 // profile tab
73 86
74 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 87 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
75 m_name = new QLineEdit(tabprof); 88 m_name = new QLineEdit(tabprof);
76 QLabel *con = new QLabel(tr("Connection"), tabprof ); 89 QLabel *con = new QLabel(tr("Connection"), tabprof );
77 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 90 QLabel *term = new QLabel(tr("Terminal"), tabprof );
@@ -140,16 +153,16 @@ void ProfileEditorDialog::accept()
140 return; 153 return;
141 } 154 }
142 // Save profile and plugin profile 155 // Save profile and plugin profile
143 //if(plugin_plugin) plugin_plugin->save(); 156 //if(plugin_plugin) plugin_plugin->save();
144 157
145 // Save general values 158 // Save general values
146 m_prof.setName(profName()); 159 m_prof.setName( profName() );
147 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); 160 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
148 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); 161 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
149 m_prof.setAutoConnect( m_autoConnect->isChecked() ); 162 m_prof.setAutoConnect( m_autoConnect->isChecked() );
150 163
151 if (m_con ) 164 if (m_con )
152 m_con->save( m_prof ); 165 m_con->save( m_prof );
153 if (m_term ) 166 if (m_term )
154 m_term->save( m_prof ); 167 m_term->save( m_prof );
155 if (m_key) 168 if (m_key)
@@ -173,34 +186,37 @@ QCString ProfileEditorDialog::profType()const
173 return QCString(); 186 return QCString();
174} 187}
175/* 188/*
176 * we need to switch the widget 189 * we need to switch the widget
177 */ 190 */
178void ProfileEditorDialog::slotConActivated( const QString& str ) { 191void ProfileEditorDialog::slotConActivated( const QString& str ) {
192
179 delete m_con; 193 delete m_con;
180 m_con = m_fact->newConnectionPlugin( str, m_tabCon ); 194
195 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() );
181 196
182 if ( !m_con ) { 197 if ( !m_con ) {
183 m_con = new NoOptions( str, m_tabCon, "name"); 198 m_con = new NoOptions( str, m_svCon->viewport(), "name");
184 } 199 }
185 m_con->load( m_prof ); 200 m_con->load( m_prof );
186 m_layCon->addWidget( m_con ); 201 m_svCon->addChild( m_con );
202}
187 203
188 tabWidget->setCurrentTab( tabprof );
189 204
190}
191/* 205/*
192 * we need to switch the widget 206 * we need to switch the widget
193 */ 207 */
194void ProfileEditorDialog::slotTermActivated( const QString& str ) { 208void ProfileEditorDialog::slotTermActivated( const QString& str ) {
209
195 delete m_term; 210 delete m_term;
196 m_term = m_fact->newTerminalPlugin( str, m_tabTerm ); 211
212 m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() );
197 213
198 if (m_term) { 214 if (m_term) {
199 m_term->load(m_prof ); 215 m_term->load( m_prof );
200 m_layTerm->addWidget( m_term ); 216 m_svTerm->addChild( m_term );
201 } 217 }
202} 218}
203 219
204void ProfileEditorDialog::slotKeyActivated(const QString &str) { 220void ProfileEditorDialog::slotKeyActivated(const QString &str) {
205 delete m_key; 221 delete m_key;
206 m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); 222 m_key = m_fact->newKeyboardPlugin( str, m_tabKey );
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 6216660..c731747 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -11,12 +11,13 @@ class EditBase;
11class QTabWidget; 11class QTabWidget;
12class QHBoxLayout; 12class QHBoxLayout;
13class QLineEdit; 13class QLineEdit;
14class QComboBox; 14class QComboBox;
15class QCheckBox; 15class QCheckBox;
16class QLabel; 16class QLabel;
17class QScrollView;
17class ProfileDialogWidget; 18class ProfileDialogWidget;
18 19
19class ProfileEditorDialog : public QDialog { 20class ProfileEditorDialog : public QDialog {
20 Q_OBJECT 21 Q_OBJECT
21public: 22public:
22 ProfileEditorDialog(MetaFactory* fact, 23 ProfileEditorDialog(MetaFactory* fact,
@@ -44,12 +45,14 @@ private:
44 Profile m_prof; 45 Profile m_prof;
45 46
46 QLineEdit *m_name; 47 QLineEdit *m_name;
47 QComboBox *m_conCmb, *m_termCmb; 48 QComboBox *m_conCmb, *m_termCmb;
48 QCheckBox *m_autoConnect; 49 QCheckBox *m_autoConnect;
49 50
51 QScrollView *m_svCon, *m_svTerm;
52
50 QWidget *m_tabCon, *m_tabTerm, *m_tabKey; 53 QWidget *m_tabCon, *m_tabTerm, *m_tabKey;
51 ProfileDialogWidget* m_con, *m_term, *m_key; 54 ProfileDialogWidget* m_con, *m_term, *m_key;
52 QHBoxLayout *m_layCon, *m_layTerm, *m_layKey; 55 QHBoxLayout *m_layCon, *m_layTerm, *m_layKey;
53 OTabWidget *tabWidget; 56 OTabWidget *tabWidget;
54 QWidget *tabprof; 57 QWidget *tabprof;
55 int m_showconntab; 58 int m_showconntab;