Changeset View
Changeset View
Standalone View
Standalone View
src/MainWindow.cpp
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Line(s) | 76 | { | |||
---|---|---|---|---|---|
111 | connect(_viewManager, &Konsole::ViewManager::updateWindowIcon, this, | 111 | connect(_viewManager, &Konsole::ViewManager::updateWindowIcon, this, | ||
112 | &Konsole::MainWindow::updateWindowIcon); | 112 | &Konsole::MainWindow::updateWindowIcon); | ||
113 | connect(_viewManager, &Konsole::ViewManager::newViewWithProfileRequest, | 113 | connect(_viewManager, &Konsole::ViewManager::newViewWithProfileRequest, | ||
114 | this, &Konsole::MainWindow::newFromProfile); | 114 | this, &Konsole::MainWindow::newFromProfile); | ||
115 | connect(_viewManager, &Konsole::ViewManager::newViewRequest, | 115 | connect(_viewManager, &Konsole::ViewManager::newViewRequest, | ||
116 | this, &Konsole::MainWindow::newTab); | 116 | this, &Konsole::MainWindow::newTab); | ||
117 | connect(_viewManager, &Konsole::ViewManager::viewDetached, this, | 117 | connect(_viewManager, &Konsole::ViewManager::viewDetached, this, | ||
118 | &Konsole::MainWindow::viewDetached); | 118 | &Konsole::MainWindow::viewDetached); | ||
119 | connect(_viewManager, &Konsole::ViewManager::tabDetached, this, | ||||
120 | &Konsole::MainWindow::tabDetached); | ||||
119 | 121 | | |||
120 | setCentralWidget(_viewManager->widget()); | 122 | setCentralWidget(_viewManager->widget()); | ||
121 | 123 | | |||
122 | // disable automatically generated accelerators in top-level | 124 | // disable automatically generated accelerators in top-level | ||
123 | // menu items - to avoid conflicting with Alt+[Letter] shortcuts | 125 | // menu items - to avoid conflicting with Alt+[Letter] shortcuts | ||
124 | // in terminal applications | 126 | // in terminal applications | ||
125 | KAcceleratorManager::setNoAccel(menuBar()); | 127 | KAcceleratorManager::setNoAccel(menuBar()); | ||
126 | 128 | | |||
▲ Show 20 Lines • Show All 335 Lines • ▼ Show 20 Line(s) | 461 | Q_FOREACH (const auto &url, urls) { | |||
462 | } else if (url.scheme() == QLatin1String("ssh")) { | 464 | } else if (url.scheme() == QLatin1String("ssh")) { | ||
463 | createSSHSession(_viewManager->activeContainer(), defaultProfile, url); | 465 | createSSHSession(_viewManager->activeContainer(), defaultProfile, url); | ||
464 | } | 466 | } | ||
465 | } | 467 | } | ||
466 | } | 468 | } | ||
467 | 469 | | |||
468 | void MainWindow::newTab(TabbedViewContainer *tabWidget) | 470 | void MainWindow::newTab(TabbedViewContainer *tabWidget) | ||
469 | { | 471 | { | ||
472 | qDebug() << "New Tab Triggered"; | ||||
470 | Profile::Ptr defaultProfile = ProfileManager::instance()->defaultProfile(); | 473 | Profile::Ptr defaultProfile = ProfileManager::instance()->defaultProfile(); | ||
471 | createSession(tabWidget, defaultProfile, activeSessionDir()); | 474 | createSession(tabWidget, defaultProfile, activeSessionDir()); | ||
472 | } | 475 | } | ||
473 | 476 | | |||
474 | void MainWindow::cloneTab() | 477 | void MainWindow::cloneTab() | ||
475 | { | 478 | { | ||
476 | Q_ASSERT(_pluggedController); | 479 | Q_ASSERT(_pluggedController); | ||
477 | 480 | | |||
Show All 21 Lines | 493 | { | |||
499 | } | 502 | } | ||
500 | 503 | | |||
501 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(_viewManager->managerId())); | 504 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(_viewManager->managerId())); | ||
502 | 505 | | |||
503 | // create view before starting the session process so that the session | 506 | // create view before starting the session process so that the session | ||
504 | // doesn't suffer a change in terminal size right after the session | 507 | // doesn't suffer a change in terminal size right after the session | ||
505 | // starts. Some applications such as GNU Screen and Midnight Commander | 508 | // starts. Some applications such as GNU Screen and Midnight Commander | ||
506 | // don't like this happening | 509 | // don't like this happening | ||
507 | _viewManager->createView(tabWidget, session); | 510 | auto newView = _viewManager->createView(session); | ||
508 | 511 | _viewManager->activeContainer()->addView(newView); | |||
509 | return session; | 512 | return session; | ||
510 | } | 513 | } | ||
511 | 514 | | |||
512 | Session *MainWindow::createSSHSession(TabbedViewContainer *tabWidget, Profile::Ptr profile, const QUrl &url) | 515 | Session *MainWindow::createSSHSession(TabbedViewContainer *tabWidget, Profile::Ptr profile, const QUrl &url) | ||
513 | { | 516 | { | ||
514 | if (!profile) { | 517 | if (!profile) { | ||
515 | profile = ProfileManager::instance()->defaultProfile(); | 518 | profile = ProfileManager::instance()->defaultProfile(); | ||
516 | } | 519 | } | ||
Show All 12 Lines | |||||
529 | } | 532 | } | ||
530 | 533 | | |||
531 | session->sendTextToTerminal(sshCommand, QLatin1Char('\r')); | 534 | session->sendTextToTerminal(sshCommand, QLatin1Char('\r')); | ||
532 | 535 | | |||
533 | // create view before starting the session process so that the session | 536 | // create view before starting the session process so that the session | ||
534 | // doesn't suffer a change in terminal size right after the session | 537 | // doesn't suffer a change in terminal size right after the session | ||
535 | // starts. some applications such as GNU Screen and Midnight Commander | 538 | // starts. some applications such as GNU Screen and Midnight Commander | ||
536 | // don't like this happening | 539 | // don't like this happening | ||
537 | _viewManager->createView(tabWidget, session); | 540 | auto newView = _viewManager->createView(session); | ||
538 | 541 | _viewManager->activeContainer()->addView(newView); | |||
539 | return session; | 542 | return session; | ||
540 | } | 543 | } | ||
541 | 544 | | |||
542 | void MainWindow::setFocus() | 545 | void MainWindow::setFocus() | ||
543 | { | 546 | { | ||
544 | _viewManager->activeView()->setFocus(); | 547 | _viewManager->activeView()->setFocus(); | ||
545 | } | 548 | } | ||
546 | 549 | | |||
▲ Show 20 Lines • Show All 344 Lines • Show Last 20 Lines |