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

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

#include "conf_encryption.h"

#include <ntqvariant.h>
#include <klineedit.h>
#include <kpushbutton.h>
#include <ntqcheckbox.h>
#include <ntqlabel.h>
#include <ntqtoolbutton.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include "conf_encryption.ui.h"

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

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

    EncryptionLayout->addMultiCellWidget( kcfg_PgpCompatibility, 2, 2, 0, 3 );

    kcfg_AsciiArmor = new TQCheckBox( this, "kcfg_AsciiArmor" );
    kcfg_AsciiArmor->setMinimumSize( TQSize( 0, 0 ) );

    EncryptionLayout->addMultiCellWidget( kcfg_AsciiArmor, 0, 0, 0, 3 );

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

    EncryptionLayout->addMultiCellWidget( kcfg_HideUserID, 3, 3, 0, 3 );

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

    EncryptionLayout->addMultiCellWidget( kcfg_ShredSource, 4, 4, 0, 3 );

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

    EncryptionLayout->addMultiCellWidget( kcfg_AllowUntrustedKeys, 1, 1, 0, 3 );
    spacer7 = new TQSpacerItem( 20, 72, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
    EncryptionLayout->addItem( spacer7, 9, 0 );

    layout3 = new TQHBoxLayout( 0, 0, 6, "layout3"); 

    kcfg_AllowCustomEncryptionOptions = new TQCheckBox( this, "kcfg_AllowCustomEncryptionOptions" );
    kcfg_AllowCustomEncryptionOptions->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)0, 0, 0, kcfg_AllowCustomEncryptionOptions->sizePolicy().hasHeightForWidth() ) );
    layout3->addWidget( kcfg_AllowCustomEncryptionOptions );

    kcfg_CustomEncryptionOptions = new KLineEdit( this, "kcfg_CustomEncryptionOptions" );
    kcfg_CustomEncryptionOptions->setEnabled( false );
    kcfg_CustomEncryptionOptions->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)3, (TQSizePolicy::SizeType)0, 0, 0, kcfg_CustomEncryptionOptions->sizePolicy().hasHeightForWidth() ) );
    layout3->addWidget( kcfg_CustomEncryptionOptions );

    EncryptionLayout->addMultiCellLayout( layout3, 7, 7, 0, 3 );

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

    EncryptionLayout->addMultiCellWidget( kcfg_PgpExtension, 8, 8, 0, 3 );

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

    EncryptionLayout->addWidget( textLabel1, 6, 0 );

    kcfg_FileKey = new KLineEdit( this, "kcfg_FileKey" );
    kcfg_FileKey->setFrameShape( KLineEdit::Panel );
    kcfg_FileKey->setLineWidth( 1 );
    kcfg_FileKey->setReadOnly( true );

    EncryptionLayout->addWidget( kcfg_FileKey, 6, 1 );

    clear_fkey = new TQToolButton( this, "clear_fkey" );
    clear_fkey->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)1, 0, 0, clear_fkey->sizePolicy().hasHeightForWidth() ) );

    EncryptionLayout->addWidget( clear_fkey, 6, 2 );

    change_fkey = new KPushButton( this, "change_fkey" );
    change_fkey->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)1, 0, 0, change_fkey->sizePolicy().hasHeightForWidth() ) );

    EncryptionLayout->addWidget( change_fkey, 6, 3 );

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

    EncryptionLayout->addWidget( textLabel1_2, 5, 0 );

    alwaysKey = new KLineEdit( this, "alwaysKey" );
    alwaysKey->setFrameShape( KLineEdit::Panel );
    alwaysKey->setLineWidth( 1 );
    alwaysKey->setReadOnly( true );

    EncryptionLayout->addWidget( alwaysKey, 5, 1 );

    change_akey = new KPushButton( this, "change_akey" );
    change_akey->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)1, 0, 0, change_akey->sizePolicy().hasHeightForWidth() ) );

    EncryptionLayout->addWidget( change_akey, 5, 3 );

    clear_akey = new TQToolButton( this, "clear_akey" );
    clear_akey->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)0, (TQSizePolicy::SizeType)1, 0, 0, clear_akey->sizePolicy().hasHeightForWidth() ) );

    EncryptionLayout->addWidget( clear_akey, 5, 2 );
    languageChange();
    resize( TQSize(538, 389).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( kcfg_AllowCustomEncryptionOptions, TQ_SIGNAL( toggled(bool) ), this, TQ_SLOT( allow_custom_option_toggled(bool) ) );

    // tab order
    setTabOrder( kcfg_AsciiArmor, kcfg_AllowUntrustedKeys );
    setTabOrder( kcfg_AllowUntrustedKeys, kcfg_PgpCompatibility );
    setTabOrder( kcfg_PgpCompatibility, kcfg_HideUserID );
    setTabOrder( kcfg_HideUserID, kcfg_ShredSource );
    setTabOrder( kcfg_ShredSource, alwaysKey );
    setTabOrder( alwaysKey, change_akey );
    setTabOrder( change_akey, kcfg_FileKey );
    setTabOrder( kcfg_FileKey, change_fkey );
    setTabOrder( change_fkey, kcfg_AllowCustomEncryptionOptions );
    setTabOrder( kcfg_AllowCustomEncryptionOptions, kcfg_CustomEncryptionOptions );
    setTabOrder( kcfg_CustomEncryptionOptions, kcfg_PgpExtension );
}

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

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void Encryption::languageChange()
{
    setCaption( tr2i18n( "Encryption" ) );
    kcfg_PgpCompatibility->setText( tr2i18n( "PGP &6 compatibility" ) );
    TQWhatsThis::add( kcfg_PgpCompatibility, tr2i18n( "<qt><b>PGP 6 compatibility:</b><br /> \n"
"		<p>Checking this option forces GnuPG to output encrypted packets that are as compliant with PGP (Pretty Good Privacy) 6 standards as possible thus allowing GnuPG users to inter operate with PGP 6 users.</p></qt>" ) );
    kcfg_AsciiArmor->setText( tr2i18n( "ASCII armored encryption" ) );
    TQWhatsThis::add( kcfg_AsciiArmor, tr2i18n( "<qt><b>ASCII armored encryption:</b> <br /> \n"
"		<p>Checking this option outputs all encrypted files in a format that can be opened by a text editor and as such the output is suitable for placing in the body of an e-mail message.</p></qt>" ) );
    kcfg_HideUserID->setText( tr2i18n( "Hide user id" ) );
    TQWhatsThis::add( kcfg_HideUserID, tr2i18n( "<qt><b>Hide user ID:</b><br /> \n"
"		<p>Checking this option will remove the keyid of the recipient from all encrypted packets. The advantage: traffic analysis of the encrypted packets cannot be performed as easily because the recipient is unknown. The disadvantage: the receiver of the encrypted packets is forced to try all secret keys before being able to decrypt the packets. This can be a lengthy process depending on the number of secret keys the receiver holds.</p></qt>" ) );
    kcfg_ShredSource->setText( tr2i18n( "Shred source file" ) );
    TQWhatsThis::add( kcfg_ShredSource, tr2i18n( "<qt><b>Shred source file:</b><br /> \n"
"		<p>Checking this option will shred (overwrite several times before erasing) the files you have encrypted. This way, it is almost impossible that the source file is recovered. But <b>you must be aware that this is not 100% secure</b> on all file systems, and that parts of the file may have been saved in a temporary file or in the spooler of your printer if you previously opened it in an editor or tried to print it. Only works on files (not on folders).</p></qt>" ) );
    kcfg_AllowUntrustedKeys->setText( tr2i18n( "Allow encryption with untrusted keys" ) );
    TQWhatsThis::add( kcfg_AllowUntrustedKeys, tr2i18n( "<qt><b>Allow encryption with untrusted keys:</b> <br />\n"
"		<p>When importing a public key, the key is usually marked as untrusted and as such cannot be used unless it is signed by the default key (Thus, making it 'trusted'). Checking this box enables any key to be used even if it is untrusted.</p></qt>" ) );
    kcfg_AllowCustomEncryptionOptions->setText( tr2i18n( "Custom encryption command:" ) );
    TQWhatsThis::add( kcfg_AllowCustomEncryptionOptions, tr2i18n( "<qt><b>Custom encryption command:</b> <br />\n"
"			<p>When activated, an entry field will be shown in the key selection dialog, enabling you to enter a custom command for encryption. This option is recommended for experienced users only.</p></qt>" ) );
    kcfg_PgpExtension->setText( tr2i18n( "Use *.pgp extension for encrypted files" ) );
    TQWhatsThis::add( kcfg_PgpExtension, tr2i18n( "<qt><b>Use *.pgp extension for encrypted files:</b><br />\n"
"		<p>Checking this option will append a .pgp extension to all encrypted files instead of a .gpg extension. This option will maintain compatibility with users of PGP (Pretty Good Privacy) software.</p></qt>" ) );
    textLabel1->setText( tr2i18n( "Encrypt files with:" ) );
    TQWhatsThis::add( kcfg_FileKey, tr2i18n( "<qt><b>Encrypt files with:</b><br /> \n"
"<p>Checking this option and selecting a key will force any file encryption operation to use the selected key. KGpg will not query for a recipient and the default key will be bypassed.</p></qt>" ) );
    clear_fkey->setText( tr2i18n( "..." ) );
    change_fkey->setText( tr2i18n( "Change..." ) );
    textLabel1_2->setText( tr2i18n( "Always encrypt with:" ) );
    TQWhatsThis::add( alwaysKey, tr2i18n( "<qt><b>Always encrypt with:</b><br /> \n"
"<p>This ensures all files/messages will also be encrypted with the chosen key. However, if the \"Encrypt files with:\" option is selected that chosen key will override the \"Always encrypt with:\" selection.</p></qt>" ) );
    change_akey->setText( tr2i18n( "Change..." ) );
    clear_akey->setText( tr2i18n( "..." ) );
}

/****************************************************************************
** Encryption meta object code from reading C++ file 'conf_encryption.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 "conf_encryption.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 *Encryption::className() const
{
    return "Encryption";
}

TQMetaObject *Encryption::metaObj = 0;
static TQMetaObjectCleanUp cleanUp_Encryption( "Encryption", &Encryption::staticMetaObject );

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

#endif // TQT_NO_TRANSLATION

TQMetaObject* Encryption::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 TQUParameter param_slot_0[] = {
	{ "isOn", &static_QUType_bool, 0, TQUParameter::In }
    };
    static const TQUMethod slot_0 = {"allow_custom_option_toggled", 1, param_slot_0 };
    static const TQUMethod slot_1 = {"languageChange", 0, 0 };
    static const TQMetaData slot_tbl[] = {
	{ "allow_custom_option_toggled(bool)", &slot_0, TQMetaData::Public },
	{ "languageChange()", &slot_1, TQMetaData::Protected }
    };
    metaObj = TQMetaObject::new_metaobject(
	"Encryption", parentObject,
	slot_tbl, 2,
	0, 0,
#ifndef TQT_NO_PROPERTIES
	0, 0,
	0, 0,
#endif // TQT_NO_PROPERTIES
	0, 0 );
    cleanUp_Encryption.setMetaObject( metaObj );
#ifdef TQT_THREAD_SUPPORT
    if (tqt_sharedMetaObjectMutex) tqt_sharedMetaObjectMutex->unlock();
#endif // TQT_THREAD_SUPPORT
    return metaObj;
}

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

bool Encryption::tqt_invoke( int _id, TQUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: allow_custom_option_toggled((bool)static_QUType_bool.get(_o+1)); break;
    case 1: languageChange(); break;
    default:
	return TQWidget::tqt_invoke( _id, _o );
    }
    return true;
}

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

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

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