kstdguiitem.cpp
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 "kstdguiitem.h" 00020 00021 #include <kguiitem.h> 00022 #include <tdelocale.h> 00023 #include <tdeapplication.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 TQString KStdGuiItem::stdItem( StdItem ui_enum ) 00063 { 00064 switch (ui_enum ) { 00065 case Ok : return TQString::fromLatin1("ok"); 00066 case Cancel : return TQString::fromLatin1("cancel"); 00067 case Yes : return TQString::fromLatin1("yes"); 00068 case No : return TQString::fromLatin1("no"); 00069 case Discard : return TQString::fromLatin1("discard"); 00070 case Save : return TQString::fromLatin1("save"); 00071 case DontSave : return TQString::fromLatin1("dontSave"); 00072 case SaveAs : return TQString::fromLatin1("saveAs"); 00073 case Apply : return TQString::fromLatin1("apply"); 00074 case Help : return TQString::fromLatin1("help"); 00075 case Close : return TQString::fromLatin1("close"); 00076 case Defaults : return TQString::fromLatin1("defaults"); 00077 case Back : return TQString::fromLatin1("back"); 00078 case Forward : return TQString::fromLatin1("forward"); 00079 case Print : return TQString::fromLatin1("print"); 00080 case Continue : return TQString::fromLatin1("continue"); 00081 case Open : return TQString::fromLatin1("open"); 00082 case Quit : return TQString::fromLatin1("quit"); 00083 case AdminMode: return TQString::fromLatin1("adminMode"); 00084 case Delete : return TQString::fromLatin1("delete"); 00085 case Insert : return TQString::fromLatin1("insert"); 00086 case Find : return TQString::fromLatin1("find"); 00087 case Stop : return TQString::fromLatin1("stop"); 00088 case Add : return TQString::fromLatin1("add"); 00089 case Remove : return TQString::fromLatin1("remove"); 00090 case Test : return TQString::fromLatin1("test"); 00091 case Properties : return TQString::fromLatin1("properties"); 00092 case Overwrite : return TQString::fromLatin1("overwrite"); 00093 default : return TQString::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" ), "window-close", i18n( "No" ) ); 00116 } 00117 00118 KGuiItem KStdGuiItem::discard() 00119 { 00120 return KGuiItem( i18n( "&Discard" ), "edittrash", 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" ), "document-save", i18n( "Save data" ) ); 00128 } 00129 00130 KGuiItem KStdGuiItem::dontSave() 00131 { 00132 return KGuiItem( i18n( "&Do Not Save" ), "edittrash", 00133 i18n( "Don't save data" ) ); 00134 } 00135 00136 KGuiItem KStdGuiItem::saveAs() 00137 { 00138 return KGuiItem( i18n( "Save &As..." ), "document-save-as", 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..." ), "wizard", 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" ), "window-close", 00175 i18n( "Close the current window or document" ) ); 00176 } 00177 00178 KGuiItem KStdGuiItem::defaults() 00179 { 00180 return KGuiItem( i18n( "&Defaults" ), "reload", 00181 i18n( "Reset all items to their default values" ) ); 00182 } 00183 00184 KGuiItem KStdGuiItem::back( BidiMode useBidi ) 00185 { 00186 TQString icon = ( useBidi == UseRTL && TQApplication::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 TQString icon = ( useBidi == UseRTL && TQApplication::reverseLayout() ) 00195 ? "back" : "forward"; 00196 return KGuiItem( i18n( "go forward", "&Forward" ), icon, 00197 i18n( "Go forward one step" ) ); 00198 } 00199 00200 TQPair<KGuiItem, KGuiItem> KStdGuiItem::backAndForward() 00201 { 00202 return tqMakePair( back( UseRTL ), forward( UseRTL ) ); 00203 } 00204 00205 KGuiItem KStdGuiItem::print() 00206 { 00207 return KGuiItem( i18n( "&Print..." ), "document-print", 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" ), TQString::null, 00215 i18n( "Continue operation" ) ); 00216 } 00217 00218 KGuiItem KStdGuiItem::del() 00219 { 00220 return KGuiItem( i18n( "&Delete" ), "edit-delete", 00221 i18n( "Delete item(s)" ) ); 00222 } 00223 00224 KGuiItem KStdGuiItem::open() 00225 { 00226 return KGuiItem( i18n( "&Open..." ), "document-open", 00227 i18n( "Open file" ) ); 00228 } 00229 00230 KGuiItem KStdGuiItem::quit() 00231 { 00232 return KGuiItem( i18n( "&Quit" ), "system-log-out", 00233 i18n( "Quit application" ) ); 00234 } 00235 00236 KGuiItem KStdGuiItem::reset() 00237 { 00238 return KGuiItem( i18n( "&Reset" ), "edit-undo", 00239 i18n( "Reset configuration" ) ); 00240 } 00241 00242 KGuiItem KStdGuiItem::insert() 00243 { 00244 return KGuiItem( i18n( "Verb", "&Insert" ), "edit-paste"); 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"), "edit-find" ); 00255 } 00256 00257 KGuiItem KStdGuiItem::stop() 00258 { 00259 return KGuiItem( i18n("Stop"), "process-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"), "document-properties" ); 00280 } 00281 00282 KGuiItem KStdGuiItem::overwrite() 00283 { 00284 return KGuiItem( i18n("&Overwrite"), "document-save-as" ); 00285 } 00286 00287 // vim: set ts=2 sts=2 sw=2 et: