summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/profileeditordialog.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 979e89d..6e1e23e 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -38,196 +38,196 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
38 38
39 initUI(); 39 initUI();
40 40
41 // Apply current profile 41 // Apply current profile
42 // plugin_plugin->load(profile); 42 // plugin_plugin->load(profile);
43} 43}
44 44
45Profile ProfileEditorDialog::profile() const 45Profile ProfileEditorDialog::profile() const
46{ 46{
47 return m_prof; 47 return m_prof;
48} 48}
49 49
50void ProfileEditorDialog::initUI() 50void ProfileEditorDialog::initUI()
51{ 51{
52 m_con = m_term = m_key = 0l; 52 m_con = m_term = m_key = 0l;
53 53
54 54
55 QVBoxLayout *mainLayout = new QVBoxLayout( this ); 55 QVBoxLayout *mainLayout = new QVBoxLayout( this );
56 tabWidget = new OTabWidget( this ); 56 tabWidget = new OTabWidget( this );
57 tabWidget->setTabStyle(OTabWidget::TextTab); 57 tabWidget->setTabStyle(OTabWidget::TextTab);
58 mainLayout->add(tabWidget); 58 mainLayout->add(tabWidget);
59 59
60 /* base tabs */ 60 /* base tabs */
61 tabprof = new QWidget(this); 61 tabprof = new QWidget(this);
62 m_tabTerm = new QWidget(this); 62 m_tabTerm = new QWidget(this);
63 m_tabCon = new QWidget(this); 63 m_tabCon = new QWidget(this);
64 m_tabKey = new QWidget(this); 64 m_tabKey = new QWidget(this);
65 65
66 m_svCon = new QScrollView( m_tabCon ); 66 m_svCon = new QScrollView( m_tabCon );
67 m_svCon->setResizePolicy( QScrollView::AutoOneFit ); 67 m_svCon->setResizePolicy( QScrollView::AutoOneFit );
68 //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); 68 //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff );
69 m_svCon->setFrameShape( QFrame::NoFrame ); 69 m_svCon->setFrameShape( QFrame::NoFrame );
70 m_svTerm = new QScrollView( m_tabTerm ); 70 m_svTerm = new QScrollView( m_tabTerm );
71 m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); 71 m_svTerm->setResizePolicy( QScrollView::AutoOneFit );
72 //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); 72 //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff );
73 m_svTerm->setFrameShape( QFrame::NoFrame ); 73 m_svTerm->setFrameShape( QFrame::NoFrame );
74 74
75 /* base layout for tabs */ 75 /* base layout for tabs */
76 m_layCon = new QHBoxLayout( m_tabCon , 2 ); 76 m_layCon = new QHBoxLayout( m_tabCon , 2 );
77 m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); 77 m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
78 m_layKey = new QHBoxLayout( m_tabKey, 2 ); 78 m_layKey = new QHBoxLayout( m_tabKey, 2 );
79 79
80 m_layCon->addWidget( m_svCon ); 80 m_layCon->addWidget( m_svCon );
81 m_layTerm->addWidget( m_svTerm ); 81 m_layTerm->addWidget( m_svTerm );
82 82
83 // profile tab 83 // profile tab
84 84
85 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); 85 QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
86 m_name = new QLineEdit(tabprof); 86 m_name = new QLineEdit(tabprof);
87 QLabel *con = new QLabel(tr("Connection"), tabprof ); 87 QLabel *con = new QLabel(tr("Connection"), tabprof );
88 QLabel *term = new QLabel(tr("Terminal"), tabprof ); 88 QLabel *term = new QLabel(tr("Terminal"), tabprof );
89 m_conCmb = new QComboBox( tabprof ); 89 m_conCmb = new QComboBox( tabprof );
90 m_termCmb = new QComboBox( tabprof ); 90 m_termCmb = new QComboBox( tabprof );
91 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); 91 m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof);
92 92
93 // layouting 93 // layouting
94 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); 94 QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
95 vbox3->add(name); 95 vbox3->add(name);
96 vbox3->add(m_name); 96 vbox3->add(m_name);
97 vbox3->add(con ); 97 vbox3->add(con );
98 vbox3->add(m_conCmb ); 98 vbox3->add(m_conCmb );
99 vbox3->add(term ); 99 vbox3->add(term );
100 vbox3->add(m_termCmb ); 100 vbox3->add(m_termCmb );
101 vbox3->add(m_autoConnect); 101 vbox3->add(m_autoConnect);
102 vbox3->addStretch(1); 102 vbox3->addStretch(1);
103 103
104 m_showconntab = 0; 104 m_showconntab = 0;
105 tabWidget->addTab(tabprof, "", QObject::tr("Profile")); 105 tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
106 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); 106 tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
107 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); 107 tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
108 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); 108 tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
109 tabWidget->setCurrentTab( tabprof ); 109 tabWidget->setCurrentTab( tabprof );
110 110
111 111
112 // fill the comboboxes 112 // fill the comboboxes
113 QStringList list = m_fact->connectionWidgets(); 113 QStringList list = m_fact->connectionWidgets();
114 QStringList::Iterator it; 114 QStringList::Iterator it;
115 for (it =list.begin(); it != list.end(); ++it ) { 115 for (it =list.begin(); it != list.end(); ++it ) {
116 m_conCmb->insertItem( (*it) ); 116 m_conCmb->insertItem( (*it) );
117 } 117 }
118 list = m_fact->terminalWidgets(); 118 list = m_fact->terminalWidgets();
119 for (it =list.begin(); it != list.end(); ++it ) { 119 for (it =list.begin(); it != list.end(); ++it ) {
120 m_termCmb->insertItem( (*it) ); 120 m_termCmb->insertItem( (*it) );
121 } 121 }
122 122
123 // load profile values 123 // load profile values
124 m_name->setText(m_prof.name()); 124 m_name->setText(m_prof.name());
125 slotKeyActivated( "Default Keyboard" ); 125 slotKeyActivated( "Default Keyboard" );
126 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); 126 setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
127 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); 127 setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
128 slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); 128 slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
129 slotTermActivated( m_fact->external(m_prof.terminalName() ) ); 129 slotTermActivated( m_fact->external(m_prof.terminalName() ) );
130 m_autoConnect->setChecked(m_prof.autoConnect()); 130 m_autoConnect->setChecked(m_prof.autoConnect());
131 131
132 132
133 // signal and slots 133 // signal and slots
134 connect(m_conCmb, SIGNAL(activated(const QString& ) ), 134 connect(m_conCmb, SIGNAL(activated(const QString&) ),
135 this, SLOT(slotConActivated(const QString&) ) ); 135 this, SLOT(slotConActivated(const QString&) ) );
136 connect(m_termCmb, SIGNAL(activated(const QString& ) ), 136 connect(m_termCmb, SIGNAL(activated(const QString&) ),
137 this, SLOT(slotTermActivated(const QString& ) ) ); 137 this, SLOT(slotTermActivated(const QString&) ) );
138 138
139} 139}
140 140
141ProfileEditorDialog::~ProfileEditorDialog() { 141ProfileEditorDialog::~ProfileEditorDialog() {
142 142
143} 143}
144void ProfileEditorDialog::accept() 144void ProfileEditorDialog::accept()
145{ 145{
146 if(profName().isEmpty()) 146 if(profName().isEmpty())
147 { 147 {
148 QMessageBox::information(this, 148 QMessageBox::information(this,
149 QObject::tr("Invalid profile"), 149 QObject::tr("Invalid profile"),
150 QObject::tr("Please enter a profile name.")); 150 QObject::tr("Please enter a profile name."));
151 return; 151 return;
152 } 152 }
153 // Save profile and plugin profile 153 // Save profile and plugin profile
154 //if(plugin_plugin) plugin_plugin->save(); 154 //if(plugin_plugin) plugin_plugin->save();
155 155
156 // Save general values 156 // Save general values
157 m_prof.setName( profName() ); 157 m_prof.setName( profName() );
158 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); 158 m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
159 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); 159 m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
160 m_prof.setAutoConnect( m_autoConnect->isChecked() ); 160 m_prof.setAutoConnect( m_autoConnect->isChecked() );
161 161
162 if (m_con ) 162 if (m_con )
163 m_con->save( m_prof ); 163 m_con->save( m_prof );
164 if (m_term ) 164 if (m_term )
165 m_term->save( m_prof ); 165 m_term->save( m_prof );
166 if (m_key) 166 if (m_key)
167 m_key->save( m_prof ); 167 m_key->save( m_prof );
168 168
169 QDialog::accept(); 169 QDialog::accept();
170} 170}
171 171
172 172
173QString ProfileEditorDialog::profName()const 173QString ProfileEditorDialog::profName()const
174{ 174{
175 return m_name->text(); 175 return m_name->text();
176} 176}
177 177
178QCString ProfileEditorDialog::profType()const 178QCString ProfileEditorDialog::profType()const
179{ 179{
180 /*QStringList w = m_fact->configWidgets(); 180 /*QStringList w = m_fact->configWidgets();
181 for(QStringList::Iterator it = w.begin(); it != w.end(); it++) 181 for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
182 if(device_box->currentText() == m_fact->name((*it))) return (*it); 182 if(device_box->currentText() == m_fact->name((*it))) return (*it);
183 */ 183 */
184 return QCString(); 184 return QCString();
185} 185}
186/* 186/*
187 * we need to switch the widget 187 * we need to switch the widget
188 */ 188 */
189void ProfileEditorDialog::slotConActivated( const QString& str ) { 189void ProfileEditorDialog::slotConActivated( const QString& str ) {
190 190
191 delete m_con; 191 delete m_con;
192 192
193 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() ); 193 m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() );
194 194
195 if ( !m_con ) { 195 if ( !m_con ) {
196 m_con = new NoOptions( str, m_svCon->viewport(), "name"); 196 m_con = new NoOptions( str, m_svCon->viewport(), "name");
197 } 197 }
198 198
199 // FIXME ugly hack right. Right solution would be to look into the layer and see if it 199 // FIXME ugly hack right. Right solution would be to look into the layer and see if it
200 // supports auto connect and then set it as prefered 200 // supports auto connect and then set it as prefered
201 if ( m_conCmb ->currentText() == tr("Local Console") ) { 201 if ( m_conCmb ->currentText() == tr("Local Console") ) {
202 m_autoConnect->setChecked( true ); 202 m_autoConnect->setChecked( true );
203 m_prof.writeEntry("Terminal", Profile::Linux ); 203 m_prof.writeEntry("Terminal", Profile::Linux );
204 slotTermActivated( m_fact->external (m_prof.terminalName() ) ); 204 slotTermActivated( m_fact->external (m_prof.terminalName() ) );
205 } else { 205 } else {
206 m_prof.writeEntry("Terminal", Profile::VT102 ); 206 m_prof.writeEntry("Terminal", Profile::VT102 );
207 slotTermActivated( m_fact->external (m_prof.terminalName() ) ); 207 slotTermActivated( m_fact->external (m_prof.terminalName() ) );
208 m_autoConnect->setChecked( false ); 208 m_autoConnect->setChecked( false );
209 } 209 }
210 210
211 m_con->load( m_prof ); 211 m_con->load( m_prof );
212 m_svCon->addChild( m_con ); 212 m_svCon->addChild( m_con );
213} 213}
214 214
215 215
216/* 216/*
217 * we need to switch the widget 217 * we need to switch the widget
218 */ 218 */
219void ProfileEditorDialog::slotTermActivated( const QString& str ) { 219void ProfileEditorDialog::slotTermActivated( const QString& str ) {
220 220
221 delete m_term; 221 delete m_term;
222 222
223 m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() ); 223 m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() );
224 224
225 if ( m_term ) { 225 if ( m_term ) {
226 m_term->load( m_prof ); 226 m_term->load( m_prof );
227 m_svTerm->addChild( m_term ); 227 m_svTerm->addChild( m_term );
228 } 228 }
229} 229}
230 230
231void ProfileEditorDialog::slotKeyActivated(const QString &str) { 231void ProfileEditorDialog::slotKeyActivated(const QString &str) {
232 delete m_key; 232 delete m_key;
233 m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); 233 m_key = m_fact->newKeyboardPlugin( str, m_tabKey );