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