00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kstdguiitem.h"
00020
00021 #include <kguiitem.h>
00022 #include <klocale.h>
00023 #include <kapplication.h>
00024
00025 KGuiItem KStdGuiItem::guiItem ( StdItem ui_enum )
00026 {
00027 switch (ui_enum ) {
00028 case Ok : return ok();
00029 case Cancel : return cancel();
00030 case Yes : return yes();
00031 case No : return no();
00032 case Discard : return discard();
00033 case Save : return save();
00034 case DontSave : return dontSave();
00035 case SaveAs : return saveAs();
00036 case Apply : return apply();
00037 case Clear : return clear();
00038 case Help : return help();
00039 case Close : return close();
00040 case Defaults : return defaults();
00041 case Back : return back();
00042 case Forward : return forward();
00043 case Print : return print();
00044 case Continue : return cont();
00045 case Open : return open();
00046 case Quit : return quit();
00047 case AdminMode: return adminMode();
00048 case Reset : return reset();
00049 case Delete : return del();
00050 case Insert : return insert();
00051 case Find : return find();
00052 case Stop : return stop();
00053 case Add : return add();
00054 case Remove : return remove();
00055 case Test : return test();
00056 case Properties : return properties();
00057 case Overwrite : return overwrite();
00058 default : return KGuiItem();
00059 };
00060 }
00061
00062 QString KStdGuiItem::stdItem( StdItem ui_enum )
00063 {
00064 switch (ui_enum ) {
00065 case Ok : return QString::fromLatin1("ok");
00066 case Cancel : return QString::fromLatin1("cancel");
00067 case Yes : return QString::fromLatin1("yes");
00068 case No : return QString::fromLatin1("no");
00069 case Discard : return QString::fromLatin1("discard");
00070 case Save : return QString::fromLatin1("save");
00071 case DontSave : return QString::fromLatin1("dontSave");
00072 case SaveAs : return QString::fromLatin1("saveAs");
00073 case Apply : return QString::fromLatin1("apply");
00074 case Help : return QString::fromLatin1("help");
00075 case Close : return QString::fromLatin1("close");
00076 case Defaults : return QString::fromLatin1("defaults");
00077 case Back : return QString::fromLatin1("back");
00078 case Forward : return QString::fromLatin1("forward");
00079 case Print : return QString::fromLatin1("print");
00080 case Continue : return QString::fromLatin1("continue");
00081 case Open : return QString::fromLatin1("open");
00082 case Quit : return QString::fromLatin1("quit");
00083 case AdminMode: return QString::fromLatin1("adminMode");
00084 case Delete : return QString::fromLatin1("delete");
00085 case Insert : return QString::fromLatin1("insert");
00086 case Find : return QString::fromLatin1("find");
00087 case Stop : return QString::fromLatin1("stop");
00088 case Add : return QString::fromLatin1("add");
00089 case Remove : return QString::fromLatin1("remove");
00090 case Test : return QString::fromLatin1("test");
00091 case Properties : return QString::fromLatin1("properties");
00092 case Overwrite : return QString::fromLatin1("overwrite");
00093 default : return QString::null;
00094 };
00095 }
00096
00097 KGuiItem KStdGuiItem::ok()
00098 {
00099 return KGuiItem( i18n( "&OK" ), "button_ok" );
00100 }
00101
00102
00103 KGuiItem KStdGuiItem::cancel()
00104 {
00105 return KGuiItem( i18n( "&Cancel" ), "button_cancel" );
00106 }
00107
00108 KGuiItem KStdGuiItem::yes()
00109 {
00110 return KGuiItem( i18n( "&Yes" ), "button_ok", i18n( "Yes" ) );
00111 }
00112
00113 KGuiItem KStdGuiItem::no()
00114 {
00115 return KGuiItem( i18n( "&No" ), "", i18n( "No" ) );
00116 }
00117
00118 KGuiItem KStdGuiItem::discard()
00119 {
00120 return KGuiItem( i18n( "&Discard" ), "", i18n( "Discard changes" ),
00121 i18n( "Pressing this button will discard all recent "
00122 "changes made in this dialog" ) );
00123 }
00124
00125 KGuiItem KStdGuiItem::save()
00126 {
00127 return KGuiItem( i18n( "&Save" ), "filesave", i18n( "Save data" ) );
00128 }
00129
00130 KGuiItem KStdGuiItem::dontSave()
00131 {
00132 return KGuiItem( i18n( "&Do Not Save" ), "",
00133 i18n( "Don't save data" ) );
00134 }
00135
00136 KGuiItem KStdGuiItem::saveAs()
00137 {
00138 return KGuiItem( i18n( "Save &As..." ), "filesaveas",
00139 i18n( "Save file with another name" ) );
00140 }
00141
00142 KGuiItem KStdGuiItem::apply()
00143 {
00144 return KGuiItem( i18n( "&Apply" ), "apply", i18n( "Apply changes" ),
00145 i18n( "When clicking <b>Apply</b>, the settings will be "
00146 "handed over to the program, but the dialog "
00147 "will not be closed.\n"
00148 "Use this to try different settings." ) );
00149 }
00150
00151 KGuiItem KStdGuiItem::adminMode()
00152 {
00153 return KGuiItem( i18n( "Administrator &Mode..." ), "", i18n( "Enter Administrator Mode" ),
00154 i18n( "When clicking <b>Administrator Mode</b> you will be prompted "
00155 "for the administrator (root) password in order to make changes "
00156 "which require root privileges." ) );
00157 }
00158
00159 KGuiItem KStdGuiItem::clear()
00160 {
00161 return KGuiItem( i18n( "C&lear" ), "locationbar_erase",
00162 i18n( "Clear input" ),
00163 i18n( "Clear the input in the edit field" ) );
00164 }
00165
00166 KGuiItem KStdGuiItem::help()
00167 {
00168 return KGuiItem( i18n( "show help", "&Help" ), "help",
00169 i18n( "Show help" ) );
00170 }
00171
00172 KGuiItem KStdGuiItem::close()
00173 {
00174 return KGuiItem( i18n( "&Close" ), "fileclose",
00175 i18n( "Close the current window or document" ) );
00176 }
00177
00178 KGuiItem KStdGuiItem::defaults()
00179 {
00180 return KGuiItem( i18n( "&Defaults" ), "",
00181 i18n( "Reset all items to their default values" ) );
00182 }
00183
00184 KGuiItem KStdGuiItem::back( BidiMode useBidi )
00185 {
00186 QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() )
00187 ? "forward" : "back";
00188 return KGuiItem( i18n( "go back", "&Back" ), icon,
00189 i18n( "Go back one step" ) );
00190 }
00191
00192 KGuiItem KStdGuiItem::forward( BidiMode useBidi )
00193 {
00194 QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() )
00195 ? "back" : "forward";
00196 return KGuiItem( i18n( "go forward", "&Forward" ), icon,
00197 i18n( "Go forward one step" ) );
00198 }
00199
00200 QPair<KGuiItem, KGuiItem> KStdGuiItem::backAndForward()
00201 {
00202 return qMakePair( back( UseRTL ), forward( UseRTL ) );
00203 }
00204
00205 KGuiItem KStdGuiItem::print()
00206 {
00207 return KGuiItem( i18n( "&Print..." ), "fileprint",
00208 i18n( "Opens the print dialog to print "
00209 "the current document" ) );
00210 }
00211
00212 KGuiItem KStdGuiItem::cont()
00213 {
00214 return KGuiItem( i18n( "C&ontinue" ), QString::null,
00215 i18n( "Continue operation" ) );
00216 }
00217
00218 KGuiItem KStdGuiItem::del()
00219 {
00220 return KGuiItem( i18n( "&Delete" ), "editdelete",
00221 i18n( "Delete item(s)" ) );
00222 }
00223
00224 KGuiItem KStdGuiItem::open()
00225 {
00226 return KGuiItem( i18n( "&Open..." ), "fileopen",
00227 i18n( "Open file" ) );
00228 }
00229
00230 KGuiItem KStdGuiItem::quit()
00231 {
00232 return KGuiItem( i18n( "&Quit" ), "exit",
00233 i18n( "Quit application" ) );
00234 }
00235
00236 KGuiItem KStdGuiItem::reset()
00237 {
00238 return KGuiItem( i18n( "&Reset" ), "undo",
00239 i18n( "Reset configuration" ) );
00240 }
00241
00242 KGuiItem KStdGuiItem::insert()
00243 {
00244 return KGuiItem( i18n( "Verb", "&Insert" ) );
00245 }
00246
00247 KGuiItem KStdGuiItem::configure()
00248 {
00249 return KGuiItem( i18n( "Confi&gure..." ), "configure" );
00250 }
00251
00252 KGuiItem KStdGuiItem::find()
00253 {
00254 return KGuiItem(i18n("&Find"), "find");
00255 }
00256
00257 KGuiItem KStdGuiItem::stop()
00258 {
00259 return KGuiItem(i18n("Stop"), "stop");
00260 }
00261
00262 KGuiItem KStdGuiItem::add()
00263 {
00264 return KGuiItem(i18n("Add"), "add");
00265 }
00266
00267 KGuiItem KStdGuiItem::remove()
00268 {
00269 return KGuiItem(i18n("Remove"), "remove");
00270 }
00271
00272 KGuiItem KStdGuiItem::test()
00273 {
00274 return KGuiItem(i18n("Test"));
00275 }
00276
00277 KGuiItem KStdGuiItem::properties()
00278 {
00279 return KGuiItem(i18n("Properties"));
00280 }
00281
00282 KGuiItem KStdGuiItem::overwrite()
00283 {
00284 return KGuiItem(i18n("&Overwrite"));
00285 }
00286
00287