From e97a6da57804aa14907dec327fbae71bff9b383e Mon Sep 17 00:00:00 2001 From: jowenn Date: Sun, 10 Nov 2002 21:08:01 +0000 Subject: import of tiny kate. (saving not possible yet) --- (limited to 'noncore/apps/tinykate/libkate/microkde/kmessagebox.cpp') diff --git a/noncore/apps/tinykate/libkate/microkde/kmessagebox.cpp b/noncore/apps/tinykate/libkate/microkde/kmessagebox.cpp new file mode 100644 index 0000000..fd305cd --- a/dev/null +++ b/noncore/apps/tinykate/libkate/microkde/kmessagebox.cpp @@ -0,0 +1,90 @@ +#include "kmessagebox.h" +#include "klocale.h" + +#include + +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::warningYesNoCancel(QWidget *parent, const QString &text) +{ + int result = QMessageBox::warning(parent,i18n("Warning"),text,QMessageBox::Yes, + QMessageBox::No, QMessageBox::Cancel); + switch (result) { + case QMessageBox::Yes: return Yes; + case QMessageBox::No: return No; + case QMessageBox::Cancel: return Cancel; + } +} + +int KMessageBox::questionYesNo(QWidget *parent, + const QString &text, + const QString &textYes, + const QString &textNo, + bool notify=true ) +{ + int result =QMessageBox::warning(parent,i18n("Question"),text,textYes,textNo); + if ( result == 0 ) return KMessageBox::Yes; + return KMessageBox::No; +} + + + + +int KMessageBox::warningContinueCancel( QWidget *parent, + const QString &text, + const QString &caption, + const QString &buttonContinue, + const QString &dontAskAgainName, + bool notify ) +{ + QString cap = caption; + + if (cap.isEmpty()) { + cap = i18n("Warning"); + } + + int result = QMessageBox::warning( parent, cap, text, i18n("Ok"), + i18n("Cancel") ); + + if ( result == 0 ) return KMessageBox::Continue; + return KMessageBox::Cancel; +} + +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 ); +} -- cgit v0.9.0.2