1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1997 Stefan Taferner (taferner@kde.org) |
3 | Copyright (C) 2000 Nicolas Hadacek (hadacek@kde.org) |
4 | Copyright (C) 2001,2002 Ellis Whitehead (ellis@kde.org) |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. |
9 | |
10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | #ifndef KSTANDARDSHORTCUT_H |
21 | #define KSTANDARDSHORTCUT_H |
22 | |
23 | #include <QtCore/QString> |
24 | |
25 | #include "kshortcut.h" |
26 | |
27 | |
28 | /** |
29 | * \namespace KStandardShortcut |
30 | * Convenient methods for access to the common accelerator keys in |
31 | * the key configuration. These are the standard keybindings that should |
32 | * be used in all KDE applications. They will be configurable, |
33 | * so do not hardcode the default behavior. |
34 | */ |
35 | namespace KStandardShortcut |
36 | { // STUFF WILL BREAK IF YOU DON'T READ THIS!!! |
37 | /* |
38 | *Always add new std-accels to the end of this enum, never in the middle! |
39 | *Don't forget to add the corresponding entries in g_infoStandardShortcut[] in kstandardshortcut.cpp, too. |
40 | *Values of elements here and positions of the corresponding entries in |
41 | *the big array g_infoStandardShortcut[] ABSOLUTELY MUST BE THE SAME. |
42 | * !!! !!!! !!!!! !!!! |
43 | * !!!! !!! !!!! !!!! |
44 | * Remember to also update kdoctools/genshortcutents.cpp. |
45 | * |
46 | * Other Rules: |
47 | * |
48 | * - Never change the name of an existing shortcut |
49 | * - Never translate the name of a shortcut |
50 | */ |
51 | |
52 | /** |
53 | * Defines the identifier of all standard accelerators. |
54 | */ |
55 | enum StandardShortcut { |
56 | //C++ requires that the value of an enum symbol be one more than the previous one. |
57 | //This means that everything will be well-ordered from here on. |
58 | AccelNone=0, |
59 | // File menu |
60 | Open, New, Close, Save, |
61 | // The Print item |
62 | Print, |
63 | Quit, |
64 | // Edit menu |
65 | Undo, Redo, Cut, Copy, Paste, PasteSelection, |
66 | SelectAll, Deselect, DeleteWordBack, DeleteWordForward, |
67 | Find, FindNext, FindPrev, Replace, |
68 | // Navigation |
69 | Home, Begin, End, Prior, Next, |
70 | Up, Back, Forward, Reload, |
71 | // Text Navigation |
72 | BeginningOfLine, EndOfLine, GotoLine, |
73 | BackwardWord, ForwardWord, |
74 | // View parameters |
75 | AddBookmark, ZoomIn, ZoomOut, FullScreen, |
76 | ShowMenubar, |
77 | // Tabular navigation |
78 | TabNext, TabPrev, |
79 | // Help menu |
80 | Help, WhatsThis, |
81 | // Text completion |
82 | TextCompletion, PrevCompletion, NextCompletion, SubstringCompletion, |
83 | |
84 | RotateUp, RotateDown, |
85 | |
86 | OpenRecent, |
87 | SaveAs, |
88 | Revert, |
89 | PrintPreview, |
90 | Mail, |
91 | Clear, |
92 | ActualSize, |
93 | FitToPage, |
94 | FitToWidth, |
95 | FitToHeight, |
96 | Zoom, |
97 | Goto, |
98 | GotoPage, |
99 | DocumentBack, |
100 | DocumentForward, |
101 | EditBookmarks, |
102 | Spelling, |
103 | ShowToolbar, |
104 | ShowStatusbar, |
105 | SaveOptions, |
106 | KeyBindings, |
107 | Preferences, |
108 | ConfigureToolbars, |
109 | ConfigureNotifications, |
110 | TipofDay, |
111 | ReportBug, |
112 | SwitchApplicationLanguage, |
113 | AboutApp, |
114 | AboutKDE, |
115 | |
116 | // Insert new items here! |
117 | |
118 | StandardShortcutCount // number of standard shortcuts |
119 | }; |
120 | |
121 | /** |
122 | * Returns the keybinding for @p accel. |
123 | * On X11, if QApplication was initialized with GUI disabled, the |
124 | * default keybinding will always be returned. |
125 | * @param id the id of the accelerator |
126 | */ |
127 | KDEUI_EXPORT const KShortcut &shortcut(StandardShortcut id); |
128 | |
129 | /** |
130 | * Returns a unique name for the given accel. |
131 | * @param id the id of the accelerator |
132 | * @return the unique name of the accelerator |
133 | */ |
134 | KDEUI_EXPORT QString name(StandardShortcut id); |
135 | |
136 | /** |
137 | * Returns a localized label for user-visible display. |
138 | * @param id the id of the accelerator |
139 | * @return a localized label for the accelerator |
140 | */ |
141 | KDEUI_EXPORT QString label(StandardShortcut id); |
142 | |
143 | /** |
144 | * Returns an extended WhatsThis description for the given accelerator. |
145 | * @param id the id of the accelerator |
146 | * @return a localized description of the accelerator |
147 | */ |
148 | KDEUI_EXPORT QString whatsThis(StandardShortcut id); |
149 | |
150 | /** |
151 | * Return the StandardShortcut id of the standard accel action which |
152 | * uses this key sequence, or AccelNone if none of them do. |
153 | * This is used by class KKeyChooser. |
154 | * @param keySeq the key sequence to search |
155 | * @return the id of the standard accelerator, or AccelNone if there |
156 | * is none |
157 | */ |
158 | KDEUI_EXPORT StandardShortcut find(const QKeySequence &keySeq); |
159 | |
160 | /** |
161 | * Return the StandardShortcut id of the standard accel action which |
162 | * has \a keyName as its name, or AccelNone if none of them do. |
163 | * This is used by class KKeyChooser. |
164 | * @param keyName the key sequence to search |
165 | * @return the id of the standard accelerator, or AccelNone if there |
166 | * is none |
167 | */ |
168 | KDEUI_EXPORT StandardShortcut find(const char *keyName); |
169 | |
170 | /** |
171 | * Returns the hardcoded default shortcut for @p id. |
172 | * This does not take into account the user's configuration. |
173 | * @param id the id of the accelerator |
174 | * @return the default shortcut of the accelerator |
175 | */ |
176 | KDEUI_EXPORT KShortcut hardcodedDefaultShortcut(StandardShortcut id); |
177 | |
178 | /** |
179 | * Saves the new shortcut \a cut for standard accel \a id. |
180 | */ |
181 | KDEUI_EXPORT void saveShortcut(StandardShortcut id, const KShortcut &newShortcut); |
182 | |
183 | /** |
184 | * Open file. Default: Ctrl-o |
185 | * @return the shortcut of the standard accelerator |
186 | */ |
187 | KDEUI_EXPORT const KShortcut &open(); |
188 | |
189 | /** |
190 | * Create a new document (or whatever). Default: Ctrl-n |
191 | * @return the shortcut of the standard accelerator |
192 | */ |
193 | KDEUI_EXPORT const KShortcut &openNew(); |
194 | |
195 | /** |
196 | * Close current document. Default: Ctrl-w |
197 | * @return the shortcut of the standard accelerator |
198 | */ |
199 | KDEUI_EXPORT const KShortcut &close(); |
200 | |
201 | /** |
202 | * Save current document. Default: Ctrl-s |
203 | * @return the shortcut of the standard accelerator |
204 | */ |
205 | KDEUI_EXPORT const KShortcut &save(); |
206 | |
207 | /** |
208 | * Print current document. Default: Ctrl-p |
209 | * @return the shortcut of the standard accelerator |
210 | */ |
211 | KDEUI_EXPORT const KShortcut &print(); |
212 | |
213 | /** |
214 | * Quit the program. Default: Ctrl-q |
215 | * @return the shortcut of the standard accelerator |
216 | */ |
217 | KDEUI_EXPORT const KShortcut &quit(); |
218 | |
219 | /** |
220 | * Undo last operation. Default: Ctrl-z |
221 | * @return the shortcut of the standard accelerator |
222 | */ |
223 | KDEUI_EXPORT const KShortcut &undo(); |
224 | |
225 | /** |
226 | * Redo. Default: Shift-Ctrl-z |
227 | * @return the shortcut of the standard accelerator |
228 | */ |
229 | KDEUI_EXPORT const KShortcut &redo(); |
230 | |
231 | /** |
232 | * Cut selected area and store it in the clipboard. Default: Ctrl-x |
233 | * @return the shortcut of the standard accelerator |
234 | */ |
235 | KDEUI_EXPORT const KShortcut &cut(); |
236 | |
237 | /** |
238 | * Copy selected area into the clipboard. Default: Ctrl-c |
239 | * @return the shortcut of the standard accelerator |
240 | */ |
241 | KDEUI_EXPORT const KShortcut ©(); |
242 | |
243 | /** |
244 | * Paste contents of clipboard at mouse/cursor position. Default: Ctrl-v |
245 | * @return the shortcut of the standard accelerator |
246 | */ |
247 | KDEUI_EXPORT const KShortcut &paste(); |
248 | |
249 | /** |
250 | * Paste the selection at mouse/cursor position. Default: Ctrl-Shift-Insert |
251 | * @return the shortcut of the standard accelerator |
252 | */ |
253 | KDEUI_EXPORT const KShortcut &pasteSelection(); |
254 | |
255 | /** |
256 | * Select all. Default: Ctrl-A |
257 | * @return the shortcut of the standard accelerator |
258 | **/ |
259 | KDEUI_EXPORT const KShortcut &selectAll(); |
260 | |
261 | /** |
262 | * Delete a word back from mouse/cursor position. Default: Ctrl-Backspace |
263 | * @return the shortcut of the standard accelerator |
264 | */ |
265 | KDEUI_EXPORT const KShortcut &deleteWordBack(); |
266 | |
267 | /** |
268 | * Delete a word forward from mouse/cursor position. Default: Ctrl-Delete |
269 | * @return the shortcut of the standard accelerator |
270 | */ |
271 | KDEUI_EXPORT const KShortcut &deleteWordForward(); |
272 | |
273 | /** |
274 | * Find, search. Default: Ctrl-f |
275 | * @return the shortcut of the standard accelerator |
276 | */ |
277 | KDEUI_EXPORT const KShortcut &find(); |
278 | |
279 | /** |
280 | * Find/search next. Default: F3 |
281 | * @return the shortcut of the standard accelerator |
282 | */ |
283 | KDEUI_EXPORT const KShortcut &findNext(); |
284 | |
285 | /** |
286 | * Find/search previous. Default: Shift-F3 |
287 | * @return the shortcut of the standard accelerator |
288 | */ |
289 | KDEUI_EXPORT const KShortcut &findPrev(); |
290 | |
291 | /** |
292 | * Find and replace matches. Default: Ctrl-r |
293 | * @return the shortcut of the standard accelerator |
294 | */ |
295 | KDEUI_EXPORT const KShortcut &replace(); |
296 | |
297 | /** |
298 | * Zoom in. Default: Ctrl-Plus |
299 | * @return the shortcut of the standard accelerator |
300 | */ |
301 | KDEUI_EXPORT const KShortcut &zoomIn(); |
302 | |
303 | /** |
304 | * Zoom out. Default: Ctrl-Minus |
305 | * @return the shortcut of the standard accelerator |
306 | */ |
307 | KDEUI_EXPORT const KShortcut &zoomOut(); |
308 | |
309 | /** |
310 | * Toggle insert/overwrite (with visual feedback, e.g. in the statusbar). Default: Insert |
311 | * @return the shortcut of the standard accelerator |
312 | */ |
313 | KDEUI_EXPORT const KShortcut &insert(); |
314 | |
315 | /** |
316 | * Goto home page. Default: Alt-Home |
317 | * @return the shortcut of the standard accelerator |
318 | */ |
319 | KDEUI_EXPORT const KShortcut &home(); |
320 | |
321 | /** |
322 | * Goto beginning of the document. Default: Ctrl-Home |
323 | * @return the shortcut of the standard accelerator |
324 | */ |
325 | KDEUI_EXPORT const KShortcut &begin(); |
326 | |
327 | /** |
328 | * Goto end of the document. Default: Ctrl-End |
329 | * @return the shortcut of the standard accelerator |
330 | */ |
331 | KDEUI_EXPORT const KShortcut &end(); |
332 | |
333 | /** |
334 | * Goto beginning of current line. Default: Home |
335 | * @return the shortcut of the standard accelerator |
336 | */ |
337 | KDEUI_EXPORT const KShortcut &beginningOfLine(); |
338 | |
339 | /** |
340 | * Goto end of current line. Default: End |
341 | * @return the shortcut of the standard accelerator |
342 | */ |
343 | KDEUI_EXPORT const KShortcut &endOfLine(); |
344 | |
345 | /** |
346 | * Scroll up one page. Default: Prior |
347 | * @return the shortcut of the standard accelerator |
348 | */ |
349 | KDEUI_EXPORT const KShortcut &prior(); |
350 | |
351 | /** |
352 | * Scroll down one page. Default: Next |
353 | * @return the shortcut of the standard accelerator |
354 | */ |
355 | KDEUI_EXPORT const KShortcut &next(); |
356 | |
357 | /** |
358 | * Go to line. Default: Ctrl+G |
359 | * @return the shortcut of the standard accelerator |
360 | */ |
361 | KDEUI_EXPORT const KShortcut &gotoLine(); |
362 | |
363 | /** |
364 | * Add current page to bookmarks. Default: Ctrl+B |
365 | * @return the shortcut of the standard accelerator |
366 | */ |
367 | KDEUI_EXPORT const KShortcut &addBookmark(); |
368 | |
369 | /** |
370 | * Next Tab. Default: Ctrl-< |
371 | * @return the shortcut of the standard accelerator |
372 | */ |
373 | KDEUI_EXPORT const KShortcut &tabNext(); |
374 | |
375 | /** |
376 | * Previous Tab. Default: Ctrl-> |
377 | * @return the shortcut of the standard accelerator |
378 | */ |
379 | KDEUI_EXPORT const KShortcut &tabPrev(); |
380 | |
381 | /** |
382 | * Full Screen Mode. Default: Ctrl+Shift+F |
383 | * @return the shortcut of the standard accelerator |
384 | */ |
385 | KDEUI_EXPORT const KShortcut &fullScreen(); |
386 | |
387 | /** |
388 | * Help the user in the current situation. Default: F1 |
389 | * @return the shortcut of the standard accelerator |
390 | */ |
391 | KDEUI_EXPORT const KShortcut &help(); |
392 | |
393 | /** |
394 | * Complete text in input widgets. Default Ctrl+E |
395 | * @return the shortcut of the standard accelerator |
396 | **/ |
397 | KDEUI_EXPORT const KShortcut &completion(); |
398 | |
399 | /** |
400 | * Iterate through a list when completion returns |
401 | * multiple items. Default: Ctrl+Up |
402 | * @return the shortcut of the standard accelerator |
403 | */ |
404 | KDEUI_EXPORT const KShortcut &prevCompletion(); |
405 | |
406 | /** |
407 | * Iterate through a list when completion returns |
408 | * multiple items. Default: Ctrl+Down |
409 | * @return the shortcut of the standard accelerator |
410 | */ |
411 | KDEUI_EXPORT const KShortcut &nextCompletion(); |
412 | |
413 | /** |
414 | * Find a string within another string or list of strings. |
415 | * Default: Ctrl-T |
416 | * @return the shortcut of the standard accelerator |
417 | */ |
418 | KDEUI_EXPORT const KShortcut &substringCompletion(); |
419 | |
420 | /** |
421 | * Help users iterate through a list of entries. Default: Up |
422 | * @return the shortcut of the standard accelerator |
423 | */ |
424 | KDEUI_EXPORT const KShortcut &rotateUp(); |
425 | |
426 | /** |
427 | * Help users iterate through a list of entries. Default: Down |
428 | * @return the shortcut of the standard accelerator |
429 | */ |
430 | KDEUI_EXPORT const KShortcut &rotateDown(); |
431 | |
432 | /** |
433 | * What's This button. Default: Shift+F1 |
434 | * @return the shortcut of the standard accelerator |
435 | */ |
436 | KDEUI_EXPORT const KShortcut &whatsThis(); |
437 | |
438 | /** |
439 | * Reload. Default: F5 |
440 | * @return the shortcut of the standard accelerator |
441 | */ |
442 | KDEUI_EXPORT const KShortcut &reload(); |
443 | |
444 | /** |
445 | * Up. Default: Alt+Up |
446 | * @return the shortcut of the standard accelerator |
447 | */ |
448 | KDEUI_EXPORT const KShortcut &up(); |
449 | |
450 | /** |
451 | * Back. Default: Alt+Left |
452 | * @return the shortcut of the standard accelerator |
453 | */ |
454 | KDEUI_EXPORT const KShortcut &back(); |
455 | |
456 | /** |
457 | * Forward. Default: ALT+Right |
458 | * @return the shortcut of the standard accelerator |
459 | */ |
460 | KDEUI_EXPORT const KShortcut &forward(); |
461 | |
462 | /** |
463 | * BackwardWord. Default: Ctrl+Left |
464 | * @return the shortcut of the standard accelerator |
465 | */ |
466 | KDEUI_EXPORT const KShortcut &backwardWord(); |
467 | |
468 | /** |
469 | * ForwardWord. Default: Ctrl+Right |
470 | * @return the shortcut of the standard accelerator |
471 | */ |
472 | KDEUI_EXPORT const KShortcut &forwardWord(); |
473 | |
474 | /** |
475 | * Show Menu Bar. Default: Ctrl-M |
476 | * @return the shortcut of the standard accelerator |
477 | */ |
478 | KDEUI_EXPORT const KShortcut &showMenubar(); |
479 | |
480 | } |
481 | |
482 | #endif // KSTANDARDSHORTCUT_H |
483 | |