-rw-r--r-- | core/pim/todo/newtaskdlg.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/core/pim/todo/newtaskdlg.cpp b/core/pim/todo/newtaskdlg.cpp new file mode 100644 index 0000000..0b5a29d --- a/dev/null +++ b/core/pim/todo/newtaskdlg.cpp | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2005 Dan Williams <drw@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This program is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This program is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "newtaskdlg.h" | ||
30 | |||
31 | #include <qbuttongroup.h> | ||
32 | #include <qcombobox.h> | ||
33 | #include <qlayout.h> | ||
34 | #include <qradiobutton.h> | ||
35 | |||
36 | NewTaskDlg::NewTaskDlg( const QStringList &templates, QWidget *parent ) | ||
37 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | ||
38 | { | ||
39 | setCaption( tr( "New Task" ) ); | ||
40 | |||
41 | QButtonGroup *bg = new QButtonGroup( this ); | ||
42 | bg->hide(); | ||
43 | |||
44 | QVBoxLayout *layout = new QVBoxLayout( this, 10, 3 ); | ||
45 | |||
46 | QRadioButton *btn = new QRadioButton( tr( "Blank task" ), this ); | ||
47 | btn->setChecked( true ); | ||
48 | bg->insert( btn ); | ||
49 | layout->addWidget( btn ); | ||
50 | |||
51 | layout->addStretch(); | ||
52 | |||
53 | m_useTemplate = new QRadioButton( tr( "Using template:" ), this ); | ||
54 | connect( m_useTemplate, SIGNAL(toggled(bool)), this, SLOT(slotUseTemplate(bool)) ); | ||
55 | bg->insert( m_useTemplate ); | ||
56 | layout->addWidget( m_useTemplate ); | ||
57 | |||
58 | m_templateList = new QComboBox( this ); | ||
59 | m_templateList->insertStringList( templates ); | ||
60 | m_templateList->setEnabled( false ); | ||
61 | layout->addWidget( m_templateList ); | ||
62 | |||
63 | layout->addStretch(); | ||
64 | } | ||
65 | |||
66 | QString NewTaskDlg::tempSelected() { | ||
67 | QString tempStr; | ||
68 | if ( m_useTemplate->isChecked() ) | ||
69 | tempStr = m_templateList->currentText(); | ||
70 | |||
71 | return tempStr; | ||
72 | } | ||
73 | |||
74 | void NewTaskDlg::slotUseTemplate( bool on ) { | ||
75 | m_templateList->setEnabled( on ); | ||
76 | if ( on ) | ||
77 | m_templateList->setFocus(); | ||
78 | } | ||