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