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 #include "newtaskdlg.h"
00032
00033 #include <qbuttongroup.h>
00034 #include <qcombobox.h>
00035 #include <qlayout.h>
00036 #include <qradiobutton.h>
00037
00038 NewTaskDlg::NewTaskDlg( const QStringList &templates, QWidget *parent )
00039 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
00040 {
00041 setCaption( tr( "New Task" ) );
00042
00043 QButtonGroup *bg = new QButtonGroup( this );
00044 bg->hide();
00045
00046 QVBoxLayout *layout = new QVBoxLayout( this, 10, 3 );
00047
00048 QRadioButton *btn = new QRadioButton( tr( "Blank task" ), this );
00049 btn->setChecked( true );
00050 bg->insert( btn );
00051 layout->addWidget( btn );
00052
00053 layout->addStretch();
00054
00055 m_useTemplate = new QRadioButton( tr( "Using template:" ), this );
00056 connect( m_useTemplate, SIGNAL(toggled(bool)), this, SLOT(slotUseTemplate(bool)) );
00057 bg->insert( m_useTemplate );
00058 layout->addWidget( m_useTemplate );
00059
00060 m_templateList = new QComboBox( this );
00061 m_templateList->insertStringList( templates );
00062 m_templateList->setEnabled( false );
00063 layout->addWidget( m_templateList );
00064
00065 layout->addStretch();
00066 }
00067
00068 QString NewTaskDlg::tempSelected() {
00069 QString tempStr;
00070 if ( m_useTemplate->isChecked() )
00071 tempStr = m_templateList->currentText();
00072
00073 return tempStr;
00074 }
00075
00076 void NewTaskDlg::slotUseTemplate( bool on ) {
00077 m_templateList->setEnabled( on );
00078 if ( on )
00079 m_templateList->setFocus();
00080 }