#include <kdialog.h>
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/usr/src/ports/kdebase3/kdebase3-3.5.10-11.x86_64/src/kdebase-3.5.10/kcontrol/kio/kcookiespoliciesdlg_ui.ui'
**
** Created by User Interface Compiler
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "kcookiespoliciesdlg_ui.h"

#include <qvariant.h>
#include <kdialog.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qheader.h>
#include <klistview.h>
#include <qtoolbutton.h>
#include <qlabel.h>
#include <klistviewsearchline.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include "klistview.h"
#include "klistviewsearchline.h"

/*
 *  Constructs a KCookiesPolicyDlgUI as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
KCookiesPolicyDlgUI::KCookiesPolicyDlgUI( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "KCookiesPolicyDlgUI" );
    KCookiesPolicyDlgUILayout = new QGridLayout( this, 1, 1, KDialog::marginHint(), KDialog::spacingHint(), "KCookiesPolicyDlgUILayout"); 

    cbEnableCookies = new QCheckBox( this, "cbEnableCookies" );

    KCookiesPolicyDlgUILayout->addWidget( cbEnableCookies, 0, 0 );

    bgPreferences = new QGroupBox( this, "bgPreferences" );
    bgPreferences->setColumnLayout(0, Qt::Vertical );
    bgPreferences->layout()->setSpacing( KDialog::spacingHint() );
    bgPreferences->layout()->setMargin( KDialog::marginHint() );
    bgPreferencesLayout = new QVBoxLayout( bgPreferences->layout() );
    bgPreferencesLayout->setAlignment( Qt::AlignTop );

    cbRejectCrossDomainCookies = new QCheckBox( bgPreferences, "cbRejectCrossDomainCookies" );
    bgPreferencesLayout->addWidget( cbRejectCrossDomainCookies );

    cbAutoAcceptSessionCookies = new QCheckBox( bgPreferences, "cbAutoAcceptSessionCookies" );
    bgPreferencesLayout->addWidget( cbAutoAcceptSessionCookies );

    cbIgnoreCookieExpirationDate = new QCheckBox( bgPreferences, "cbIgnoreCookieExpirationDate" );
    bgPreferencesLayout->addWidget( cbIgnoreCookieExpirationDate );

    KCookiesPolicyDlgUILayout->addWidget( bgPreferences, 1, 0 );

    bgDefault = new QButtonGroup( this, "bgDefault" );
    bgDefault->setExclusive( TRUE );
    bgDefault->setColumnLayout(0, Qt::Vertical );
    bgDefault->layout()->setSpacing( KDialog::spacingHint() );
    bgDefault->layout()->setMargin( KDialog::marginHint() );
    bgDefaultLayout = new QVBoxLayout( bgDefault->layout() );
    bgDefaultLayout->setAlignment( Qt::AlignTop );

    rbPolicyAsk = new QRadioButton( bgDefault, "rbPolicyAsk" );
    bgDefaultLayout->addWidget( rbPolicyAsk );

    rbPolicyAccept = new QRadioButton( bgDefault, "rbPolicyAccept" );
    bgDefaultLayout->addWidget( rbPolicyAccept );

    rbPolicyReject = new QRadioButton( bgDefault, "rbPolicyReject" );
    bgDefaultLayout->addWidget( rbPolicyReject );

    KCookiesPolicyDlgUILayout->addWidget( bgDefault, 2, 0 );

    gbDomainSpecific = new QGroupBox( this, "gbDomainSpecific" );
    gbDomainSpecific->setColumnLayout(0, Qt::Vertical );
    gbDomainSpecific->layout()->setSpacing( KDialog::spacingHint() );
    gbDomainSpecific->layout()->setMargin( KDialog::marginHint() );
    gbDomainSpecificLayout = new QGridLayout( gbDomainSpecific->layout() );
    gbDomainSpecificLayout->setAlignment( Qt::AlignTop );
    spacer1 = new QSpacerItem( 20, 16, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding );
    gbDomainSpecificLayout->addItem( spacer1, 2, 1 );

    layout3 = new QVBoxLayout( 0, 0, KDialog::spacingHint(), "layout3"); 

    pbNew = new QPushButton( gbDomainSpecific, "pbNew" );
    layout3->addWidget( pbNew );

    pbChange = new QPushButton( gbDomainSpecific, "pbChange" );
    layout3->addWidget( pbChange );

    pbDelete = new QPushButton( gbDomainSpecific, "pbDelete" );
    layout3->addWidget( pbDelete );

    pbDeleteAll = new QPushButton( gbDomainSpecific, "pbDeleteAll" );
    layout3->addWidget( pbDeleteAll );

    gbDomainSpecificLayout->addMultiCellLayout( layout3, 0, 1, 1, 1 );

    lvDomainPolicy = new KListView( gbDomainSpecific, "lvDomainPolicy" );
    lvDomainPolicy->addColumn( tr2i18n( "Domain" ) );
    lvDomainPolicy->addColumn( tr2i18n( "Policy" ) );
    lvDomainPolicy->setProperty( "selectionMode", "Extended" );
    lvDomainPolicy->setShowSortIndicator( TRUE );
    lvDomainPolicy->setRootIsDecorated( TRUE );
    lvDomainPolicy->setTreeStepSize( 0 );

    gbDomainSpecificLayout->addMultiCellWidget( lvDomainPolicy, 1, 2, 0, 0 );

    layout2 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "layout2"); 

    tbClearSearchLine = new QToolButton( gbDomainSpecific, "tbClearSearchLine" );
    layout2->addWidget( tbClearSearchLine );

    textLabel1 = new QLabel( gbDomainSpecific, "textLabel1" );
    layout2->addWidget( textLabel1 );

    kListViewSearchLine = new KListViewSearchLine( gbDomainSpecific, "kListViewSearchLine" );
    layout2->addWidget( kListViewSearchLine );

    gbDomainSpecificLayout->addLayout( layout2, 0, 0 );

    KCookiesPolicyDlgUILayout->addWidget( gbDomainSpecific, 3, 0 );
    languageChange();
    resize( QSize(444, 552).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( tbClearSearchLine, SIGNAL( clicked() ), kListViewSearchLine, SLOT( clear() ) );

    // buddies
    textLabel1->setBuddy( kListViewSearchLine );
}

/*
 *  Destroys the object and frees any allocated resources
 */
KCookiesPolicyDlgUI::~KCookiesPolicyDlgUI()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KCookiesPolicyDlgUI::languageChange()
{
    cbEnableCookies->setText( tr2i18n( "Enable coo&kies" ) );
    QWhatsThis::add( cbEnableCookies, tr2i18n( "<qt>\n"
"Enable cookie support. Normally you will want to have cookie support enabled and customize it to suit your privacy needs.<p>\n"
"Please note that disabling cookie support might make many web sites unbrowsable.\n"
"</qt>" ) );
    bgPreferences->setTitle( QString::null );
    cbRejectCrossDomainCookies->setText( tr2i18n( "Only acce&pt cookies from originating server" ) );
    QWhatsThis::add( cbRejectCrossDomainCookies, tr2i18n( "<qt>\n"
"Reject the so called third-party cookies. These are cookies that originate from a site other than the one you are currently browsing. For example, if you visit <b>www.foobar.com</b> while this option is on, only cookies that originate from www.foobar.com will be processed per your settings. Cookies from any other site will be rejected. This reduces the chances of site operators compiling a profile about your daily browsing habits.\n"
"</qt>" ) );
    cbAutoAcceptSessionCookies->setText( tr2i18n( "Automaticall&y accept session cookies" ) );
    QWhatsThis::add( cbAutoAcceptSessionCookies, tr2i18n( "<qt>\n"
"Automatically accept temporary cookies meant to expire at the end of the current session. Such cookies will not be stored in your computer's hard drive or storage device. Instead, they are deleted when you close all applications (e.g. your browser) that use them.<p>\n"
"<u>NOTE:</u> Checking this option along with the next one will override your default as well as site specific cookie policies. However, doing so also increases your privacy since all cookies will be removed when the current session ends.\n"
"</qt>" ) );
    cbIgnoreCookieExpirationDate->setText( tr2i18n( "Treat &all cookies as session cookies" ) );
    QWhatsThis::add( cbIgnoreCookieExpirationDate, tr2i18n( "<qt>\n"
"Treat all cookies as session cookies. Session cookies are small pieces of data that are temporarily stored in your computer's memory until you quit or close all applications (e.g. your browser) that use them. Unlike regular cookies, session cookies are never stored on your hard drive or other storage medium.<p>\n"
"<u>NOTE:</u> Checking this option along with the previous one will override your default as well as site specific cookie policies. However, doing so also increases your privacy since all cookies will be removed when the current session ends.\n"
"</qt>" ) );
    bgDefault->setTitle( tr2i18n( "Default Policy" ) );
    QWhatsThis::add( bgDefault, tr2i18n( "<qt>\n"
"Determines how cookies received from a remote machine will be handled: \n"
"<ul>\n"
"<li><b>Ask</b> will cause KDE to ask for your confirmation whenever a server wants to set a cookie.\"</li>\n"
"<li><b>Accept</b> will cause cookies to be accepted without prompting you.</li>\n"
"<li><b>Reject</b> will cause the cookiejar to refuse all cookies it receives.</li>\n"
"</ul><p>\n"
"<u>NOTE:</u> Domain specific policies, which can be set below, always take precedence over the default policy.\n"
"</qt>" ) );
    rbPolicyAsk->setText( tr2i18n( "Ask &for confirmation" ) );
    rbPolicyAccept->setText( tr2i18n( "Accep&t all cookies" ) );
    rbPolicyReject->setText( tr2i18n( "Re&ject all cookies" ) );
    gbDomainSpecific->setTitle( tr2i18n( "Site Policy" ) );
    QWhatsThis::add( gbDomainSpecific, tr2i18n( "<qt>\n"
"To add a new policy, simply click on the <b>Add...</b> button and supply the necessary information. To change an existing policy, use the <b>Change...</b> button and choose the new policy from the policy dialog box. Clicking on the <b>Delete</b> button will remove the currently selected policy causing the default policy setting to be used for that domain whereas <b>Delete All</b> will remove all the site specific policies.\n"
"</qt>" ) );
    pbNew->setText( tr2i18n( "&New..." ) );
    pbChange->setText( tr2i18n( "Chan&ge..." ) );
    pbDelete->setText( tr2i18n( "D&elete" ) );
    pbDeleteAll->setText( tr2i18n( "Delete A&ll" ) );
    lvDomainPolicy->header()->setLabel( 0, tr2i18n( "Domain" ) );
    lvDomainPolicy->header()->setLabel( 1, tr2i18n( "Policy" ) );
    QWhatsThis::add( lvDomainPolicy, tr2i18n( "<qt>\n"
"List of sites for which you have set a specific cookie policy. Specific policies override the default policy setting for these sites.\n"
"</qt>" ) );
    tbClearSearchLine->setText( tr2i18n( "..." ) );
    tbClearSearchLine->setTextLabel( tr2i18n( "Clear Search" ) );
    textLabel1->setText( tr2i18n( "&Search:" ) );
    kListViewSearchLine->setText( QString::null );
    QToolTip::add( kListViewSearchLine, tr2i18n( "Search interactively for domains" ) );
}

#include "kcookiespoliciesdlg_ui.moc"
