| 161 | } |
| 162 | |
| 163 | void MainWindowPrivate::mergeView(Sublime::View* view) |
| 164 | { |
| 165 | // If the previous view was KXMLGUIClient, remove its actions |
| 166 | // In the case that that view was removed, lastActiveView |
| 167 | // will auto-reset, and xmlguifactory will disconnect that |
| 168 | // client, I think. |
| 169 | if (lastXMLGUIClientView) |
| 170 | { |
| 171 | qCDebug(SHELL) << "clearing last XML GUI client" << lastXMLGUIClientView; |
| 172 | |
| 173 | m_mainWindow->guiFactory()->removeClient(dynamic_cast<KXMLGUIClient*>(lastXMLGUIClientView)); |
| 174 | |
| 175 | disconnect (lastXMLGUIClientView, &QWidget::destroyed, this, nullptr); |
| 176 | |
| 177 | lastXMLGUIClientView = nullptr; |
| 178 | } |
| 179 | |
| 180 | if (!view) |
| 181 | return; |
| 182 | |
| 183 | QWidget* viewWidget = view->widget(); |
| 184 | Q_ASSERT(viewWidget); |
| 185 | |
| 186 | qCDebug(SHELL) << "changing active view to" << view << "doc" << view->document() << "mw" << m_mainWindow; |
| 187 | |
| 188 | // If the new view is KXMLGUIClient, add it. |
| 189 | if (auto* c = dynamic_cast<KXMLGUIClient*>(viewWidget)) |
| 190 | { |
| 191 | qCDebug(SHELL) << "setting new XMLGUI client" << viewWidget; |
| 192 | lastXMLGUIClientView = viewWidget; |
| 193 | m_mainWindow->guiFactory()->addClient(c); |
| 194 | connect(viewWidget, &QWidget::destroyed, |
| 195 | this, &MainWindowPrivate::xmlguiclientDestroyed); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | void MainWindowPrivate::xmlguiclientDestroyed(QObject* obj) |
| 200 | { |
nothing calls this directly
no test coverage detected