• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kstandardguiitem.cpp

Go to the documentation of this file.
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 "kstandardguiitem.h"
00020 
00021 #include <QtGui/QApplication>
00022 
00023 #include <kguiitem.h>
00024 #include <klocale.h>
00025 
00026 namespace KStandardGuiItem
00027 {
00028 
00029 KGuiItem guiItem( StandardItem ui_enum )
00030 {
00031   switch (ui_enum ) {
00032   case Ok       : return ok();
00033   case Cancel   : return cancel();
00034   case Yes      : return yes();
00035   case No       : return no();
00036   case Discard  : return discard();
00037   case Save     : return save();
00038   case DontSave : return dontSave();
00039   case SaveAs   : return saveAs();
00040   case Apply    : return apply();
00041   case Clear    : return clear();
00042   case Help     : return help();
00043   case Close    : return close();
00044   case Defaults : return defaults();
00045   case Back     : return back();
00046   case Forward  : return forward();
00047   case Print    : return print();
00048   case Continue : return cont();
00049   case Open     : return open();
00050   case Quit     : return quit();
00051   case AdminMode: return adminMode();
00052   case Reset    : return reset();
00053   case Delete   : return del();
00054   case Insert   : return insert();
00055   case Configure: return configure();
00056   case Find     : return find();
00057   case Stop     : return stop();
00058   case Add      : return add();
00059   case Remove   : return remove();
00060   case Test     : return test();
00061   case Properties : return properties();
00062   case Overwrite : return overwrite();
00063   default       : return KGuiItem();
00064   };
00065 }
00066 
00067 QString standardItem( StandardItem ui_enum )
00068 {
00069   switch (ui_enum ) {
00070   case Ok       : return QLatin1String("ok");
00071   case Cancel   : return QLatin1String("cancel");
00072   case Yes      : return QLatin1String("yes");
00073   case No       : return QLatin1String("no");
00074   case Discard  : return QLatin1String("discard");
00075   case Save     : return QLatin1String("save");
00076   case DontSave : return QLatin1String("dontSave");
00077   case SaveAs   : return QLatin1String("saveAs");
00078   case Apply    : return QLatin1String("apply");
00079   case Help     : return QLatin1String("help");
00080   case Close    : return QLatin1String("close");
00081   case Defaults : return QLatin1String("defaults");
00082   case Back     : return QLatin1String("back");
00083   case Forward  : return QLatin1String("forward");
00084   case Print    : return QLatin1String("print");
00085   case Continue : return QLatin1String("continue");
00086   case Open     : return QLatin1String("open");
00087   case Quit     : return QLatin1String("quit");
00088   case AdminMode: return QLatin1String("adminMode");
00089   case Delete   : return QLatin1String("delete");
00090   case Insert   : return QLatin1String("insert");
00091   case Configure: return QLatin1String("configure");
00092   case Find     : return QLatin1String("find");
00093   case Stop     : return QLatin1String("stop");
00094   case Add      : return QLatin1String("add");
00095   case Remove   : return QLatin1String("remove");
00096   case Test     : return QLatin1String("test");
00097   case Properties : return QLatin1String("properties");
00098   case Overwrite : return QLatin1String("overwrite");
00099   default       : return QString();
00100   };
00101 }
00102 
00103 KGuiItem ok()
00104 {
00105   return KGuiItem( i18n( "&OK" ), "dialog-ok" );
00106 }
00107 
00108 
00109 KGuiItem cancel()
00110 {
00111   return KGuiItem( i18n( "&Cancel" ), "dialog-cancel" );
00112 }
00113 
00114 KGuiItem yes()
00115 {
00116   return KGuiItem( i18n( "&Yes" ), "dialog-ok", i18n( "Yes" ) );
00117 }
00118 
00119 KGuiItem no()
00120 {
00121   return KGuiItem( i18n( "&No" ), "process-stop", i18n( "No" ) );
00122 }
00123 
00124 KGuiItem discard()
00125 {
00126   return KGuiItem( i18n( "&Discard" ), "", i18n( "Discard changes" ),
00127                    i18n( "Pressing this button will discard all recent "
00128                          "changes made in this dialog" ) );
00129 }
00130 
00131 KGuiItem save()
00132 {
00133   return KGuiItem( i18n( "&Save" ), "document-save", i18n( "Save data" ) );
00134 }
00135 
00136 KGuiItem dontSave()
00137 {
00138   return KGuiItem( i18n( "&Do Not Save" ), "",
00139                    i18n( "Do not save data" ) );
00140 }
00141 
00142 KGuiItem saveAs()
00143 {
00144   return KGuiItem( i18n( "Save &As..." ), "document-save-as",
00145                    i18n( "Save file with another name" ) );
00146 }
00147 
00148 KGuiItem apply()
00149 {
00150   return KGuiItem( i18n( "&Apply" ), "dialog-ok-apply", i18n( "Apply changes" ),
00151                    i18n( "When clicking <b>Apply</b>, the settings will be "
00152                          "handed over to the program, but the dialog "
00153                          "will not be closed.\n"
00154                          "Use this to try different settings." ) );
00155 }
00156 
00157 KGuiItem adminMode()
00158 {
00159   return KGuiItem( i18n( "Administrator &Mode..." ), "", i18n( "Enter Administrator Mode" ),
00160                    i18n( "When clicking <b>Administrator Mode</b> you will be prompted "
00161                          "for the administrator (root) password in order to make changes "
00162                          "which require root privileges." ) );
00163 }
00164 
00165 KGuiItem clear()
00166 {
00167   return KGuiItem( i18n( "C&lear" ), "edit-clear",
00168                    i18n( "Clear input" ),
00169                    i18n( "Clear the input in the edit field" ) );
00170 }
00171 
00172 KGuiItem help()
00173 {
00174   return KGuiItem( i18nc( "show help", "&Help" ), "help-contents",
00175                    i18n( "Show help" ) );
00176 }
00177 
00178 KGuiItem close()
00179 {
00180   return KGuiItem( i18n( "&Close" ), "window-close",
00181                    i18n( "Close the current window or document" ) );
00182 }
00183 
00184 KGuiItem defaults()
00185 {
00186   return KGuiItem( i18n( "&Defaults" ), "document-revert",
00187                    i18n( "Reset all items to their default values" ) );
00188 }
00189 
00190 KGuiItem back( BidiMode useBidi )
00191 {
00192   QString icon = ( useBidi == UseRTL && QApplication::isRightToLeft() )
00193                  ? "go-next" : "go-previous";
00194   return KGuiItem( i18nc( "go back", "&Back" ), icon,
00195                    i18n( "Go back one step" ) );
00196 }
00197 
00198 KGuiItem forward( BidiMode useBidi )
00199 {
00200   QString icon = ( useBidi == UseRTL && QApplication::isRightToLeft() )
00201                  ? "go-previous" : "go-next";
00202   return KGuiItem( i18nc( "go forward", "&Forward" ), icon,
00203                    i18n( "Go forward one step" ) );
00204 }
00205 
00206 QPair<KGuiItem, KGuiItem> backAndForward()
00207 {
00208   return qMakePair( back( UseRTL ), forward( UseRTL ) );
00209 }
00210 
00211 KGuiItem print()
00212 {
00213   return KGuiItem( i18n( "&Print..." ), "document-print",
00214                    i18n( "Opens the print dialog to print "
00215                          "the current document" ) );
00216 }
00217 
00218 KGuiItem cont()
00219 {
00220   return KGuiItem( i18n( "C&ontinue" ), QString(),
00221                    i18n( "Continue operation" ) );
00222 }
00223 
00224 KGuiItem del()
00225 {
00226   return KGuiItem( i18n( "&Delete" ), "edit-delete",
00227                    i18n( "Delete item(s)" ) );
00228 }
00229 
00230 KGuiItem open()
00231 {
00232   return KGuiItem( i18n( "&Open..." ), "document-open",
00233                    i18n( "Open file" ) );
00234 }
00235 
00236 KGuiItem quit()
00237 {
00238   return KGuiItem( i18n( "&Quit" ), "application-exit",
00239                    i18n( "Quit application" ) );
00240 }
00241 
00242 KGuiItem reset()
00243 {
00244   return KGuiItem( i18n( "&Reset" ), "edit-undo",
00245                   i18n( "Reset configuration" ) );
00246 }
00247 
00248 KGuiItem insert()
00249 {
00250   return KGuiItem( i18nc( "Verb", "&Insert" ) );
00251 }
00252 
00253 KGuiItem configure()
00254 {
00255   return KGuiItem( i18n( "Confi&gure..." ), "configure" );
00256 }
00257 
00258 KGuiItem find()
00259 {
00260   return KGuiItem(i18n("&Find"), "edit-find");
00261 }
00262 
00263 KGuiItem stop()
00264 {
00265   return KGuiItem(i18n("Stop"), "process-stop");
00266 }
00267 
00268 KGuiItem add()
00269 {
00270   return KGuiItem(i18n("Add"), "list-add");
00271 }
00272 
00273 KGuiItem remove()
00274 {
00275   return KGuiItem(i18n("Remove"), "list-remove");
00276 }
00277 
00278 KGuiItem test()
00279 {
00280   return KGuiItem(i18n("Test"));
00281 }
00282 
00283 KGuiItem properties()
00284 {
00285   return KGuiItem(i18n("Properties"), "document-properties");
00286 }
00287 
00288 KGuiItem overwrite()
00289 {
00290   return KGuiItem(i18n("&Overwrite"));
00291 }
00292 
00293 } // KStandardGuiItem namespace
00294 

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal