| 165 | } |
| 166 | |
| 167 | ContextBrowserView::ContextBrowserView(ContextBrowserPlugin* plugin, QWidget* parent) : QWidget(parent) |
| 168 | , m_plugin(plugin) |
| 169 | , m_navigationWidget(new QTextBrowser()) |
| 170 | , m_autoLocked(false) |
| 171 | { |
| 172 | setWindowTitle(i18nc("@title:window", "Code Browser")); |
| 173 | setWindowIcon(QIcon::fromTheme(QStringLiteral("code-context"), windowIcon())); |
| 174 | |
| 175 | m_allowLockedUpdate = false; |
| 176 | |
| 177 | m_declarationMenuAction = new QAction(QIcon::fromTheme(QStringLiteral("code-class")), QString(), this); |
| 178 | m_declarationMenuAction->setToolTip(i18nc("@info:tooltip", "Show declaration menu")); |
| 179 | // expose the declaration menu via the context menu; allows hiding the toolbar to save some space |
| 180 | // (this will not make it behave like a submenu though) |
| 181 | m_declarationMenuAction->setText(i18nc("@action", "Declaration Menu")); |
| 182 | connect(m_declarationMenuAction, &QAction::triggered, this, &ContextBrowserView::declarationMenu); |
| 183 | addAction(m_declarationMenuAction); |
| 184 | m_lockAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("object-unlocked")), |
| 185 | i18nc("@action", "Lock Current View"), this); |
| 186 | m_lockAction->setToolTip(i18nc("@info:tooltip", "Lock current view")); |
| 187 | m_lockAction->setCheckedState(KGuiItem(i18nc("@action", "Unlock Current View"), |
| 188 | QIcon::fromTheme(QStringLiteral("object-locked")), |
| 189 | i18nc("@info:tooltip", "Unlock current view"))); |
| 190 | m_lockAction->setChecked(false); |
| 191 | addAction(m_lockAction); |
| 192 | |
| 193 | m_layout = new QVBoxLayout; |
| 194 | m_layout->setSpacing(0); |
| 195 | m_layout->setContentsMargins(0, 0, 0, 0); |
| 196 | m_layout->addWidget(m_navigationWidget); |
| 197 | //m_layout->addStretch(); |
| 198 | setLayout(m_layout); |
| 199 | |
| 200 | m_plugin->registerToolView(this); |
| 201 | } |
| 202 | |
| 203 | ContextBrowserView::~ContextBrowserView() |
| 204 | { |
nothing calls this directly
no test coverage detected