libkcal
calselectdialog.cppGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00045 #include "calselectdialog.h"
00046
00047 #include <tqlabel.h>
00048 #include <tqlayout.h>
00049
00050 using namespace KCal;
00051
00052 CalSelectDialog::CalSelectDialog( const TQString &caption, const TQString &label,
00053 const TQStringList &list )
00054 : KDialogBase( 0, 0, true, caption, Ok|Cancel, Ok, true )
00055 {
00056 TQFrame *frame = makeMainWidget();
00057 TQVBoxLayout *layout = new TQVBoxLayout( frame, 0, spacingHint() );
00058
00059 TQLabel *labelWidget = new TQLabel( label, frame );
00060 layout->addWidget( labelWidget );
00061
00062 mListBox = new TDEListBox( frame );
00063 mListBox->insertStringList( list );
00064 mListBox->setSelected( 0, true );
00065 mListBox->ensureCurrentVisible();
00066 layout->addWidget( mListBox, 10 );
00067
00068 connect( mListBox, TQT_SIGNAL(doubleClicked(TQListBoxItem *)),
00069 TQT_SLOT(slotOk()) );
00070 connect( mListBox, TQT_SIGNAL(returnPressed(TQListBoxItem *)),
00071 TQT_SLOT(slotOk()) );
00072
00073 mListBox->setFocus();
00074
00075 layout->addStretch();
00076
00077 setMinimumWidth( 320 );
00078 }
00079
00080 TQString CalSelectDialog::getItem( const TQString &caption, const TQString &label,
00081 const TQStringList &list )
00082 {
00083 CalSelectDialog dlg( caption, label, list );
00084
00085 TQString result;
00086 if ( dlg.exec() == Accepted ) {
00087 result = dlg.mListBox->currentText();
00088 }
00089
00090 return result;
00091 }
00092
00093 void CalSelectDialog::closeEvent( TQCloseEvent *event )
00094 {
00095 event->ignore();
00096 }
00097
00098 void CalSelectDialog::reject()
00099 {
00100 }
00101
|