Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index abcdb84..a6fc30b 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -43,24 +43,25 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow( | |||
43 | m_factory = new MetaFactory(); | 43 | m_factory = new MetaFactory(); |
44 | Default def(m_factory); | 44 | Default def(m_factory); |
45 | m_sessions.setAutoDelete( TRUE ); | 45 | m_sessions.setAutoDelete( TRUE ); |
46 | m_curSession = 0; | 46 | m_curSession = 0; |
47 | m_manager = new ProfileManager( m_factory ); | 47 | m_manager = new ProfileManager( m_factory ); |
48 | m_manager->load(); | 48 | m_manager->load(); |
49 | m_scriptsData.setAutoDelete(TRUE); | 49 | m_scriptsData.setAutoDelete(TRUE); |
50 | 50 | ||
51 | initUI(); | 51 | initUI(); |
52 | populateProfiles(); | 52 | populateProfiles(); |
53 | populateScripts(); | 53 | populateScripts(); |
54 | } | 54 | } |
55 | |||
55 | void MainWindow::initUI() { | 56 | void MainWindow::initUI() { |
56 | setToolBarsMovable( FALSE ); | 57 | setToolBarsMovable( FALSE ); |
57 | 58 | ||
58 | /* tool bar for the menu */ | 59 | /* tool bar for the menu */ |
59 | m_tool = new QToolBar( this ); | 60 | m_tool = new QToolBar( this ); |
60 | m_tool->setHorizontalStretchable( TRUE ); | 61 | m_tool->setHorizontalStretchable( TRUE ); |
61 | 62 | ||
62 | m_bar = new QMenuBar( m_tool ); | 63 | m_bar = new QMenuBar( m_tool ); |
63 | m_console = new QPopupMenu( this ); | 64 | m_console = new QPopupMenu( this ); |
64 | m_scripts = new QPopupMenu( this ); | 65 | m_scripts = new QPopupMenu( this ); |
65 | m_sessionsPop= new QPopupMenu( this ); | 66 | m_sessionsPop= new QPopupMenu( this ); |
66 | m_scriptsPop = new QPopupMenu( this ); | 67 | m_scriptsPop = new QPopupMenu( this ); |
@@ -110,30 +111,37 @@ void MainWindow::initUI() { | |||
110 | 111 | ||
111 | /* | 112 | /* |
112 | * disconnect action | 113 | * disconnect action |
113 | */ | 114 | */ |
114 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 115 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
115 | QString::null, 0, this, 0 ); | 116 | QString::null, 0, this, 0 ); |
116 | m_disconnect->addTo( m_console ); | 117 | m_disconnect->addTo( m_console ); |
117 | connect(m_disconnect, SIGNAL(activated() ), | 118 | connect(m_disconnect, SIGNAL(activated() ), |
118 | this, SLOT(slotDisconnect() ) ); | 119 | this, SLOT(slotDisconnect() ) ); |
119 | 120 | ||
120 | m_console->insertSeparator(); | 121 | m_console->insertSeparator(); |
121 | 122 | ||
123 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | ||
124 | m_quickLaunch->addTo( m_icons ); | ||
125 | connect( m_quickLaunch, SIGNAL( activated() ), | ||
126 | this, SLOT( slotQuickLaunch() ) ); | ||
127 | |||
122 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 128 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
123 | 0, this, 0 ); | 129 | 0, this, 0 ); |
124 | m_transfer->addTo( m_console ); | 130 | m_transfer->addTo( m_console ); |
125 | connect(m_transfer, SIGNAL(activated() ), | 131 | connect(m_transfer, SIGNAL(activated() ), |
126 | this, SLOT(slotTransfer() ) ); | 132 | this, SLOT(slotTransfer() ) ); |
127 | 133 | ||
134 | |||
135 | |||
128 | /* | 136 | /* |
129 | * immediate change of line wrap policy | 137 | * immediate change of line wrap policy |
130 | */ | 138 | */ |
131 | m_isWrapped = false; | 139 | m_isWrapped = false; |
132 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 140 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); |
133 | m_wrap->addTo( m_console ); | 141 | m_wrap->addTo( m_console ); |
134 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 142 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
135 | 143 | ||
136 | /* | 144 | /* |
137 | * fullscreen | 145 | * fullscreen |
138 | */ | 146 | */ |
139 | m_isFullscreen = false; | 147 | m_isFullscreen = false; |
@@ -393,24 +401,34 @@ void MainWindow::slotDisconnect() { | |||
393 | m_scripts->setItemEnabled(m_runScript_id, false); | 401 | m_scripts->setItemEnabled(m_runScript_id, false); |
394 | } | 402 | } |
395 | } | 403 | } |
396 | 404 | ||
397 | void MainWindow::slotTerminate() { | 405 | void MainWindow::slotTerminate() { |
398 | if ( currentSession() ) | 406 | if ( currentSession() ) |
399 | currentSession()->layer()->close(); | 407 | currentSession()->layer()->close(); |
400 | 408 | ||
401 | slotClose(); | 409 | slotClose(); |
402 | /* FIXME move to the next session */ | 410 | /* FIXME move to the next session */ |
403 | } | 411 | } |
404 | 412 | ||
413 | void MainWindow::slotQuickLaunch() { | ||
414 | Profile prof = manager()->profile( "default" ); | ||
415 | if ( prof.name() == "default" ) { | ||
416 | create( prof ); | ||
417 | } else { | ||
418 | QMessageBox::warning(this, tr("Failure"),tr("please configure one profile named \"default\"")); | ||
419 | } | ||
420 | |||
421 | } | ||
422 | |||
405 | void MainWindow::slotConfigure() { | 423 | void MainWindow::slotConfigure() { |
406 | ConfigDialog conf( manager()->all(), factory() ); | 424 | ConfigDialog conf( manager()->all(), factory() ); |
407 | conf.showMaximized(); | 425 | conf.showMaximized(); |
408 | 426 | ||
409 | int ret = conf.exec(); | 427 | int ret = conf.exec(); |
410 | 428 | ||
411 | if ( QDialog::Accepted == ret ) { | 429 | if ( QDialog::Accepted == ret ) { |
412 | manager()->setProfiles( conf.list() ); | 430 | manager()->setProfiles( conf.list() ); |
413 | manager()->save(); | 431 | manager()->save(); |
414 | populateProfiles(); | 432 | populateProfiles(); |
415 | } | 433 | } |
416 | } | 434 | } |
@@ -450,24 +468,27 @@ void MainWindow::slotClose() { | |||
450 | m_kb->loadDefaults(); | 468 | m_kb->loadDefaults(); |
451 | } | 469 | } |
452 | 470 | ||
453 | /* | 471 | /* |
454 | * We will get the name | 472 | * We will get the name |
455 | * Then the profile | 473 | * Then the profile |
456 | * and then we will make a profile | 474 | * and then we will make a profile |
457 | */ | 475 | */ |
458 | void MainWindow::slotProfile( int id) { | 476 | void MainWindow::slotProfile( int id) { |
459 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 477 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
460 | create( prof ); | 478 | create( prof ); |
461 | } | 479 | } |
480 | |||
481 | |||
482 | |||
462 | void MainWindow::create( const Profile& prof ) { | 483 | void MainWindow::create( const Profile& prof ) { |
463 | if(m_curSession) | 484 | if(m_curSession) |
464 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 485 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
465 | 486 | ||
466 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 487 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
467 | 488 | ||
468 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 489 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
469 | { | 490 | { |
470 | QMessageBox::warning(this, | 491 | QMessageBox::warning(this, |
471 | QObject::tr("Session failed"), | 492 | QObject::tr("Session failed"), |
472 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 493 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
473 | //if(ses) delete ses; | 494 | //if(ses) delete ses; |