2 * Copyright (c) 2000- Dawit Alemayehu <adawit@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include "ui_policydlg.h"
28 class PolicyDlgUI
: public QWidget
, public Ui::PolicyDlgUI
31 PolicyDlgUI( QWidget
*parent
) : QWidget( parent
) {
40 enum Value
{Dunno
=0, Accept
, Reject
, Ask
};
42 static const char * adviceToStr (const int& advice
)
46 case KCookieAdvice::Accept
:
47 return I18N_NOOP("Accept");
48 case KCookieAdvice::Reject
:
49 return I18N_NOOP("Reject");
50 case KCookieAdvice::Ask
:
51 return I18N_NOOP("Ask");
53 return I18N_NOOP("Dunno");
57 static KCookieAdvice::Value
strToAdvice (const QString
& advice
)
60 return KCookieAdvice::Dunno
;
62 if (advice
.indexOf (QLatin1String("accept"), 0, Qt::CaseInsensitive
) == 0)
63 return KCookieAdvice::Accept
;
64 else if (advice
.indexOf (QLatin1String("reject"), 0, Qt::CaseInsensitive
) == 0)
65 return KCookieAdvice::Reject
;
66 else if (advice
.indexOf (QLatin1String("ask"), 0, Qt::CaseInsensitive
) == 0)
67 return KCookieAdvice::Ask
;
69 return KCookieAdvice::Dunno
;
73 class PolicyDlg
: public KDialog
78 explicit PolicyDlg (const QString
& caption
, QWidget
*parent
= 0,
79 const char *name
= 0);
83 QString
domain() const;
85 void setEnableHostEdit( bool, const QString
& host
= QString() );
86 void setPolicy (int policy
);
89 void slotTextChanged( const QString
& );