summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp133
-rw-r--r--core/pim/todo/mainwindow.h5
-rw-r--r--core/pim/todo/otaskeditor.cpp13
-rw-r--r--core/pim/todo/quickeditimpl.cpp20
-rw-r--r--core/pim/todo/taskeditoralarms.cpp190
-rw-r--r--core/pim/todo/taskeditoralarms.h26
-rw-r--r--core/pim/todo/taskeditorstatus.cpp11
-rw-r--r--core/pim/todo/templatedialog.cpp10
-rw-r--r--core/pim/todo/templatedialogimpl.cpp10
-rw-r--r--core/pim/todo/templateeditor.cpp5
-rw-r--r--core/pim/todo/todomanager.cpp1
11 files changed, 373 insertions, 51 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index c5cedc6..5119ae0 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -34,2 +34,3 @@
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qpushbutton.h>
35#include <qwidgetstack.h> 36#include <qwidgetstack.h>
@@ -47,4 +48,8 @@
47#include <qpe/qpemessagebox.h> 48#include <qpe/qpemessagebox.h>
49#include <qpe/alarmserver.h>
50#include <qpe/timestring.h>
51#include <qpe/qpeapplication.h>
48 52
49#include <opie/orecur.h> 53#include <opie/orecur.h>
54#include <opie/opimnotifymanager.h>
50#include <opie/otodoaccessvcal.h> 55#include <opie/otodoaccessvcal.h>
@@ -303,2 +308,6 @@ OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
303 cat = currentCatId(); 308 cat = currentCatId();
309 if ( m_curCat == QWidget::tr("Unfiled") )
310 cat = -1;
311
312 qWarning(" Category %d %s", cat, m_curCat.latin1() );
304 313
@@ -318,2 +327,5 @@ OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
318 327
328 if ( m_curCat == QWidget::tr("Unfiled") )
329 cat = -1;
330
319 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat ); 331 return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
@@ -452,2 +464,3 @@ void MainWindow::slotDelete() {
452 464
465 handleAlarms( OTodo(), m_todoMgr.event( currentView()->current() ) );
453 m_todoMgr.remove( currentView()->current() ); 466 m_todoMgr.remove( currentView()->current() );
@@ -643,5 +656,5 @@ void MainWindow::slotEdit( int uid ) {
643 656
644 OTodo todo = m_todoMgr.event( uid ); 657 OTodo old_todo = m_todoMgr.event( uid );
645 658
646 todo = currentEditor()->edit(this, todo ); 659 OTodo todo = currentEditor()->edit(this, old_todo );
647 660
@@ -650,2 +663,3 @@ void MainWindow::slotEdit( int uid ) {
650 qWarning("Replacing now" ); 663 qWarning("Replacing now" );
664 handleAlarms( old_todo, todo );
651 m_todoMgr.update( todo.uid(), todo ); 665 m_todoMgr.update( todo.uid(), todo );
@@ -768,2 +782,3 @@ int MainWindow::create() {
768 uid = todo.uid(); 782 uid = todo.uid();
783 handleAlarms( OTodo(), todo );
769 m_todoMgr.add( todo ); 784 m_todoMgr.add( todo );
@@ -785,2 +800,5 @@ bool MainWindow::remove( int uid ) {
785 800
801 /* argh need to get the whole OEvent... to disable alarms -zecke */
802 handleAlarms( OTodo(), m_todoMgr.event( uid ) );
803
786 return m_todoMgr.remove( uid ); 804 return m_todoMgr.remove( uid );
@@ -823 +841,112 @@ void MainWindow::slotReturnFromView() {
823} 841}
842
843namespace {
844 OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls,
845 const OPimNotifyManager::Alarms& newAls ) {
846 OPimNotifyManager::Alarms nonMatching;
847 OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin();
848 OPimNotifyManager::Alarms::ConstIterator newIt;
849 for ( ; oldIt != oldAls.end(); ++oldIt ) {
850 bool found = false;
851 QDateTime oldDt = (*oldIt).dateTime();
852 for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) {
853 if ( oldDt == (*newIt).dateTime() ) {
854 found = true;
855 break;
856 }
857 }
858 if (!found)
859 nonMatching.append( (*oldIt) );
860 }
861 return nonMatching;
862 }
863 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
864 OPimNotifyManager::Alarms::ConstIterator it;
865 for ( it = als.begin(); it != als.end(); ++it ) {
866 qWarning("Adding alarm for %s", (*it).dateTime().toString().latin1() );
867 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
868 }
869
870 }
871 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
872 OPimNotifyManager::Alarms::ConstIterator it;
873 for ( it = als.begin(); it != als.end(); ++it ) {
874 qWarning("Removinf alarm for %s", (*it).dateTime().toString().latin1() );
875 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
876 }
877 }
878}
879
880void MainWindow::handleAlarms( const OTodo& oldTodo, const OTodo& newTodo) {
881 /*
882 * if oldTodo is not empty and has notifiers we need to find the deleted ones
883 */
884 if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) {
885 OPimNotifyManager::Alarms removed;
886 OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms();
887 if (!newTodo.hasNotifiers() )
888 removed = oldAls;
889 else
890 removed = findNonMatching( oldAls, newTodo.notifiers().alarms() );
891
892 removeAlarms( removed, oldTodo.uid() );
893 }
894 if ( newTodo.hasNotifiers() ) {
895 OPimNotifyManager::Alarms added;
896 if ( oldTodo.isEmpty() || !oldTodo.hasNotifiers() )
897 added = newTodo.notifiers().alarms();
898 else
899 added = findNonMatching( newTodo.notifiers().alarms(), oldTodo.notifiers().alarms() );
900
901 addAlarms( added, newTodo.uid() );
902 }
903}
904/* we might have not loaded the db */
905void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
906 m_todoMgr.load();
907
908 OTodo todo = m_todoMgr.event( uid );
909 if (!todo.hasNotifiers() ) return;
910
911 /*
912 * let's find the right alarm and find out if silent
913 * then show a richtext widget
914 */
915 bool loud = false;
916 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
917 OPimNotifyManager::Alarms::Iterator it;
918 for ( it = als.begin(); it != als.end(); ++it ) {
919 if ( (*it).dateTime() == dt ) {
920 loud = ( (*it).sound() == OPimAlarm::Loud );
921 break;
922 }
923 }
924 if (loud)
925 startAlarm();
926
927 QDialog dlg(this, 0, TRUE );
928 QVBoxLayout* lay = new QVBoxLayout( &dlg );
929 QTextView* view = new QTextView( &dlg );
930 lay->addWidget( view );
931 QPushButton* btnOk = new QPushButton( tr("Ok"), &dlg );
932 connect( btnOk, SIGNAL(clicked() ), &dlg, SLOT(accept() ) );
933 lay->addWidget( btnOk );
934
935 QString text = tr("<h1>Alarm at %0</h1><br>").arg( TimeString::dateString( dt ) );
936 text += todo.toRichText();
937 view->setText( text );
938
939 dlg.showMaximized();
940 bool needToStay = dlg.exec();
941
942 if (loud)
943 killAlarm();
944
945 if (needToStay) {
946 showMaximized();
947 raise();
948 QPEApplication::setKeepRunning();
949 setActiveWindow();
950 }
951
952}
diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h
index 434e969..02e2449 100644
--- a/core/pim/todo/mainwindow.h
+++ b/core/pim/todo/mainwindow.h
@@ -106,2 +106,4 @@ private slots:
106 private: 106 private:
107 /* handle setting and removing alarms */
108 void handleAlarms( const OTodo& oldTodo, const OTodo& newTodo );
107 void receiveFile( const QString& filename ); 109 void receiveFile( const QString& filename );
@@ -197,4 +199,5 @@ private slots:
197 void add( const OPimRecord& ); 199 void add( const OPimRecord& );
200 void doAlarm( const QDateTime& dt, int uid );
198 }; 201 };
199}; 202}
200 203
diff --git a/core/pim/todo/otaskeditor.cpp b/core/pim/todo/otaskeditor.cpp
index e26d5e4..84f854f 100644
--- a/core/pim/todo/otaskeditor.cpp
+++ b/core/pim/todo/otaskeditor.cpp
@@ -44,2 +44,3 @@ OTodo OTaskEditor::todo()const{
44 to.setRecurrence( m_rec->recurrence() ); 44 to.setRecurrence( m_rec->recurrence() );
45 m_alarm->save( to );
45 46
@@ -51,2 +52,4 @@ void OTaskEditor::load(const OTodo& to) {
51 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() ); 52 m_rec->setRecurrence( to.recurrence(), to.hasDueDate() ? to.dueDate() : QDate::currentDate() );
53 m_alarm->setEnabled( !to.hasRecurrence() );
54 m_alarm->load( to );
52} 55}
@@ -71,8 +74,8 @@ void OTaskEditor::init() {
71 74
72 m_remind = new TaskEditorAlarms( m_tab ); 75// m_remind = new TaskEditorAlarms( m_tab );
73 m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") ); 76// m_tab->addTab( m_remind, "todo/reminder", tr("Reminders") );
74 77
75 QLabel* lbl = new QLabel( m_tab ); 78// QLabel* lbl = new QLabel( m_tab );
76 lbl->setText( tr("X-Ref") ); 79// lbl->setText( tr("X-Ref") );
77 m_tab->addTab( lbl, "todo/xref", tr("X-Ref") ); 80// m_tab->addTab( lbl, "todo/xref", tr("X-Ref") );
78 81
diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp
index 91d3131..f4c7c47 100644
--- a/core/pim/todo/quickeditimpl.cpp
+++ b/core/pim/todo/quickeditimpl.cpp
@@ -27,3 +27,3 @@ QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); 27 connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) );
28 QWhatsThis::add( m_lbl, tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 28 QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
29 29
@@ -31,18 +31,18 @@ QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
31 setStretchableWidget( m_edit ); 31 setStretchableWidget( m_edit );
32 QWhatsThis::add( m_edit, tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 32 QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
33 33
34 QAction *a = new QAction( tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); 34 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 );
35 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); 35 connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) );
36 a->addTo( this ); 36 a->addTo( this );
37 a->setWhatsThis( tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 37 a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
38 38
39 a = new QAction( tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); 39 a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 );
40 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); 40 connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) );
41 a->addTo( this ); 41 a->addTo( this );
42 a->setWhatsThis( tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 42 a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
43 43
44 a = new QAction( tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 44 a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
45 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); 45 connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) );
46 a->addTo( this ); 46 a->addTo( this );
47 a->setWhatsThis( tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); 47 a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) );
48 48
@@ -52,3 +52,3 @@ QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible )
52 } 52 }
53 53
54 m_menu = 0l; 54 m_menu = 0l;
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp
index 3cb5576..bff3338 100644
--- a/core/pim/todo/taskeditoralarms.cpp
+++ b/core/pim/todo/taskeditoralarms.cpp
@@ -30,6 +30,14 @@
30 30
31#include <opie/otodo.h>
32#include <opie/opimnotifymanager.h>
33#include <opie/otimepicker.h>
34
35#include <qpe/datebookmonth.h>
31#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <qpe/timestring.h>
32 38
39#include <qdatetime.h>
33#include <qlistview.h> 40#include <qlistview.h>
34#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qpopupmenu.h>
35#include <qlayout.h> 43#include <qlayout.h>
@@ -37,8 +45,47 @@
37 45
38TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, const char* name, WFlags fl ) 46
47class AlarmItem : public QListViewItem {
48public:
49 AlarmItem( QListView*, const OPimAlarm& );
50 ~AlarmItem();
51
52 OPimAlarm alarm()const;
53 void setAlarm( const OPimAlarm& );
54private:
55 QDateTime m_dt;
56 int m_type;
57};
58AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt)
59 : QListViewItem(view) {
60 setAlarm( dt );
61}
62void AlarmItem::setAlarm( const OPimAlarm& dt ) {
63 m_dt = dt.dateTime();
64 m_type = dt.sound();
65 setText( 0, TimeString::dateString( m_dt.date() ) );
66 setText( 1, TimeString::timeString( m_dt.time() ) );
67 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") );
68}
69AlarmItem::~AlarmItem() {
70}
71OPimAlarm AlarmItem::alarm()const{
72 OPimAlarm al( m_type, m_dt );
73
74 return al;
75}
76
77TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl )
39 : QWidget( parent, name, fl ) 78 : QWidget( parent, name, fl )
40{ 79{
41 QGridLayout *layout = new QGridLayout( this, 2, 3, 4, 4 ); 80 m_date = m_type = m_time = 0;
81 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 );
42 82
43 lstAlarms = new QListView( this ); 83 lstAlarms = new QListView( this );
84 lstAlarms->addColumn( tr("Date") );
85 lstAlarms->addColumn( tr("Time") );
86 lstAlarms->addColumn( tr("Type") );
87
88 connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ),
89 this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) );
90
44 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); 91 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 );
@@ -47,9 +94,11 @@ TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, const char* name, WFlags f
47 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 94 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
48 //connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); 95 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
49 layout->addWidget( btn, 1, 0 ); 96 layout->addWidget( btn, 1, 0 );
50 97/* use when we've reminders too */
98#if 0
51 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); 99 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this );
52 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 100 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
53 //connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); 101 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
54 layout->addWidget( btn, 1, 1 ); 102 layout->addWidget( btn, 1, 1 );
103#endif
55 104
@@ -57,3 +106,3 @@ TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, const char* name, WFlags f
57 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 106 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
58 //connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); 107 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
59 layout->addWidget( btn, 1, 2 ); 108 layout->addWidget( btn, 1, 2 );
@@ -61,16 +110,129 @@ TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, const char* name, WFlags f
61 110
62TaskEditorAlarms::~TaskEditorAlarms() 111TaskEditorAlarms::~TaskEditorAlarms(){
63{
64} 112}
65 113
66void TaskEditorAlarms::slotNew() 114void TaskEditorAlarms::slotNew(){
67{ 115 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) );
68} 116}
69 117
70void TaskEditorAlarms::slotEdit() 118void TaskEditorAlarms::slotEdit(){
71{
72} 119}
73 120
74void TaskEditorAlarms::slotDelete() 121void TaskEditorAlarms::slotDelete(){
75{ 122 QListViewItem* item = lstAlarms->currentItem();
123 if (!item) return;
124
125 lstAlarms->takeItem( item ); delete item;
126
127
128}
129
130void TaskEditorAlarms::load( const OTodo& todo) {
131 lstAlarms->clear();
132 if (!todo.hasNotifiers() ) return;
133
134 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
135
136 if (als.isEmpty() ) return;
137
138 OPimNotifyManager::Alarms::Iterator it = als.begin();
139 for ( ; it != als.end(); ++it )
140 (void)new AlarmItem( lstAlarms, (*it) );
141
142
143}
144void TaskEditorAlarms::save( OTodo& todo ) {
145 if (lstAlarms->childCount() <= 0 ) return;
146
147 OPimNotifyManager::Alarms alarms;
148
149 for ( QListViewItem* item = lstAlarms->firstChild(); item; item = item->nextSibling() ) {
150 AlarmItem *alItem = static_cast<AlarmItem*>(item);
151 alarms.append( alItem->alarm() );
152 }
153
154 OPimNotifyManager& manager = todo.notifiers();
155 manager.setAlarms( alarms );
156}
157void TaskEditorAlarms::inlineEdit( QListViewItem* alarm, const QPoint& p, int col ) {
158 if (!alarm) return;
159
160 AlarmItem* item = static_cast<AlarmItem*>(alarm);
161 switch( col ) {
162 // date
163 case 0:
164 return inlineSetDate( item, p );
165 // time
166 case 1:
167 return inlineSetTime( item );
168 // type
169 case 2:
170 return inlineSetType( item, p );
171 }
172}
173void TaskEditorAlarms::inlineSetDate( AlarmItem* item, const QPoint& p ) {
174 QPopupMenu* pop = popup( 0 );
175 m_dbMonth->setDate( item->alarm().dateTime().date() );
176 pop->exec(p);
177
178 OPimAlarm al = item->alarm();
179 QDateTime dt = al.dateTime();
180 dt.setDate( m_dbMonth->selectedDate() );
181 al.setDateTime( dt );
182 item->setAlarm( al );
183}
184void TaskEditorAlarms::inlineSetType( AlarmItem* item, const QPoint& p ) {
185 int type;
186 QPopupMenu* pop = popup( 2 );
187 switch( pop->exec(p) ) {
188 case 10:
189 type = 1;
190 break;
191 case 20:
192 default:
193 type = 0;
194 }
195 OPimAlarm al = item->alarm();
196 al.setSound( type );
197 item->setAlarm( al );
198}
199void TaskEditorAlarms::inlineSetTime( AlarmItem* item ) {
200 OPimAlarm al = item->alarm();
201 QDateTime dt = al.dateTime();
202
203 OTimePickerDialog dialog;
204 dialog.setTime( dt.time() );
205 if ( dialog.exec() == QDialog::Accepted ) {
206 dt.setTime( dialog.time() );
207 al.setDateTime( dt );
208 item->setAlarm( al );
209 }
210}
211QPopupMenu* TaskEditorAlarms::popup( int column ) {
212 QPopupMenu* pop = 0;
213 switch( column ) {
214 case 0:{
215 if (!m_date) {
216 m_date = new QPopupMenu(this);
217 m_dbMonth = new DateBookMonth(m_date, 0, TRUE);
218 m_date->insertItem(m_dbMonth);
219 }
220 pop = m_date;
221 }
222 break;
223 case 1:
224 break;
225 case 2:{
226 if (!m_type) {
227 m_type = new QPopupMenu(this);
228 m_type->insertItem( QObject::tr("loud"), 10 );
229 m_type->insertItem( QObject::tr("silent"), 20 );
230 }
231 pop = m_type;
232 }
233 break;
234 default:
235 break;
236 }
237 return pop;
76} 238}
diff --git a/core/pim/todo/taskeditoralarms.h b/core/pim/todo/taskeditoralarms.h
index f77ded5..0aa52cc 100644
--- a/core/pim/todo/taskeditoralarms.h
+++ b/core/pim/todo/taskeditoralarms.h
@@ -2,3 +2,3 @@
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,2003 <>
4           .>+-= 4           .>+-=
@@ -34,5 +34,9 @@
34class QListView; 34class QListView;
35class QListViewItem;
36class OTodo;
35 37
38class AlarmItem;
39class DateBookMonth;
36class TaskEditorAlarms : public QWidget 40class TaskEditorAlarms : public QWidget
37{ 41{
38 Q_OBJECT 42 Q_OBJECT
@@ -40,6 +44,21 @@ class TaskEditorAlarms : public QWidget
40public: 44public:
41 TaskEditorAlarms( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 45 enum Type {
46 Alarm = 0,
47 Reminders
48 };
49 TaskEditorAlarms( QWidget* parent = 0, int type = Alarm, const char* name = 0, WFlags fl = 0 );
42 ~TaskEditorAlarms(); 50 ~TaskEditorAlarms();
51 void load( const OTodo& );
52 void save( OTodo& );
53private:
54 QPopupMenu* popup( int column );
55 void inlineSetDate( AlarmItem*, const QPoint& p );
56 void inlineSetTime( AlarmItem*);
57 void inlineSetType( AlarmItem*, const QPoint& p );
43 58
44 QListView* lstAlarms; 59 QListView* lstAlarms;
60 QPopupMenu* m_date;
61 QPopupMenu* m_time;
62 QPopupMenu* m_type;
63 DateBookMonth* m_dbMonth;
45 64
@@ -49,2 +68,3 @@ protected slots:
49 void slotDelete(); 68 void slotDelete();
69 void inlineEdit( QListViewItem*, const QPoint& p, int );
50}; 70};
diff --git a/core/pim/todo/taskeditorstatus.cpp b/core/pim/todo/taskeditorstatus.cpp
index 4331877..0ab4223 100644
--- a/core/pim/todo/taskeditorstatus.cpp
+++ b/core/pim/todo/taskeditorstatus.cpp
@@ -146,2 +146,3 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
146 // Maintainer mode 146 // Maintainer mode
147#if 0
147 label = new QLabel( tr( "Maintainer Mode:" ), container ); 148 label = new QLabel( tr( "Maintainer Mode:" ), container );
@@ -154,3 +155,3 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
154 cmbMaintMode->insertItem( tr( "Coordinating" ) ); 155 cmbMaintMode->insertItem( tr( "Coordinating" ) );
155 layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 ); 156// layout->addMultiCellWidget( cmbMaintMode, 6, 6, 1, 2 );
156 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) ); 157 QWhatsThis::add( cmbMaintMode, tr( "Click here to set the maintainer's role." ) );
@@ -167,4 +168,5 @@ TaskEditorStatus::TaskEditorStatus( QWidget* parent, const char* name, WFlags f
167 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) ); 168 tbtMaintainer->setPixmap( Resource::loadPixmap( "todo/more" ) );
168 layout->addWidget( tbtMaintainer, 7, 2 ); 169// layout->addWidget( tbtMaintainer, 7, 2 );
169 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) ); 170 QWhatsThis::add( tbtMaintainer, tr( "Click here to select the task maintainer." ) );
171#endif
170} 172}
@@ -218,2 +220,3 @@ void TaskEditorStatus::load( const OTodo &todo )
218 // Maintainer Mode 220 // Maintainer Mode
221#if 0
219 state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing; 222 state = todo.hasMaintainer() ? todo.maintainer().mode() : OPimMaintainer::Nothing;
@@ -222,3 +225,3 @@ void TaskEditorStatus::load( const OTodo &todo )
222 cmbMaintMode->setCurrentItem( state ); 225 cmbMaintMode->setCurrentItem( state );
223 226#endif
224 // Maintainer - not implemented yet 227 // Maintainer - not implemented yet
@@ -262,2 +265,3 @@ void TaskEditorStatus::save( OTodo &todo )
262 265
266#if 0
263 // Maintainer mode - not implemented yet 267 // Maintainer mode - not implemented yet
@@ -267,2 +271,3 @@ void TaskEditorStatus::save( OTodo &todo )
267 todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) ); 271 todo.setMaintainer( OPimMaintainer( cmbMaintMode->currentItem(), -10 ) );
272#endif
268} 273}
diff --git a/core/pim/todo/templatedialog.cpp b/core/pim/todo/templatedialog.cpp
index c94f69c..8dfbd0b 100644
--- a/core/pim/todo/templatedialog.cpp
+++ b/core/pim/todo/templatedialog.cpp
@@ -11,2 +11,4 @@ using namespace Todo;
11 11
12/* TRANSLATOR Todo::TemplateDialog */
13
12TemplateDialog::TemplateDialog( QWidget* widget ) 14TemplateDialog::TemplateDialog( QWidget* widget )
@@ -14,3 +16,3 @@ TemplateDialog::TemplateDialog( QWidget* widget )
14{ 16{
15 setCaption( tr("Template Editor") ); 17 setCaption( QWidget::tr("Template Editor") );
16 m_main = new QVBoxLayout(this ); 18 m_main = new QVBoxLayout(this );
@@ -24,5 +26,5 @@ TemplateDialog::TemplateDialog( QWidget* widget )
24 m_btnBar = new QHBox( this ); 26 m_btnBar = new QHBox( this );
25 m_add = new QPushButton( tr("Add"), m_btnBar ); 27 m_add = new QPushButton( QWidget::tr("Add"), m_btnBar );
26 m_edit = new QPushButton( tr("Edit"), m_btnBar ); 28 m_edit = new QPushButton( QWidget::tr("Edit"), m_btnBar );
27 m_rem = new QPushButton( tr("Remove"), m_btnBar ); 29 m_rem = new QPushButton( QWidget::tr("Remove"), m_btnBar );
28 m_main->addWidget( m_btnBar ); 30 m_main->addWidget( m_btnBar );
diff --git a/core/pim/todo/templatedialogimpl.cpp b/core/pim/todo/templatedialogimpl.cpp
index 77c5363..fed92f0 100644
--- a/core/pim/todo/templatedialogimpl.cpp
+++ b/core/pim/todo/templatedialogimpl.cpp
@@ -11,2 +11,4 @@ using namespace Todo;
11 11
12/* TRANSLATOR Todo::TemplateDialogImpl */
13
12namespace { 14namespace {
@@ -63,3 +65,3 @@ TemplateDialogImpl::TemplateDialogImpl( MainWindow* win,
63 } 65 }
64 listView()->addColumn( tr("Name") ); 66 listView()->addColumn( QWidget::tr("Name") );
65 67
@@ -72,3 +74,3 @@ TemplateDialogImpl::~TemplateDialogImpl() {
72void TemplateDialogImpl::slotAdd() { 74void TemplateDialogImpl::slotAdd() {
73 QString str = tr("New Template %1").arg( listView()->childCount() ); 75 QString str = QWidget::tr("New Template %1").arg( listView()->childCount() );
74 OTodo ev; 76 OTodo ev;
@@ -89,5 +91,3 @@ void TemplateDialogImpl::slotEdit() {
89 if ( m_win->currentEditor()->accepted() ) { 91 if ( m_win->currentEditor()->accepted() ) {
90 qWarning("accepted");
91 item->setEvent( ev ); 92 item->setEvent( ev );
92 qWarning("Priority %d", ev.priority() );
93 m_man->removeEvent( item->text() ); 93 m_man->removeEvent( item->text() );
@@ -115,3 +115,3 @@ void TemplateDialogImpl::slotClicked( QListViewItem* item) {
115 115
116 TemplateListItem* tbl = (TemplateListItem*)item; 116 TemplateListItem* tbl = static_cast<TemplateListItem*>(item);
117 edit()->setText( tbl->text() ); 117 edit()->setText( tbl->text() );
diff --git a/core/pim/todo/templateeditor.cpp b/core/pim/todo/templateeditor.cpp
index 3930428..ca02173 100644
--- a/core/pim/todo/templateeditor.cpp
+++ b/core/pim/todo/templateeditor.cpp
@@ -31,8 +31,7 @@ void TemplateEditor::init() {
31void TemplateEditor::setUp() { 31void TemplateEditor::setUp() {
32 qWarning("set up");
33 TemplateDialogImpl dlg(m_main, m_man ); 32 TemplateDialogImpl dlg(m_main, m_man );
34 int ret= dlg.exec(); 33 int ret= dlg.exec();
35 if (QDialog::Accepted != ret ) { 34 if (QDialog::Accepted != ret )
36 m_man->load(); 35 m_man->load();
37 }else 36 else
38 m_main->populateTemplates(); 37 m_main->populateTemplates();
diff --git a/core/pim/todo/todomanager.cpp b/core/pim/todo/todomanager.cpp
index b5b87de..df2e711 100644
--- a/core/pim/todo/todomanager.cpp
+++ b/core/pim/todo/todomanager.cpp
@@ -124,3 +124,2 @@ void TodoManager::load() {
124 if (!m_db) { 124 if (!m_db) {
125 qWarning("loading!");
126 m_db = new OTodoAccess(); 125 m_db = new OTodoAccess();