summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/BUGS3
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp22
2 files changed, 22 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/BUGS b/noncore/apps/opie-console/BUGS
index 8195dc5..694bc8b 100644
--- a/noncore/apps/opie-console/BUGS
+++ b/noncore/apps/opie-console/BUGS
@@ -1,32 +1,35 @@
1Ok we all know we write perfect code 1Ok we all know we write perfect code
2but sometimes the compiler produces bad code 2but sometimes the compiler produces bad code
3and we need to work around some compiler bugs!! -zecke 3and we need to work around some compiler bugs!! -zecke
4 4
5 5
6Send/receive: lrzsz behaves strange when trying to use 6Send/receive: lrzsz behaves strange when trying to use
7--overwrite or --rename. 7--overwrite or --rename.
8 8
9- transfer dialog is still a top dialog instead on the widgetstack of of the 9- transfer dialog is still a top dialog instead on the widgetstack of of the
10connection its used on 10connection its used on
11 11
12- keys and buttonbar merge 12- keys and buttonbar merge
13 13
14- keys really working 14- keys really working
15 mc is working 15 mc is working
16 but F11 on bar seems to be the F10 key and so on 16 but F11 on bar seems to be the F10 key and so on
17 F9 is F8... -zecke 17 F9 is F8... -zecke
18 Should be fixed -zecke 18 Should be fixed -zecke
19 19
20- scripting with "direct subpopup" 20- scripting with "direct subpopup"
21 also: 21 also:
22 - an indication that it is currently recording, also change menu entry to 22 - an indication that it is currently recording, also change menu entry to
23 "cancel recording" then 23 "cancel recording" then
24 24
25- scripts need an extension and also an icon 25- scripts need an extension and also an icon
26 26
27- help documentation needs to be extended 27- help documentation needs to be extended
28 - new connection and save connection 28 - new connection and save connection
29 - paste button 29 - paste button
30 - keys button 30 - keys button
31 31
32- dial dialog - ugly , better use a qlineedit there to for showing or
33 disable
34
32- exit / strg + d does not close conection / tab \ No newline at end of file 35- exit / strg + d does not close conection / tab \ No newline at end of file
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index c7750be..406586c 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -148,428 +148,444 @@ void MainWindow::initUI() {
148 this, SLOT(slotTerminate() ) ); 148 this, SLOT(slotTerminate() ) );
149 149
150 m_closewindow = new QAction(); 150 m_closewindow = new QAction();
151 m_closewindow->setText( tr("Close Window") ); 151 m_closewindow->setText( tr("Close Window") );
152 m_closewindow->addTo( m_console ); 152 m_closewindow->addTo( m_console );
153 connect( m_closewindow, SIGNAL(activated() ), 153 connect( m_closewindow, SIGNAL(activated() ),
154 this, SLOT(slotClose() ) ); 154 this, SLOT(slotClose() ) );
155 155
156 156
157 /* 157 /*
158 * script actions 158 * script actions
159 */ 159 */
160 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 160 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
161 m_recordScript->addTo(m_scripts); 161 m_recordScript->addTo(m_scripts);
162 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 162 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
163 163
164 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 164 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
165 m_saveScript->addTo(m_scripts); 165 m_saveScript->addTo(m_scripts);
166 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 166 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
167 167
168 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); 168 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
169 m_runScript->addTo(m_scripts); 169 m_runScript->addTo(m_scripts);
170 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); 170 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
171 171
172 /* 172 /*
173 * action that open/closes the keyboard 173 * action that open/closes the keyboard
174 */ 174 */
175 m_openKeys = new QAction (tr("Open Keyboard..."), 175 m_openKeys = new QAction (tr("Open Keyboard..."),
176 Resource::loadPixmap( "console/keys/keyboard_icon" ), 176 Resource::loadPixmap( "console/keys/keyboard_icon" ),
177 QString::null, 0, this, 0); 177 QString::null, 0, this, 0);
178 178
179 m_openKeys->setToggleAction(true); 179 m_openKeys->setToggleAction(true);
180 180
181 connect (m_openKeys, SIGNAL(toggled(bool)), 181 connect (m_openKeys, SIGNAL(toggled(bool)),
182 this, SLOT(slotOpenKeb(bool))); 182 this, SLOT(slotOpenKeb(bool)));
183 m_openKeys->addTo(m_icons); 183 m_openKeys->addTo(m_icons);
184 184
185 /* insert the submenu */ 185 /* insert the submenu */
186 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 186 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
187 -1, 0); 187 -1, 0);
188 188
189 /* insert the connection menu */ 189 /* insert the connection menu */
190 m_bar->insertItem( tr("Connection"), m_console ); 190 m_bar->insertItem( tr("Connection"), m_console );
191 191
192 /* the scripts menu */ 192 /* the scripts menu */
193 m_bar->insertItem( tr("Scripts"), m_scripts ); 193 m_bar->insertItem( tr("Scripts"), m_scripts );
194 194
195 /* the settings menu */ 195 /* the settings menu */
196 // m_bar->insertItem( tr("Settings"), m_settings ); 196 // m_bar->insertItem( tr("Settings"), m_settings );
197 197
198 /* and the keyboard */ 198 /* and the keyboard */
199 m_keyBar = new QToolBar(this); 199 m_keyBar = new QToolBar(this);
200 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 200 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
201 m_keyBar->setHorizontalStretchable( TRUE ); 201 m_keyBar->setHorizontalStretchable( TRUE );
202 m_keyBar->hide(); 202 m_keyBar->hide();
203 203
204 m_kb = new FunctionKeyboard(m_keyBar); 204 m_kb = new FunctionKeyboard(m_keyBar);
205 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 205 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
206 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 206 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
207 207
208 m_buttonBar = new QToolBar( this ); 208 m_buttonBar = new QToolBar( this );
209 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); 209 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE );
210 m_buttonBar->setHorizontalStretchable( TRUE ); 210 m_buttonBar->setHorizontalStretchable( TRUE );
211 m_buttonBar->hide(); 211 m_buttonBar->hide();
212 212
213 a = new QAction(tr("Copy"), 213 a = new QAction(tr("Copy"),
214 Resource::loadPixmap("copy"), QString::null, 214 Resource::loadPixmap("copy"), QString::null,
215 0, this, 0 ); 215 0, this, 0 );
216 //a->addTo( m_icons ); 216 //a->addTo( m_icons );
217 connect( a, SIGNAL(activated() ), 217 connect( a, SIGNAL(activated() ),
218 this, SLOT(slotCopy() ) ); 218 this, SLOT(slotCopy() ) );
219 219
220 a = new QAction(tr("Paste"), 220 a = new QAction(tr("Paste"),
221 Resource::loadPixmap("paste"), QString::null, 221 Resource::loadPixmap("paste"), QString::null,
222 0, this, 0 ); 222 0, this, 0 );
223 a->addTo( m_icons ); 223 a->addTo( m_icons );
224 connect( a, SIGNAL(activated() ), 224 connect( a, SIGNAL(activated() ),
225 this, SLOT(slotPaste() ) ); 225 this, SLOT(slotPaste() ) );
226 226
227 227
228 m_connect->setEnabled( false ); 228 m_connect->setEnabled( false );
229 m_disconnect->setEnabled( false ); 229 m_disconnect->setEnabled( false );
230 m_terminate->setEnabled( false ); 230 m_terminate->setEnabled( false );
231 m_transfer->setEnabled( false ); 231 m_transfer->setEnabled( false );
232 m_recordScript->setEnabled( false ); 232 m_recordScript->setEnabled( false );
233 m_saveScript->setEnabled( false ); 233 m_saveScript->setEnabled( false );
234 m_runScript->setEnabled( false ); 234 m_runScript->setEnabled( false );
235 m_fullscreen->setEnabled( false ); 235 m_fullscreen->setEnabled( false );
236 m_closewindow->setEnabled( false ); 236 m_closewindow->setEnabled( false );
237 237
238 /* 238 /*
239 * connect to the menu activation 239 * connect to the menu activation
240 */ 240 */
241 connect( m_sessionsPop, SIGNAL(activated( int ) ), 241 connect( m_sessionsPop, SIGNAL(activated( int ) ),
242 this, SLOT(slotProfile( int ) ) ); 242 this, SLOT(slotProfile( int ) ) );
243 243
244 m_consoleWindow = new TabWidget( this, "blah"); 244 m_consoleWindow = new TabWidget( this, "blah");
245 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 245 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
246 this, SLOT(slotSessionChanged(Session*) ) ); 246 this, SLOT(slotSessionChanged(Session*) ) );
247 setCentralWidget( m_consoleWindow ); 247 setCentralWidget( m_consoleWindow );
248 248
249} 249}
250 250
251ProfileManager* MainWindow::manager() { 251ProfileManager* MainWindow::manager() {
252 return m_manager; 252 return m_manager;
253} 253}
254TabWidget* MainWindow::tabWidget() { 254TabWidget* MainWindow::tabWidget() {
255 return m_consoleWindow; 255 return m_consoleWindow;
256} 256}
257void MainWindow::populateProfiles() { 257void MainWindow::populateProfiles() {
258 m_sessionsPop->clear(); 258 m_sessionsPop->clear();
259 Profile::ValueList list = manager()->all(); 259 Profile::ValueList list = manager()->all();
260 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 260 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
261 m_sessionsPop->insertItem( (*it).name() ); 261 m_sessionsPop->insertItem( (*it).name() );
262 } 262 }
263 263
264} 264}
265MainWindow::~MainWindow() { 265MainWindow::~MainWindow() {
266 delete m_factory; 266 delete m_factory;
267 manager()->save(); 267 manager()->save();
268} 268}
269 269
270MetaFactory* MainWindow::factory() { 270MetaFactory* MainWindow::factory() {
271 return m_factory; 271 return m_factory;
272} 272}
273 273
274Session* MainWindow::currentSession() { 274Session* MainWindow::currentSession() {
275 return m_curSession; 275 return m_curSession;
276} 276}
277 277
278QList<Session> MainWindow::sessions() { 278QList<Session> MainWindow::sessions() {
279 return m_sessions; 279 return m_sessions;
280} 280}
281 281
282void MainWindow::slotNew() { 282void MainWindow::slotNew() {
283 ProfileEditorDialog dlg(factory() ); 283 ProfileEditorDialog dlg(factory() );
284 dlg.showMaximized(); 284 dlg.showMaximized();
285 int ret = dlg.exec(); 285 int ret = dlg.exec();
286 286
287 if ( ret == QDialog::Accepted ) { 287 if ( ret == QDialog::Accepted ) {
288 create( dlg.profile() ); 288 create( dlg.profile() );
289 } 289 }
290} 290}
291 291
292void MainWindow::slotRecordScript() { 292void MainWindow::slotRecordScript() {
293 if (currentSession()) { 293 if (currentSession()) {
294 currentSession()->emulationHandler()->startRecording(); 294 currentSession()->emulationHandler()->startRecording();
295 } 295 }
296} 296}
297 297
298void MainWindow::slotSaveScript() { 298void MainWindow::slotSaveScript() {
299 if (currentSession() && currentSession()->emulationHandler()->isRecording()) { 299 if (currentSession() && currentSession()->emulationHandler()->isRecording()) {
300 MimeTypes types; 300 MimeTypes types;
301 QStringList script; 301 QStringList script;
302 script << "text/plain"; 302 script << "text/plain";
303 script << "text/all"; 303 script << "text/all";
304 script << "application/octet-stream"; 304 script << "application/octet-stream";
305 types.insert("Script", script); 305 types.insert("Script", script);
306 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 306 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
307 if (!filename.isEmpty()) { 307 if (!filename.isEmpty()) {
308 currentSession()->emulationHandler()->script()->saveTo(filename); 308 currentSession()->emulationHandler()->script()->saveTo(filename);
309 currentSession()->emulationHandler()->clearScript(); 309 currentSession()->emulationHandler()->clearScript();
310 } 310 }
311 } 311 }
312} 312}
313 313
314void MainWindow::slotRunScript() { 314void MainWindow::slotRunScript() {
315 if (currentSession()) { 315 if (currentSession()) {
316 MimeTypes types; 316 MimeTypes types;
317 QStringList script; 317 QStringList script;
318 script << "text/plain"; 318 script << "text/plain";
319 script << "text/all"; 319 script << "text/all";
320 script << "application/octet-stream"; 320 script << "application/octet-stream";
321 types.insert("Script", script); 321 types.insert("Script", script);
322 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 322 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
323 if (!filename.isEmpty()) { 323 if (!filename.isEmpty()) {
324 Script script(DocLnk(filename).file()); 324 Script script(DocLnk(filename).file());
325 currentSession()->emulationHandler()->runScript(&script); 325 currentSession()->emulationHandler()->runScript(&script);
326 } 326 }
327 } 327 }
328} 328}
329 329
330void MainWindow::slotConnect() { 330void MainWindow::slotConnect() {
331 if ( currentSession() ) { 331 if ( currentSession() ) {
332 bool ret = currentSession()->layer()->open(); 332 bool ret = currentSession()->layer()->open();
333 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 333 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
334 QObject::tr("Failed"), 334 QObject::tr("Failed"),
335 QObject::tr("Connecting failed for this session.")); 335 QObject::tr("Connecting failed for this session."));
336 else { 336 else {
337 m_connect->setEnabled( false ); 337 m_connect->setEnabled( false );
338 m_disconnect->setEnabled( true ); 338 m_disconnect->setEnabled( true );
339 m_transfer->setEnabled( true ); 339 m_transfer->setEnabled( true );
340 m_recordScript->setEnabled( true );
341 m_saveScript->setEnabled( true );
342 m_runScript->setEnabled( true );
340 } 343 }
341 } 344 }
342} 345}
343 346
344void MainWindow::slotDisconnect() { 347void MainWindow::slotDisconnect() {
345 if ( currentSession() ) { 348 if ( currentSession() ) {
346 currentSession()->layer()->close(); 349 currentSession()->layer()->close();
347 m_connect->setEnabled( true ); 350 m_connect->setEnabled( true );
348 m_disconnect->setEnabled( false ); 351 m_disconnect->setEnabled( false );
349 m_transfer->setEnabled( false ); 352 m_transfer->setEnabled( false );
353 m_recordScript->setEnabled( false);
354 m_saveScript->setEnabled( false );
355 m_runScript->setEnabled( false );
350 } 356 }
351} 357}
352 358
353void MainWindow::slotTerminate() { 359void MainWindow::slotTerminate() {
354 if ( currentSession() ) 360 if ( currentSession() )
355 currentSession()->layer()->close(); 361 currentSession()->layer()->close();
356 362
357 slotClose(); 363 slotClose();
358 /* FIXME move to the next session */ 364 /* FIXME move to the next session */
359} 365}
360 366
361void MainWindow::slotConfigure() { 367void MainWindow::slotConfigure() {
362 ConfigDialog conf( manager()->all(), factory() ); 368 ConfigDialog conf( manager()->all(), factory() );
363 conf.showMaximized(); 369 conf.showMaximized();
364 370
365 int ret = conf.exec(); 371 int ret = conf.exec();
366 372
367 if ( QDialog::Accepted == ret ) { 373 if ( QDialog::Accepted == ret ) {
368 manager()->setProfiles( conf.list() ); 374 manager()->setProfiles( conf.list() );
369 manager()->save(); 375 manager()->save();
370 populateProfiles(); 376 populateProfiles();
371 } 377 }
372} 378}
373/* 379/*
374 * we will remove 380 * we will remove
375 * this window from the tabwidget 381 * this window from the tabwidget
376 * remove it from the list 382 * remove it from the list
377 * delete it 383 * delete it
378 * and set the currentSession() 384 * and set the currentSession()
379 */ 385 */
380void MainWindow::slotClose() { 386void MainWindow::slotClose() {
381 if (!currentSession() ) 387 if (!currentSession() )
382 return; 388 return;
383 389
384 Session* ses = currentSession(); 390 Session* ses = currentSession();
385 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 391 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
386 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 392 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
387 m_curSession = NULL; 393 m_curSession = NULL;
388 tabWidget()->remove( /*currentSession()*/ses ); 394 tabWidget()->remove( /*currentSession()*/ses );
389 /*it's autodelete */ 395 /*it's autodelete */
390 m_sessions.remove( ses ); 396 m_sessions.remove( ses );
391 qWarning("after remove!!"); 397 qWarning("after remove!!");
392 398
393 if (!currentSession() ) { 399 if (!currentSession() ) {
394 m_connect->setEnabled( false ); 400 m_connect->setEnabled( false );
395 m_disconnect->setEnabled( false ); 401 m_disconnect->setEnabled( false );
396 m_terminate->setEnabled( false ); 402 m_terminate->setEnabled( false );
397 m_transfer->setEnabled( false ); 403 m_transfer->setEnabled( false );
398 m_recordScript->setEnabled( false ); 404 m_recordScript->setEnabled( false );
399 m_saveScript->setEnabled( false ); 405 m_saveScript->setEnabled( false );
400 m_runScript->setEnabled( false ); 406 m_runScript->setEnabled( false );
401 m_fullscreen->setEnabled( false ); 407 m_fullscreen->setEnabled( false );
402 m_closewindow->setEnabled( false ); 408 m_closewindow->setEnabled( false );
403 } 409 }
404} 410}
405 411
406/* 412/*
407 * We will get the name 413 * We will get the name
408 * Then the profile 414 * Then the profile
409 * and then we will make a profile 415 * and then we will make a profile
410 */ 416 */
411void MainWindow::slotProfile( int id) { 417void MainWindow::slotProfile( int id) {
412 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 418 Profile prof = manager()->profile( m_sessionsPop->text( id) );
413 create( prof ); 419 create( prof );
414} 420}
415void MainWindow::create( const Profile& prof ) { 421void MainWindow::create( const Profile& prof ) {
416 Session *ses = manager()->fromProfile( prof, tabWidget() ); 422 Session *ses = manager()->fromProfile( prof, tabWidget() );
417 423
418 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 424 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
419 { 425 {
420 QMessageBox::warning(this, 426 QMessageBox::warning(this,
421 QObject::tr("Session failed"), 427 QObject::tr("Session failed"),
422 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 428 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
423 //if(ses) delete ses; 429 //if(ses) delete ses;
424 return; 430 return;
425 } 431 }
426 432
427 m_sessions.append( ses ); 433 m_sessions.append( ses );
428 tabWidget()->add( ses ); 434 tabWidget()->add( ses );
429 tabWidget()->repaint(); 435 tabWidget()->repaint();
430 m_curSession = ses; 436 m_curSession = ses;
431 437
432 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 438 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
433 m_connect->setEnabled( true ); 439 m_connect->setEnabled( true );
434 m_disconnect->setEnabled( false ); 440 m_disconnect->setEnabled( false );
435 m_terminate->setEnabled( true ); 441 m_terminate->setEnabled( true );
436 m_recordScript->setEnabled( true );
437 m_saveScript->setEnabled( true );
438 m_runScript->setEnabled( true );
439 m_fullscreen->setEnabled( true ); 442 m_fullscreen->setEnabled( true );
440 m_closewindow->setEnabled( true ); 443 m_closewindow->setEnabled( true );
441 m_transfer->setEnabled( false ); 444 m_transfer->setEnabled( false );
445 m_recordScript->setEnabled( false );
446 m_saveScript->setEnabled( false );
447 m_runScript->setEnabled( false );
442 448
443 // is io_layer wants direct connection, then autoconnect 449 // is io_layer wants direct connection, then autoconnect
444 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 450 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
445 if (prof.autoConnect()) { 451 if (prof.autoConnect()) {
446 slotConnect(); 452 slotConnect();
447 } 453 }
448 454
449 455
450 456
451 QWidget *w = currentSession()->widget(); 457 QWidget *w = currentSession()->widget();
452 if(w) w->setFocus(); 458 if(w) w->setFocus();
453} 459}
454 460
455void MainWindow::slotTransfer() 461void MainWindow::slotTransfer()
456{ 462{
457 if ( currentSession() ) { 463 if ( currentSession() ) {
458 TransferDialog dlg(currentSession()->widgetStack(), this); 464 TransferDialog dlg(currentSession()->widgetStack(), this);
459 dlg.showMaximized(); 465 dlg.showMaximized();
460 //currentSession()->widgetStack()->add(dlg); 466 //currentSession()->widgetStack()->add(dlg);
461 dlg.exec(); 467 dlg.exec();
462 } 468 }
463} 469}
464 470
465 471
466void MainWindow::slotOpenKeb(bool state) { 472void MainWindow::slotOpenKeb(bool state) {
467 473
468 if (state) m_keyBar->show(); 474 if (state) m_keyBar->show();
469 else m_keyBar->hide(); 475 else m_keyBar->hide();
470 476
471} 477}
472 478
473 479
474void MainWindow::slotOpenButtons( bool state ) { 480void MainWindow::slotOpenButtons( bool state ) {
475 481
476 if ( state ) { 482 if ( state ) {
477 m_buttonBar->show(); 483 m_buttonBar->show();
478 } else { 484 } else {
479 m_buttonBar->hide(); 485 m_buttonBar->hide();
480 } 486 }
481} 487}
482 488
483 489
484 490
485void MainWindow::slotSessionChanged( Session* ses ) { 491void MainWindow::slotSessionChanged( Session* ses ) {
486 qWarning("changed!"); 492 qWarning("changed!");
487 if ( ses ) { 493 if ( ses ) {
488 m_curSession = ses; 494 m_curSession = ses;
489 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 495 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
490 if ( m_curSession->layer()->isConnected() ) { 496 if ( m_curSession->layer()->isConnected() ) {
491 m_connect->setEnabled( false ); 497 m_connect->setEnabled( false );
492 m_disconnect->setEnabled( true ); 498 m_disconnect->setEnabled( true );
499 m_recordScript->setEnabled( true );
500 m_saveScript->setEnabled( true );
501 m_runScript->setEnabled( true );
493 } else { 502 } else {
494 m_connect->setEnabled( true ); 503 m_connect->setEnabled( true );
495 m_disconnect->setEnabled( false ); 504 m_disconnect->setEnabled( false );
505 m_recordScript->setEnabled( false );
506 m_saveScript->setEnabled( false );
507 m_runScript->setEnabled( false );
496 } 508 }
497 509
498 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 510 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
499 m_transfer->setEnabled( false ); 511 m_transfer->setEnabled( false );
500 } else { 512 } else {
501 m_transfer->setEnabled( true ); 513 m_transfer->setEnabled( true );
502 } 514 }
503 515
516
517
518
519
504 QWidget *w = m_curSession->widget(); 520 QWidget *w = m_curSession->widget();
505 if(w) w->setFocus(); 521 if(w) w->setFocus();
506 } 522 }
507} 523}
508 524
509void MainWindow::slotFullscreen() { 525void MainWindow::slotFullscreen() {
510 526
511 527
512 528
513 if ( m_isFullscreen ) { 529 if ( m_isFullscreen ) {
514 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); 530 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
515 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); 531 ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
516 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 532 ( m_curSession->emulationHandler() )->cornerButton()->hide();
517 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 533 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
518 534
519 } else { 535 } else {
520 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); 536 savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
521 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 537 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
522 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 538 ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
523 , QPoint(0,0), false ); 539 , QPoint(0,0), false );
524 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 540 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
525 ( m_curSession->widgetStack() )->setFocus(); 541 ( m_curSession->widgetStack() )->setFocus();
526 ( m_curSession->widgetStack() )->show(); 542 ( m_curSession->widgetStack() )->show();
527 543
528 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 544 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
529 545
530 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 546 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
531 } 547 }
532 548
533 m_isFullscreen = !m_isFullscreen; 549 m_isFullscreen = !m_isFullscreen;
534} 550}
535 551
536 552
537void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 553void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
538 554
539 if ( m_curSession ) { 555 if ( m_curSession ) {
540 556
541 QEvent::Type state; 557 QEvent::Type state;
542 558
543 if (pressed) state = QEvent::KeyPress; 559 if (pressed) state = QEvent::KeyPress;
544 else state = QEvent::KeyRelease; 560 else state = QEvent::KeyRelease;
545 561
546 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 562 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
547 563
548 // where should i send this event? doesnt work sending it here 564 // where should i send this event? doesnt work sending it here
549 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); 565 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
550 ke.ignore(); 566 ke.ignore();
551 } 567 }
552} 568}
553void MainWindow::slotCopy() { 569void MainWindow::slotCopy() {
554 if (!currentSession() ) return; 570 if (!currentSession() ) return;
555 currentSession()->emulationHandler()->copy(); 571 currentSession()->emulationHandler()->copy();
556} 572}
557void MainWindow::slotPaste() { 573void MainWindow::slotPaste() {
558 if (!currentSession() ) return; 574 if (!currentSession() ) return;
559 currentSession()->emulationHandler()->paste(); 575 currentSession()->emulationHandler()->paste();
560} 576}
561 577
562/* 578/*
563 * Save the session 579 * Save the session
564 */ 580 */
565 581
566void MainWindow::slotSaveSession() { 582void MainWindow::slotSaveSession() {
567 if (!currentSession() ) { 583 if (!currentSession() ) {
568 QMessageBox::information(this, tr("Save Connection"), 584 QMessageBox::information(this, tr("Save Connection"),
569 tr("<qt>There is no Connection.</qt>"), 1 ); 585 tr("<qt>There is no Connection.</qt>"), 1 );
570 return; 586 return;
571 } 587 }
572 manager()->add( currentSession()->profile() ); 588 manager()->add( currentSession()->profile() );
573 manager()->save(); 589 manager()->save();
574 populateProfiles(); 590 populateProfiles();
575} 591}