Changeset View
Changeset View
Standalone View
Standalone View
components/shellprivate/interactiveconsole/interactiveconsole.cpp
Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 78 | { | |||
---|---|---|---|---|---|
124 | toolBar->addAction(m_plasmaAction); | 124 | toolBar->addAction(m_plasmaAction); | ||
125 | toolBar->addAction(m_kwinAction); | 125 | toolBar->addAction(m_kwinAction); | ||
126 | toolBar->addWidget(loadTemplateButton); | 126 | toolBar->addWidget(loadTemplateButton); | ||
127 | toolBar->addWidget(useTemplateButton); | 127 | toolBar->addWidget(useTemplateButton); | ||
128 | 128 | | |||
129 | editorLayout->addWidget(toolBar); | 129 | editorLayout->addWidget(toolBar); | ||
130 | 130 | | |||
131 | const KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KTextEditor/Document")); | 131 | const KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KTextEditor/Document")); | ||
132 | foreach (const KService::Ptr &service, offers) { | 132 | for (const KService::Ptr &service : offers) { | ||
133 | m_editorPart = service->createInstance<KTextEditor::Document>(widget); | 133 | m_editorPart = service->createInstance<KTextEditor::Document>(widget); | ||
134 | if (m_editorPart) { | 134 | if (m_editorPart) { | ||
135 | m_editorPart->setHighlightingMode(QStringLiteral("JavaScript/PlasmaDesktop")); | 135 | m_editorPart->setHighlightingMode(QStringLiteral("JavaScript/PlasmaDesktop")); | ||
136 | 136 | | |||
137 | KTextEditor::View * view = m_editorPart->createView(widget); | 137 | KTextEditor::View * view = m_editorPart->createView(widget); | ||
138 | view->setContextMenu(view->defaultContextMenu()); | 138 | view->setContextMenu(view->defaultContextMenu()); | ||
139 | 139 | | |||
140 | KTextEditor::ConfigInterface *config = qobject_cast<KTextEditor::ConfigInterface*>(view); | 140 | KTextEditor::ConfigInterface *config = qobject_cast<KTextEditor::ConfigInterface*>(view); | ||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Line(s) | |||||
368 | 368 | | |||
369 | void InteractiveConsole::populateTemplatesMenu() | 369 | void InteractiveConsole::populateTemplatesMenu() | ||
370 | { | 370 | { | ||
371 | m_snippetsMenu->clear(); | 371 | m_snippetsMenu->clear(); | ||
372 | 372 | | |||
373 | QMap<QString, KService::Ptr> sorted; | 373 | QMap<QString, KService::Ptr> sorted; | ||
374 | const QString constraint = QStringLiteral("[X-Plasma-Shell] == '%1'") | 374 | const QString constraint = QStringLiteral("[X-Plasma-Shell] == '%1'") | ||
375 | .arg(qApp->applicationName()); | 375 | .arg(qApp->applicationName()); | ||
376 | KService::List templates = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/LayoutTemplate"), constraint); | 376 | const KService::List templates = KServiceTypeTrader::self()->query(QStringLiteral("Plasma/LayoutTemplate"), constraint); | ||
377 | foreach (const KService::Ptr &service, templates) { | 377 | for (const KService::Ptr &service : templates) { | ||
378 | sorted.insert(service->name(), service); | 378 | sorted.insert(service->name(), service); | ||
379 | } | 379 | } | ||
380 | 380 | | |||
381 | QMapIterator<QString, KService::Ptr> it(sorted); | 381 | QMapIterator<QString, KService::Ptr> it(sorted); | ||
382 | 382 | | |||
383 | KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LayoutTemplate")); | 383 | KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LayoutTemplate")); | ||
384 | 384 | | |||
385 | while (it.hasNext()) { | 385 | while (it.hasNext()) { | ||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |