Changeset View
Changeset View
Standalone View
Standalone View
src/MainWindow.cpp
Show First 20 Lines • Show All 494 Lines • ▼ Show 20 Line(s) | 484 | { | |||
---|---|---|---|---|---|
495 | } | 495 | } | ||
496 | } | 496 | } | ||
497 | 497 | | |||
498 | Session *MainWindow::createSession(Profile::Ptr profile, const QString &directory) | 498 | Session *MainWindow::createSession(Profile::Ptr profile, const QString &directory) | ||
499 | { | 499 | { | ||
500 | if (!profile) { | 500 | if (!profile) { | ||
501 | profile = ProfileManager::instance()->defaultProfile(); | 501 | profile = ProfileManager::instance()->defaultProfile(); | ||
502 | } | 502 | } | ||
503 | 503 | int sessionId = _viewManager->newSession(profile->name(), directory, false); | |||
504 | Session *session = SessionManager::instance()->createSession(profile); | 504 | return SessionManager::instance()->idToSession(sessionId); | ||
505 | | ||||
506 | if (!directory.isEmpty() && profile->startInCurrentSessionDir()) { | | |||
507 | session->setInitialWorkingDirectory(directory); | | |||
508 | } | | |||
509 | | ||||
510 | session->addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_WINDOW=/Windows/%1").arg(_viewManager->managerId())); | | |||
511 | | ||||
512 | // create view before starting the session process so that the session | | |||
513 | // doesn't suffer a change in terminal size right after the session | | |||
514 | // starts. Some applications such as GNU Screen and Midnight Commander | | |||
515 | // don't like this happening | | |||
516 | _viewManager->createView(session); | | |||
517 | | ||||
518 | return session; | | |||
519 | } | 505 | } | ||
520 | 506 | | |||
521 | Session *MainWindow::createSSHSession(Profile::Ptr profile, const QUrl &url) | 507 | Session *MainWindow::createSSHSession(Profile::Ptr profile, const QUrl &url) | ||
522 | { | 508 | { | ||
523 | if (!profile) { | 509 | if (!profile) { | ||
524 | profile = ProfileManager::instance()->defaultProfile(); | 510 | profile = ProfileManager::instance()->defaultProfile(); | ||
525 | } | 511 | } | ||
526 | 512 | | |||
▲ Show 20 Lines • Show All 375 Lines • Show Last 20 Lines |