00001 #include "kmessagebox.h"
00002 #include "klocale.h"
00003
00004 #include <qmessagebox.h>
00005
00006 void KMessageBox::sorry( QWidget *parent,
00007 const QString &text,
00008 const QString &caption, bool )
00009 {
00010 QString cap = caption;
00011
00012 if (cap.isEmpty()) {
00013 cap = i18n("Sorry");
00014 }
00015
00016 QMessageBox::warning( parent, cap, text );
00017 }
00018
00019 int KMessageBox::warningYesNoCancel(QWidget *parent, const QString &text)
00020 {
00021 int result = QMessageBox::warning(parent,i18n("Warning"),text,QMessageBox::Yes,
00022 QMessageBox::No, QMessageBox::Cancel);
00023 switch (result) {
00024 case QMessageBox::Yes: return Yes;
00025 case QMessageBox::No: return No;
00026 case QMessageBox::Cancel: return Cancel;
00027 }
00028 }
00029
00030 int KMessageBox::questionYesNo(QWidget *parent,
00031 const QString &text,
00032 const QString &textYes,
00033 const QString &textNo,
00034 bool notify )
00035 {
00036 int result =QMessageBox::warning(parent,i18n("Question"),text,textYes,textNo);
00037 if ( result == 0 ) return KMessageBox::Yes;
00038 return KMessageBox::No;
00039 }
00040
00041
00042
00043
00044 int KMessageBox::warningContinueCancel( QWidget *parent,
00045 const QString &text,
00046 const QString &caption,
00047 const QString &buttonContinue,
00048 const QString &dontAskAgainName,
00049 bool notify )
00050 {
00051 QString cap = caption;
00052
00053 if (cap.isEmpty()) {
00054 cap = i18n("Warning");
00055 }
00056
00057 int result = QMessageBox::warning( parent, cap, text, i18n("Ok"),
00058 i18n("Cancel") );
00059
00060 if ( result == 0 ) return KMessageBox::Continue;
00061 return KMessageBox::Cancel;
00062 }
00063
00064 void KMessageBox::error( QWidget *parent,
00065 const QString &text,
00066 const QString &caption, bool notify )
00067 {
00068 QString cap = caption;
00069
00070 if (cap.isEmpty()) {
00071 cap = i18n("Error");
00072 }
00073
00074 QMessageBox::critical( parent, cap, text );
00075 }
00076
00077 void KMessageBox::information( QWidget *parent,
00078 const QString &text,
00079 const QString &caption,
00080 const QString &,
00081 bool )
00082 {
00083 QString cap = caption;
00084
00085 if (cap.isEmpty()) {
00086 cap = i18n("Information");
00087 }
00088
00089 QMessageBox::information( parent, cap, text );
00090 }