kstdguiitem.cpp Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

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

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:57:44 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001