Changeset View
Changeset View
Standalone View
Standalone View
src/Application.cpp
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Line(s) | 163 | { | |||
---|---|---|---|---|---|
170 | connect(window, &Konsole::MainWindow::viewDetached, this, &Konsole::Application::detachView); | 170 | connect(window, &Konsole::MainWindow::viewDetached, this, &Konsole::Application::detachView); | ||
171 | 171 | | |||
172 | return window; | 172 | return window; | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | void Application::createWindow(Profile::Ptr profile, const QString &directory) | 175 | void Application::createWindow(Profile::Ptr profile, const QString &directory) | ||
176 | { | 176 | { | ||
177 | MainWindow *window = newMainWindow(); | 177 | MainWindow *window = newMainWindow(); | ||
178 | window->createSession(profile, directory); | 178 | ViewManager *viewManager = window->viewManager(); | ||
179 | window->createSession(viewManager->activeContainer(), profile, directory); | ||||
179 | finalizeNewMainWindow(window); | 180 | finalizeNewMainWindow(window); | ||
180 | } | 181 | } | ||
181 | 182 | | |||
182 | void Application::detachView(Session *session) | 183 | void Application::detachView(Session *session) | ||
183 | { | 184 | { | ||
184 | MainWindow *window = newMainWindow(); | 185 | MainWindow *window = newMainWindow(); | ||
185 | window->viewManager()->createView(session); | 186 | ViewManager *manager = window->viewManager(); | ||
187 | | ||||
188 | manager->createView(manager->activeContainer(), session); | ||||
186 | 189 | | |||
187 | // When detaching a view, the size of the new window should equal the | 190 | // When detaching a view, the size of the new window should equal the | ||
188 | // size of the source window | 191 | // size of the source window | ||
189 | Session *newsession = window->viewManager()->activeViewController()->session(); | 192 | Session *newsession = manager->activeViewController()->session(); | ||
190 | newsession->setSize(session->size()); | 193 | newsession->setSize(session->size()); | ||
191 | window->adjustSize(); | 194 | window->adjustSize(); | ||
192 | // Since user is dragging and dropping, move dnd window to where | 195 | // Since user is dragging and dropping, move dnd window to where | ||
193 | // the user has the cursor (correct multiple monitor setups). | 196 | // the user has the cursor (correct multiple monitor setups). | ||
194 | window->move(QCursor::pos()); | 197 | window->move(QCursor::pos()); | ||
195 | window->show(); | 198 | window->show(); | ||
196 | } | 199 | } | ||
197 | 200 | | |||
Show All 24 Lines | 202 | { | |||
222 | // select profile to use | 225 | // select profile to use | ||
223 | Profile::Ptr baseProfile = processProfileSelectArgs(); | 226 | Profile::Ptr baseProfile = processProfileSelectArgs(); | ||
224 | 227 | | |||
225 | // process various command-line options which cause a property of the | 228 | // process various command-line options which cause a property of the | ||
226 | // selected profile to be changed | 229 | // selected profile to be changed | ||
227 | Profile::Ptr newProfile = processProfileChangeArgs(baseProfile); | 230 | Profile::Ptr newProfile = processProfileChangeArgs(baseProfile); | ||
228 | 231 | | |||
229 | // create new session | 232 | // create new session | ||
230 | Session *session = window->createSession(newProfile, QString()); | 233 | ViewManager *viewManager = window->viewManager(); | ||
234 | Session *session = window->createSession(viewManager->activeContainer(), newProfile, QString()); | ||||
231 | 235 | | |||
232 | if (m_parser->isSet(QStringLiteral("noclose"))) { | 236 | if (m_parser->isSet(QStringLiteral("noclose"))) { | ||
233 | session->setAutoClose(false); | 237 | session->setAutoClose(false); | ||
234 | } | 238 | } | ||
235 | 239 | | |||
236 | // if the background-mode argument is supplied, start the background | 240 | // if the background-mode argument is supplied, start the background | ||
237 | // session ( or bring to the front if it already exists ) | 241 | // session ( or bring to the front if it already exists ) | ||
238 | if (m_parser->isSet(QStringLiteral("background-mode"))) { | 242 | if (m_parser->isSet(QStringLiteral("background-mode"))) { | ||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 335 | { | |||
369 | 373 | | |||
370 | if (!workdir.isEmpty()) { | 374 | if (!workdir.isEmpty()) { | ||
371 | newProfile->setProperty(Profile::Directory, workdir); | 375 | newProfile->setProperty(Profile::Directory, workdir); | ||
372 | shouldUseNewProfile = true; | 376 | shouldUseNewProfile = true; | ||
373 | } | 377 | } | ||
374 | 378 | | |||
375 | // Create the new session | 379 | // Create the new session | ||
376 | Profile::Ptr theProfile = shouldUseNewProfile ? newProfile : baseProfile; | 380 | Profile::Ptr theProfile = shouldUseNewProfile ? newProfile : baseProfile; | ||
377 | Session *session = window->createSession(theProfile, QString()); | 381 | ViewManager *viewManager = window->viewManager(); | ||
382 | Session *session = window->createSession(viewManager->activeContainer(), theProfile, QString()); | ||||
378 | 383 | | |||
379 | if (m_parser->isSet(QStringLiteral("noclose"))) { | 384 | if (m_parser->isSet(QStringLiteral("noclose"))) { | ||
380 | session->setAutoClose(false); | 385 | session->setAutoClose(false); | ||
381 | } | 386 | } | ||
382 | 387 | | |||
383 | if (!window->testAttribute(Qt::WA_Resized)) { | 388 | if (!window->testAttribute(Qt::WA_Resized)) { | ||
384 | window->resize(window->sizeHint()); | 389 | window->resize(window->sizeHint()); | ||
385 | } | 390 | } | ||
▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines |