Changeset View
Changeset View
Standalone View
Standalone View
src/syntax/katehighlightmenu.cpp
Show All 20 Lines | |||||
21 | #include "katehighlightmenu.h" | 21 | #include "katehighlightmenu.h" | ||
22 | 22 | | |||
23 | #include "katedocument.h" | 23 | #include "katedocument.h" | ||
24 | #include "kateconfig.h" | 24 | #include "kateconfig.h" | ||
25 | #include "kateview.h" | 25 | #include "kateview.h" | ||
26 | #include "kateglobal.h" | 26 | #include "kateglobal.h" | ||
27 | #include "katesyntaxmanager.h" | 27 | #include "katesyntaxmanager.h" | ||
28 | #include "katepartdebug.h" | 28 | #include "katepartdebug.h" | ||
29 | #include <KLocalizedString> | ||||
29 | //END Includes | 30 | //END Includes | ||
30 | 31 | | |||
31 | KateHighlightingMenu::~KateHighlightingMenu() | 32 | KateHighlightingMenu::~KateHighlightingMenu() | ||
32 | { | 33 | { | ||
33 | qDeleteAll(subMenus); | 34 | qDeleteAll(subMenus); | ||
34 | } | 35 | } | ||
35 | 36 | | |||
36 | void KateHighlightingMenu::init() | 37 | void KateHighlightingMenu::init() | ||
37 | { | 38 | { | ||
38 | m_doc = nullptr; | 39 | m_doc = nullptr; | ||
39 | 40 | | |||
40 | connect(menu(), SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow())); | 41 | connect(menu(), SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow())); | ||
41 | m_actionGroup = new QActionGroup(menu()); | 42 | m_actionGroup = new QActionGroup(menu()); | ||
42 | } | 43 | } | ||
43 | 44 | | |||
44 | void KateHighlightingMenu::updateMenu(KTextEditor::DocumentPrivate *doc) | 45 | void KateHighlightingMenu::updateMenu(KTextEditor::DocumentPrivate *doc) | ||
45 | { | 46 | { | ||
46 | m_doc = doc; | 47 | m_doc = doc; | ||
47 | } | 48 | } | ||
48 | 49 | | |||
49 | void KateHighlightingMenu::slotAboutToShow() | 50 | void KateHighlightingMenu::slotAboutToShow() | ||
50 | { | 51 | { | ||
51 | for (const auto &hl : KateHlManager::self()->modeList()) { | 52 | for (const auto &hl : KateHlManager::self()->modeList()) { | ||
52 | QString hlName = hl.translatedName(); | 53 | QString hlName = hl.translatedName(); | ||
53 | QString hlSection = hl.section(); | 54 | QString hlSection = hl.translatedSection(); | ||
55 | if (hlName == QLatin1String("None")) | ||||
56 | hlName = i18n("None"); | ||||
54 | 57 | | |||
55 | if (!hl.isHidden()) { | 58 | if (!hl.isHidden()) { | ||
56 | if (!hlSection.isEmpty() && !names.contains(hlName)) { | 59 | if (!hlSection.isEmpty() && !names.contains(hlName)) { | ||
57 | if (!subMenusName.contains(hlSection)) { | 60 | if (!subMenusName.contains(hlSection)) { | ||
58 | subMenusName << hlSection; | 61 | subMenusName << hlSection; | ||
59 | QMenu *qmenu = new QMenu(QLatin1Char('&') + hlSection); | 62 | QMenu *qmenu = new QMenu(QLatin1Char('&') + hlSection); | ||
60 | subMenus.append(qmenu); | 63 | subMenus.append(qmenu); | ||
61 | menu()->addMenu(qmenu); | 64 | menu()->addMenu(qmenu); | ||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |