Changeset View
Changeset View
Standalone View
Standalone View
addons/kate-ctags/kate_ctags_view.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 43 | { | |||
---|---|---|---|---|---|
58 | decl->setText(i18n("Go to Declaration")); | 58 | decl->setText(i18n("Go to Declaration")); | ||
59 | connect(decl, &QAction::triggered, this, &KateCTagsView::gotoDeclaration); | 59 | connect(decl, &QAction::triggered, this, &KateCTagsView::gotoDeclaration); | ||
60 | 60 | | |||
61 | QAction *defin = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_definition")); | 61 | QAction *defin = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_definition")); | ||
62 | defin->setText(i18n("Go to Definition")); | 62 | defin->setText(i18n("Go to Definition")); | ||
63 | connect(defin, &QAction::triggered, this, &KateCTagsView::gotoDefinition); | 63 | connect(defin, &QAction::triggered, this, &KateCTagsView::gotoDefinition); | ||
64 | 64 | | |||
65 | QAction *lookup = actionCollection()->addAction(QLatin1String("ctags_lookup_current")); | 65 | QAction *lookup = actionCollection()->addAction(QLatin1String("ctags_lookup_current")); | ||
66 | lookup->setText(i18n("Lookup Current Text")); | 66 | lookup->setText(i18n("Lookup Selected Text")); | ||
ngraham: While you're touching this user-facing string, let's fix the grammar for all the places where… | |||||
This change is not entirely correct as you do not need to select any text. You can look up the word containing the text cursor. That is why it says "current" and not "selected" text. I would suggest "Look Up Current Text" sars: This change is not entirely correct as you do not need to select any text. You can look up the… | |||||
67 | connect(lookup, &QAction::triggered, this, &KateCTagsView::lookupTag); | 67 | connect(lookup, &QAction::triggered, this, &KateCTagsView::lookupTag); | ||
68 | 68 | | |||
69 | // popup menu | 69 | // context menu (same actions as above but with prefix in item title) | ||
70 | m_menu = new KActionMenu(i18n("CTags"), this); | 70 | decl = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_declaration_popup")); | ||
71 | actionCollection()->addAction(QLatin1String("popup_ctags"), m_menu); | 71 | decl->setText(i18n("CTags: Go to Declaration")); | ||
72 | 72 | connect(decl, &QAction::triggered, this, &KateCTagsView::gotoDeclaration); | |||
73 | m_gotoDec=m_menu->menu()->addAction(i18n("Go to Declaration: %1",QString()), this, SLOT(gotoDeclaration())); | 73 | defin = actionCollection()->addAction(QLatin1String("ctags_lookup_current_as_definition_popup")); | ||
74 | m_gotoDef=m_menu->menu()->addAction(i18n("Go to Definition: %1",QString()), this, SLOT(gotoDefinition())); | 74 | defin->setText(i18n("CTags: Go to Definition")); | ||
75 | m_lookup=m_menu->menu()->addAction(i18n("Lookup: %1",QString()), this, SLOT(lookupTag())); | 75 | connect(defin, &QAction::triggered, this, &KateCTagsView::gotoDefinition); | ||
76 | 76 | lookup = actionCollection()->addAction(QLatin1String("ctags_lookup_current_popup")); | |||
77 | connect(m_menu->menu(), &QMenu::aboutToShow, this, &KateCTagsView::aboutToShow); | 77 | lookup->setText(i18n("CTags: Lookup Selected Text")); | ||
78 | connect(lookup, &QAction::triggered, this, &KateCTagsView::lookupTag); | ||||
78 | 79 | | |||
79 | QWidget *ctagsWidget = new QWidget(m_toolView); | 80 | QWidget *ctagsWidget = new QWidget(m_toolView); | ||
80 | m_ctagsUi.setupUi(ctagsWidget); | 81 | m_ctagsUi.setupUi(ctagsWidget); | ||
81 | m_ctagsUi.cmdEdit->setText(DEFAULT_CTAGS_CMD); | 82 | m_ctagsUi.cmdEdit->setText(DEFAULT_CTAGS_CMD); | ||
82 | 83 | | |||
83 | m_ctagsUi.addButton->setToolTip(i18n("Add a directory to index.")); | 84 | m_ctagsUi.addButton->setToolTip(i18n("Add a directory to index.")); | ||
84 | m_ctagsUi.addButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); | 85 | m_ctagsUi.addButton->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); | ||
85 | 86 | | |||
Show All 40 Lines | |||||
126 | KateCTagsView::~KateCTagsView() | 127 | KateCTagsView::~KateCTagsView() | ||
127 | { | 128 | { | ||
128 | m_mWin->guiFactory()->removeClient( this ); | 129 | m_mWin->guiFactory()->removeClient( this ); | ||
129 | 130 | | |||
130 | delete m_toolView; | 131 | delete m_toolView; | ||
131 | } | 132 | } | ||
132 | 133 | | |||
133 | /******************************************************************/ | 134 | /******************************************************************/ | ||
134 | void KateCTagsView::aboutToShow() | | |||
135 | { | | |||
136 | QString currWord = currentWord(); | | |||
137 | if (currWord.isEmpty()) { | | |||
138 | return; | | |||
139 | } | | |||
140 | | ||||
141 | if (Tags::hasTag(m_commonDB, currWord) || Tags::hasTag(m_ctagsUi.tagsFile->text(), currWord)) { | | |||
142 | QString squeezed = KStringHandler::csqueeze(currWord, 30); | | |||
143 | | ||||
144 | m_gotoDec->setText(i18n("Go to Declaration: %1",squeezed)); | | |||
145 | m_gotoDef->setText(i18n("Go to Definition: %1",squeezed)); | | |||
146 | m_lookup->setText(i18n("Lookup: %1",squeezed)); | | |||
147 | } | | |||
148 | } | | |||
149 | | ||||
150 | | ||||
151 | /******************************************************************/ | | |||
152 | void KateCTagsView::readSessionConfig (const KConfigGroup& cg) | 135 | void KateCTagsView::readSessionConfig (const KConfigGroup& cg) | ||
153 | { | 136 | { | ||
154 | m_ctagsUi.cmdEdit->setText(cg.readEntry("TagsGenCMD", DEFAULT_CTAGS_CMD)); | 137 | m_ctagsUi.cmdEdit->setText(cg.readEntry("TagsGenCMD", DEFAULT_CTAGS_CMD)); | ||
155 | 138 | | |||
156 | int numEntries = cg.readEntry("SessionNumTargets", 0); | 139 | int numEntries = cg.readEntry("SessionNumTargets", 0); | ||
157 | QString nr; | 140 | QString nr; | ||
158 | QString target; | 141 | QString target; | ||
159 | for (int i=0; i<numEntries; i++) { | 142 | for (int i=0; i<numEntries; i++) { | ||
▲ Show 20 Lines • Show All 455 Lines • Show Last 20 Lines |
While you're touching this user-facing string, let's fix the grammar for all the places where it's currently wrong, because "lookup" is a noun, not a verb.
Lookup Selected Text -> Look Up Selected Text