| 240 | } |
| 241 | |
| 242 | void UiController::switchToArea(const QString &areaName, SwitchMode switchMode) |
| 243 | { |
| 244 | if (switchMode == ThisWindow) { |
| 245 | showArea(areaName, activeSublimeWindow()); |
| 246 | return; |
| 247 | } |
| 248 | |
| 249 | // TODO: non-primary main windows probably need separate settings and state. Therefore, their |
| 250 | // config group keys should include some main window identifier. The configGroupName() |
| 251 | // function defined in sublime/mainwindow.cpp will have to be adapted for this purpose. |
| 252 | // The main window identification can be similar to the existing one in UiController::saveAllAreas(). |
| 253 | // TODO: move UiControllerPrivate::activeActionListener and its management into MainWindow so that each |
| 254 | // main window tracks its own active action listener, and the actions "Jump to Next Outputmark" and |
| 255 | // "Jump to Previous Outputmark" are applied to the active main window's active action listener. |
| 256 | auto *main = new MainWindow(this); |
| 257 | |
| 258 | addMainWindow(main); |
| 259 | // TODO: consider reordering the following two lines - showArea(areaName, main) |
| 260 | // and main->initialize() - in order to let the new main window load settings. |
| 261 | // See the comment about initialization in KDevelop::MainWindow::loadSettings(). |
| 262 | showArea(areaName, main); |
| 263 | main->initialize(); |
| 264 | |
| 265 | // WTF? First, enabling this code causes crashes since we |
| 266 | // try to disconnect some already-deleted action, or something. |
| 267 | // Second, this code will disconnection the clients from guiFactory |
| 268 | // of the previous main window. Ick! |
| 269 | #if 0 |
| 270 | //we need to add all existing guiclients to the new mainwindow |
| 271 | //@todo adymo: add only ones that belong to the area (when the area code is there) |
| 272 | const auto clients = oldMain->guiFactory()->clients(); |
| 273 | for (KXMLGUIClient *client : clients) { |
| 274 | main->guiFactory()->addClient(client); |
| 275 | } |
| 276 | #endif |
| 277 | |
| 278 | main->show(); |
| 279 | } |
| 280 | |
| 281 | Sublime::Area* UiController::restoredActiveArea() |
| 282 | { |