Commit 753f8b5f authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Urlbar: Allow configuring whether to show symbols

Not everyone wants it.
parent c8bbdfd6
Pipeline #256377 failed with stage
in 11 minutes and 11 seconds
......@@ -537,6 +537,16 @@ void KateConfigDialog::addBehaviorPage()
m_diffStyle->setCurrentIndex(cgGeneral.readEntry("Diff Show Style", 0));
connect(m_diffStyle, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &KateConfigDialog::slotChanged);
buttonGroup = new QGroupBox(i18n("Navigation Bar"), generalFrame);
vbox = new QVBoxLayout(buttonGroup);
hlayout = new QHBoxLayout;
vbox->addLayout(hlayout);
layout->addWidget(buttonGroup);
m_urlBarShowSymbols = new QCheckBox(i18n("Show current symbol in navigation bar"));
hlayout->addWidget(m_urlBarShowSymbols);
m_urlBarShowSymbols->setChecked(cgGeneral.readEntry("Show Symbol In Navigation Bar", true));
connect(m_urlBarShowSymbols, &QCheckBox::toggled, this, &KateConfigDialog::slotChanged);
layout->addStretch(1); // :-] works correct without autoadd
}
......@@ -794,6 +804,8 @@ void KateConfigDialog::slotApply()
cg.writeEntry("Diff Show Style", m_diffStyle->currentIndex());
cg.writeEntry("Show Symbol In Navigation Bar", m_urlBarShowSymbols->isChecked());
// patch document modified warn state
const QList<KTextEditor::Document *> &docs = KateApp::self()->documentManager()->documentList();
for (KTextEditor::Document *doc : docs) {
......
......@@ -119,6 +119,7 @@ private:
QCheckBox *m_tabsScrollable = nullptr;
QCheckBox *m_tabsElided = nullptr;
QComboBox *m_diffStyle = nullptr;
QCheckBox *m_urlBarShowSymbols = nullptr;
Ui::SessionConfigWidget sessionConfigUi;
......
......@@ -573,6 +573,17 @@ public:
connect(qApp, &QApplication::paletteChanged, this, &BreadCrumbView::updatePalette, Qt::QueuedConnection);
updatePalette();
auto onConfigChanged = [this] {
KConfigGroup cg(KSharedConfig::openConfig(), "General");
auto v = cg.readEntry("Show Symbol In Navigation Bar", true);
if (v != m_showSymbolCrumb) {
m_showSymbolCrumb = v;
Q_EMIT requestRefresh();
}
};
connect(KateApp::self(), &KateApp::configurationChanged, this, onConfigChanged);
onConfigChanged();
connect(this, &QListView::clicked, this, &BreadCrumbView::onClicked);
}
......@@ -619,6 +630,10 @@ public:
i++;
}
if (!m_showSymbolCrumb) {
return;
}
auto *mainWindow = m_urlBar->viewManager()->mainWindow();
QPointer<QObject> lsp = mainWindow->pluginView(QStringLiteral("lspclientplugin"));
if (lsp) {
......@@ -946,9 +961,11 @@ private:
QPointer<QAbstractItemModel> m_symbolsModel;
QMetaObject::Connection m_connToView; // Only one conn at a time
bool m_isNavigating = false;
bool m_showSymbolCrumb = true;
Q_SIGNALS:
void unsetFocus();
void requestRefresh();
};
// TODO: Merge this class back into KateUrlBar
......@@ -995,6 +1012,13 @@ public:
connect(m_mainCrumbView, &BreadCrumbView::unsetFocus, this, [this] {
m_urlBar->viewManager()->activeView()->setFocus();
});
connect(m_mainCrumbView, &BreadCrumbView::requestRefresh, this, [this] {
auto vs = m_urlBar->viewSpace();
auto view = vs->currentView();
if (vs && view) {
setUrl(view->document());
}
});
connect(
qApp,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment