1 /* This file is part of the KDE libraries
2 Copyright (C) 2001 Holger Freyther <freyther@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include "kstandardguiitem.h"
21 #include <QtGui/QApplication>
26 namespace KStandardGuiItem
29 KGuiItem
guiItem( StandardItem ui_enum
)
32 case Ok
: return ok();
33 case Cancel
: return cancel();
34 case Yes
: return yes();
35 case No
: return no();
36 case Discard
: return discard();
37 case Save
: return save();
38 case DontSave
: return dontSave();
39 case SaveAs
: return saveAs();
40 case Apply
: return apply();
41 case Clear
: return clear();
42 case Help
: return help();
43 case Close
: return close();
44 case CloseWindow
: return closeWindow();
45 case CloseDocument
: return closeDocument();
46 case Defaults
: return defaults();
47 case Back
: return back();
48 case Forward
: return forward();
49 case Print
: return print();
50 case Continue
: return cont();
51 case Open
: return open();
52 case Quit
: return quit();
53 case AdminMode
: return adminMode();
54 case Reset
: return reset();
55 case Delete
: return del();
56 case Insert
: return insert();
57 case Configure
: return configure();
58 case Find
: return find();
59 case Stop
: return stop();
60 case Add
: return add();
61 case Remove
: return remove();
62 case Test
: return test();
63 case Properties
: return properties();
64 case Overwrite
: return overwrite();
65 default : return KGuiItem();
69 QString
standardItem( StandardItem ui_enum
)
72 case Ok
: return QLatin1String("ok");
73 case Cancel
: return QLatin1String("cancel");
74 case Yes
: return QLatin1String("yes");
75 case No
: return QLatin1String("no");
76 case Discard
: return QLatin1String("discard");
77 case Save
: return QLatin1String("save");
78 case DontSave
: return QLatin1String("dontSave");
79 case SaveAs
: return QLatin1String("saveAs");
80 case Apply
: return QLatin1String("apply");
81 case Help
: return QLatin1String("help");
82 case Close
: return QLatin1String("close");
83 case CloseWindow
: return QLatin1String("closeWindow");
84 case CloseDocument
: return QLatin1String("closeDocument");
85 case Defaults
: return QLatin1String("defaults");
86 case Back
: return QLatin1String("back");
87 case Forward
: return QLatin1String("forward");
88 case Print
: return QLatin1String("print");
89 case Continue
: return QLatin1String("continue");
90 case Open
: return QLatin1String("open");
91 case Quit
: return QLatin1String("quit");
92 case AdminMode
: return QLatin1String("adminMode");
93 case Delete
: return QLatin1String("delete");
94 case Insert
: return QLatin1String("insert");
95 case Configure
: return QLatin1String("configure");
96 case Find
: return QLatin1String("find");
97 case Stop
: return QLatin1String("stop");
98 case Add
: return QLatin1String("add");
99 case Remove
: return QLatin1String("remove");
100 case Test
: return QLatin1String("test");
101 case Properties
: return QLatin1String("properties");
102 case Overwrite
: return QLatin1String("overwrite");
103 default : return QString();
109 return KGuiItem( i18n( "&OK" ), "dialog-ok" );
115 return KGuiItem( i18n( "&Cancel" ), "dialog-cancel" );
120 return KGuiItem( i18n( "&Yes" ), "dialog-ok", i18n( "Yes" ) );
125 return KGuiItem( i18n( "&No" ), "process-stop", i18n( "No" ) );
130 return KGuiItem( i18n( "&Discard" ), "", i18n( "Discard changes" ),
131 i18n( "Pressing this button will discard all recent "
132 "changes made in this dialog" ) );
137 return KGuiItem( i18n( "&Save" ), "document-save", i18n( "Save data" ) );
142 return KGuiItem( i18n( "&Do Not Save" ), "",
143 i18n( "Do not save data" ) );
148 return KGuiItem( i18n( "Save &As..." ), "document-save-as",
149 i18n( "Save file with another name" ) );
154 return KGuiItem( i18n( "&Apply" ), "dialog-ok-apply", i18n( "Apply changes" ),
155 i18n( "When clicking <b>Apply</b>, the settings will be "
156 "handed over to the program, but the dialog "
157 "will not be closed.\n"
158 "Use this to try different settings." ) );
163 return KGuiItem( i18n( "Administrator &Mode..." ), "", i18n( "Enter Administrator Mode" ),
164 i18n( "When clicking <b>Administrator Mode</b> you will be prompted "
165 "for the administrator (root) password in order to make changes "
166 "which require root privileges." ) );
171 return KGuiItem( i18n( "C&lear" ), "edit-clear",
172 i18n( "Clear input" ),
173 i18n( "Clear the input in the edit field" ) );
178 return KGuiItem( i18nc( "show help", "&Help" ), "help-contents",
179 i18n( "Show help" ) );
184 return KGuiItem( i18n( "&Close" ), "window-close",
185 i18n( "Close the current window or document" ) );
188 KGuiItem
closeWindow()
190 return KGuiItem( i18n( "&Close Window" ), "window-close",
191 i18n( "Close the current window." ) );
194 KGuiItem
closeDocument()
196 return KGuiItem( i18n( "&Close Document" ), "document-close",
197 i18n( "Close the current document." ) );
202 return KGuiItem( i18n( "&Defaults" ), "document-revert",
203 i18n( "Reset all items to their default values" ) );
206 KGuiItem
back( BidiMode useBidi
)
208 QString icon
= ( useBidi
== UseRTL
&& QApplication::isRightToLeft() )
209 ? "go-next" : "go-previous";
210 return KGuiItem( i18nc( "go back", "&Back" ), icon
,
211 i18n( "Go back one step" ) );
214 KGuiItem
forward( BidiMode useBidi
)
216 QString icon
= ( useBidi
== UseRTL
&& QApplication::isRightToLeft() )
217 ? "go-previous" : "go-next";
218 return KGuiItem( i18nc( "go forward", "&Forward" ), icon
,
219 i18n( "Go forward one step" ) );
222 QPair
<KGuiItem
, KGuiItem
> backAndForward()
224 return qMakePair( back( UseRTL
), forward( UseRTL
) );
229 return KGuiItem( i18n( "&Print..." ), "document-print",
230 i18n( "Opens the print dialog to print "
231 "the current document" ) );
236 return KGuiItem( i18n( "C&ontinue" ), QString(),
237 i18n( "Continue operation" ) );
242 return KGuiItem( i18n( "&Delete" ), "edit-delete",
243 i18n( "Delete item(s)" ) );
248 return KGuiItem( i18n( "&Open..." ), "document-open",
249 i18n( "Open file" ) );
254 return KGuiItem( i18n( "&Quit" ), "application-exit",
255 i18n( "Quit application" ) );
260 return KGuiItem( i18n( "&Reset" ), "edit-undo",
261 i18n( "Reset configuration" ) );
266 return KGuiItem( i18nc( "Verb", "&Insert" ) );
271 return KGuiItem( i18n( "Confi&gure..." ), "configure" );
276 return KGuiItem(i18n("&Find"), "edit-find");
281 return KGuiItem(i18n("Stop"), "process-stop");
286 return KGuiItem(i18n("Add"), "list-add");
291 return KGuiItem(i18n("Remove"), "list-remove");
296 return KGuiItem(i18n("Test"));
299 KGuiItem
properties()
301 return KGuiItem(i18n("Properties"), "document-properties");
306 return KGuiItem(i18n("&Overwrite"));
309 } // KStandardGuiItem namespace