summaryrefslogtreecommitdiffabout
path: root/microkde/kmessagebox.cpp
blob: f06708a15af1629734aee4aa9ee972761c29b259 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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 );
}