KConfig

kstandardshortcut.cpp
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 1997 Stefan Taferner <[email protected]>
4  SPDX-FileCopyrightText: 2000 Nicolas Hadacek <[email protected]>
5  SPDX-FileCopyrightText: 2001, 2002 Ellis Whitehead <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-only
8 */
9 
10 #include "kstandardshortcut.h"
11 
12 #include "kconfig.h"
13 #include "ksharedconfig.h"
14 #include <kconfiggroup.h>
15 
16 #include <QCoreApplication>
17 #include <QDebug>
18 #include <QKeySequence>
19 
21 {
22 
23 struct KStandardShortcutInfo {
26 
32  const char *name;
33 
35  struct { const char *text; const char *context; } description;
36 
38  int cutDefault, cutDefault2;
39 
42 
44  bool isInitialized;
45 };
46 
47 #define CTRL(x) Qt::CTRL+Qt::Key_##x
48 #define SHIFT(x) Qt::SHIFT+Qt::Key_##x
49 #define CTRLSHIFT(x) Qt::CTRL+Qt::SHIFT+Qt::Key_##x
50 #define ALT(x) Qt::ALT+Qt::Key_##x
51 #define ALTSHIFT(x) Qt::ALT+Qt::SHIFT+Qt::Key_##x
52 
57 // STUFF WILL BREAK IF YOU DON'T READ THIS!!!
58 // Read the comments of the big enum in kstandardshortcut.h before you change anything!
59 static KStandardShortcutInfo g_infoStandardShortcut[] = {
60 //Group File,
61  { AccelNone, nullptr, {nullptr, nullptr}, 0, 0, QList<QKeySequence>(), false },
62  { Open, "Open", QT_TRANSLATE_NOOP3("KStandardShortcut", "Open", "@action"), CTRL(O), 0, QList<QKeySequence>(), false },
63  { New, "New", QT_TRANSLATE_NOOP3("KStandardShortcut", "New", "@action"), CTRL(N), 0, QList<QKeySequence>(), false },
64  { Close, "Close", QT_TRANSLATE_NOOP3("KStandardShortcut", "Close", "@action"), CTRL(W), CTRL(Escape), QList<QKeySequence>(), false },
65  { Save, "Save", QT_TRANSLATE_NOOP3("KStandardShortcut", "Save", "@action"), CTRL(S), 0, QList<QKeySequence>(), false },
66  { Print, "Print", QT_TRANSLATE_NOOP3("KStandardShortcut", "Print", "@action"), CTRL(P), 0, QList<QKeySequence>(), false },
67  { Quit, "Quit", QT_TRANSLATE_NOOP3("KStandardShortcut", "Quit", "@action"), CTRL(Q), 0, QList<QKeySequence>(), false },
68 
69 //Group Edit
70  { Undo, "Undo", QT_TRANSLATE_NOOP3("KStandardShortcut", "Undo", "@action"), CTRL(Z), 0, QList<QKeySequence>(), false },
71  { Redo, "Redo", QT_TRANSLATE_NOOP3("KStandardShortcut", "Redo", "@action"), CTRLSHIFT(Z), 0, QList<QKeySequence>(), false },
72  // Both "Cut" and "Delete" use Shift+Delete, but this is okay; see
73  // https://commits.kde.org/kxmlgui/8eabbf6725386e716b7536c71a9181dfe5d959f0
74  { Cut, "Cut", QT_TRANSLATE_NOOP3("KStandardShortcut", "Cut", "@action"), CTRL(X), SHIFT(Delete), QList<QKeySequence>(), false },
75  { Copy, "Copy", QT_TRANSLATE_NOOP3("KStandardShortcut", "Copy", "@action"), CTRL(C), CTRL(Insert), QList<QKeySequence>(), false },
76  { Paste, "Paste", QT_TRANSLATE_NOOP3("KStandardShortcut", "Paste", "@action"), CTRL(V), SHIFT(Insert), QList<QKeySequence>(), false },
77  { PasteSelection, "Paste Selection", QT_TRANSLATE_NOOP3("KStandardShortcut", "Paste Selection", "@action"), CTRLSHIFT(Insert), 0, QList<QKeySequence>(), false },
78 
79  { SelectAll, "SelectAll", QT_TRANSLATE_NOOP3("KStandardShortcut", "Select All", "@action"), CTRL(A), 0, QList<QKeySequence>(), false },
80  { Deselect, "Deselect", QT_TRANSLATE_NOOP3("KStandardShortcut", "Deselect", "@action"), CTRLSHIFT(A), 0, QList<QKeySequence>(), false },
81  { DeleteWordBack, "DeleteWordBack", QT_TRANSLATE_NOOP3("KStandardShortcut", "Delete Word Backwards", "@action"), CTRL(Backspace), 0, QList<QKeySequence>(), false },
82  { DeleteWordForward, "DeleteWordForward", QT_TRANSLATE_NOOP3("KStandardShortcut", "Delete Word Forward", "@action"), CTRL(Delete), 0, QList<QKeySequence>(), false },
83 
84  { Find, "Find", QT_TRANSLATE_NOOP3("KStandardShortcut", "Find", "@action"), CTRL(F), 0, QList<QKeySequence>(), false },
85  { FindNext, "FindNext", QT_TRANSLATE_NOOP3("KStandardShortcut", "Find Next", "@action"), Qt::Key_F3, 0, QList<QKeySequence>(), false },
86  { FindPrev, "FindPrev", QT_TRANSLATE_NOOP3("KStandardShortcut", "Find Prev", "@action"), SHIFT(F3), 0, QList<QKeySequence>(), false },
87  { Replace, "Replace", QT_TRANSLATE_NOOP3("KStandardShortcut", "Replace", "@action"), CTRL(R), 0, QList<QKeySequence>(), false },
88 
89 //Group Navigation
90  { Home, "Home", QT_TRANSLATE_NOOP3("KStandardShortcut", "Home", "@action Go to main page"), ALT(Home), Qt::Key_HomePage, QList<QKeySequence>(), false },
91  { Begin, "Begin", QT_TRANSLATE_NOOP3("KStandardShortcut", "Begin", "@action Beginning of document"), CTRL(Home), 0, QList<QKeySequence>(), false },
92  { End, "End", QT_TRANSLATE_NOOP3("KStandardShortcut", "End", "@action End of document"), CTRL(End), 0, QList<QKeySequence>(), false },
93  { Prior, "Prior", QT_TRANSLATE_NOOP3("KStandardShortcut", "Prior", "@action"), Qt::Key_PageUp, 0, QList<QKeySequence>(), false },
94  { Next, "Next", QT_TRANSLATE_NOOP3("KStandardShortcut", "Next", "@action Opposite to Prior"), Qt::Key_PageDown, 0, QList<QKeySequence>(), false },
95 
96  { Up, "Up", QT_TRANSLATE_NOOP3("KStandardShortcut", "Up", "@action"), ALT(Up), 0, QList<QKeySequence>(), false },
97  { Back, "Back", QT_TRANSLATE_NOOP3("KStandardShortcut", "Back", "@action"), ALT(Left), Qt::Key_Back, QList<QKeySequence>(), false },
98  { Forward, "Forward", QT_TRANSLATE_NOOP3("KStandardShortcut", "Forward", "@action"), ALT(Right), Qt::Key_Forward, QList<QKeySequence>(), false },
99  { Reload, "Reload", QT_TRANSLATE_NOOP3("KStandardShortcut", "Reload", "@action"), Qt::Key_F5, Qt::Key_Refresh, QList<QKeySequence>(), false },
100 
101  { BeginningOfLine, "BeginningOfLine", QT_TRANSLATE_NOOP3("KStandardShortcut", "Beginning of Line", "@action"), Qt::Key_Home, 0, QList<QKeySequence>(), false },
102  { EndOfLine, "EndOfLine", QT_TRANSLATE_NOOP3("KStandardShortcut", "End of Line", "@action"), Qt::Key_End, 0, QList<QKeySequence>(), false },
103  { GotoLine, "GotoLine", QT_TRANSLATE_NOOP3("KStandardShortcut", "Go to Line", "@action"), CTRL(G), 0, QList<QKeySequence>(), false },
104  { BackwardWord, "BackwardWord", QT_TRANSLATE_NOOP3("KStandardShortcut", "Backward Word", "@action"), CTRL(Left), 0, QList<QKeySequence>(), false },
105  { ForwardWord, "ForwardWord", QT_TRANSLATE_NOOP3("KStandardShortcut", "Forward Word", "@action"), CTRL(Right), 0, QList<QKeySequence>(), false },
106 
107  { AddBookmark, "AddBookmark", QT_TRANSLATE_NOOP3("KStandardShortcut", "Add Bookmark", "@action"), CTRL(B), 0, QList<QKeySequence>(), false },
108  { ZoomIn, "ZoomIn", QT_TRANSLATE_NOOP3("KStandardShortcut", "Zoom In", "@action"), CTRL(Plus), CTRL(Equal), QList<QKeySequence>(), false },
109  { ZoomOut, "ZoomOut", QT_TRANSLATE_NOOP3("KStandardShortcut", "Zoom Out", "@action"), CTRL(Minus), 0, QList<QKeySequence>(), false },
110  { FullScreen, "FullScreen", QT_TRANSLATE_NOOP3("KStandardShortcut", "Full Screen Mode", "@action"), CTRLSHIFT(F), 0, QList<QKeySequence>(), false },
111 
112  { ShowMenubar, "ShowMenubar", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show Menu Bar", "@action"), CTRL(M), 0, QList<QKeySequence>(), false },
113  { TabNext, "Activate Next Tab", QT_TRANSLATE_NOOP3("KStandardShortcut", "Activate Next Tab", "@action"), CTRL(PageDown), CTRL(BracketRight), QList<QKeySequence>(), false },
114  { TabPrev, "Activate Previous Tab", QT_TRANSLATE_NOOP3("KStandardShortcut", "Activate Previous Tab", "@action"), CTRL(PageUp), CTRL(BracketLeft), QList<QKeySequence>(), false },
115 
116  //Group Help
117  { Help, "Help", QT_TRANSLATE_NOOP3("KStandardShortcut", "Help", "@action"), Qt::Key_F1, 0, QList<QKeySequence>(), false },
118  { WhatsThis, "WhatsThis", QT_TRANSLATE_NOOP3("KStandardShortcut", "What's This", "@action"), SHIFT(F1), 0, QList<QKeySequence>(), false },
119 
120 //Group TextCompletion
121  { TextCompletion, "TextCompletion", QT_TRANSLATE_NOOP3("KStandardShortcut", "Text Completion", "@action"), CTRL(E), 0, QList<QKeySequence>(), false },
122  { PrevCompletion, "PrevCompletion", QT_TRANSLATE_NOOP3("KStandardShortcut", "Previous Completion Match", "@action"), CTRL(Up), 0, QList<QKeySequence>(), false },
123  { NextCompletion, "NextCompletion", QT_TRANSLATE_NOOP3("KStandardShortcut", "Next Completion Match", "@action"), CTRL(Down), 0, QList<QKeySequence>(), false },
124  { SubstringCompletion, "SubstringCompletion", QT_TRANSLATE_NOOP3("KStandardShortcut", "Substring Completion", "@action"), CTRL(T), 0, QList<QKeySequence>(), false },
125 
126  { RotateUp, "RotateUp", QT_TRANSLATE_NOOP3("KStandardShortcut", "Previous Item in List", "@action"), Qt::Key_Up, 0, QList<QKeySequence>(), false },
127  { RotateDown, "RotateDown", QT_TRANSLATE_NOOP3("KStandardShortcut", "Next Item in List", "@action"), Qt::Key_Down, 0, QList<QKeySequence>(), false },
128 
129  { OpenRecent, "OpenRecent", QT_TRANSLATE_NOOP3("KStandardShortcut", "Open Recent", "@action"), 0, 0, QList<QKeySequence>(), false },
130  { SaveAs, "SaveAs", QT_TRANSLATE_NOOP3("KStandardShortcut", "Save As", "@action"), CTRLSHIFT(S), 0, QList<QKeySequence>(), false },
131  { Revert, "Revert", QT_TRANSLATE_NOOP3("KStandardShortcut", "Revert", "@action"), 0, 0, QList<QKeySequence>(), false },
132  { PrintPreview, "PrintPreview", QT_TRANSLATE_NOOP3("KStandardShortcut", "Print Preview", "@action"), 0, 0, QList<QKeySequence>(), false },
133  { Mail, "Mail", QT_TRANSLATE_NOOP3("KStandardShortcut", "Mail", "@action"), 0, 0, QList<QKeySequence>(), false },
134  { Clear, "Clear", QT_TRANSLATE_NOOP3("KStandardShortcut", "Clear", "@action"), 0, 0, QList<QKeySequence>(), false },
135  { ActualSize, "ActualSize", QT_TRANSLATE_NOOP3("KStandardShortcut", "Actual Size", "@action"), CTRL(0), 0, QList<QKeySequence>(), false },
136  { FitToPage, "FitToPage", QT_TRANSLATE_NOOP3("KStandardShortcut", "Fit To Page", "@action"), 0, 0, QList<QKeySequence>(), false },
137  { FitToWidth, "FitToWidth", QT_TRANSLATE_NOOP3("KStandardShortcut", "Fit To Width", "@action"), 0, 0, QList<QKeySequence>(), false },
138  { FitToHeight, "FitToHeight", QT_TRANSLATE_NOOP3("KStandardShortcut", "Fit To Height", "@action"), 0, 0, QList<QKeySequence>(), false },
139  { Zoom, "Zoom", QT_TRANSLATE_NOOP3("KStandardShortcut", "Zoom", "@action"), 0, 0, QList<QKeySequence>(), false },
140  { Goto, "Goto", QT_TRANSLATE_NOOP3("KStandardShortcut", "Goto", "@action"), 0, 0, QList<QKeySequence>(), false },
141  { GotoPage, "GotoPage", QT_TRANSLATE_NOOP3("KStandardShortcut", "Goto Page", "@action"), 0, 0, QList<QKeySequence>(), false },
142  { DocumentBack, "DocumentBack", QT_TRANSLATE_NOOP3("KStandardShortcut", "Document Back", "@action"), ALTSHIFT(Left), 0, QList<QKeySequence>(), false },
143  { DocumentForward, "DocumentForward", QT_TRANSLATE_NOOP3("KStandardShortcut", "Document Forward", "@action"), ALTSHIFT(Right), 0, QList<QKeySequence>(), false },
144  { EditBookmarks, "EditBookmarks", QT_TRANSLATE_NOOP3("KStandardShortcut", "Edit Bookmarks", "@action"), 0, 0, QList<QKeySequence>(), false },
145  { Spelling, "Spelling", QT_TRANSLATE_NOOP3("KStandardShortcut", "Spelling", "@action"), 0, 0, QList<QKeySequence>(), false },
146  { ShowToolbar, "ShowToolbar", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show Toolbar", "@action"), 0, 0, QList<QKeySequence>(), false },
147  { ShowStatusbar, "ShowStatusbar", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show Statusbar", "@action"), 0, 0, QList<QKeySequence>(), false },
148 #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 39)
149  { SaveOptions, "SaveOptions", QT_TRANSLATE_NOOP3("KStandardShortcut", "Save Options", "@action"), 0, 0, QList<QKeySequence>(), false },
150 #else
151  // dummy entry
152  { SaveOptions_DEPRECATED_DO_NOT_USE, nullptr, {nullptr, nullptr}, 0, 0, QList<QKeySequence>(), false },
153 #endif
154  { KeyBindings, "KeyBindings", QT_TRANSLATE_NOOP3("KStandardShortcut", "Key Bindings", "@action"), 0, 0, QList<QKeySequence>(), false },
155  { Preferences, "Preferences", QT_TRANSLATE_NOOP3("KStandardShortcut", "Configure Application", "@action"), CTRLSHIFT(Comma), 0, QList<QKeySequence>(), false },
156  { ConfigureToolbars, "ConfigureToolbars", QT_TRANSLATE_NOOP3("KStandardShortcut", "Configure Toolbars", "@action"), 0, 0, QList<QKeySequence>(), false },
157  { ConfigureNotifications, "ConfigureNotifications", QT_TRANSLATE_NOOP3("KStandardShortcut", "Configure Notifications", "@action"), 0, 0, QList<QKeySequence>(), false },
158  { TipofDay, "TipofDay", QT_TRANSLATE_NOOP3("KStandardShortcut", "Tip Of Day", "@action"), 0, 0, QList<QKeySequence>(), false },
159  { ReportBug, "ReportBug", QT_TRANSLATE_NOOP3("KStandardShortcut", "Report Bug", "@action"), 0, 0, QList<QKeySequence>(), false },
160  { SwitchApplicationLanguage, "SwitchApplicationLanguage", QT_TRANSLATE_NOOP3("KStandardShortcut", "Configure Language...", "@action"), 0, 0, QList<QKeySequence>(), false },
161  { AboutApp, "AboutApp", QT_TRANSLATE_NOOP3("KStandardShortcut", "About Application", "@action"), 0, 0, QList<QKeySequence>(), false },
162  { AboutKDE, "AboutKDE", QT_TRANSLATE_NOOP3("KStandardShortcut", "About KDE", "@action"), 0, 0, QList<QKeySequence>(), false },
163  // Both "Cut" and "Delete" use Shift+Delete, but this is okay; see
164  // https://commits.kde.org/kxmlgui/8eabbf6725386e716b7536c71a9181dfe5d959f0
165  { DeleteFile, "DeleteFile", QT_TRANSLATE_NOOP3("KStandardShortcut", "Delete", "@action"), SHIFT(Delete), 0, QList<QKeySequence>(), false },
166  { RenameFile, "RenameFile", QT_TRANSLATE_NOOP3("KStandardShortcut", "Rename", "@action"), Qt::Key_F2, 0, QList<QKeySequence>(), false },
167  { MoveToTrash, "MoveToTrash", QT_TRANSLATE_NOOP3("KStandardShortcut", "Move to Trash", "@action"), Qt::Key_Delete, 0, QList<QKeySequence>(), false },
168  { Donate, "Donate", QT_TRANSLATE_NOOP3("KStandardShortcut", "Donate", "@action"), 0, 0, QList<QKeySequence>(), false },
169  { ShowHideHiddenFiles, "ShowHideHiddenFiles", QT_TRANSLATE_NOOP3("KStandardShortcut", "Show/Hide Hidden Files", "@action"), CTRL(H), ALT(Period), QList<QKeySequence>(), false },
170 
171  //dummy entry to catch simple off-by-one errors. Insert new entries before this line.
172  { AccelNone, nullptr, {nullptr, nullptr}, 0, 0, QList<QKeySequence>(), false }
173 };
174 
178 static KStandardShortcutInfo *guardedStandardShortcutInfo(StandardShortcut id)
179 {
180  if (id >= static_cast<int>(sizeof(g_infoStandardShortcut) / sizeof(KStandardShortcutInfo)) ||
181  id < 0) {
182  qWarning() << "KStandardShortcut: id not found!";
183  return &g_infoStandardShortcut[AccelNone];
184  } else {
185  return &g_infoStandardShortcut[id];
186  }
187 }
188 
189 
190 // Sanitize the list for duplicates. For some reason some
191 // people have kdeglobals entries like
192 // Close=Ctrl+W; Ctrl+Esc; Ctrl+W; Ctrl+Esc;
193 // having the same shortcut more than once in the shortcut
194 // declaration is clearly bogus so fix it
195 static void sanitizeShortcutList(QList<QKeySequence> *list)
196 {
197  for (int i = 0; i < list->size(); ++i) {
198  const QKeySequence &ks = list->at(i);
199  int other = list->indexOf(ks, i + 1);
200  while (other != -1) {
201  list->removeAt(other);
202  other = list->indexOf(ks, other);
203  }
204  }
205 }
206 
213 {
214  KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);
215 
216  // All three are needed.
217  if (info->id != AccelNone) {
218  Q_ASSERT(info->description.text);
219  Q_ASSERT(info->description.context);
220  Q_ASSERT(info->name);
221  }
222 
223  KConfigGroup cg(KSharedConfig::openConfig(), "Shortcuts");
224 
225  if (cg.hasKey(info->name)) {
226  QString s = cg.readEntry(info->name);
227  if (s != QLatin1String("none")) {
228  info->cut = QKeySequence::listFromString(s);
229  sanitizeShortcutList(&info->cut);
230  } else {
231  info->cut = QList<QKeySequence>();
232  }
233  } else {
234  info->cut = hardcodedDefaultShortcut(id);
235  }
236 
237  info->isInitialized = true;
238 }
239 
241 {
242  KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);
243  // If the action has no standard shortcut associated there is nothing to
244  // save
245  if (info->id == AccelNone) {
246  return;
247  }
248 
249  KConfigGroup cg(KSharedConfig::openConfig(), "Shortcuts");
250 
251  info->cut = newShortcut;
252  bool sameAsDefault = (newShortcut == hardcodedDefaultShortcut(id));
253 
254  if (sameAsDefault) {
255  // If the shortcut is the equal to the hardcoded one we remove it from
256  // kdeglobal if necessary and return.
257  if (cg.hasKey(info->name)) {
259  }
260 
261  return;
262  }
263 
264  // Write the changed shortcut to kdeglobals
265  sanitizeShortcutList(&info->cut);
267 }
268 
270 {
272 }
273 
275 {
276  KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);
277  return QCoreApplication::translate("KStandardShortcut",
278  info->description.text,
279  info->description.context);
280 }
281 
282 // TODO: Add psWhatsThis entry to KStandardShortcutInfo
284 {
285 // KStandardShortcutInfo* info = guardedStandardShortcutInfo( id );
286 // if( info && info->whatsThis )
287 // return i18n(info->whatsThis);
288 // else
289  return QString();
290 }
291 
293 {
294  KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);
295 
296  if (!info->isInitialized) {
297  initialize(id);
298  }
299 
300  return info->cut;
301 }
302 
304 {
305  if (!seq.isEmpty()) {
306  for (const KStandardShortcutInfo &shortcutInfo : g_infoStandardShortcut) {
307  const StandardShortcut id = shortcutInfo.id;
308 #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 39)
309  if (id != AccelNone) {
310 #else
311  if (id != AccelNone && id != SaveOptions_DEPRECATED_DO_NOT_USE) {
312 #endif
313  if (!shortcutInfo.isInitialized) {
314  initialize(id);
315  }
316  if (shortcutInfo.cut.contains(seq)) {
317  return id;
318  }
319  }
320  }
321  }
322  return AccelNone;
323 }
324 
325 
326 #if KCONFIGGUI_BUILD_DEPRECATED_SINCE(5, 71)
327 StandardShortcut find(const char *keyName)
328 {
329  for (const KStandardShortcutInfo &shortcutInfo : g_infoStandardShortcut) {
330  if (qstrcmp(shortcutInfo.name, keyName) == 0) {
331  return shortcutInfo.id;
332  }
333  }
334 
335  return AccelNone;
336 }
337 #endif
338 
340 {
341 
342  for (const KStandardShortcutInfo &shortcutInfo : g_infoStandardShortcut) {
343  if (QString::fromLatin1(shortcutInfo.name) == name) {
344  return shortcutInfo.id;
345  }
346  }
347  return AccelNone;
348 }
349 
351 {
353  KStandardShortcutInfo *info = guardedStandardShortcutInfo(id);
354 
355  if (info->cutDefault != 0) {
356  cut << info->cutDefault;
357  }
358 
359  if (info->cutDefault2 != 0) {
360  if (cut.isEmpty()) {
361  cut << QKeySequence();
362  }
363 
364  cut << info->cutDefault2;
365  }
366 
367  return cut;
368 }
369 
371 {
372  return shortcut(Open);
373 }
375 {
376  return shortcut(New);
377 }
379 {
380  return shortcut(Close);
381 }
383 {
384  return shortcut(Save);
385 }
387 {
388  return shortcut(Print);
389 }
391 {
392  return shortcut(Quit);
393 }
395 {
396  return shortcut(Cut);
397 }
399 {
400  return shortcut(Copy);
401 }
403 {
404  return shortcut(Paste);
405 }
407 {
408  return shortcut(PasteSelection);
409 }
411 {
412  return shortcut(DeleteWordBack);
413 }
415 {
416  return shortcut(DeleteWordForward);
417 }
419 {
420  return shortcut(Undo);
421 }
423 {
424  return shortcut(Redo);
425 }
427 {
428  return shortcut(Find);
429 }
431 {
432  return shortcut(FindNext);
433 }
435 {
436  return shortcut(FindPrev);
437 }
439 {
440  return shortcut(Replace);
441 }
443 {
444  return shortcut(Home);
445 }
447 {
448  return shortcut(Begin);
449 }
451 {
452  return shortcut(End);
453 }
455 {
456  return shortcut(BeginningOfLine);
457 }
459 {
460  return shortcut(EndOfLine);
461 }
463 {
464  return shortcut(Prior);
465 }
467 {
468  return shortcut(Next);
469 }
471 {
472  return shortcut(BackwardWord);
473 }
475 {
476  return shortcut(ForwardWord);
477 }
479 {
480  return shortcut(GotoLine);
481 }
483 {
484  return shortcut(AddBookmark);
485 }
487 {
488  return shortcut(TabNext);
489 }
491 {
492  return shortcut(TabPrev);
493 }
495 {
496  return shortcut(FullScreen);
497 }
499 {
500  return shortcut(ZoomIn);
501 }
503 {
504  return shortcut(ZoomOut);
505 }
507 {
508  return shortcut(Help);
509 }
511 {
512  return shortcut(TextCompletion);
513 }
515 {
516  return shortcut(PrevCompletion);
517 }
519 {
520  return shortcut(NextCompletion);
521 }
523 {
524  return shortcut(RotateUp);
525 }
527 {
528  return shortcut(RotateDown);
529 }
531 {
533 }
535 {
536  return shortcut(WhatsThis);
537 }
539 {
540  return shortcut(Reload);
541 }
543 {
544  return shortcut(SelectAll);
545 }
547 {
548  return shortcut(Up);
549 }
551 {
552  return shortcut(Back);
553 }
555 {
556  return shortcut(Forward);
557 }
559 {
560  return shortcut(ShowMenubar);
561 }
563 {
564  return shortcut(DeleteFile);
565 }
567 {
568  return shortcut(RenameFile);
569 }
571 {
572  return shortcut(MoveToTrash);
573 }
575 {
576  return shortcut(Preferences);
577 }
578 
580 {
582 }
583 
584 }
Open donation page on kde.org.
View the document at its actual size.
Fit the document view to the height of the current window.
const QList< QKeySequence > & redo()
Redo last operation.
const QList< QKeySequence > & rotateDown()
Help users iterate through a list of entries.
const QList< QKeySequence > & deleteWordBack()
Delete a word back from mouse/cursor position.
Initiate a &#39;find&#39; request in the current document.
Save this entry when saving the config object.
Definition: kconfigbase.h:38
Close current document.
void saveShortcut(StandardShortcut id, const QList< QKeySequence > &newShortcut)
Saves the new shortcut cut for standard accel id.
const QList< QKeySequence > & open()
Open file.
const QList< QKeySequence > & showMenubar()
Show Menu Bar.
const QList< QKeySequence > & moveToTrash()
Moves files or folders to the trash.
const QList< QKeySequence > & next()
Scroll down one page.
QList< QKeySequence > listFromString(const QString &str, QKeySequence::SequenceFormat format)
Find a string within another string or list of strings.
const QList< QKeySequence > & prevCompletion()
Iterate through a list when completion returns multiple items.
QString listToString(const QList< QKeySequence > &list, QKeySequence::SequenceFormat format)
Scroll up one page.
Save the entry to the global KDE config file instead of the application specific config file...
Definition: kconfigbase.h:42
Show/Hide the statusbar.
Pop up the spell checker.
Go to beginning of current line.
Cut selected area and store it in the clipboard.
const QList< QKeySequence > & findPrev()
Find a previous instance of a stored &#39;find&#39;.
const T & at(int i) const const
QString translate(const char *context, const char *sourceText, const char *disambiguation, int n)
Left
StandardShortcut findByName(const QString &name)
Return the StandardShortcut id of the standard accelerator action which has name as its name...
const QList< QKeySequence > & completion()
Complete text in input widgets.
void removeAt(int i)
Paste contents of clipboard at mouse/cursor position.
Help the user in the current situation.
Save the current document under a different name.
Find and replace matches.
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
Writes a value to the configuration object.
StandardShortcut find(const QKeySequence &seq)
Return the StandardShortcut id of the standard accel action which uses this key sequence, or AccelNone if none of them do.
Paste the selection at mouse/cursor position.
const QList< QKeySequence > & preferences()
Opens the app&#39;s settings window.
const QList< QKeySequence > & close()
Close current document.
const QList< QKeySequence > & fullScreen()
Full Screen Mode.
const QList< QKeySequence > & cut()
Cut selected area and store it in the clipboard.
Scroll down one page.
QList< QKeySequence > hardcodedDefaultShortcut(StandardShortcut id)
Returns the hardcoded default shortcut for id.
const QList< QKeySequence > & begin()
Go to beginning of the document.
const QList< QKeySequence > & tabPrev()
Previous Tab.
int size() const const
const QList< QKeySequence > & renameFile()
Rename files or folders.
QString name(StandardShortcut id)
Returns a unique name for the given accel.
int indexOf(const T &value, int from) const const
const QList< QKeySequence > & reload()
Reload.
const QList< QKeySequence > & prior()
Scroll up one page.
Display the Switch Application Language dialog.
Permanently delete files or folders.
void deleteEntry(const QString &pKey, WriteConfigFlags pFlags=Normal)
Deletes the entry specified by pKey in the current group.
const QList< QKeySequence > & deleteWordForward()
Delete a word forward from mouse/cursor position.
const QList< QKeySequence > & deleteFile()
Permanently delete files or folders.
QString whatsThis(StandardShortcut)
What&#39;s This button.
Delete a word back from mouse/cursor position.
const QList< QKeySequence > & beginningOfLine()
Go to beginning of current line.
Display the notifications configuration dialog.
const QList< QKeySequence > & undo()
Undo last operation.
const QList< QKeySequence > & forwardWord()
ForwardWord.
Go to end of the document.
const QList< QKeySequence > & findNext()
Find the next instance of a stored &#39;find&#39; Default: F3.
const QList< QKeySequence > & back()
Back.
const QList< QKeySequence > & help()
Help the user in the current situation.
const QList< QKeySequence > & copy()
Copy selected area into the clipboard.
Move files or folders to the trash.
Iterate through a list when completion returns multiple items.
const QList< QKeySequence > & nextCompletion()
Iterate through a list when completion returns multiple items.
Add current page to bookmarks.
StandardShortcut
Defines the identifier of all standard accelerators.
const QList< QKeySequence > & zoomOut()
Zoom out.
QString label(StandardShortcut id)
Returns a localized label for user-visible display.
static KStandardShortcutInfo * guardedStandardShortcutInfo(StandardShortcut id)
Search for the KStandardShortcutInfo object associated with the given id.
const QList< QKeySequence > & substringCompletion()
Find a string within another string or list of strings.
bool isEmpty() const const
Open a recently used document.
Copy selected area into the clipboard.
Display the Report Bug dialog.
Display the About KDE dialog.
const QList< QKeySequence > & save()
Save current document.
Edit the application bookmarks.
Go to beginning of the document.
const QList< QKeySequence > & pasteSelection()
Paste the selection at mouse/cursor position.
static void initialize(StandardShortcut id)
Initialize the accelerator id by checking if it is overridden in the configuration file (and if it is...
Jump to some specific location in the document.
Redo last operation.
static KStandardShortcutInfo g_infoStandardShortcut[]
Array of predefined KStandardShortcutInfo objects, which cover all the "standard" accelerators...
const QList< QKeySequence > & print()
Print current document.
const QList< QKeySequence > & openNew()
Create a new document (or whatever).
Rename files or folders.
const QList< QKeySequence > & replace()
Find and replace matches.
const QList< QKeySequence > & forward()
Forward.
Fit the document view to the width of the current window.
Display the preferences/options dialog.
Clear the content of the focus widget.
const QList< QKeySequence > & addBookmark()
Add current page to bookmarks.
const QList< QKeySequence > & home()
Go to home page.
Send the current document by mail.
static KSharedConfig::Ptr openConfig(const QString &fileName=QString(), OpenFlags mode=FullConfig, QStandardPaths::StandardLocation type=QStandardPaths::GenericConfigLocation)
Creates a KSharedConfig object to manipulate a configuration file.
const QList< QKeySequence > & endOfLine()
Go to end of current line.
bool isEmpty() const const
bool hasKey(const QString &key) const
Checks whether the key has an entry in this group.
Find the next instance of a stored &#39;find&#39;.
Complete text in input widgets.
const QList< QKeySequence > & up()
Up.
A class for one specific group in a KConfig object.
Definition: kconfiggroup.h:38
const QList< QKeySequence > & showHideHiddenFiles()
Shows or hides hidden files.
Show a print preview of the current document.
const QList< QKeySequence > & end()
Go to end of the document.
const QList< QKeySequence > & tabNext()
Next Tab.
Display the "Tip of the Day".
Find a previous instance of a stored &#39;find&#39;.
const QList< QKeySequence > & backwardWord()
BackwardWord.
Move back (document style menu).
Display the configure key bindings dialog.
Iterate through a list when completion returns multiple items.
Display the application&#39;s About dialog.
Help users iterate through a list of entries.
Move forward (document style menu).
Select the current zoom level.
Quit the program.
Fit the document view to the size of the current window.
Deselect any selected elements.
Print current document.
QString fromLatin1(const char *str, int size)
const QList< QKeySequence > & shortcut(StandardShortcut id)
Returns the keybinding for accel.
Help users iterate through a list of entries.
Save current document.
Toggle showing or hiding hidden files.
const QList< QKeySequence > & paste()
Paste contents of clipboard at mouse/cursor position.
Convenient methods for access to the common accelerator keys in the key configuration.
Create a new document.
const QList< QKeySequence > & selectAll()
Select all.
Delete a word forward from mouse/cursor position.
const QList< QKeySequence > & rotateUp()
Help users iterate through a list of entries.
Go to a specific page.
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfiggroup.h:236
What&#39;s This button.
Display the toolbar configuration dialog.
Undo last operation.
const QList< QKeySequence > & quit()
Quit the program.
const QList< QKeySequence > & zoomIn()
Zoom in.
Revert the current document to the last saved version.
const QList< QKeySequence > & gotoLine()
Go to line.
Go to end of current line.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jul 10 2020 22:46:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.