00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "snippetdlgbase.h"
00013
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <kpushbutton.h>
00017 #include <klineedit.h>
00018 #include <qlabel.h>
00019 #include <kcombobox.h>
00020 #include <ktextedit.h>
00021 #include <qlayout.h>
00022 #include <qtooltip.h>
00023 #include <qwhatsthis.h>
00024
00025
00026
00027
00028
00029
00030
00031
00032 SnippetDlgBase::SnippetDlgBase( QWidget* parent, const char* name, bool modal, WFlags fl )
00033 : QDialog( parent, name, modal, fl )
00034 {
00035 if ( !name )
00036 setName( "SnippetDlgBase" );
00037 SnippetDlgBaseLayout = new QGridLayout( this, 1, 1, 11, 6, "SnippetDlgBaseLayout");
00038
00039 layout5 = new QHBoxLayout( 0, 0, 6, "layout5");
00040 spacer1 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00041 layout5->addItem( spacer1 );
00042
00043 btnAdd = new KPushButton( this, "btnAdd" );
00044 layout5->addWidget( btnAdd );
00045
00046 btnCancel = new KPushButton( this, "btnCancel" );
00047 layout5->addWidget( btnCancel );
00048
00049 SnippetDlgBaseLayout->addLayout( layout5, 1, 0 );
00050
00051 layout3 = new QGridLayout( 0, 1, 1, 0, 6, "layout3");
00052
00053 snippetName = new KLineEdit( this, "snippetName" );
00054
00055 layout3->addWidget( snippetName, 0, 1 );
00056 spacer2 = new QSpacerItem( 20, 80, QSizePolicy::Minimum, QSizePolicy::Expanding );
00057 layout3->addItem( spacer2, 4, 0 );
00058
00059 textLabel1 = new QLabel( this, "textLabel1" );
00060
00061 layout3->addWidget( textLabel1, 0, 0 );
00062
00063 textLabel2 = new QLabel( this, "textLabel2" );
00064 textLabel2->setAlignment( int( QLabel::AlignTop ) );
00065
00066 layout3->addWidget( textLabel2, 2, 0 );
00067
00068 textLabelGroup = new QLabel( this, "textLabelGroup" );
00069
00070 layout3->addWidget( textLabelGroup, 1, 0 );
00071
00072 cbGroup = new KComboBox( FALSE, this, "cbGroup" );
00073
00074 layout3->addWidget( cbGroup, 1, 1 );
00075
00076 snippetText = new KTextEdit( this, "snippetText" );
00077 QFont snippetText_font( snippetText->font() );
00078 snippetText_font.setFamily( "Courier" );
00079 snippetText_font.setPointSize( 11 );
00080 snippetText->setFont( snippetText_font );
00081
00082 layout3->addMultiCellWidget( snippetText, 2, 4, 1, 1 );
00083
00084 SnippetDlgBaseLayout->addLayout( layout3, 0, 0 );
00085 languageChange();
00086 resize( QSize(344, 289).expandedTo(minimumSizeHint()) );
00087 clearWState( WState_Polished );
00088
00089
00090 connect( btnAdd, SIGNAL( clicked() ), this, SLOT( accept() ) );
00091 connect( btnCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00092
00093
00094 setTabOrder( snippetName, cbGroup );
00095 setTabOrder( cbGroup, snippetText );
00096 setTabOrder( snippetText, btnAdd );
00097 setTabOrder( btnAdd, btnCancel );
00098
00099
00100 textLabel1->setBuddy( snippetName );
00101 textLabel2->setBuddy( snippetText );
00102 textLabelGroup->setBuddy( cbGroup );
00103 }
00104
00105
00106
00107
00108 SnippetDlgBase::~SnippetDlgBase()
00109 {
00110
00111 }
00112
00113
00114
00115
00116
00117 void SnippetDlgBase::languageChange()
00118 {
00119 setCaption( tr2i18n( "Add Snippet" ) );
00120 btnAdd->setText( tr2i18n( "&Add" ) );
00121 btnCancel->setText( tr2i18n( "&Cancel" ) );
00122 textLabel1->setText( tr2i18n( "&Name:" ) );
00123 textLabel2->setText( tr2i18n( "&Snippet:" ) );
00124 textLabelGroup->setText( tr2i18n( "Group:" ) );
00125 }
00126
00127 #include "snippetdlgbase.moc"