summaryrefslogtreecommitdiff
path: root/core/pim/todo/taskeditoralarms.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/taskeditoralarms.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/taskeditoralarms.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/core/pim/todo/taskeditoralarms.cpp b/core/pim/todo/taskeditoralarms.cpp
index bff3338..bcc40fe 100644
--- a/core/pim/todo/taskeditoralarms.cpp
+++ b/core/pim/todo/taskeditoralarms.cpp
@@ -1,140 +1,135 @@
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 "taskeditoralarms.h" 29#include "taskeditoralarms.h"
30 30
31#include <opie/otodo.h> 31#include <opie/otodo.h>
32#include <opie/opimnotifymanager.h> 32#include <opie/opimnotifymanager.h>
33#include <opie/otimepicker.h> 33#include <opie/otimepicker.h>
34 34
35#include <qpe/datebookmonth.h> 35#include <qpe/datebookmonth.h>
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37#include <qpe/timestring.h>
38 37
39#include <qdatetime.h>
40#include <qlistview.h> 38#include <qlistview.h>
41#include <qpushbutton.h>
42#include <qpopupmenu.h>
43#include <qlayout.h> 39#include <qlayout.h>
44#include <qwhatsthis.h>
45 40
46 41
47class AlarmItem : public QListViewItem { 42class AlarmItem : public QListViewItem {
48public: 43public:
49 AlarmItem( QListView*, const OPimAlarm& ); 44 AlarmItem( QListView*, const OPimAlarm& );
50 ~AlarmItem(); 45 ~AlarmItem();
51 46
52 OPimAlarm alarm()const; 47 OPimAlarm alarm()const;
53 void setAlarm( const OPimAlarm& ); 48 void setAlarm( const OPimAlarm& );
54private: 49private:
55 QDateTime m_dt; 50 QDateTime m_dt;
56 int m_type; 51 int m_type;
57}; 52};
58AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt) 53AlarmItem::AlarmItem( QListView* view, const OPimAlarm& dt)
59 : QListViewItem(view) { 54 : QListViewItem(view) {
60 setAlarm( dt ); 55 setAlarm( dt );
61} 56}
62void AlarmItem::setAlarm( const OPimAlarm& dt ) { 57void AlarmItem::setAlarm( const OPimAlarm& dt ) {
63 m_dt = dt.dateTime(); 58 m_dt = dt.dateTime();
64 m_type = dt.sound(); 59 m_type = dt.sound();
65 setText( 0, TimeString::dateString( m_dt.date() ) ); 60 setText( 0, TimeString::dateString( m_dt.date() ) );
66 setText( 1, TimeString::timeString( m_dt.time() ) ); 61 setText( 1, TimeString::timeString( m_dt.time() ) );
67 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") ); 62 setText( 2, m_type == 0 ? QObject::tr("silent") : QObject::tr("loud") );
68} 63}
69AlarmItem::~AlarmItem() { 64AlarmItem::~AlarmItem() {
70} 65}
71OPimAlarm AlarmItem::alarm()const{ 66OPimAlarm AlarmItem::alarm()const{
72 OPimAlarm al( m_type, m_dt ); 67 OPimAlarm al( m_type, m_dt );
73 68
74 return al; 69 return al;
75} 70}
76 71
77TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl ) 72TaskEditorAlarms::TaskEditorAlarms( QWidget* parent, int, const char* name, WFlags fl )
78 : QWidget( parent, name, fl ) 73 : QWidget( parent, name, fl )
79{ 74{
80 m_date = m_type = m_time = 0; 75 m_date = m_type = m_time = 0;
81 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 ); 76 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 4 );
82 77
83 lstAlarms = new QListView( this ); 78 lstAlarms = new QListView( this );
84 lstAlarms->addColumn( tr("Date") ); 79 lstAlarms->addColumn( tr("Date") );
85 lstAlarms->addColumn( tr("Time") ); 80 lstAlarms->addColumn( tr("Time") );
86 lstAlarms->addColumn( tr("Type") ); 81 lstAlarms->addColumn( tr("Type") );
87 82
88 connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ), 83 connect( lstAlarms, SIGNAL(clicked ( QListViewItem *, const QPoint &, int ) ),
89 this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) ); 84 this, SLOT(inlineEdit(QListViewItem*, const QPoint&, int ) ) );
90 85
91 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 ); 86 layout->addMultiCellWidget( lstAlarms, 0, 0, 0, 2 );
92 87
93 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this ); 88 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), this );
94 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 89 //QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
95 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) ); 90 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNew() ) );
96 layout->addWidget( btn, 1, 0 ); 91 layout->addWidget( btn, 1, 0 );
97/* use when we've reminders too */ 92/* use when we've reminders too */
98#if 0 93#if 0
99 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this ); 94 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), this );
100 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 95 //QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
101 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) ); 96 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEdit() ) );
102 layout->addWidget( btn, 1, 1 ); 97 layout->addWidget( btn, 1, 1 );
103#endif 98#endif
104 99
105 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); 100 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this );
106 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 101 //QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
107 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) ); 102 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDelete() ) );
108 layout->addWidget( btn, 1, 2 ); 103 layout->addWidget( btn, 1, 2 );
109} 104}
110 105
111TaskEditorAlarms::~TaskEditorAlarms(){ 106TaskEditorAlarms::~TaskEditorAlarms(){
112} 107}
113 108
114void TaskEditorAlarms::slotNew(){ 109void TaskEditorAlarms::slotNew(){
115 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) ); 110 (void)new AlarmItem(lstAlarms, OPimAlarm(0, QDateTime::currentDateTime() ) );
116} 111}
117 112
118void TaskEditorAlarms::slotEdit(){ 113void TaskEditorAlarms::slotEdit(){
119} 114}
120 115
121void TaskEditorAlarms::slotDelete(){ 116void TaskEditorAlarms::slotDelete(){
122 QListViewItem* item = lstAlarms->currentItem(); 117 QListViewItem* item = lstAlarms->currentItem();
123 if (!item) return; 118 if (!item) return;
124 119
125 lstAlarms->takeItem( item ); delete item; 120 lstAlarms->takeItem( item ); delete item;
126 121
127 122
128} 123}
129 124
130void TaskEditorAlarms::load( const OTodo& todo) { 125void TaskEditorAlarms::load( const OTodo& todo) {
131 lstAlarms->clear(); 126 lstAlarms->clear();
132 if (!todo.hasNotifiers() ) return; 127 if (!todo.hasNotifiers() ) return;
133 128
134 OPimNotifyManager::Alarms als = todo.notifiers().alarms(); 129 OPimNotifyManager::Alarms als = todo.notifiers().alarms();
135 130
136 if (als.isEmpty() ) return; 131 if (als.isEmpty() ) return;
137 132
138 OPimNotifyManager::Alarms::Iterator it = als.begin(); 133 OPimNotifyManager::Alarms::Iterator it = als.begin();
139 for ( ; it != als.end(); ++it ) 134 for ( ; it != als.end(); ++it )
140 (void)new AlarmItem( lstAlarms, (*it) ); 135 (void)new AlarmItem( lstAlarms, (*it) );