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   default       : return KGuiItem();
00048   };
00049 }
00050 
00051 QString KStdGuiItem::stdItem( StdItem ui_enum )
00052 {
00053   switch (ui_enum ) {
00054   case Ok       : return QString::fromLatin1("ok");
00055   case Cancel   : return QString::fromLatin1("cancel");
00056   case Yes      : return QString::fromLatin1("yes");
00057   case No       : return QString::fromLatin1("no");
00058   case Discard  : return QString::fromLatin1("discard");
00059   case Save     : return QString::fromLatin1("save");
00060   case DontSave : return QString::fromLatin1("dontSave");
00061   case SaveAs   : return QString::fromLatin1("saveAs");
00062   case Apply    : return QString::fromLatin1("apply");
00063   case Help     : return QString::fromLatin1("help");
00064   case Close    : return QString::fromLatin1("close");
00065   case Defaults : return QString::fromLatin1("defaults");
00066   case Back     : return QString::fromLatin1("back");
00067   case Forward  : return QString::fromLatin1("forward");
00068   case Print    : return QString::fromLatin1("print");
00069   case Continue : return QString::fromLatin1("continue");
00070   case Open     : return QString::fromLatin1("open");
00071   case Quit     : return QString::fromLatin1("quit");
00072   default       : return QString::null;
00073   };
00074 }
00075 
00076 KGuiItem KStdGuiItem::ok()
00077 {
00078   return KGuiItem( i18n( "&OK" ), "button_ok", i18n( "Accept settings" ),
00079                    i18n( "If you press the <b>OK</b> button, all changes\n"
00080                          "you made will be used to proceed." ) );
00081 }
00082 
00083 
00084 KGuiItem KStdGuiItem::cancel()
00085 {
00086   return KGuiItem( i18n( "&Cancel" ), "button_cancel", i18n( "Cancel operation" ) );
00087 }
00088 
00089 KGuiItem KStdGuiItem::yes()
00090 {
00091   return KGuiItem( i18n( "&Yes" ), "button_ok", i18n( "Yes" ) );
00092 }
00093 
00094 KGuiItem KStdGuiItem::no()
00095 {
00096   return KGuiItem( i18n( "&No" ), "", i18n( "No" ) );
00097 }
00098 
00099 KGuiItem KStdGuiItem::discard()
00100 {
00101   return KGuiItem( i18n( "&Discard" ), "", i18n( "Discard changes" ),
00102                    i18n( "Pressing this button will discard all recent "
00103                          "changes made in this dialog" ) );
00104 }
00105 
00106 KGuiItem KStdGuiItem::save()
00107 {
00108   return KGuiItem( i18n( "&Save" ), "filesave", i18n( "Save data" ) );
00109 }
00110 
00111 KGuiItem KStdGuiItem::dontSave()
00112 {
00113   return KGuiItem( i18n( "&Don't Save" ), "",
00114                    i18n( "Don't save data" ) );
00115 }
00116 
00117 KGuiItem KStdGuiItem::saveAs()
00118 {
00119   return KGuiItem( i18n( "Save &As..." ), "filesaveas",
00120                    i18n( "Save file with another name" ) );
00121 }
00122 
00123 KGuiItem KStdGuiItem::apply()
00124 {
00125   return KGuiItem( i18n( "&Apply" ), "apply", i18n( "Apply changes" ),
00126                    i18n( "When clicking <b>Apply</b>, the settings will be "
00127                          "handed over to the program, but the dialog "
00128                          "will not be closed.\n"
00129                          "Use this to try different settings." ) );
00130 }
00131 
00132 KGuiItem KStdGuiItem::clear()
00133 {
00134   return KGuiItem( i18n( "C&lear" ), "locationbar_erase",
00135                    i18n( "Clear input" ),
00136                    i18n( "Clear the input in the edit field" ) );
00137 }
00138 
00139 KGuiItem KStdGuiItem::help()
00140 {
00141   return KGuiItem( i18n( "show help", "&Help" ), "help",
00142                    i18n( "Show help" ) );
00143 }
00144 
00145 KGuiItem KStdGuiItem::close()
00146 {
00147   return KGuiItem( i18n( "&Close" ), "fileclose",
00148                    i18n( "Close the current window or document" ) );
00149 }
00150 
00151 KGuiItem KStdGuiItem::defaults()
00152 {
00153   return KGuiItem( i18n( "&Defaults" ), "",
00154                    i18n( "Reset all items to their default values" ) );
00155 }
00156 
00157 KGuiItem KStdGuiItem::back( BidiMode useBidi )
00158 {
00159   QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() )
00160                  ? "forward" : "back";
00161   return KGuiItem( i18n( "go back", "&Back" ), icon,
00162                    i18n( "Go back one step" ) );
00163 }
00164 
00165 KGuiItem KStdGuiItem::forward( BidiMode useBidi )
00166 {
00167   QString icon = ( useBidi == UseRTL && QApplication::reverseLayout() )
00168                  ? "back" : "forward";
00169   return KGuiItem( i18n( "go forward", "&Forward" ), icon,
00170                    i18n( "Go forward one step" ) );
00171 }
00172 
00173 QPair<KGuiItem, KGuiItem> KStdGuiItem::backAndForward()
00174 {
00175     return qMakePair( back( UseRTL ), forward( UseRTL ) );
00176 }
00177 
00178 KGuiItem KStdGuiItem::print()
00179 {
00180   return KGuiItem( i18n( "&Print..." ), "fileprint",
00181                    i18n( "Opens the print dialog to print "
00182                          "the current document" ) );
00183 }
00184 
00185 KGuiItem KStdGuiItem::cont()
00186 {
00187   return KGuiItem( i18n( "C&ontinue" ), QString::null,
00188                    i18n( "Continue operation" ) );
00189 }
00190 
00191 KGuiItem KStdGuiItem::open()
00192 {
00193   return KGuiItem( i18n( "&Open..." ), "fileopen",
00194                    i18n( "Open file" ) );
00195 }
00196 
00197 KGuiItem KStdGuiItem::quit()
00198 {
00199   return KGuiItem( i18n( "&Quit" ), "exit",
00200                    i18n( "Quit application" ) );
00201 }
00202 
00203 // vim: set ts=2 sts=2 sw=2 et:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Apr 21 18:43:18 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003