| 161 | } |
| 162 | |
| 163 | KParts::Part* PartController::createPart( const QUrl & url, const QString& preferredPart ) |
| 164 | { |
| 165 | if (!url.isValid()) { |
| 166 | return nullptr; |
| 167 | } |
| 168 | |
| 169 | qCDebug(SHELL) << "creating part with url" << url << "and pref part:" << preferredPart; |
| 170 | KParts::Part* part = createPart(mimeTypeForUrl(url), preferredPart); |
| 171 | if (!part) { |
| 172 | return nullptr; |
| 173 | } |
| 174 | |
| 175 | // only ReadOnlyParts are supported by PartController |
| 176 | static_cast<KParts::ReadOnlyPart*>(part)->openUrl(url); |
| 177 | |
| 178 | // restrict keyboard shortcuts to the KParts view |
| 179 | const auto actions = part->actionCollection()->actions(); |
| 180 | for (auto* action : actions) { |
| 181 | if (action->shortcutContext() != Qt::WidgetShortcut) { |
| 182 | action->setShortcutContext(Qt::WidgetWithChildrenShortcut); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | return part; |
| 187 | } |
| 188 | |
| 189 | void PartController::loadSettings( bool projectIsLoaded ) |
| 190 | { |
no test coverage detected