KDEUI
kstandardguiitem.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 Holger Freyther <freyther@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "kstandardguiitem.h" 00020 00021 #include <QtGui/QApplication> 00022 00023 #include <kguiitem.h> 00024 #include <klocale.h> 00025 00026 namespace KStandardGuiItem 00027 { 00028 00029 KGuiItem guiItem( StandardItem ui_enum ) 00030 { 00031 switch (ui_enum ) { 00032 case Ok : return ok(); 00033 case Cancel : return cancel(); 00034 case Yes : return yes(); 00035 case No : return no(); 00036 case Discard : return discard(); 00037 case Save : return save(); 00038 case DontSave : return dontSave(); 00039 case SaveAs : return saveAs(); 00040 case Apply : return apply(); 00041 case Clear : return clear(); 00042 case Help : return help(); 00043 case Close : return close(); 00044 case CloseWindow : return closeWindow(); 00045 case CloseDocument : return closeDocument(); 00046 case Defaults : return defaults(); 00047 case Back : return back(); 00048 case Forward : return forward(); 00049 case Print : return print(); 00050 case Continue : return cont(); 00051 case Open : return open(); 00052 case Quit : return quit(); 00053 case AdminMode: return adminMode(); 00054 case Reset : return reset(); 00055 case Delete : return del(); 00056 case Insert : return insert(); 00057 case Configure: return configure(); 00058 case Find : return find(); 00059 case Stop : return stop(); 00060 case Add : return add(); 00061 case Remove : return remove(); 00062 case Test : return test(); 00063 case Properties : return properties(); 00064 case Overwrite : return overwrite(); 00065 default : return KGuiItem(); 00066 }; 00067 } 00068 00069 QString standardItem( StandardItem ui_enum ) 00070 { 00071 switch (ui_enum ) { 00072 case Ok : return QLatin1String("ok"); 00073 case Cancel : return QLatin1String("cancel"); 00074 case Yes : return QLatin1String("yes"); 00075 case No : return QLatin1String("no"); 00076 case Discard : return QLatin1String("discard"); 00077 case Save : return QLatin1String("save"); 00078 case DontSave : return QLatin1String("dontSave"); 00079 case SaveAs : return QLatin1String("saveAs"); 00080 case Apply : return QLatin1String("apply"); 00081 case Help : return QLatin1String("help"); 00082 case Close : return QLatin1String("close"); 00083 case CloseWindow : return QLatin1String("closeWindow"); 00084 case CloseDocument : return QLatin1String("closeDocument"); 00085 case Defaults : return QLatin1String("defaults"); 00086 case Back : return QLatin1String("back"); 00087 case Forward : return QLatin1String("forward"); 00088 case Print : return QLatin1String("print"); 00089 case Continue : return QLatin1String("continue"); 00090 case Open : return QLatin1String("open"); 00091 case Quit : return QLatin1String("quit"); 00092 case AdminMode: return QLatin1String("adminMode"); 00093 case Delete : return QLatin1String("delete"); 00094 case Insert : return QLatin1String("insert"); 00095 case Configure: return QLatin1String("configure"); 00096 case Find : return QLatin1String("find"); 00097 case Stop : return QLatin1String("stop"); 00098 case Add : return QLatin1String("add"); 00099 case Remove : return QLatin1String("remove"); 00100 case Test : return QLatin1String("test"); 00101 case Properties : return QLatin1String("properties"); 00102 case Overwrite : return QLatin1String("overwrite"); 00103 default : return QString(); 00104 }; 00105 } 00106 00107 KGuiItem ok() 00108 { 00109 return KGuiItem( i18n( "&OK" ), "dialog-ok" ); 00110 } 00111 00112 00113 KGuiItem cancel() 00114 { 00115 return KGuiItem( i18n( "&Cancel" ), "dialog-cancel" ); 00116 } 00117 00118 KGuiItem yes() 00119 { 00120 return KGuiItem( i18n( "&Yes" ), "dialog-ok", i18n( "Yes" ) ); 00121 } 00122 00123 KGuiItem no() 00124 { 00125 return KGuiItem( i18n( "&No" ), "process-stop", i18n( "No" ) ); 00126 } 00127 00128 KGuiItem discard() 00129 { 00130 return KGuiItem( i18n( "&Discard" ), "edit-clear", i18n( "Discard changes" ), 00131 i18n( "Pressing this button will discard all recent " 00132 "changes made in this dialog." ) ); 00133 } 00134 00135 KGuiItem save() 00136 { 00137 return KGuiItem( i18n( "&Save" ), "document-save", i18n( "Save data" ) ); 00138 } 00139 00140 KGuiItem dontSave() 00141 { 00142 return KGuiItem( i18n( "&Do Not Save" ), "", 00143 i18n( "Do not save data" ) ); 00144 } 00145 00146 KGuiItem saveAs() 00147 { 00148 return KGuiItem( i18n( "Save &As..." ), "document-save-as", 00149 i18n( "Save file with another name" ) ); 00150 } 00151 00152 KGuiItem apply() 00153 { 00154 return KGuiItem( i18n( "&Apply" ), "dialog-ok-apply", i18n( "Apply changes" ), 00155 i18n( "When you click <b>Apply</b>, the settings will be " 00156 "handed over to the program, but the dialog " 00157 "will not be closed.\n" 00158 "Use this to try different settings." ) ); 00159 } 00160 00161 KGuiItem adminMode() 00162 { 00163 return KGuiItem( i18n( "Administrator &Mode..." ), "", i18n( "Enter Administrator Mode" ), 00164 i18n( "When you click <b>Administrator Mode</b> you will be prompted " 00165 "for the administrator (root) password in order to make changes " 00166 "which require root privileges." ) ); 00167 } 00168 00169 KGuiItem clear() 00170 { 00171 return KGuiItem( i18n( "C&lear" ), "edit-clear", 00172 i18n( "Clear input" ), 00173 i18n( "Clear the input in the edit field" ) ); 00174 } 00175 00176 KGuiItem help() 00177 { 00178 return KGuiItem( i18nc( "show help", "&Help" ), "help-contents", 00179 i18n( "Show help" ) ); 00180 } 00181 00182 KGuiItem close() 00183 { 00184 return KGuiItem( i18n( "&Close" ), "window-close", 00185 i18n( "Close the current window or document" ) ); 00186 } 00187 00188 KGuiItem closeWindow() 00189 { 00190 return KGuiItem( i18n( "&Close Window" ), "window-close", 00191 i18n( "Close the current window." ) ); 00192 } 00193 00194 KGuiItem closeDocument() 00195 { 00196 return KGuiItem( i18n( "&Close Document" ), "document-close", 00197 i18n( "Close the current document." ) ); 00198 } 00199 00200 KGuiItem defaults() 00201 { 00202 return KGuiItem( i18n( "&Defaults" ), "document-revert", 00203 i18n( "Reset all items to their default values" ) ); 00204 } 00205 00206 KGuiItem back( BidiMode useBidi ) 00207 { 00208 QString icon = ( useBidi == UseRTL && QApplication::isRightToLeft() ) 00209 ? "go-next" : "go-previous"; 00210 return KGuiItem( i18nc( "go back", "&Back" ), icon, 00211 i18n( "Go back one step" ) ); 00212 } 00213 00214 KGuiItem forward( BidiMode useBidi ) 00215 { 00216 QString icon = ( useBidi == UseRTL && QApplication::isRightToLeft() ) 00217 ? "go-previous" : "go-next"; 00218 return KGuiItem( i18nc( "go forward", "&Forward" ), icon, 00219 i18n( "Go forward one step" ) ); 00220 } 00221 00222 QPair<KGuiItem, KGuiItem> backAndForward() 00223 { 00224 return qMakePair( back( UseRTL ), forward( UseRTL ) ); 00225 } 00226 00227 KGuiItem print() 00228 { 00229 return KGuiItem( i18n( "&Print..." ), "document-print", 00230 i18n( "Opens the print dialog to print " 00231 "the current document" ) ); 00232 } 00233 00234 KGuiItem cont() 00235 { 00236 return KGuiItem( i18n( "C&ontinue" ), "arrow-right", 00237 i18n( "Continue operation" ) ); 00238 } 00239 00240 KGuiItem del() 00241 { 00242 return KGuiItem( i18n( "&Delete" ), "edit-delete", 00243 i18n( "Delete item(s)" ) ); 00244 } 00245 00246 KGuiItem open() 00247 { 00248 return KGuiItem( i18n( "&Open..." ), "document-open", 00249 i18n( "Open file" ) ); 00250 } 00251 00252 KGuiItem quit() 00253 { 00254 return KGuiItem( i18n( "&Quit" ), "application-exit", 00255 i18n( "Quit application" ) ); 00256 } 00257 00258 KGuiItem reset() 00259 { 00260 return KGuiItem( i18n( "&Reset" ), "edit-undo", 00261 i18n( "Reset configuration" ) ); 00262 } 00263 00264 KGuiItem insert() 00265 { 00266 return KGuiItem( i18nc( "Verb", "&Insert" ) ); 00267 } 00268 00269 KGuiItem configure() 00270 { 00271 return KGuiItem( i18n( "Confi&gure..." ), "configure" ); 00272 } 00273 00274 KGuiItem find() 00275 { 00276 return KGuiItem(i18n("&Find"), "edit-find"); 00277 } 00278 00279 KGuiItem stop() 00280 { 00281 return KGuiItem(i18n("Stop"), "process-stop"); 00282 } 00283 00284 KGuiItem add() 00285 { 00286 return KGuiItem(i18n("Add"), "list-add"); 00287 } 00288 00289 KGuiItem remove() 00290 { 00291 return KGuiItem(i18n("Remove"), "list-remove"); 00292 } 00293 00294 KGuiItem test() 00295 { 00296 return KGuiItem(i18n("Test")); 00297 } 00298 00299 KGuiItem properties() 00300 { 00301 return KGuiItem(i18n("Properties"), "document-properties"); 00302 } 00303 00304 KGuiItem overwrite() 00305 { 00306 return KGuiItem(i18n("&Overwrite")); 00307 } 00308 00309 } // KStandardGuiItem namespace 00310
KDE 4.6 API Reference