00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "customtemplates_base.h"
00012
00013 #include <qvariant.h>
00014 #include <qpushbutton.h>
00015 #include <klineedit.h>
00016 #include <kpushbutton.h>
00017 #include <qheader.h>
00018 #include <qlistview.h>
00019 #include <kactivelabel.h>
00020 #include <qframe.h>
00021 #include <qlabel.h>
00022 #include <qtextedit.h>
00023 #include <qcombobox.h>
00024 #include <kkeybutton.h>
00025 #include <qlayout.h>
00026 #include <qtooltip.h>
00027 #include <qwhatsthis.h>
00028 #include "templatesinsertcommand.h"
00029 #include "kmfawidgets.h"
00030
00031
00032
00033
00034
00035 CustomTemplatesBase::CustomTemplatesBase( QWidget* parent, const char* name, WFlags fl )
00036 : QWidget( parent, name, fl )
00037 {
00038 grid = new QGridLayout( this, 1, 1, 11, 6, "grid");
00039
00040 layout9 = new QVBoxLayout( 0, 0, 6, "layout9");
00041
00042 layout8 = new QHBoxLayout( 0, 0, 6, "layout8");
00043
00044 mName = new KLineEdit( this, "mName" );
00045 mName->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, mName->sizePolicy().hasHeightForWidth() ) );
00046 mName->setMinimumSize( QSize( 100, 0 ) );
00047 layout8->addWidget( mName );
00048
00049 mAdd = new KPushButton( this, "mAdd" );
00050 layout8->addWidget( mAdd );
00051
00052 mRemove = new KPushButton( this, "mRemove" );
00053 layout8->addWidget( mRemove );
00054 layout9->addLayout( layout8 );
00055
00056 mList = new QListView( this, "mList" );
00057 mList->addColumn( tr2i18n( "Type" ) );
00058 mList->addColumn( tr2i18n( "Name" ) );
00059 mList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 3, 1, mList->sizePolicy().hasHeightForWidth() ) );
00060 mList->setAllColumnsShowFocus( TRUE );
00061 layout9->addWidget( mList );
00062
00063 mHelp = new KActiveLabel( this, "mHelp" );
00064 layout9->addWidget( mHelp );
00065
00066 grid->addLayout( layout9, 0, 0 );
00067
00068 mEditFrame = new QFrame( this, "mEditFrame" );
00069 mEditFrame->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 12, 0, mEditFrame->sizePolicy().hasHeightForWidth() ) );
00070 mEditFrame->setFrameShape( QFrame::NoFrame );
00071 mEditFrame->setFrameShadow( QFrame::Raised );
00072 mEditFrameLayout = new QVBoxLayout( mEditFrame, 0, 6, "mEditFrameLayout");
00073
00074 layout8_2 = new QHBoxLayout( 0, 0, 6, "layout8_2");
00075
00076 layout6 = new QVBoxLayout( 0, 0, 6, "layout6");
00077
00078 mToLabel = new QLabel( mEditFrame, "mToLabel" );
00079 layout6->addWidget( mToLabel );
00080
00081 mCCLabel = new QLabel( mEditFrame, "mCCLabel" );
00082 layout6->addWidget( mCCLabel );
00083 layout8_2->addLayout( layout6 );
00084
00085 layout7 = new QVBoxLayout( 0, 0, 6, "layout7");
00086
00087 mToEdit = new KMFilterActionWithAddressWidget( mEditFrame, "mToEdit" );
00088 layout7->addWidget( mToEdit );
00089
00090 mCCEdit = new KMFilterActionWithAddressWidget( mEditFrame, "mCCEdit" );
00091 layout7->addWidget( mCCEdit );
00092 layout8_2->addLayout( layout7 );
00093 mEditFrameLayout->addLayout( layout8_2 );
00094
00095 mEdit = new QTextEdit( mEditFrame, "mEdit" );
00096 mEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 3, 1, mEdit->sizePolicy().hasHeightForWidth() ) );
00097 mEdit->setTextFormat( QTextEdit::PlainText );
00098 mEdit->setWordWrap( QTextEdit::NoWrap );
00099 mEditFrameLayout->addWidget( mEdit );
00100
00101 layout4 = new QGridLayout( 0, 1, 1, 0, 6, "layout4");
00102
00103 mType = new QComboBox( FALSE, mEditFrame, "mType" );
00104
00105 layout4->addWidget( mType, 1, 2 );
00106
00107 textLabel1_2 = new QLabel( mEditFrame, "textLabel1_2" );
00108 textLabel1_2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00109
00110 layout4->addWidget( textLabel1_2, 0, 1 );
00111
00112 textLabel1 = new QLabel( mEditFrame, "textLabel1" );
00113 textLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 1, 0, textLabel1->sizePolicy().hasHeightForWidth() ) );
00114 textLabel1->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
00115
00116 layout4->addWidget( textLabel1, 1, 1 );
00117
00118 mInsertCommand = new TemplatesInsertCommand( mEditFrame, "mInsertCommand" );
00119
00120 layout4->addWidget( mInsertCommand, 1, 0 );
00121
00122 mKeyButton = new KKeyButton( mEditFrame, "mKeyButton" );
00123
00124 layout4->addWidget( mKeyButton, 0, 2 );
00125 mEditFrameLayout->addLayout( layout4 );
00126
00127 grid->addWidget( mEditFrame, 0, 1 );
00128 languageChange();
00129 resize( QSize(589, 463).expandedTo(minimumSizeHint()) );
00130 clearWState( WState_Polished );
00131
00132
00133 textLabel1_2->setBuddy( mKeyButton );
00134 textLabel1->setBuddy( mType );
00135 }
00136
00137
00138
00139
00140 CustomTemplatesBase::~CustomTemplatesBase()
00141 {
00142
00143 }
00144
00145
00146
00147
00148
00149 void CustomTemplatesBase::languageChange()
00150 {
00151 mAdd->setText( QString::null );
00152 mRemove->setText( QString::null );
00153 mList->header()->setLabel( 0, tr2i18n( "Type" ) );
00154 mList->header()->setLabel( 1, tr2i18n( "Name" ) );
00155 mHelp->setText( tr2i18n( "How does this work?" ) );
00156 mToLabel->setText( tr2i18n( "To:" ) );
00157 mCCLabel->setText( tr2i18n( "CC:" ) );
00158 mType->clear();
00159 mType->insertItem( tr2i18n( "Universal" ) );
00160 mType->insertItem( tr2i18n( "Reply" ) );
00161 mType->insertItem( tr2i18n( "Reply to All" ) );
00162 mType->insertItem( tr2i18n( "Forward" ) );
00163 textLabel1_2->setText( tr2i18n( "Shortc&ut:" ) );
00164 textLabel1->setText( tr2i18n( "&Template type:" ) );
00165 mKeyButton->setText( tr2i18n( "None" ) );
00166 }
00167
00168 void CustomTemplatesBase::mAdd_clicked()
00169 {
00170 qWarning( "CustomTemplatesBase::mAdd_clicked(): Not implemented yet" );
00171 }
00172
00173 void CustomTemplatesBase::mRemove_clicked()
00174 {
00175 qWarning( "CustomTemplatesBase::mRemove_clicked(): Not implemented yet" );
00176 }
00177
00178 #include "customtemplates_base.moc"