#include <kdialog.h>
#include <tdelocale.h>

/****************************************************************************
** Form implementation generated from reading ui file 'cryptographyprefsbase.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "cryptographyprefsbase.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <ntqpushbutton.h>
#include <ntqlabel.h>
#include <ntqcheckbox.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqspinbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>

/*
 *  Constructs a CryptographyPrefsUI as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
CryptographyPrefsUI::CryptographyPrefsUI( TQWidget* parent, const char* name, WFlags fl )
    : TQWidget( parent, name, fl )
{
    if ( !name )
	setName( "CryptographyPrefsUI" );
    CryptographyPrefsUILayout = new TQGridLayout( this, 1, 1, 11, 6, "CryptographyPrefsUILayout"); 

    TextLabel1 = new TQLabel( this, "TextLabel1" );

    CryptographyPrefsUILayout->addWidget( TextLabel1, 0, 0 );

    m_selectOwnKey = new TQPushButton( this, "m_selectOwnKey" );

    CryptographyPrefsUILayout->addWidget( m_selectOwnKey, 0, 2 );

    PGP_private_key = new KLineEdit( this, "PGP_private_key" );
    PGP_private_key->setReadOnly( true );

    CryptographyPrefsUILayout->addWidget( PGP_private_key, 0, 1 );

    Also_my_key = new TQCheckBox( this, "Also_my_key" );

    CryptographyPrefsUILayout->addMultiCellWidget( Also_my_key, 1, 1, 0, 2 );
    spacer3 = new TQSpacerItem( 21, 50, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    CryptographyPrefsUILayout->addItem( spacer3, 5, 1 );

    m_cache = new TQButtonGroup( this, "m_cache" );
    m_cache->setColumnLayout(0, TQt::Vertical );
    m_cache->layout()->setSpacing( 6 );
    m_cache->layout()->setMargin( 11 );
    m_cacheLayout = new TQGridLayout( m_cache->layout() );
    m_cacheLayout->setAlignment( TQt::AlignTop );

    Cache_Till_App_Close = new TQRadioButton( m_cache, "Cache_Till_App_Close" );
    Cache_Till_App_Close->setChecked( true );

    m_cacheLayout->addMultiCellWidget( Cache_Till_App_Close, 0, 0, 0, 2 );

    Cache_Time = new TQSpinBox( m_cache, "Cache_Time" );
    Cache_Time->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, Cache_Time->sizePolicy().hasHeightForWidth() ) );
    Cache_Time->setMaxValue( 999 );
    Cache_Time->setMinValue( 1 );
    Cache_Time->setValue( 15 );

    m_cacheLayout->addWidget( Cache_Time, 2, 1 );

    textLabel1 = new TQLabel( m_cache, "textLabel1" );
    textLabel1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)7, (TQSizePolicy::SizeType)0, 0, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );

    m_cacheLayout->addWidget( textLabel1, 2, 2 );

    Cache_Till_Time = new TQRadioButton( m_cache, "Cache_Till_Time" );
    Cache_Till_Time->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, Cache_Till_Time->sizePolicy().hasHeightForWidth() ) );

    m_cacheLayout->addWidget( Cache_Till_Time, 2, 0 );

    Cache_Never = new TQRadioButton( m_cache, "Cache_Never" );

    m_cacheLayout->addMultiCellWidget( Cache_Never, 3, 3, 0, 2 );

    CryptographyPrefsUILayout->addMultiCellWidget( m_cache, 4, 4, 0, 2 );

    No_Passphrase_Handling = new TQCheckBox( this, "No_Passphrase_Handling" );

    CryptographyPrefsUILayout->addMultiCellWidget( No_Passphrase_Handling, 3, 3, 0, 2 );
    languageChange();
    resize( TQSize(403, 287).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( No_Passphrase_Handling, TQ_SIGNAL( toggled(bool) ), m_cache, TQ_SLOT( setDisabled(bool) ) );

    // tab order
    setTabOrder( PGP_private_key, m_selectOwnKey );
    setTabOrder( m_selectOwnKey, Also_my_key );
    setTabOrder( Also_my_key, No_Passphrase_Handling );
    setTabOrder( No_Passphrase_Handling, Cache_Till_App_Close );
    setTabOrder( Cache_Till_App_Close, Cache_Till_Time );
    setTabOrder( Cache_Till_Time, Cache_Time );
    setTabOrder( Cache_Time, Cache_Never );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void CryptographyPrefsUI::languageChange()
{
    TextLabel1->setText( tr2i18n( "Your private PGP key:" ) );
    m_selectOwnKey->setText( tr2i18n( "Select..." ) );
    Also_my_key->setText( tr2i18n( "Encrypt outgoing messages with this key" ) );
    TQWhatsThis::add( Also_my_key, tr2i18n( "<qt>Check this box if you want to encrypt outgoing messages with this key, so that you will be able to decrypt them yourself later.<br>\n"
"<b>Warning:</b> This can increase the size of messages, and some protocols will refuse to send your messages because they are too large." ) );
    m_cache->setTitle( tr2i18n( "Cache Passphrase" ) );
    Cache_Till_App_Close->setText( tr2i18n( "Until Kopete closes" ) );
    textLabel1->setText( tr2i18n( "minutes" ) );
    Cache_Till_Time->setText( tr2i18n( "For" ) );
    Cache_Never->setText( tr2i18n( "Never" ) );
    No_Passphrase_Handling->setText( tr2i18n( "Do not ask for the passphrase" ) );
}

void CryptographyPrefsUI::m_selectOwnKey_clicked()
{
    tqWarning( "CryptographyPrefsUI::m_selectOwnKey_clicked(): Not implemented yet" );
}

void CryptographyPrefsUI::m_selectOwnKey_toggled(bool)
{
    tqWarning( "CryptographyPrefsUI::m_selectOwnKey_toggled(bool): Not implemented yet" );
}

void CryptographyPrefsUI::m_selectOwnKey_stateChanged(int)
{
    tqWarning( "CryptographyPrefsUI::m_selectOwnKey_stateChanged(int): Not implemented yet" );
}

/****************************************************************************
** CryptographyPrefsUI meta object code from reading C++ file 'cryptographyprefsbase.h'
**
** Created by: The TQt Meta Object Compiler version 26 (TQt 3.5.0)
** WARNING! All changes made in this file will be lost!
*****************************************************************************/

#undef TQT_NO_COMPAT
#include "cryptographyprefsbase.h"
#include <ntqmetaobject.h>
#include <ntqapplication.h>

#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.5.0. It"
#error "cannot be used with the include files from this version of TQt."
#error "(The moc has changed too much.)"
#endif

const char *CryptographyPrefsUI::className() const
{
    return "CryptographyPrefsUI";
}

TQMetaObject *CryptographyPrefsUI::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_CryptographyPrefsUI( "CryptographyPrefsUI", &CryptographyPrefsUI::staticMetaObject );

#ifndef TQT_NO_TRANSLATION
TQString CryptographyPrefsUI::tr( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "CryptographyPrefsUI", s, c, TQApplication::DefaultCodec );
    else
	return TQString::fromLatin1( s );
}
#ifndef TQT_NO_TRANSLATION_UTF8
TQString CryptographyPrefsUI::trUtf8( const char *s, const char *c )
{
    if ( tqApp )
	return tqApp->translate( "CryptographyPrefsUI", s, c, TQApplication::UnicodeUTF8 );
    else
	return TQString::fromUtf8( s );
}
#endif // TQT_NO_TRANSLATION_UTF8

#endif // TQT_NO_TRANSLATION

TQMetaObject* CryptographyPrefsUI::staticMetaObject()
{
    if ( metaObj ) {
	return metaObj;
}
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->lock();
    if ( metaObj ) {
	if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
	return metaObj;
    }
#endif // TQT_THREAD_SUPPORT
    TQMetaObject* parentObject = TQWidget::staticMetaObject();
    static const TQUMethod slot_0 = {"m_selectOwnKey_clicked", 0, 0 };
    static const TQUParameter param_slot_1[] = {
	{ 0, &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_1 = {"m_selectOwnKey_toggled", 1, param_slot_1 };
    static const TQUParameter param_slot_2[] = {
	{ 0, &static_QUType_int, 0, TQUParameter::In }
    };
    static const TQUMethod slot_2 = {"m_selectOwnKey_stateChanged", 1, param_slot_2 };
    static const TQUMethod slot_3 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "m_selectOwnKey_clicked()", &slot_0, TQMetaData::Public },
	{ "m_selectOwnKey_toggled(bool)", &slot_1, TQMetaData::Public },
	{ "m_selectOwnKey_stateChanged(int)", &slot_2, TQMetaData::Public },
	{ "languageChange()", &slot_3, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"CryptographyPrefsUI", parentObject,
	slot_tbl, 4,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_CryptographyPrefsUI.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

void* CryptographyPrefsUI::tqt_cast( const char* clname )
{
    if ( !qstrcmp( clname, "CryptographyPrefsUI" ) )
	return this;
    return TQWidget::tqt_cast( clname );
}

bool CryptographyPrefsUI::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: m_selectOwnKey_clicked(); break;
    case 1: m_selectOwnKey_toggled((bool)static_QUType_bool.get(_o+1)); break;
    case 2: m_selectOwnKey_stateChanged((int)static_QUType_int.get(_o+1)); break;
    case 3: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

bool CryptographyPrefsUI::tqt_emit( int _id, TQUObject* _o )
{
    return TQWidget::tqt_emit(_id,_o);
}
#ifndef TQT_NO_PROPERTIES

bool CryptographyPrefsUI::tqt_property( int id, int f, TQVariant* v)
{
    return TQWidget::tqt_property( id, f, v);
}

bool CryptographyPrefsUI::tqt_static_property( TQObject* , int , int , TQVariant* ){ return false; }
#endif // TQT_NO_PROPERTIES
