add more spacing
[personal-kdebase.git] / apps / konqueror / settings / kio / policydlg.h
blob2991791919ba2a701bb62a075488434633232ac5
1 /**
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.
19 #ifndef _POLICYDLG_H
20 #define _POLICYDLG_H
24 #include <kdialog.h>
25 #include "ui_policydlg.h"
28 class PolicyDlgUI : public QWidget, public Ui::PolicyDlgUI
30 public:
31 PolicyDlgUI( QWidget *parent ) : QWidget( parent ) {
32 setupUi( this );
37 class KCookieAdvice
39 public:
40 enum Value {Dunno=0, Accept, Reject, Ask};
42 static const char * adviceToStr (const int& advice)
44 switch (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");
52 default:
53 return I18N_NOOP("Dunno");
57 static KCookieAdvice::Value strToAdvice (const QString& advice)
59 if (advice.isEmpty())
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
75 Q_OBJECT
77 public:
78 explicit PolicyDlg (const QString& caption, QWidget *parent = 0,
79 const char *name = 0);
80 ~PolicyDlg (){}
82 int advice() const;
83 QString domain() const;
85 void setEnableHostEdit( bool, const QString& host = QString() );
86 void setPolicy (int policy);
88 protected Q_SLOTS:
89 void slotTextChanged( const QString& );
91 private:
92 PolicyDlgUI* m_dlgUI;
94 #endif