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   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   default       : return KGuiItem();
00058   };
00059 }
00060 
00061 QString KStdGuiItem::stdItem( StdItem ui_enum )
00062 {
00063   switch (ui_enum ) {
00064   case Ok       : return QString::fromLatin1("ok");
00065   case Cancel   : return QString::fromLatin1("cancel");
00066   case Yes      : return QString::fromLatin1("yes");
00067   case No       : return QString::fromLatin1("no");
00068   case Discard  : return QString::fromLatin1("discard");
00069   case Save     : return QString::fromLatin1("save");
00070   case DontSave : return QString::fromLatin1("dontSave");
00071   case SaveAs   : return QString::fromLatin1("saveAs");
00072   case Apply    : return QString::fromLatin1("apply");
00073   case Help     : return QString::fromLatin1("help");
00074   case Close    : return QString::fromLatin1("close");
00075   case Defaults : return QString::fromLatin1("defaults");
00076   case Back     : return QString::fromLatin1("back");
00077   case Forward  : return QString::fromLatin1("forward");
00078   case Print    : return QString::fromLatin1("print");
00079   case Continue : return QString::fromLatin1("continue");
00080   case Open     : return QString::fromLatin1("open");
00081   case Quit     : return QString::fromLatin1("quit");
00082   case AdminMode: return QString::fromLatin1("adminMode");
00083   case Delete   : return QString::fromLatin1("delete");
00084   case Insert   : return QString::fromLatin1("insert");
00085   case Find     : return QString::fromLatin1("find");
00086   case Stop     : return QString::fromLatin1("stop");
00087   case Add      : return QString::fromLatin1("add");
00088   case Remove   : return QString::fromLatin1("remove");
00089   case Test     : return QString::fromLatin1("test");
00090   case Properties : return QString::fromLatin1("properties");
00091   default       : return QString::null;
00092   };
00093 }
00094 
00095 KGuiItem KStdGuiItem::ok()
00096 {
00097   return KGuiItem( i18n( "&OK" ), "button_ok" );
00098 }
00099 
00100 
00101 KGuiItem KStdGuiItem::cancel()
00102 {
00103   return KGuiItem( i18n( "&Cancel" ), "button_cancel" );
00104 }
00105 
00106 KGuiItem KStdGuiItem::yes()
00107 {
00108   return KGuiItem( i18n( "&Yes" ), "button_ok", i18n( "Yes" ) );
00109 }
00110 
00111 KGuiItem KStdGuiItem::no()
00112 {
00113   return KGuiItem( i18n( "&No" ), "", i18n( "No" ) );
00114 }
00115 
00116 KGuiItem KStdGuiItem::discard()
00117 {
00118   return KGuiItem( i18n( "&Discard" ), "", i18n( "Discard changes" ),
00119                    i18n( "Pressing this button will discard all recent "
00120                          "changes made in this dialog" ) );
00121 }
00122 
00123 KGuiItem KStdGuiItem::save()
00124 {
00125   return KGuiItem( i18n( "&Save" ), "filesave", i18n( "Save data" ) );
00126 }
00127 
00128 KGuiItem KStdGuiItem::dontSave()
00129 {
00130   return KGuiItem( i18n( "&Do Not Save" ), "",
00131                    i18n( "Don't save data" ) );
00132 }
00133 
00134 KGuiItem KStdGuiItem::saveAs()
00135 {
00136   return KGuiItem( i18n( "Save &As..." ), "filesaveas",
00137                    i18n( "Save file with another name" ) );
00138 }
00139 
00140 KGuiItem KStdGuiItem::apply()
00141 {
00142   return KGuiItem( i18n( "&Apply" ), "apply", i18n( "Apply changes" ),
00143                    i18n( "When clicking <b>Apply</b>, the settings will be "
00144                          "handed over to the program, but the dialog "
00145                          "will not be closed.\n"
00146                          "Use this to try different settings." ) );
00147 }
00148 
00149 KGuiItem KStdGuiItem::adminMode()
00150 {
00151   return KGuiItem( i18n( "Administrator &Mode..." ), "", i18n( "Enter Administrator Mode" ),
00152                    i18n( "When clicking <b>Administrator Mode</b> you will be prompted "
00153                          "for the administrator (root) password in order to make changes "
00154                          "which require root privileges." ) );
00155 }
00156 
00157 KGuiItem KStdGuiItem::clear()
00158 {
00159   return KGuiItem( i18n( "C&lear" ), "locationbar_erase",
00160                    i18n( "Clear input" ),
00161                    i18n( "Clear the input in the edit field" ) );
00162 }
00163 
00164 KGuiItem KStdGuiItem::help()
00165 {
00166   return KGuiItem( i18n( "show help", "&Help" ), "help",
00167                    i18n( "Show help" ) );
00168 }
00169 
00170 KGuiItem KStdGuiItem::close()
00171 {
00172   return KGuiItem( i18n( "&Close" ), "fileclose",
00173                    i18n( "Close the current window or document" ) );
00174 }
00175 
00176 KGuiItem KStdGuiItem::defaults()
00177 {
00178   return KGuiItem( i18n( "&Defaults" ), "",
00179                    i18n( "Reset all items to their default values" ) );
00180 }
00181 
00182 KGuiItem KStdGuiItem::back( BidiMode useBidi )
00183 {
00184   QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() )
00185                  ? "forward" : "back";
00186   return KGuiItem( i18n( "go back", "&Back" ), icon,
00187                    i18n( "Go back one step" ) );
00188 }
00189 
00190 KGuiItem KStdGuiItem::forward( BidiMode useBidi )
00191 {
00192   QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() )
00193                  ? "back" : "forward";
00194   return KGuiItem( i18n( "go forward", "&Forward" ), icon,
00195                    i18n( "Go forward one step" ) );
00196 }
00197 
00198 QPair<KGuiItem, KGuiItem> KStdGuiItem::backAndForward()
00199 {
00200     return qMakePair( back( UseRTL ), forward( UseRTL ) );
00201 }
00202 
00203 KGuiItem KStdGuiItem::print()
00204 {
00205   return KGuiItem( i18n( "&Print..." ), "fileprint",
00206                    i18n( "Opens the print dialog to print "
00207                          "the current document" ) );
00208 }
00209 
00210 KGuiItem KStdGuiItem::cont()
00211 {
00212   return KGuiItem( i18n( "C&ontinue" ), QString::null,
00213                    i18n( "Continue operation" ) );
00214 }
00215 
00216 KGuiItem KStdGuiItem::del()
00217 {
00218   return KGuiItem( i18n( "&Delete" ), "editdelete",
00219                    i18n( "Delete item(s)" ) );
00220 }
00221 
00222 KGuiItem KStdGuiItem::open()
00223 {
00224   return KGuiItem( i18n( "&Open..." ), "fileopen",
00225                    i18n( "Open file" ) );
00226 }
00227 
00228 KGuiItem KStdGuiItem::quit()
00229 {
00230   return KGuiItem( i18n( "&Quit" ), "exit",
00231                    i18n( "Quit application" ) );
00232 }
00233 
00234 KGuiItem KStdGuiItem::reset()
00235 {
00236   return KGuiItem( i18n( "&Reset" ), "undo",
00237                   i18n( "Reset configuration" ) );
00238 }
00239 
00240 KGuiItem KStdGuiItem::insert()
00241 {
00242   return KGuiItem( i18n( "&Insert"));
00243 }
00244 
00245 KGuiItem KStdGuiItem::configure()
00246 {
00247   return KGuiItem( i18n( "Confi&gure..." ), "configure" );
00248 }
00249 
00250 KGuiItem KStdGuiItem::find()
00251 {
00252   return KGuiItem(i18n("&Find"), "find");
00253 }
00254 
00255 KGuiItem KStdGuiItem::stop()
00256 {
00257   return KGuiItem(i18n("Stop"), "stop");
00258 }
00259 
00260 KGuiItem KStdGuiItem::add()
00261 {
00262   return KGuiItem(i18n("Add"), "edit_add");
00263 }
00264 
00265 KGuiItem KStdGuiItem::remove()
00266 {
00267   return KGuiItem(i18n("Remove"), "edit_remove");
00268 }
00269 
00270 KGuiItem KStdGuiItem::test()
00271 {
00272   return KGuiItem(i18n("Test"));
00273 }
00274 
00275 KGuiItem KStdGuiItem::properties()
00276 {
00277   return KGuiItem(i18n("Properties"), "" );
00278 }
00279 
00280 // vim: set ts=2 sts=2 sw=2 et:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 28 01:34:49 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003