kdeui Library API Documentation

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., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 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 default : return KGuiItem(); 00052 }; 00053 } 00054 00055 QString KStdGuiItem::stdItem( StdItem ui_enum ) 00056 { 00057 switch (ui_enum ) { 00058 case Ok : return QString::fromLatin1("ok"); 00059 case Cancel : return QString::fromLatin1("cancel"); 00060 case Yes : return QString::fromLatin1("yes"); 00061 case No : return QString::fromLatin1("no"); 00062 case Discard : return QString::fromLatin1("discard"); 00063 case Save : return QString::fromLatin1("save"); 00064 case DontSave : return QString::fromLatin1("dontSave"); 00065 case SaveAs : return QString::fromLatin1("saveAs"); 00066 case Apply : return QString::fromLatin1("apply"); 00067 case Help : return QString::fromLatin1("help"); 00068 case Close : return QString::fromLatin1("close"); 00069 case Defaults : return QString::fromLatin1("defaults"); 00070 case Back : return QString::fromLatin1("back"); 00071 case Forward : return QString::fromLatin1("forward"); 00072 case Print : return QString::fromLatin1("print"); 00073 case Continue : return QString::fromLatin1("continue"); 00074 case Open : return QString::fromLatin1("open"); 00075 case Quit : return QString::fromLatin1("quit"); 00076 case AdminMode: return QString::fromLatin1("adminMode"); 00077 case Delete : return QString::fromLatin1("delete"); 00078 case Insert : return QString::fromLatin1("insert"); 00079 default : return QString::null; 00080 }; 00081 } 00082 00083 KGuiItem KStdGuiItem::ok() 00084 { 00085 return KGuiItem( i18n( "&OK" ), "button_ok" ); 00086 } 00087 00088 00089 KGuiItem KStdGuiItem::cancel() 00090 { 00091 return KGuiItem( i18n( "&Cancel" ), "button_cancel" ); 00092 } 00093 00094 KGuiItem KStdGuiItem::yes() 00095 { 00096 return KGuiItem( i18n( "&Yes" ), "button_ok", i18n( "Yes" ) ); 00097 } 00098 00099 KGuiItem KStdGuiItem::no() 00100 { 00101 return KGuiItem( i18n( "&No" ), "", i18n( "No" ) ); 00102 } 00103 00104 KGuiItem KStdGuiItem::discard() 00105 { 00106 return KGuiItem( i18n( "&Discard" ), "", i18n( "Discard changes" ), 00107 i18n( "Pressing this button will discard all recent " 00108 "changes made in this dialog" ) ); 00109 } 00110 00111 KGuiItem KStdGuiItem::save() 00112 { 00113 return KGuiItem( i18n( "&Save" ), "filesave", i18n( "Save data" ) ); 00114 } 00115 00116 KGuiItem KStdGuiItem::dontSave() 00117 { 00118 return KGuiItem( i18n( "&Do Not Save" ), "", 00119 i18n( "Don't save data" ) ); 00120 } 00121 00122 KGuiItem KStdGuiItem::saveAs() 00123 { 00124 return KGuiItem( i18n( "Save &As..." ), "filesaveas", 00125 i18n( "Save file with another name" ) ); 00126 } 00127 00128 KGuiItem KStdGuiItem::apply() 00129 { 00130 return KGuiItem( i18n( "&Apply" ), "apply", i18n( "Apply changes" ), 00131 i18n( "When clicking <b>Apply</b>, the settings will be " 00132 "handed over to the program, but the dialog " 00133 "will not be closed.\n" 00134 "Use this to try different settings." ) ); 00135 } 00136 00137 KGuiItem KStdGuiItem::adminMode() 00138 { 00139 return KGuiItem( i18n( "Administrator &Mode..." ), "", i18n( "Enter Administrator Mode" ), 00140 i18n( "When clicking <b>Administrator Mode</b> you will be prompted " 00141 "for the administrator (root) password in order to make changes " 00142 "which require root privileges." ) ); 00143 } 00144 00145 KGuiItem KStdGuiItem::clear() 00146 { 00147 return KGuiItem( i18n( "C&lear" ), "locationbar_erase", 00148 i18n( "Clear input" ), 00149 i18n( "Clear the input in the edit field" ) ); 00150 } 00151 00152 KGuiItem KStdGuiItem::help() 00153 { 00154 return KGuiItem( i18n( "show help", "&Help" ), "help", 00155 i18n( "Show help" ) ); 00156 } 00157 00158 KGuiItem KStdGuiItem::close() 00159 { 00160 return KGuiItem( i18n( "&Close" ), "fileclose", 00161 i18n( "Close the current window or document" ) ); 00162 } 00163 00164 KGuiItem KStdGuiItem::defaults() 00165 { 00166 return KGuiItem( i18n( "&Defaults" ), "", 00167 i18n( "Reset all items to their default values" ) ); 00168 } 00169 00170 KGuiItem KStdGuiItem::back( BidiMode useBidi ) 00171 { 00172 QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() ) 00173 ? "forward" : "back"; 00174 return KGuiItem( i18n( "go back", "&Back" ), icon, 00175 i18n( "Go back one step" ) ); 00176 } 00177 00178 KGuiItem KStdGuiItem::forward( BidiMode useBidi ) 00179 { 00180 QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() ) 00181 ? "back" : "forward"; 00182 return KGuiItem( i18n( "go forward", "&Forward" ), icon, 00183 i18n( "Go forward one step" ) ); 00184 } 00185 00186 QPair<KGuiItem, KGuiItem> KStdGuiItem::backAndForward() 00187 { 00188 return qMakePair( back( UseRTL ), forward( UseRTL ) ); 00189 } 00190 00191 KGuiItem KStdGuiItem::print() 00192 { 00193 return KGuiItem( i18n( "&Print..." ), "fileprint", 00194 i18n( "Opens the print dialog to print " 00195 "the current document" ) ); 00196 } 00197 00198 KGuiItem KStdGuiItem::cont() 00199 { 00200 return KGuiItem( i18n( "C&ontinue" ), QString::null, 00201 i18n( "Continue operation" ) ); 00202 } 00203 00204 KGuiItem KStdGuiItem::del() 00205 { 00206 return KGuiItem( i18n( "&Delete" ), "editdelete", 00207 i18n( "Delete item(s)" ) ); 00208 } 00209 00210 KGuiItem KStdGuiItem::open() 00211 { 00212 return KGuiItem( i18n( "&Open..." ), "fileopen", 00213 i18n( "Open file" ) ); 00214 } 00215 00216 KGuiItem KStdGuiItem::quit() 00217 { 00218 return KGuiItem( i18n( "&Quit" ), "exit", 00219 i18n( "Quit application" ) ); 00220 } 00221 00222 KGuiItem KStdGuiItem::reset() 00223 { 00224 return KGuiItem( i18n( "&Reset" ), "undo", 00225 i18n( "Reset configuration" ) ); 00226 } 00227 00228 KGuiItem KStdGuiItem::insert() 00229 { 00230 return KGuiItem( i18n( "&Insert")); 00231 } 00232 00233 // vim: set ts=2 sts=2 sw=2 et:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:27:32 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003