Changeset View
Changeset View
Standalone View
Standalone View
src/Part.cpp
Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Line(s) | |||||
195 | { | 195 | { | ||
196 | Q_ASSERT(activeSession()); | 196 | Q_ASSERT(activeSession()); | ||
197 | 197 | | |||
198 | return activeSession()->currentWorkingDirectory(); | 198 | return activeSession()->currentWorkingDirectory(); | ||
199 | } | 199 | } | ||
200 | 200 | | |||
201 | void Part::createSession(const QString &profileName, const QString &directory) | 201 | void Part::createSession(const QString &profileName, const QString &directory) | ||
202 | { | 202 | { | ||
203 | Profile::Ptr profile = ProfileManager::instance()->defaultProfile(); | 203 | auto profile = profileName.isEmpty() ? | ||
204 | if (!profileName.isEmpty()) { | 204 | ProfileManager::instance()->defaultProfile() : | ||
205 | profile = ProfileManager::instance()->loadProfile(profileName); | 205 | ProfileManager::instance()->loadProfile(profileName); | ||
206 | } | | |||
207 | 206 | | |||
208 | Q_ASSERT(profile); | 207 | Q_ASSERT(profile); | ||
209 | 208 | | |||
210 | Session *session = SessionManager::instance()->createSession(profile); | 209 | const auto initialDir = profile->startInCurrentSessionDir() ? directory : QString(); | ||
211 | 210 | _viewManager->newSession(profile->name(), initialDir, false); | |||
212 | // override the default directory specified in the profile | | |||
213 | if (!directory.isEmpty() && profile->startInCurrentSessionDir()) { | | |||
214 | session->setInitialWorkingDirectory(directory); | | |||
215 | } | | |||
216 | | ||||
217 | _viewManager->createView(session); | | |||
218 | } | 211 | } | ||
219 | 212 | | |||
220 | void Part::activeViewChanged(SessionController *controller) | 213 | void Part::activeViewChanged(SessionController *controller) | ||
221 | { | 214 | { | ||
222 | Q_ASSERT(controller); | 215 | Q_ASSERT(controller); | ||
223 | Q_ASSERT(controller->view()); | 216 | Q_ASSERT(controller->view()); | ||
224 | 217 | | |||
225 | // remove existing controller | 218 | // remove existing controller | ||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |