author | hash <hash> | 2002-10-17 18:03:39 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-17 18:03:39 (UTC) |
commit | 43aecbd7095da335158b461a9ce293d236cd32ab (patch) (unidiff) | |
tree | 43fbfa93d33ae3308f3aec8f5bb5c00d2505f64a | |
parent | 08e9fcbbaf57383fd65fe4eb197d97a51abe0f26 (diff) | |
download | opie-43aecbd7095da335158b461a9ce293d236cd32ab.zip opie-43aecbd7095da335158b461a9ce293d236cd32ab.tar.gz opie-43aecbd7095da335158b461a9ce293d236cd32ab.tar.bz2 |
function keyboard should work now. here is a sample opie-console-keys.conf file
[keys]
r0c0 = F1|4144|0
r0c1 = F2|4145|0
r0c2 = F3|4146|0
r0c3 = F4|4147|0
r0c4 = F5|4148|0
r0c5 = F6|4149|0
r0c6 = ESC|4096|0
r0c7 = A|65|65
r0c8 = a|65|97
r0c9 = PgUp|4118|0
r0c10 = PgDn|4119|0
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index fdb0452..f0130e1 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -92,396 +92,402 @@ void MainWindow::initUI() { | |||
92 | 92 | ||
93 | /* | 93 | /* |
94 | * connect action | 94 | * connect action |
95 | */ | 95 | */ |
96 | m_connect = new QAction(); | 96 | m_connect = new QAction(); |
97 | m_connect->setText( tr("Connect") ); | 97 | m_connect->setText( tr("Connect") ); |
98 | m_connect->addTo( m_console ); | 98 | m_connect->addTo( m_console ); |
99 | connect(m_connect, SIGNAL(activated() ), | 99 | connect(m_connect, SIGNAL(activated() ), |
100 | this, SLOT(slotConnect() ) ); | 100 | this, SLOT(slotConnect() ) ); |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * disconnect action | 103 | * disconnect action |
104 | */ | 104 | */ |
105 | m_disconnect = new QAction(); | 105 | m_disconnect = new QAction(); |
106 | m_disconnect->setText( tr("Disconnect") ); | 106 | m_disconnect->setText( tr("Disconnect") ); |
107 | m_disconnect->addTo( m_console ); | 107 | m_disconnect->addTo( m_console ); |
108 | connect(m_disconnect, SIGNAL(activated() ), | 108 | connect(m_disconnect, SIGNAL(activated() ), |
109 | this, SLOT(slotDisconnect() ) ); | 109 | this, SLOT(slotDisconnect() ) ); |
110 | 110 | ||
111 | m_transfer = new QAction(); | 111 | m_transfer = new QAction(); |
112 | m_transfer->setText( tr("Transfer file...") ); | 112 | m_transfer->setText( tr("Transfer file...") ); |
113 | m_transfer->addTo( m_console ); | 113 | m_transfer->addTo( m_console ); |
114 | connect(m_transfer, SIGNAL(activated() ), | 114 | connect(m_transfer, SIGNAL(activated() ), |
115 | this, SLOT(slotTransfer() ) ); | 115 | this, SLOT(slotTransfer() ) ); |
116 | 116 | ||
117 | 117 | ||
118 | /* | 118 | /* |
119 | * fullscreen | 119 | * fullscreen |
120 | */ | 120 | */ |
121 | m_isFullscreen = false; | 121 | m_isFullscreen = false; |
122 | 122 | ||
123 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 123 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
124 | , QString::null, 0, this, 0); | 124 | , QString::null, 0, this, 0); |
125 | m_fullscreen->addTo( m_console ); | 125 | m_fullscreen->addTo( m_console ); |
126 | m_fullscreen->addTo( m_icons ); | 126 | m_fullscreen->addTo( m_icons ); |
127 | connect( m_fullscreen, SIGNAL( activated() ), | 127 | connect( m_fullscreen, SIGNAL( activated() ), |
128 | this, SLOT( slotFullscreen() ) ); | 128 | this, SLOT( slotFullscreen() ) ); |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * terminate action | 131 | * terminate action |
132 | */ | 132 | */ |
133 | m_terminate = new QAction(); | 133 | m_terminate = new QAction(); |
134 | m_terminate->setText( tr("Terminate") ); | 134 | m_terminate->setText( tr("Terminate") ); |
135 | m_terminate->addTo( m_console ); | 135 | m_terminate->addTo( m_console ); |
136 | connect(m_terminate, SIGNAL(activated() ), | 136 | connect(m_terminate, SIGNAL(activated() ), |
137 | this, SLOT(slotTerminate() ) ); | 137 | this, SLOT(slotTerminate() ) ); |
138 | 138 | ||
139 | m_closewindow = new QAction(); | 139 | m_closewindow = new QAction(); |
140 | m_closewindow->setText( tr("Close Window") ); | 140 | m_closewindow->setText( tr("Close Window") ); |
141 | m_closewindow->addTo( m_console ); | 141 | m_closewindow->addTo( m_console ); |
142 | connect( m_closewindow, SIGNAL(activated() ), | 142 | connect( m_closewindow, SIGNAL(activated() ), |
143 | this, SLOT(slotClose() ) ); | 143 | this, SLOT(slotClose() ) ); |
144 | 144 | ||
145 | 145 | ||
146 | /* | 146 | /* |
147 | * script actions | 147 | * script actions |
148 | */ | 148 | */ |
149 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 149 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
150 | m_recordScript->addTo(m_scripts); | 150 | m_recordScript->addTo(m_scripts); |
151 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 151 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
152 | 152 | ||
153 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 153 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
154 | m_saveScript->addTo(m_scripts); | 154 | m_saveScript->addTo(m_scripts); |
155 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 155 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
156 | 156 | ||
157 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 157 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
158 | m_runScript->addTo(m_scripts); | 158 | m_runScript->addTo(m_scripts); |
159 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 159 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
160 | 160 | ||
161 | /* | 161 | /* |
162 | * action that open/closes the keyboard | 162 | * action that open/closes the keyboard |
163 | */ | 163 | */ |
164 | m_openKeys = new QAction (tr("Open Keyboard..."), | 164 | m_openKeys = new QAction (tr("Open Keyboard..."), |
165 | Resource::loadPixmap( "down" ), | 165 | Resource::loadPixmap( "down" ), |
166 | QString::null, 0, this, 0); | 166 | QString::null, 0, this, 0); |
167 | 167 | ||
168 | m_openKeys->setToggleAction(true); | 168 | m_openKeys->setToggleAction(true); |
169 | 169 | ||
170 | connect (m_openKeys, SIGNAL(toggled(bool)), | 170 | connect (m_openKeys, SIGNAL(toggled(bool)), |
171 | this, SLOT(slotOpenKeb(bool))); | 171 | this, SLOT(slotOpenKeb(bool))); |
172 | m_openKeys->addTo(m_icons); | 172 | m_openKeys->addTo(m_icons); |
173 | 173 | ||
174 | 174 | ||
175 | /* insert the submenu */ | 175 | /* insert the submenu */ |
176 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 176 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
177 | -1, 0); | 177 | -1, 0); |
178 | 178 | ||
179 | /* insert the connection menu */ | 179 | /* insert the connection menu */ |
180 | m_bar->insertItem( tr("Connection"), m_console ); | 180 | m_bar->insertItem( tr("Connection"), m_console ); |
181 | 181 | ||
182 | /* the scripts menu */ | 182 | /* the scripts menu */ |
183 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 183 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
184 | 184 | ||
185 | /* the settings menu */ | 185 | /* the settings menu */ |
186 | // m_bar->insertItem( tr("Settings"), m_settings ); | 186 | // m_bar->insertItem( tr("Settings"), m_settings ); |
187 | 187 | ||
188 | /* and the keyboard */ | 188 | /* and the keyboard */ |
189 | m_keyBar = new QToolBar(this); | 189 | m_keyBar = new QToolBar(this); |
190 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 190 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
191 | m_keyBar->setHorizontalStretchable( TRUE ); | 191 | m_keyBar->setHorizontalStretchable( TRUE ); |
192 | m_keyBar->hide(); | 192 | m_keyBar->hide(); |
193 | 193 | ||
194 | m_kb = new FunctionKeyboard(m_keyBar); | 194 | m_kb = new FunctionKeyboard(m_keyBar); |
195 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 195 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), |
196 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 196 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); |
197 | 197 | ||
198 | 198 | ||
199 | 199 | ||
200 | m_connect->setEnabled( false ); | 200 | m_connect->setEnabled( false ); |
201 | m_disconnect->setEnabled( false ); | 201 | m_disconnect->setEnabled( false ); |
202 | m_terminate->setEnabled( false ); | 202 | m_terminate->setEnabled( false ); |
203 | m_transfer->setEnabled( false ); | 203 | m_transfer->setEnabled( false ); |
204 | m_recordScript->setEnabled( false ); | 204 | m_recordScript->setEnabled( false ); |
205 | m_saveScript->setEnabled( false ); | 205 | m_saveScript->setEnabled( false ); |
206 | m_runScript->setEnabled( false ); | 206 | m_runScript->setEnabled( false ); |
207 | m_fullscreen->setEnabled( false ); | 207 | m_fullscreen->setEnabled( false ); |
208 | m_closewindow->setEnabled( false ); | 208 | m_closewindow->setEnabled( false ); |
209 | 209 | ||
210 | /* | 210 | /* |
211 | * connect to the menu activation | 211 | * connect to the menu activation |
212 | */ | 212 | */ |
213 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 213 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
214 | this, SLOT(slotProfile( int ) ) ); | 214 | this, SLOT(slotProfile( int ) ) ); |
215 | 215 | ||
216 | m_consoleWindow = new TabWidget( this, "blah"); | 216 | m_consoleWindow = new TabWidget( this, "blah"); |
217 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 217 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
218 | this, SLOT(slotSessionChanged(Session*) ) ); | 218 | this, SLOT(slotSessionChanged(Session*) ) ); |
219 | setCentralWidget( m_consoleWindow ); | 219 | setCentralWidget( m_consoleWindow ); |
220 | 220 | ||
221 | } | 221 | } |
222 | 222 | ||
223 | ProfileManager* MainWindow::manager() { | 223 | ProfileManager* MainWindow::manager() { |
224 | return m_manager; | 224 | return m_manager; |
225 | } | 225 | } |
226 | TabWidget* MainWindow::tabWidget() { | 226 | TabWidget* MainWindow::tabWidget() { |
227 | return m_consoleWindow; | 227 | return m_consoleWindow; |
228 | } | 228 | } |
229 | void MainWindow::populateProfiles() { | 229 | void MainWindow::populateProfiles() { |
230 | m_sessionsPop->clear(); | 230 | m_sessionsPop->clear(); |
231 | Profile::ValueList list = manager()->all(); | 231 | Profile::ValueList list = manager()->all(); |
232 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 232 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
233 | m_sessionsPop->insertItem( (*it).name() ); | 233 | m_sessionsPop->insertItem( (*it).name() ); |
234 | } | 234 | } |
235 | 235 | ||
236 | } | 236 | } |
237 | MainWindow::~MainWindow() { | 237 | MainWindow::~MainWindow() { |
238 | delete m_factory; | 238 | delete m_factory; |
239 | manager()->save(); | 239 | manager()->save(); |
240 | } | 240 | } |
241 | 241 | ||
242 | MetaFactory* MainWindow::factory() { | 242 | MetaFactory* MainWindow::factory() { |
243 | return m_factory; | 243 | return m_factory; |
244 | } | 244 | } |
245 | 245 | ||
246 | Session* MainWindow::currentSession() { | 246 | Session* MainWindow::currentSession() { |
247 | return m_curSession; | 247 | return m_curSession; |
248 | } | 248 | } |
249 | 249 | ||
250 | QList<Session> MainWindow::sessions() { | 250 | QList<Session> MainWindow::sessions() { |
251 | return m_sessions; | 251 | return m_sessions; |
252 | } | 252 | } |
253 | 253 | ||
254 | void MainWindow::slotNew() { | 254 | void MainWindow::slotNew() { |
255 | ProfileEditorDialog dlg(factory() ); | 255 | ProfileEditorDialog dlg(factory() ); |
256 | dlg.showMaximized(); | 256 | dlg.showMaximized(); |
257 | int ret = dlg.exec(); | 257 | int ret = dlg.exec(); |
258 | 258 | ||
259 | if ( ret == QDialog::Accepted ) { | 259 | if ( ret == QDialog::Accepted ) { |
260 | create( dlg.profile() ); | 260 | create( dlg.profile() ); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | void MainWindow::slotRecordScript() { | 264 | void MainWindow::slotRecordScript() { |
265 | /* if (currentSession()) { | 265 | /* if (currentSession()) { |
266 | currentSession()->emulationLayer()->startRecording(); | 266 | currentSession()->emulationLayer()->startRecording(); |
267 | } | 267 | } |
268 | */ | 268 | */ |
269 | } | 269 | } |
270 | 270 | ||
271 | void MainWindow::slotSaveScript() { | 271 | void MainWindow::slotSaveScript() { |
272 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 272 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
273 | MimeTypes types; | 273 | MimeTypes types; |
274 | QStringList script; | 274 | QStringList script; |
275 | script << "text/plain"; | 275 | script << "text/plain"; |
276 | types.insert("Script", script); | 276 | types.insert("Script", script); |
277 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 277 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
278 | if (!filename.isEmpty()) { | 278 | if (!filename.isEmpty()) { |
279 | currentSession()->emulationLayer()->script()->saveTo(filename); | 279 | currentSession()->emulationLayer()->script()->saveTo(filename); |
280 | currentSession()->emulationLayer()->clearScript(); | 280 | currentSession()->emulationLayer()->clearScript(); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | */ | 283 | */ |
284 | } | 284 | } |
285 | 285 | ||
286 | void MainWindow::slotRunScript() { | 286 | void MainWindow::slotRunScript() { |
287 | /* | 287 | /* |
288 | if (currentSession()) { | 288 | if (currentSession()) { |
289 | MimeTypes types; | 289 | MimeTypes types; |
290 | QStringList script; | 290 | QStringList script; |
291 | script << "text/plain"; | 291 | script << "text/plain"; |
292 | types.insert("Script", script); | 292 | types.insert("Script", script); |
293 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 293 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
294 | if (!filename.isEmpty()) { | 294 | if (!filename.isEmpty()) { |
295 | Script script(DocLnk(filename).file()); | 295 | Script script(DocLnk(filename).file()); |
296 | currentSession()->emulationLayer()->runScript(&script); | 296 | currentSession()->emulationLayer()->runScript(&script); |
297 | } | 297 | } |
298 | } | 298 | } |
299 | */ | 299 | */ |
300 | } | 300 | } |
301 | 301 | ||
302 | void MainWindow::slotConnect() { | 302 | void MainWindow::slotConnect() { |
303 | if ( currentSession() ) { | 303 | if ( currentSession() ) { |
304 | bool ret = currentSession()->layer()->open(); | 304 | bool ret = currentSession()->layer()->open(); |
305 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 305 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
306 | QObject::tr("Failed"), | 306 | QObject::tr("Failed"), |
307 | QObject::tr("Connecting failed for this session.")); | 307 | QObject::tr("Connecting failed for this session.")); |
308 | else { | 308 | else { |
309 | m_connect->setEnabled( false ); | 309 | m_connect->setEnabled( false ); |
310 | m_disconnect->setEnabled( true ); | 310 | m_disconnect->setEnabled( true ); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | void MainWindow::slotDisconnect() { | 315 | void MainWindow::slotDisconnect() { |
316 | if ( currentSession() ) { | 316 | if ( currentSession() ) { |
317 | currentSession()->layer()->close(); | 317 | currentSession()->layer()->close(); |
318 | m_connect->setEnabled( true ); | 318 | m_connect->setEnabled( true ); |
319 | m_disconnect->setEnabled( false ); | 319 | m_disconnect->setEnabled( false ); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | void MainWindow::slotTerminate() { | 323 | void MainWindow::slotTerminate() { |
324 | if ( currentSession() ) | 324 | if ( currentSession() ) |
325 | currentSession()->layer()->close(); | 325 | currentSession()->layer()->close(); |
326 | 326 | ||
327 | slotClose(); | 327 | slotClose(); |
328 | /* FIXME move to the next session */ | 328 | /* FIXME move to the next session */ |
329 | } | 329 | } |
330 | 330 | ||
331 | void MainWindow::slotConfigure() { | 331 | void MainWindow::slotConfigure() { |
332 | ConfigDialog conf( manager()->all(), factory() ); | 332 | ConfigDialog conf( manager()->all(), factory() ); |
333 | conf.showMaximized(); | 333 | conf.showMaximized(); |
334 | 334 | ||
335 | int ret = conf.exec(); | 335 | int ret = conf.exec(); |
336 | 336 | ||
337 | if ( QDialog::Accepted == ret ) { | 337 | if ( QDialog::Accepted == ret ) { |
338 | manager()->setProfiles( conf.list() ); | 338 | manager()->setProfiles( conf.list() ); |
339 | manager()->save(); | 339 | manager()->save(); |
340 | populateProfiles(); | 340 | populateProfiles(); |
341 | } | 341 | } |
342 | } | 342 | } |
343 | /* | 343 | /* |
344 | * we will remove | 344 | * we will remove |
345 | * this window from the tabwidget | 345 | * this window from the tabwidget |
346 | * remove it from the list | 346 | * remove it from the list |
347 | * delete it | 347 | * delete it |
348 | * and set the currentSession() | 348 | * and set the currentSession() |
349 | */ | 349 | */ |
350 | void MainWindow::slotClose() { | 350 | void MainWindow::slotClose() { |
351 | if (!currentSession() ) | 351 | if (!currentSession() ) |
352 | return; | 352 | return; |
353 | 353 | ||
354 | Session* ses = currentSession(); | 354 | Session* ses = currentSession(); |
355 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 355 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
356 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 356 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
357 | m_curSession = NULL; | 357 | m_curSession = NULL; |
358 | tabWidget()->remove( /*currentSession()*/ses ); | 358 | tabWidget()->remove( /*currentSession()*/ses ); |
359 | /*it's autodelete */ | 359 | /*it's autodelete */ |
360 | m_sessions.remove( ses ); | 360 | m_sessions.remove( ses ); |
361 | qWarning("after remove!!"); | 361 | qWarning("after remove!!"); |
362 | 362 | ||
363 | if (!currentSession() ) { | 363 | if (!currentSession() ) { |
364 | m_connect->setEnabled( false ); | 364 | m_connect->setEnabled( false ); |
365 | m_disconnect->setEnabled( false ); | 365 | m_disconnect->setEnabled( false ); |
366 | m_terminate->setEnabled( false ); | 366 | m_terminate->setEnabled( false ); |
367 | m_transfer->setEnabled( false ); | 367 | m_transfer->setEnabled( false ); |
368 | m_recordScript->setEnabled( false ); | 368 | m_recordScript->setEnabled( false ); |
369 | m_saveScript->setEnabled( false ); | 369 | m_saveScript->setEnabled( false ); |
370 | m_runScript->setEnabled( false ); | 370 | m_runScript->setEnabled( false ); |
371 | m_fullscreen->setEnabled( false ); | 371 | m_fullscreen->setEnabled( false ); |
372 | m_closewindow->setEnabled( false ); | 372 | m_closewindow->setEnabled( false ); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | /* | 376 | /* |
377 | * We will get the name | 377 | * We will get the name |
378 | * Then the profile | 378 | * Then the profile |
379 | * and then we will make a profile | 379 | * and then we will make a profile |
380 | */ | 380 | */ |
381 | void MainWindow::slotProfile( int id) { | 381 | void MainWindow::slotProfile( int id) { |
382 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 382 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
383 | create( prof ); | 383 | create( prof ); |
384 | } | 384 | } |
385 | void MainWindow::create( const Profile& prof ) { | 385 | void MainWindow::create( const Profile& prof ) { |
386 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 386 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
387 | 387 | ||
388 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 388 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
389 | { | 389 | { |
390 | QMessageBox::warning(this, | 390 | QMessageBox::warning(this, |
391 | QObject::tr("Session failed"), | 391 | QObject::tr("Session failed"), |
392 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 392 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
393 | //if(ses) delete ses; | 393 | //if(ses) delete ses; |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | 396 | ||
397 | m_sessions.append( ses ); | 397 | m_sessions.append( ses ); |
398 | tabWidget()->add( ses ); | 398 | tabWidget()->add( ses ); |
399 | m_curSession = ses; | 399 | m_curSession = ses; |
400 | 400 | ||
401 | // is io_layer wants direct connection, then autoconnect | 401 | // is io_layer wants direct connection, then autoconnect |
402 | if ( ( m_curSession->layer() )->supports()[0] = 1 ) { | 402 | if ( ( m_curSession->layer() )->supports()[0] = 1 ) { |
403 | slotConnect(); | 403 | slotConnect(); |
404 | } | 404 | } |
405 | 405 | ||
406 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 406 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
407 | m_connect->setEnabled( true ); | 407 | m_connect->setEnabled( true ); |
408 | m_disconnect->setEnabled( false ); | 408 | m_disconnect->setEnabled( false ); |
409 | m_terminate->setEnabled( true ); | 409 | m_terminate->setEnabled( true ); |
410 | m_transfer->setEnabled( true ); | 410 | m_transfer->setEnabled( true ); |
411 | m_recordScript->setEnabled( true ); | 411 | m_recordScript->setEnabled( true ); |
412 | m_saveScript->setEnabled( true ); | 412 | m_saveScript->setEnabled( true ); |
413 | m_runScript->setEnabled( true ); | 413 | m_runScript->setEnabled( true ); |
414 | m_fullscreen->setEnabled( true ); | 414 | m_fullscreen->setEnabled( true ); |
415 | m_closewindow->setEnabled( true ); | 415 | m_closewindow->setEnabled( true ); |
416 | } | 416 | } |
417 | 417 | ||
418 | void MainWindow::slotTransfer() | 418 | void MainWindow::slotTransfer() |
419 | { | 419 | { |
420 | if ( currentSession() ) { | 420 | if ( currentSession() ) { |
421 | TransferDialog dlg(this); | 421 | TransferDialog dlg(this); |
422 | dlg.showMaximized(); | 422 | dlg.showMaximized(); |
423 | dlg.exec(); | 423 | dlg.exec(); |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | 427 | ||
428 | void MainWindow::slotOpenKeb(bool state) { | 428 | void MainWindow::slotOpenKeb(bool state) { |
429 | 429 | ||
430 | if (state) m_keyBar->show(); | 430 | if (state) m_keyBar->show(); |
431 | else m_keyBar->hide(); | 431 | else m_keyBar->hide(); |
432 | 432 | ||
433 | } | 433 | } |
434 | void MainWindow::slotSessionChanged( Session* ses ) { | 434 | void MainWindow::slotSessionChanged( Session* ses ) { |
435 | qWarning("changed!"); | 435 | qWarning("changed!"); |
436 | if ( ses ) { | 436 | if ( ses ) { |
437 | m_curSession = ses; | 437 | m_curSession = ses; |
438 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 438 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
439 | if ( m_curSession->layer()->isConnected() ) { | 439 | if ( m_curSession->layer()->isConnected() ) { |
440 | m_connect->setEnabled( false ); | 440 | m_connect->setEnabled( false ); |
441 | m_disconnect->setEnabled( true ); | 441 | m_disconnect->setEnabled( true ); |
442 | } else { | 442 | } else { |
443 | m_connect->setEnabled( true ); | 443 | m_connect->setEnabled( true ); |
444 | m_disconnect->setEnabled( false ); | 444 | m_disconnect->setEnabled( false ); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
449 | void MainWindow::slotFullscreen() { | 449 | void MainWindow::slotFullscreen() { |
450 | 450 | ||
451 | if ( m_isFullscreen ) { | 451 | if ( m_isFullscreen ) { |
452 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); | 452 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); |
453 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 453 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
454 | setCentralWidget( m_consoleWindow ); | 454 | setCentralWidget( m_consoleWindow ); |
455 | ( m_curSession->widgetStack() )->show(); | 455 | ( m_curSession->widgetStack() )->show(); |
456 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 456 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
457 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 457 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
458 | 458 | ||
459 | } else { | 459 | } else { |
460 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 460 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
461 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 461 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
462 | , QPoint(0,0), false ); | 462 | , QPoint(0,0), false ); |
463 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 463 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
464 | ( m_curSession->widgetStack() )->setFocus(); | 464 | ( m_curSession->widgetStack() )->setFocus(); |
465 | ( m_curSession->widgetStack() )->show(); | 465 | ( m_curSession->widgetStack() )->show(); |
466 | 466 | ||
467 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 467 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
468 | 468 | ||
469 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 469 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
470 | } | 470 | } |
471 | 471 | ||
472 | m_isFullscreen = !m_isFullscreen; | 472 | m_isFullscreen = !m_isFullscreen; |
473 | } | 473 | } |
474 | 474 | ||
475 | 475 | ||
476 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { | 476 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) { |
477 | 477 | ||
478 | qWarning("received key event! relay to TE widget"); | 478 | qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released"); |
479 | 479 | ||
480 | if ( m_curSession ) { | 480 | if ( m_curSession ) { |
481 | QKeyEvent ke(QEvent::KeyPress, q, u, 0); | ||
482 | 481 | ||
483 | ke.ignore(); | 482 | QEvent::Type state; |
483 | |||
484 | if (pressed) state = QEvent::KeyPress; | ||
485 | else state = QEvent::KeyRelease; | ||
486 | |||
487 | QKeyEvent ke(state, q, u, 0, QString(QChar(u))); | ||
488 | |||
484 | // where should i send this event? doesnt work sending it here | 489 | // where should i send this event? doesnt work sending it here |
485 | QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke); | 490 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
491 | ke.ignore(); | ||
486 | } | 492 | } |
487 | } | 493 | } |