summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp2
-rw-r--r--noncore/apps/opie-console/script.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index afac542..7ffeca7 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -107,398 +107,400 @@ void MainWindow::initUI() {
107 connect(m_disconnect, SIGNAL(activated() ), 107 connect(m_disconnect, SIGNAL(activated() ),
108 this, SLOT(slotDisconnect() ) ); 108 this, SLOT(slotDisconnect() ) );
109 109
110 m_console->insertSeparator(); 110 m_console->insertSeparator();
111 111
112 m_transfer = new QAction(); 112 m_transfer = new QAction();
113 m_transfer->setText( tr("Transfer file...") ); 113 m_transfer->setText( tr("Transfer file...") );
114 m_transfer->addTo( m_console ); 114 m_transfer->addTo( m_console );
115 connect(m_transfer, SIGNAL(activated() ), 115 connect(m_transfer, SIGNAL(activated() ),
116 this, SLOT(slotTransfer() ) ); 116 this, SLOT(slotTransfer() ) );
117 117
118 118
119 /* 119 /*
120 * fullscreen 120 * fullscreen
121 */ 121 */
122 m_isFullscreen = false; 122 m_isFullscreen = false;
123 123
124 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 124 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
125 , QString::null, 0, this, 0); 125 , QString::null, 0, this, 0);
126 m_fullscreen->addTo( m_console ); 126 m_fullscreen->addTo( m_console );
127 m_fullscreen->addTo( m_icons ); 127 m_fullscreen->addTo( m_icons );
128 connect( m_fullscreen, SIGNAL( activated() ), 128 connect( m_fullscreen, SIGNAL( activated() ),
129 this, SLOT( slotFullscreen() ) ); 129 this, SLOT( slotFullscreen() ) );
130 130
131 m_console->insertSeparator(); 131 m_console->insertSeparator();
132 /* 132 /*
133 * terminate action 133 * terminate action
134 */ 134 */
135 m_terminate = new QAction(); 135 m_terminate = new QAction();
136 m_terminate->setText( tr("Terminate") ); 136 m_terminate->setText( tr("Terminate") );
137 m_terminate->addTo( m_console ); 137 m_terminate->addTo( m_console );
138 connect(m_terminate, SIGNAL(activated() ), 138 connect(m_terminate, SIGNAL(activated() ),
139 this, SLOT(slotTerminate() ) ); 139 this, SLOT(slotTerminate() ) );
140 140
141 m_closewindow = new QAction(); 141 m_closewindow = new QAction();
142 m_closewindow->setText( tr("Close Window") ); 142 m_closewindow->setText( tr("Close Window") );
143 m_closewindow->addTo( m_console ); 143 m_closewindow->addTo( m_console );
144 connect( m_closewindow, SIGNAL(activated() ), 144 connect( m_closewindow, SIGNAL(activated() ),
145 this, SLOT(slotClose() ) ); 145 this, SLOT(slotClose() ) );
146 146
147 147
148 /* 148 /*
149 * script actions 149 * script actions
150 */ 150 */
151 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 151 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
152 m_recordScript->addTo(m_scripts); 152 m_recordScript->addTo(m_scripts);
153 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 153 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
154 154
155 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 155 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
156 m_saveScript->addTo(m_scripts); 156 m_saveScript->addTo(m_scripts);
157 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 157 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
158 158
159 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); 159 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
160 m_runScript->addTo(m_scripts); 160 m_runScript->addTo(m_scripts);
161 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); 161 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
162 162
163 /* 163 /*
164 * action that open/closes the keyboard 164 * action that open/closes the keyboard
165 */ 165 */
166 m_openKeys = new QAction (tr("Open Keyboard..."), 166 m_openKeys = new QAction (tr("Open Keyboard..."),
167 Resource::loadPixmap( "console/keyboard_icon.png" ), 167 Resource::loadPixmap( "console/keyboard_icon.png" ),
168 QString::null, 0, this, 0); 168 QString::null, 0, this, 0);
169 169
170 m_openKeys->setToggleAction(true); 170 m_openKeys->setToggleAction(true);
171 171
172 connect (m_openKeys, SIGNAL(toggled(bool)), 172 connect (m_openKeys, SIGNAL(toggled(bool)),
173 this, SLOT(slotOpenKeb(bool))); 173 this, SLOT(slotOpenKeb(bool)));
174 m_openKeys->addTo(m_icons); 174 m_openKeys->addTo(m_icons);
175 175
176 176
177 /* 177 /*
178 * action that open/closes the keyboard 178 * action that open/closes the keyboard
179 */ 179 */
180 m_openButtons = new QAction ( tr( "Open Buttons..." ), 180 m_openButtons = new QAction ( tr( "Open Buttons..." ),
181 Resource::loadPixmap( "down" ), 181 Resource::loadPixmap( "down" ),
182 QString::null, 0, this, 0 ); 182 QString::null, 0, this, 0 );
183 183
184 m_openButtons->setToggleAction( true ); 184 m_openButtons->setToggleAction( true );
185 185
186 connect ( m_openButtons, SIGNAL( toggled( bool ) ), 186 connect ( m_openButtons, SIGNAL( toggled( bool ) ),
187 this, SLOT( slotOpenButtons( bool ) ) ); 187 this, SLOT( slotOpenButtons( bool ) ) );
188 m_openButtons->addTo( m_icons ); 188 m_openButtons->addTo( m_icons );
189 189
190 190
191 /* insert the submenu */ 191 /* insert the submenu */
192 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 192 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
193 -1, 0); 193 -1, 0);
194 194
195 /* insert the connection menu */ 195 /* insert the connection menu */
196 m_bar->insertItem( tr("Connection"), m_console ); 196 m_bar->insertItem( tr("Connection"), m_console );
197 197
198 /* the scripts menu */ 198 /* the scripts menu */
199 m_bar->insertItem( tr("Scripts"), m_scripts ); 199 m_bar->insertItem( tr("Scripts"), m_scripts );
200 200
201 /* the settings menu */ 201 /* the settings menu */
202 // m_bar->insertItem( tr("Settings"), m_settings ); 202 // m_bar->insertItem( tr("Settings"), m_settings );
203 203
204 /* and the keyboard */ 204 /* and the keyboard */
205 m_keyBar = new QToolBar(this); 205 m_keyBar = new QToolBar(this);
206 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 206 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
207 m_keyBar->setHorizontalStretchable( TRUE ); 207 m_keyBar->setHorizontalStretchable( TRUE );
208 m_keyBar->hide(); 208 m_keyBar->hide();
209 209
210 m_kb = new FunctionKeyboard(m_keyBar); 210 m_kb = new FunctionKeyboard(m_keyBar);
211 connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), 211 connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)),
212 this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); 212 this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool)));
213 213
214 m_buttonBar = new QToolBar( this ); 214 m_buttonBar = new QToolBar( this );
215 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); 215 addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE );
216 m_buttonBar->setHorizontalStretchable( TRUE ); 216 m_buttonBar->setHorizontalStretchable( TRUE );
217 m_buttonBar->hide(); 217 m_buttonBar->hide();
218 218
219 m_qb = new QuickButton( m_buttonBar ); 219 m_qb = new QuickButton( m_buttonBar );
220 connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), 220 connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ),
221 this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); 221 this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) );
222 222
223 223
224 m_connect->setEnabled( false ); 224 m_connect->setEnabled( false );
225 m_disconnect->setEnabled( false ); 225 m_disconnect->setEnabled( false );
226 m_terminate->setEnabled( false ); 226 m_terminate->setEnabled( false );
227 m_transfer->setEnabled( false ); 227 m_transfer->setEnabled( false );
228 m_recordScript->setEnabled( false ); 228 m_recordScript->setEnabled( false );
229 m_saveScript->setEnabled( false ); 229 m_saveScript->setEnabled( false );
230 m_runScript->setEnabled( false ); 230 m_runScript->setEnabled( false );
231 m_fullscreen->setEnabled( false ); 231 m_fullscreen->setEnabled( false );
232 m_closewindow->setEnabled( false ); 232 m_closewindow->setEnabled( false );
233 233
234 /* 234 /*
235 * connect to the menu activation 235 * connect to the menu activation
236 */ 236 */
237 connect( m_sessionsPop, SIGNAL(activated( int ) ), 237 connect( m_sessionsPop, SIGNAL(activated( int ) ),
238 this, SLOT(slotProfile( int ) ) ); 238 this, SLOT(slotProfile( int ) ) );
239 239
240 m_consoleWindow = new TabWidget( this, "blah"); 240 m_consoleWindow = new TabWidget( this, "blah");
241 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 241 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
242 this, SLOT(slotSessionChanged(Session*) ) ); 242 this, SLOT(slotSessionChanged(Session*) ) );
243 setCentralWidget( m_consoleWindow ); 243 setCentralWidget( m_consoleWindow );
244 244
245} 245}
246 246
247ProfileManager* MainWindow::manager() { 247ProfileManager* MainWindow::manager() {
248 return m_manager; 248 return m_manager;
249} 249}
250TabWidget* MainWindow::tabWidget() { 250TabWidget* MainWindow::tabWidget() {
251 return m_consoleWindow; 251 return m_consoleWindow;
252} 252}
253void MainWindow::populateProfiles() { 253void MainWindow::populateProfiles() {
254 m_sessionsPop->clear(); 254 m_sessionsPop->clear();
255 Profile::ValueList list = manager()->all(); 255 Profile::ValueList list = manager()->all();
256 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 256 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
257 m_sessionsPop->insertItem( (*it).name() ); 257 m_sessionsPop->insertItem( (*it).name() );
258 } 258 }
259 259
260} 260}
261MainWindow::~MainWindow() { 261MainWindow::~MainWindow() {
262 delete m_factory; 262 delete m_factory;
263 manager()->save(); 263 manager()->save();
264} 264}
265 265
266MetaFactory* MainWindow::factory() { 266MetaFactory* MainWindow::factory() {
267 return m_factory; 267 return m_factory;
268} 268}
269 269
270Session* MainWindow::currentSession() { 270Session* MainWindow::currentSession() {
271 return m_curSession; 271 return m_curSession;
272} 272}
273 273
274QList<Session> MainWindow::sessions() { 274QList<Session> MainWindow::sessions() {
275 return m_sessions; 275 return m_sessions;
276} 276}
277 277
278void MainWindow::slotNew() { 278void MainWindow::slotNew() {
279 ProfileEditorDialog dlg(factory() ); 279 ProfileEditorDialog dlg(factory() );
280 dlg.showMaximized(); 280 dlg.showMaximized();
281 int ret = dlg.exec(); 281 int ret = dlg.exec();
282 282
283 if ( ret == QDialog::Accepted ) { 283 if ( ret == QDialog::Accepted ) {
284 create( dlg.profile() ); 284 create( dlg.profile() );
285 } 285 }
286} 286}
287 287
288void MainWindow::slotRecordScript() { 288void MainWindow::slotRecordScript() {
289 if (currentSession()) { 289 if (currentSession()) {
290 currentSession()->emulationHandler()->startRecording(); 290 currentSession()->emulationHandler()->startRecording();
291 } 291 }
292} 292}
293 293
294void MainWindow::slotSaveScript() { 294void MainWindow::slotSaveScript() {
295 if (currentSession() && currentSession()->emulationHandler()->isRecording()) { 295 if (currentSession() && currentSession()->emulationHandler()->isRecording()) {
296 MimeTypes types; 296 MimeTypes types;
297 QStringList script; 297 QStringList script;
298 script << "text/plain"; 298 script << "text/plain";
299 script << "text/all";
299 types.insert("Script", script); 300 types.insert("Script", script);
300 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 301 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
301 if (!filename.isEmpty()) { 302 if (!filename.isEmpty()) {
302 currentSession()->emulationHandler()->script()->saveTo(filename); 303 currentSession()->emulationHandler()->script()->saveTo(filename);
303 currentSession()->emulationHandler()->clearScript(); 304 currentSession()->emulationHandler()->clearScript();
304 } 305 }
305 } 306 }
306} 307}
307 308
308void MainWindow::slotRunScript() { 309void MainWindow::slotRunScript() {
309 if (currentSession()) { 310 if (currentSession()) {
310 MimeTypes types; 311 MimeTypes types;
311 QStringList script; 312 QStringList script;
312 script << "text/plain"; 313 script << "text/plain";
314 script << "text/all";
313 types.insert("Script", script); 315 types.insert("Script", script);
314 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 316 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
315 if (!filename.isEmpty()) { 317 if (!filename.isEmpty()) {
316 Script script(DocLnk(filename).file()); 318 Script script(DocLnk(filename).file());
317 currentSession()->emulationHandler()->runScript(&script); 319 currentSession()->emulationHandler()->runScript(&script);
318 } 320 }
319 } 321 }
320} 322}
321 323
322void MainWindow::slotConnect() { 324void MainWindow::slotConnect() {
323 if ( currentSession() ) { 325 if ( currentSession() ) {
324 bool ret = currentSession()->layer()->open(); 326 bool ret = currentSession()->layer()->open();
325 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 327 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
326 QObject::tr("Failed"), 328 QObject::tr("Failed"),
327 QObject::tr("Connecting failed for this session.")); 329 QObject::tr("Connecting failed for this session."));
328 else { 330 else {
329 m_connect->setEnabled( false ); 331 m_connect->setEnabled( false );
330 m_disconnect->setEnabled( true ); 332 m_disconnect->setEnabled( true );
331 } 333 }
332 } 334 }
333} 335}
334 336
335void MainWindow::slotDisconnect() { 337void MainWindow::slotDisconnect() {
336 if ( currentSession() ) { 338 if ( currentSession() ) {
337 currentSession()->layer()->close(); 339 currentSession()->layer()->close();
338 m_connect->setEnabled( true ); 340 m_connect->setEnabled( true );
339 m_disconnect->setEnabled( false ); 341 m_disconnect->setEnabled( false );
340 } 342 }
341} 343}
342 344
343void MainWindow::slotTerminate() { 345void MainWindow::slotTerminate() {
344 if ( currentSession() ) 346 if ( currentSession() )
345 currentSession()->layer()->close(); 347 currentSession()->layer()->close();
346 348
347 slotClose(); 349 slotClose();
348 /* FIXME move to the next session */ 350 /* FIXME move to the next session */
349} 351}
350 352
351void MainWindow::slotConfigure() { 353void MainWindow::slotConfigure() {
352 ConfigDialog conf( manager()->all(), factory() ); 354 ConfigDialog conf( manager()->all(), factory() );
353 conf.showMaximized(); 355 conf.showMaximized();
354 356
355 int ret = conf.exec(); 357 int ret = conf.exec();
356 358
357 if ( QDialog::Accepted == ret ) { 359 if ( QDialog::Accepted == ret ) {
358 manager()->setProfiles( conf.list() ); 360 manager()->setProfiles( conf.list() );
359 manager()->save(); 361 manager()->save();
360 populateProfiles(); 362 populateProfiles();
361 } 363 }
362} 364}
363/* 365/*
364 * we will remove 366 * we will remove
365 * this window from the tabwidget 367 * this window from the tabwidget
366 * remove it from the list 368 * remove it from the list
367 * delete it 369 * delete it
368 * and set the currentSession() 370 * and set the currentSession()
369 */ 371 */
370void MainWindow::slotClose() { 372void MainWindow::slotClose() {
371 if (!currentSession() ) 373 if (!currentSession() )
372 return; 374 return;
373 375
374 Session* ses = currentSession(); 376 Session* ses = currentSession();
375 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 377 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
376 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 378 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
377 m_curSession = NULL; 379 m_curSession = NULL;
378 tabWidget()->remove( /*currentSession()*/ses ); 380 tabWidget()->remove( /*currentSession()*/ses );
379 /*it's autodelete */ 381 /*it's autodelete */
380 m_sessions.remove( ses ); 382 m_sessions.remove( ses );
381 qWarning("after remove!!"); 383 qWarning("after remove!!");
382 384
383 if (!currentSession() ) { 385 if (!currentSession() ) {
384 m_connect->setEnabled( false ); 386 m_connect->setEnabled( false );
385 m_disconnect->setEnabled( false ); 387 m_disconnect->setEnabled( false );
386 m_terminate->setEnabled( false ); 388 m_terminate->setEnabled( false );
387 m_transfer->setEnabled( false ); 389 m_transfer->setEnabled( false );
388 m_recordScript->setEnabled( false ); 390 m_recordScript->setEnabled( false );
389 m_saveScript->setEnabled( false ); 391 m_saveScript->setEnabled( false );
390 m_runScript->setEnabled( false ); 392 m_runScript->setEnabled( false );
391 m_fullscreen->setEnabled( false ); 393 m_fullscreen->setEnabled( false );
392 m_closewindow->setEnabled( false ); 394 m_closewindow->setEnabled( false );
393 } 395 }
394} 396}
395 397
396/* 398/*
397 * We will get the name 399 * We will get the name
398 * Then the profile 400 * Then the profile
399 * and then we will make a profile 401 * and then we will make a profile
400 */ 402 */
401void MainWindow::slotProfile( int id) { 403void MainWindow::slotProfile( int id) {
402 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 404 Profile prof = manager()->profile( m_sessionsPop->text( id) );
403 create( prof ); 405 create( prof );
404} 406}
405void MainWindow::create( const Profile& prof ) { 407void MainWindow::create( const Profile& prof ) {
406 Session *ses = manager()->fromProfile( prof, tabWidget() ); 408 Session *ses = manager()->fromProfile( prof, tabWidget() );
407 409
408 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 410 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
409 { 411 {
410 QMessageBox::warning(this, 412 QMessageBox::warning(this,
411 QObject::tr("Session failed"), 413 QObject::tr("Session failed"),
412 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 414 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
413 //if(ses) delete ses; 415 //if(ses) delete ses;
414 return; 416 return;
415 } 417 }
416 418
417 m_sessions.append( ses ); 419 m_sessions.append( ses );
418 tabWidget()->add( ses ); 420 tabWidget()->add( ses );
419 m_curSession = ses; 421 m_curSession = ses;
420 422
421 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 423 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
422 m_connect->setEnabled( true ); 424 m_connect->setEnabled( true );
423 m_disconnect->setEnabled( false ); 425 m_disconnect->setEnabled( false );
424 m_terminate->setEnabled( true ); 426 m_terminate->setEnabled( true );
425 m_transfer->setEnabled( true ); 427 m_transfer->setEnabled( true );
426 m_recordScript->setEnabled( true ); 428 m_recordScript->setEnabled( true );
427 m_saveScript->setEnabled( true ); 429 m_saveScript->setEnabled( true );
428 m_runScript->setEnabled( true ); 430 m_runScript->setEnabled( true );
429 m_fullscreen->setEnabled( true ); 431 m_fullscreen->setEnabled( true );
430 m_closewindow->setEnabled( true ); 432 m_closewindow->setEnabled( true );
431 433
432 434
433 // is io_layer wants direct connection, then autoconnect 435 // is io_layer wants direct connection, then autoconnect
434 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { 436 //if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
435 if (prof.autoConnect()) { 437 if (prof.autoConnect()) {
436 slotConnect(); 438 slotConnect();
437 } 439 }
438 440
439 QWidget *w = currentSession()->widget(); 441 QWidget *w = currentSession()->widget();
440 if(w) w->setFocus(); 442 if(w) w->setFocus();
441} 443}
442 444
443void MainWindow::slotTransfer() 445void MainWindow::slotTransfer()
444{ 446{
445 if ( currentSession() ) { 447 if ( currentSession() ) {
446 TransferDialog dlg(currentSession()->widgetStack(), this); 448 TransferDialog dlg(currentSession()->widgetStack(), this);
447 dlg.showMaximized(); 449 dlg.showMaximized();
448 //currentSession()->widgetStack()->add(dlg); 450 //currentSession()->widgetStack()->add(dlg);
449 dlg.exec(); 451 dlg.exec();
450 } 452 }
451} 453}
452 454
453 455
454void MainWindow::slotOpenKeb(bool state) { 456void MainWindow::slotOpenKeb(bool state) {
455 457
456 if (state) m_keyBar->show(); 458 if (state) m_keyBar->show();
457 else m_keyBar->hide(); 459 else m_keyBar->hide();
458 460
459} 461}
460 462
461 463
462void MainWindow::slotOpenButtons( bool state ) { 464void MainWindow::slotOpenButtons( bool state ) {
463 465
464 if ( state ) { 466 if ( state ) {
465 m_buttonBar->show(); 467 m_buttonBar->show();
466 } else { 468 } else {
467 m_buttonBar->hide(); 469 m_buttonBar->hide();
468 } 470 }
469} 471}
470 472
471 473
472 474
473void MainWindow::slotSessionChanged( Session* ses ) { 475void MainWindow::slotSessionChanged( Session* ses ) {
474 qWarning("changed!"); 476 qWarning("changed!");
475 if ( ses ) { 477 if ( ses ) {
476 m_curSession = ses; 478 m_curSession = ses;
477 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 479 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
478 if ( m_curSession->layer()->isConnected() ) { 480 if ( m_curSession->layer()->isConnected() ) {
479 m_connect->setEnabled( false ); 481 m_connect->setEnabled( false );
480 m_disconnect->setEnabled( true ); 482 m_disconnect->setEnabled( true );
481 } else { 483 } else {
482 m_connect->setEnabled( true ); 484 m_connect->setEnabled( true );
483 m_disconnect->setEnabled( false ); 485 m_disconnect->setEnabled( false );
484 } 486 }
485 487
486 QWidget *w = m_curSession->widget(); 488 QWidget *w = m_curSession->widget();
487 if(w) w->setFocus(); 489 if(w) w->setFocus();
488 } 490 }
489} 491}
490 492
491void MainWindow::slotFullscreen() { 493void MainWindow::slotFullscreen() {
492 494
493 495
494 496
495 if ( m_isFullscreen ) { 497 if ( m_isFullscreen ) {
496 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), false ); 498 ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), false );
497 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 499 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
498 500
499 setCentralWidget( m_consoleWindow ); 501 setCentralWidget( m_consoleWindow );
500 ( m_curSession->widgetStack() )->show(); 502 ( m_curSession->widgetStack() )->show();
501 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 503 ( m_curSession->emulationHandler() )->cornerButton()->hide();
502 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 504 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
503 505
504 } else { 506 } else {
diff --git a/noncore/apps/opie-console/script.cpp b/noncore/apps/opie-console/script.cpp
index 9cb1cd3..e6e9d6d 100644
--- a/noncore/apps/opie-console/script.cpp
+++ b/noncore/apps/opie-console/script.cpp
@@ -1,29 +1,30 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include "script.h" 3#include "script.h"
4 4
5Script::Script() { 5Script::Script() {
6} 6}
7 7
8Script::Script(const QString fileName) { 8Script::Script(const QString fileName) {
9 QFile file(fileName); 9 QFile file(fileName);
10 file.open(IO_ReadOnly );
10 m_script = file.readAll(); 11 m_script = file.readAll();
11} 12}
12 13
13void Script::saveTo(const QString fileName) const { 14void Script::saveTo(const QString fileName) const {
14 QFile file(fileName); 15 QFile file(fileName);
15 file.open(IO_WriteOnly); 16 file.open(IO_WriteOnly);
16 file.writeBlock(m_script); 17 file.writeBlock(m_script);
17 file.close(); 18 file.close();
18} 19}
19 20
20 21
21void Script::append(const QByteArray &data) { 22void Script::append(const QByteArray &data) {
22 int size = m_script.size(); 23 int size = m_script.size();
23 m_script.resize(size + data.size()); 24 m_script.resize(size + data.size());
24 memcpy(m_script.data() + size, data.data(), data.size()); 25 memcpy(m_script.data() + size, data.data(), data.size());
25} 26}
26 27
27QByteArray Script::script() const { 28QByteArray Script::script() const {
28 return m_script; 29 return m_script;
29} 30}