Changeset View
Changeset View
Standalone View
Standalone View
src/view/katestatusbar.cpp
Show All 19 Lines | |||||
20 | 20 | | |||
21 | #include "katestatusbar.h" | 21 | #include "katestatusbar.h" | ||
22 | 22 | | |||
23 | #include "kateabstractinputmode.h" | 23 | #include "kateabstractinputmode.h" | ||
24 | #include "kateconfig.h" | 24 | #include "kateconfig.h" | ||
25 | #include "katedocument.h" | 25 | #include "katedocument.h" | ||
26 | #include "kateglobal.h" | 26 | #include "kateglobal.h" | ||
27 | #include "katemodemanager.h" | 27 | #include "katemodemanager.h" | ||
28 | #include "katemodemenulist.h" | | |||
29 | #include "wordcounter.h" | 28 | #include "wordcounter.h" | ||
30 | 29 | | |||
31 | #include <KAcceleratorManager> | 30 | #include <KAcceleratorManager> | ||
32 | #include <KActionCollection> | 31 | #include <KActionCollection> | ||
33 | #include <KIconUtils> | 32 | #include <KIconUtils> | ||
34 | #include <KLocalizedString> | 33 | #include <KLocalizedString> | ||
35 | #include <Sonnet/Speller> | 34 | #include <Sonnet/Speller> | ||
36 | 35 | | |||
▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Line(s) | 83 | { | |||
192 | topLayout->addWidget(m_encoding); | 191 | topLayout->addWidget(m_encoding); | ||
193 | m_encoding->setMenu(m_view->encodingAction()->menu()); | 192 | m_encoding->setMenu(m_view->encodingAction()->menu()); | ||
194 | m_encoding->setWhatsThis(i18n("Encoding")); | 193 | m_encoding->setWhatsThis(i18n("Encoding")); | ||
195 | 194 | | |||
196 | /** | 195 | /** | ||
197 | * load the mode menu, which contains a scrollable list + search bar. | 196 | * load the mode menu, which contains a scrollable list + search bar. | ||
198 | * This is an alternative menu to the mode action menu of the view. | 197 | * This is an alternative menu to the mode action menu of the view. | ||
199 | */ | 198 | */ | ||
200 | KateModeMenuList *modeMenuList = new KateModeMenuList(i18n("Mode"), this); | 199 | m_modeMenuList = new KateModeMenuList(i18n("Mode"), this); | ||
201 | modeMenuList->setWhatsThis(i18n("Here you can choose which mode should be used for the current document. This will influence the highlighting and folding being used, for example.")); | 200 | m_modeMenuList->setWhatsThis(i18n("Here you can choose which mode should be used for the current document. This will influence the highlighting and folding being used, for example.")); | ||
202 | modeMenuList->updateMenu(m_view->doc()); | 201 | m_modeMenuList->updateMenu(m_view->doc()); | ||
203 | /** | 202 | /** | ||
204 | * add mode button which allows user to switch mode of document | 203 | * add mode button which allows user to switch mode of document | ||
205 | */ | 204 | */ | ||
206 | m_mode = new StatusBarButton(this); | 205 | m_mode = new StatusBarButton(this); | ||
207 | topLayout->addWidget(m_mode); | 206 | topLayout->addWidget(m_mode); | ||
208 | modeMenuList->setButton(m_mode, KateModeMenuList::AlignHInverse, KateModeMenuList::AlignTop, KateModeMenuList::AutoUpdateTextButton(false)); | 207 | m_modeMenuList->setButton(m_mode, KateModeMenuList::AlignHInverse, KateModeMenuList::AlignTop, KateModeMenuList::AutoUpdateTextButton(false)); | ||
209 | m_mode->setMenu(modeMenuList); | 208 | m_mode->setMenu(m_modeMenuList); | ||
210 | m_mode->setWhatsThis(i18n("Syntax highlighting")); | 209 | m_mode->setWhatsThis(i18n("Syntax highlighting")); | ||
211 | 210 | | |||
212 | // signals for the statusbar | 211 | // signals for the statusbar | ||
213 | connect(m_view, &KTextEditor::View::cursorPositionChanged, this, &KateStatusBar::cursorPositionChanged); | 212 | connect(m_view, &KTextEditor::View::cursorPositionChanged, this, &KateStatusBar::cursorPositionChanged); | ||
214 | connect(m_view, &KTextEditor::View::viewModeChanged, this, &KateStatusBar::viewModeChanged); | 213 | connect(m_view, &KTextEditor::View::viewModeChanged, this, &KateStatusBar::viewModeChanged); | ||
215 | connect(m_view, &KTextEditor::View::selectionChanged, this, &KateStatusBar::selectionChanged); | 214 | connect(m_view, &KTextEditor::View::selectionChanged, this, &KateStatusBar::selectionChanged); | ||
216 | connect(m_view->document(), &KTextEditor::DocumentPrivate::modifiedChanged, this, &KateStatusBar::modifiedChanged); | 215 | connect(m_view->document(), &KTextEditor::DocumentPrivate::modifiedChanged, this, &KateStatusBar::modifiedChanged); | ||
217 | connect(m_view->doc(), &KTextEditor::DocumentPrivate::modifiedOnDisk, this, &KateStatusBar::modifiedChanged); | 216 | connect(m_view->doc(), &KTextEditor::DocumentPrivate::modifiedOnDisk, this, &KateStatusBar::modifiedChanged); | ||
▲ Show 20 Lines • Show All 363 Lines • ▼ Show 20 Line(s) | 577 | { | |||
581 | // Code stolen from KateDictionaryBar::dictionaryChanged | 580 | // Code stolen from KateDictionaryBar::dictionaryChanged | ||
582 | KTextEditor::Range selection = m_view->selectionRange(); | 581 | KTextEditor::Range selection = m_view->selectionRange(); | ||
583 | if (selection.isValid() && !selection.isEmpty()) { | 582 | if (selection.isValid() && !selection.isEmpty()) { | ||
584 | m_view->doc()->setDictionary(dictionary, selection); | 583 | m_view->doc()->setDictionary(dictionary, selection); | ||
585 | } else { | 584 | } else { | ||
586 | m_view->doc()->setDefaultDictionary(dictionary); | 585 | m_view->doc()->setDefaultDictionary(dictionary); | ||
587 | } | 586 | } | ||
588 | } | 587 | } | ||
588 | | ||||
589 | KateModeMenuList *KateStatusBar::modeMenu() const | ||||
590 | { | ||||
591 | return m_modeMenuList; | ||||
592 | } |