summaryrefslogtreecommitdiff
path: root/core/pim/todo/taskeditoroverview.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/taskeditoroverview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/taskeditoroverview.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/pim/todo/taskeditoroverview.cpp b/core/pim/todo/taskeditoroverview.cpp
index 9a8abea..415dcf2 100644
--- a/core/pim/todo/taskeditoroverview.cpp
+++ b/core/pim/todo/taskeditoroverview.cpp
@@ -1,177 +1,175 @@
1/* 1/*
2               =. This file is part of the OPIE Project 2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 <> 3             .=l. Copyright (c) 2002 <>
4           .>+-= 4           .>+-=
5 _;:,     .>    :=|. This program is free software; you can 5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under 6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public 7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software 8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License, 9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version. 10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that 12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more 17..}^=.=       =       ; Library General Public License for more
18++=   -.     .`     .: details. 18++=   -.     .`     .: details.
19 :     =  ...= . :.=- 19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU 20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = General Public License along with 21  -_. . .   )=.  = General Public License along with
22    --        :-=` this library; see the file COPYING.LIB. 22    --        :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation, 23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330, 24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "taskeditoroverview.h" 29#include "taskeditoroverview.h"
30 30
31#include <opie/orecur.h> 31#include <opie/orecur.h>
32 32
33#include <qpe/categoryselect.h> 33#include <qpe/categoryselect.h>
34#include <qpe/datebookmonth.h> 34#include <qpe/datebookmonth.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/timestring.h>
37 36
38#include <qcheckbox.h> 37#include <qcheckbox.h>
39#include <qcombobox.h>
40#include <qlabel.h> 38#include <qlabel.h>
41#include <qlayout.h> 39#include <qlayout.h>
42#include <qmultilineedit.h> 40#include <qmultilineedit.h>
43#include <qwhatsthis.h> 41#include <qwhatsthis.h>
44 42
45TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl ) 43TaskEditorOverView::TaskEditorOverView( QWidget* parent, const char* name, WFlags fl )
46 : QWidget( parent, name, fl ) 44 : QWidget( parent, name, fl )
47{ 45{
48 // Load icons 46 // Load icons
49 // TODO - probably should be done globally somewhere else, 47 // TODO - probably should be done globally somewhere else,
50 // see also quickeditimpl.cpp/h, tableview.cpp/h 48 // see also quickeditimpl.cpp/h, tableview.cpp/h
51 QString namestr; 49 QString namestr;
52 for ( unsigned int i = 1; i < 6; i++ ) { 50 for ( unsigned int i = 1; i < 6; i++ ) {
53 namestr = "todo/priority"; 51 namestr = "todo/priority";
54 namestr.append( QString::number( i ) ); 52 namestr.append( QString::number( i ) );
55 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr ); 53 m_pic_priority[ i - 1 ] = Resource::loadPixmap( namestr );
56 } 54 }
57 55
58 QVBoxLayout *vb = new QVBoxLayout( this ); 56 QVBoxLayout *vb = new QVBoxLayout( this );
59 57
60 QScrollView *sv = new QScrollView( this ); 58 QScrollView *sv = new QScrollView( this );
61 vb->addWidget( sv ); 59 vb->addWidget( sv );
62 sv->setResizePolicy( QScrollView::AutoOneFit ); 60 sv->setResizePolicy( QScrollView::AutoOneFit );
63 sv->setFrameStyle( QFrame::NoFrame ); 61 sv->setFrameStyle( QFrame::NoFrame );
64 62
65 QWidget *container = new QWidget( sv->viewport() ); 63 QWidget *container = new QWidget( sv->viewport() );
66 sv->addChild( container ); 64 sv->addChild( container );
67 65
68 QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 ); 66 QGridLayout *layout = new QGridLayout( container, 7, 2, 4, 4 );
69 67
70 // Description 68 // Description
71 QLabel *label = new QLabel( tr( "Description:" ), container ); 69 QLabel *label = new QLabel( tr( "Summary:" ), container );
72 layout->addWidget( label, 0, 0 ); 70 layout->addWidget( label, 0, 0 );
73 QWhatsThis::add( label, tr( "Enter brief description of the task here." ) ); 71 QWhatsThis::add( label, tr( "Enter brief description of the task here." ) );
74 cmbDesc = new QComboBox( TRUE, container ); 72 cmbDesc = new QComboBox( TRUE, container );
75 cmbDesc->insertItem( tr( "Complete " ) ); 73 cmbDesc->insertItem( tr( "Complete " ) );
76 cmbDesc->insertItem( tr( "Work on " ) ); 74 cmbDesc->insertItem( tr( "Work on " ) );
77 cmbDesc->insertItem( tr( "Buy " ) ); 75 cmbDesc->insertItem( tr( "Buy " ) );
78 cmbDesc->insertItem( tr( "Organize " ) ); 76 cmbDesc->insertItem( tr( "Organize " ) );
79 cmbDesc->insertItem( tr( "Get " ) ); 77 cmbDesc->insertItem( tr( "Get " ) );
80 cmbDesc->insertItem( tr( "Update " ) ); 78 cmbDesc->insertItem( tr( "Update " ) );
81 cmbDesc->insertItem( tr( "Create " ) ); 79 cmbDesc->insertItem( tr( "Create " ) );
82 cmbDesc->insertItem( tr( "Plan " ) ); 80 cmbDesc->insertItem( tr( "Plan " ) );
83 cmbDesc->insertItem( tr( "Call " ) ); 81 cmbDesc->insertItem( tr( "Call " ) );
84 cmbDesc->insertItem( tr( "Mail " ) ); 82 cmbDesc->insertItem( tr( "Mail " ) );
85 cmbDesc->clearEdit(); 83 cmbDesc->clearEdit();
86 layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 ); 84 layout->addMultiCellWidget( cmbDesc, 1, 1, 0, 1 );
87 QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) ); 85 QWhatsThis::add( cmbDesc, tr( "Enter brief description of the task here." ) );
88 86
89 // Priority 87 // Priority
90 label = new QLabel( QWidget::tr( "Priority:" ), container ); 88 label = new QLabel( QWidget::tr( "Priority:" ), container );
91 layout->addWidget( label, 2, 0 ); 89 layout->addWidget( label, 2, 0 );
92 QWhatsThis::add( label, tr( "Select priority of task here." ) ); 90 QWhatsThis::add( label, tr( "Select priority of task here." ) );
93 cmbPriority = new QComboBox( FALSE, container ); 91 cmbPriority = new QComboBox( FALSE, container );
94 cmbPriority->setMinimumHeight( 26 ); 92 cmbPriority->setMinimumHeight( 26 );
95 cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) ); 93 cmbPriority->insertItem( m_pic_priority[ 0 ], tr( "Very High" ) );
96 cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) ); 94 cmbPriority->insertItem( m_pic_priority[ 1 ], tr( "High" ) );
97 cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) ); 95 cmbPriority->insertItem( m_pic_priority[ 2 ], tr( "Normal" ) );
98 cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) ); 96 cmbPriority->insertItem( m_pic_priority[ 3 ], tr( "Low" ) );
99 cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) ); 97 cmbPriority->insertItem( m_pic_priority[ 4 ], tr( "Very Low" ) );
100 cmbPriority->setCurrentItem( 2 ); 98 cmbPriority->setCurrentItem( 2 );
101 layout->addWidget( cmbPriority, 2, 1 ); 99 layout->addWidget( cmbPriority, 2, 1 );
102 QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) ); 100 QWhatsThis::add( cmbPriority, tr( "Select priority of task here." ) );
103 101
104 // Category 102 // Category
105 label = new QLabel( tr( "Category:" ), container ); 103 label = new QLabel( tr( "Category:" ), container );
106 layout->addWidget( label, 3, 0 ); 104 layout->addWidget( label, 3, 0 );
107 QWhatsThis::add( label, tr( "Select category to organize this task with." ) ); 105 QWhatsThis::add( label, tr( "Select category to organize this task with." ) );
108 cmbCategory = new CategorySelect( container ); 106 cmbCategory = new CategorySelect( container );
109 layout->addWidget( cmbCategory, 3, 1 ); 107 layout->addWidget( cmbCategory, 3, 1 );
110 QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) ); 108 QWhatsThis::add( cmbCategory, tr( "Select category to organize this task with." ) );
111 109
112 // Recurrence 110 // Recurrence
113 ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container ); 111 ckbRecurrence = new QCheckBox( tr( "Recurring task" ), container );
114 layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 ); 112 layout->addMultiCellWidget( ckbRecurrence, 4, 4, 0, 1 );
115 QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) ); 113 QWhatsThis::add( ckbRecurrence, tr( "Click here if task happens on a regular basis. If selected, frequency can be set on the Recurrence tab." ) );
116 connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) ); 114 connect( ckbRecurrence, SIGNAL(clicked() ), this, SLOT( slotRecClicked() ) );
117 115
118 // Notes 116 // Notes
119 label = new QLabel( tr( "Notes:" ), container ); 117 label = new QLabel( tr( "Description:" ), container );
120 layout->addWidget( label, 5, 0 ); 118 layout->addWidget( label, 5, 0 );
121 QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) ); 119 QWhatsThis::add( label, tr( "Enter any additional information about this task here." ) );
122 mleNotes = new QMultiLineEdit( container ); 120 mleNotes = new QMultiLineEdit( container );
123 mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth ); 121 mleNotes->setWordWrap( QMultiLineEdit::WidgetWidth );
124 layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 ); 122 layout->addMultiCellWidget( mleNotes, 6, 6, 0, 1 );
125 QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) ); 123 QWhatsThis::add( mleNotes, tr( "Enter any additional information about this task here." ) );
126} 124}
127 125
128TaskEditorOverView::~TaskEditorOverView() 126TaskEditorOverView::~TaskEditorOverView()
129{ 127{
130} 128}
131 129
132void TaskEditorOverView::load( const OTodo& todo ) 130void TaskEditorOverView::load( const OTodo& todo )
133{ 131{
134 // Description 132 // Description
135 cmbDesc->insertItem( todo.summary(), 0 ); 133 cmbDesc->insertItem( todo.summary(), 0 );
136 cmbDesc->setCurrentItem( 0 ); 134 cmbDesc->setCurrentItem( 0 );
137 135
138 // Priority 136 // Priority
139 cmbPriority->setCurrentItem( todo.priority() - 1 ); 137 cmbPriority->setCurrentItem( todo.priority() - 1 );
140 138
141 // Category 139 // Category
142 cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) ); 140 cmbCategory->setCategories( todo.categories(), "Todo List", tr( "Todo List" ) );
143 141
144 // Recurrence 142 // Recurrence
145 ckbRecurrence->setChecked( todo.hasRecurrence() ); 143 ckbRecurrence->setChecked( todo.hasRecurrence() );
146 emit recurranceEnabled( todo.hasRecurrence() ); 144 emit recurranceEnabled( todo.hasRecurrence() );
147 145
148 // Notes 146 // Notes
149 mleNotes->setText( todo.description() ); 147 mleNotes->setText( todo.description() );
150 148
151} 149}
152 150
153void TaskEditorOverView::save( OTodo &todo ) 151void TaskEditorOverView::save( OTodo &todo )
154{ 152{
155 // Description 153 // Description
156 todo.setSummary( cmbDesc->currentText() ); 154 todo.setSummary( cmbDesc->currentText() );
157 155
158 // Priority 156 // Priority
159 todo.setPriority( cmbPriority->currentItem() + 1 ); 157 todo.setPriority( cmbPriority->currentItem() + 1 );
160 158
161 // Category 159 // Category
162 if ( cmbCategory->currentCategory() != -1 ) 160 if ( cmbCategory->currentCategory() != -1 )
163 { 161 {
164 QArray<int> arr = cmbCategory->currentCategories(); 162 QArray<int> arr = cmbCategory->currentCategories();
165 todo.setCategories( arr ); 163 todo.setCategories( arr );
166 } 164 }
167 165
168 // Recurrence - don't need to save here... 166 // Recurrence - don't need to save here...
169 167
170 // Notes 168 // Notes
171 todo.setDescription( mleNotes->text() ); 169 todo.setDescription( mleNotes->text() );
172} 170}
173 171
174void TaskEditorOverView::slotRecClicked() 172void TaskEditorOverView::slotRecClicked()
175{ 173{
176 emit recurranceEnabled( ckbRecurrence->isChecked() ); 174 emit recurranceEnabled( ckbRecurrence->isChecked() );
177} 175}