author | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-06-26 19:01:18 (UTC) |
commit | b9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (side-by-side diff) | |
tree | 2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kmessagebox.cpp | |
download | kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2 |
Initial revision
-rw-r--r-- | microkde/kmessagebox.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/microkde/kmessagebox.cpp b/microkde/kmessagebox.cpp new file mode 100644 index 0000000..f06708a --- a/dev/null +++ b/microkde/kmessagebox.cpp @@ -0,0 +1,90 @@ +#include "kmessagebox.h" +#include "klocale.h" + +#include <qmessagebox.h> + +void KMessageBox::sorry( QWidget *parent, + const QString &text, + const QString &caption, bool ) +{ + QString cap = caption; + + if (cap.isEmpty()) { + cap = i18n("Sorry"); + } + + QMessageBox::warning( parent, cap, text ); +} + +int KMessageBox::warningContinueCancel( QWidget *parent, + const QString &text, + const QString &caption, + const QString &buttonContinue, + const QString &dontAskAgainName, + bool notify ) +{ + QString cap = caption; + + int result = QMessageBox::warning( parent, cap, text, buttonContinue, + dontAskAgainName); + + if ( result == 0 ) return KMessageBox::Continue; + return KMessageBox::Cancel; +} + +int KMessageBox::warningYesNoCancel( QWidget *parent, + const QString &text, + const QString &caption, + const QString &buttonYes, + const QString &buttonNo ) +{ + QString cap = caption; + + int result = QMessageBox::warning( parent, cap, text,buttonYes ,buttonNo, + i18n("Cancel") ); + + if ( result == 0 ) return KMessageBox::Yes; + else if ( result == 1 ) return KMessageBox::No; + return KMessageBox::Cancel; +} + +int KMessageBox::questionYesNo(QWidget *parent, + const QString &text, + const QString &caption) +{ + QString cap = caption; + + int result = QMessageBox::warning( parent, cap, text, i18n("Yes"), + i18n("No") ); + + if ( result == 0 ) return KMessageBox::Yes; + else return KMessageBox::No; +} + +void KMessageBox::error( QWidget *parent, + const QString &text, + const QString &caption, bool notify ) +{ + QString cap = caption; + + if (cap.isEmpty()) { + cap = i18n("Error"); + } + + QMessageBox::critical( parent, cap, text ); +} + +void KMessageBox::information( QWidget *parent, + const QString &text, + const QString &caption, + const QString &, + bool ) +{ + QString cap = caption; + + if (cap.isEmpty()) { + cap = i18n("Information"); + } + + QMessageBox::information( parent, cap, text ); +} |