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 <qlabel.h>
00048 #include <qlayout.h>
00049
00050 using namespace KCal;
00051
00052 CalSelectDialog::CalSelectDialog( const QString &caption, const QString &label,
00053 const QStringList &list )
00054 : KDialogBase( 0, 0, true, caption, Ok|Cancel, Ok, true )
00055 {
00056 QFrame *frame = makeMainWidget();
00057 QVBoxLayout *layout = new QVBoxLayout( frame, 0, spacingHint() );
00058
00059 QLabel *labelWidget = new QLabel( label, frame );
00060 layout->addWidget( labelWidget );
00061
00062 mListBox = new KListBox( frame );
00063 mListBox->insertStringList( list );
00064 mListBox->setSelected( 0, true );
00065 mListBox->ensureCurrentVisible();
00066 layout->addWidget( mListBox, 10 );
00067
00068 connect( mListBox, SIGNAL(doubleClicked(QListBoxItem *)),
00069 SLOT(slotOk()) );
00070 connect( mListBox, SIGNAL(returnPressed(QListBoxItem *)),
00071 SLOT(slotOk()) );
00072
00073 mListBox->setFocus();
00074
00075 layout->addStretch();
00076
00077 setMinimumWidth( 320 );
00078 }
00079
00080 QString CalSelectDialog::getItem( const QString &caption, const QString &label,
00081 const QStringList &list )
00082 {
00083 CalSelectDialog dlg( caption, label, list );
00084
00085 QString result;
00086 if ( dlg.exec() == Accepted ) {
00087 result = dlg.mListBox->currentText();
00088 }
00089
00090 return result;
00091 }
00092
00093 void CalSelectDialog::closeEvent( QCloseEvent *event )
00094 {
00095 event->ignore();
00096 }
00097
00098 void CalSelectDialog::reject()
00099 {
00100 }
00101
|