author | zautrix <zautrix> | 2005-06-18 09:12:06 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-18 09:12:06 (UTC) |
commit | 39112dfe29d2108d54d37f25dc57dcd9299f1f93 (patch) (unidiff) | |
tree | d240d7a346ae56d41a68e77ae83eba119665b86b /korganizer/kolistview.cpp | |
parent | 86e7069527cf45b4ba7889619fb0a8a6dd5867cc (diff) | |
download | kdepimpi-39112dfe29d2108d54d37f25dc57dcd9299f1f93.zip kdepimpi-39112dfe29d2108d54d37f25dc57dcd9299f1f93.tar.gz kdepimpi-39112dfe29d2108d54d37f25dc57dcd9299f1f93.tar.bz2 |
icons for todos
-rw-r--r-- | korganizer/kolistview.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index c705c73..0b2f9a4 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,624 +1,632 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qpaintdevicemetrics.h> | 38 | #include <qpaintdevicemetrics.h> |
39 | 39 | ||
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | 44 | ||
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | #include <libkcal/calendar.h> | 46 | #include <libkcal/calendar.h> |
47 | #include <libkcal/calendarlocal.h> | 47 | #include <libkcal/calendarlocal.h> |
48 | #include <libkcal/icalformat.h> | 48 | #include <libkcal/icalformat.h> |
49 | #include <libkcal/vcalformat.h> | 49 | #include <libkcal/vcalformat.h> |
50 | #include <libkcal/recurrence.h> | 50 | #include <libkcal/recurrence.h> |
51 | #include <libkcal/filestorage.h> | 51 | #include <libkcal/filestorage.h> |
52 | #include <libkdepim/categoryselectdialog.h> | 52 | #include <libkdepim/categoryselectdialog.h> |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
55 | #include <qpe/qpeapplication.h> | 55 | #include <qpe/qpeapplication.h> |
56 | #else | 56 | #else |
57 | #include <qapplication.h> | 57 | #include <qapplication.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifndef KORG_NOPRINTER | 60 | #ifndef KORG_NOPRINTER |
61 | #include "calprinter.h" | 61 | #include "calprinter.h" |
62 | #endif | 62 | #endif |
63 | #include "koglobals.h" | 63 | #include "koglobals.h" |
64 | #include "koprefs.h" | 64 | #include "koprefs.h" |
65 | #include "kfiledialog.h" | 65 | #include "kfiledialog.h" |
66 | 66 | ||
67 | #include "kolistview.h" | 67 | #include "kolistview.h" |
68 | #include "koeventviewer.h" | 68 | #include "koeventviewer.h" |
69 | 69 | ||
70 | extern QPixmap* sgListViewCompletedPix[6]; | ||
71 | |||
70 | class KOListViewWhatsThis :public QWhatsThis | 72 | class KOListViewWhatsThis :public QWhatsThis |
71 | { | 73 | { |
72 | public: | 74 | public: |
73 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 75 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
74 | 76 | ||
75 | protected: | 77 | protected: |
76 | virtual QString text( const QPoint& p) | 78 | virtual QString text( const QPoint& p) |
77 | { | 79 | { |
78 | return _view->getWhatsThisText(p) ; | 80 | return _view->getWhatsThisText(p) ; |
79 | } | 81 | } |
80 | private: | 82 | private: |
81 | QWidget* _wid; | 83 | QWidget* _wid; |
82 | KOListView * _view; | 84 | KOListView * _view; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | 87 | ||
86 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 88 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
87 | { | 89 | { |
88 | mItem = item; | 90 | mItem = item; |
89 | mDate = date; | 91 | mDate = date; |
90 | } | 92 | } |
91 | 93 | ||
92 | ListItemVisitor::~ListItemVisitor() | 94 | ListItemVisitor::~ListItemVisitor() |
93 | { | 95 | { |
94 | } | 96 | } |
95 | 97 | ||
96 | bool ListItemVisitor::visit(Event *e) | 98 | bool ListItemVisitor::visit(Event *e) |
97 | { | 99 | { |
98 | bool ok = false; | 100 | bool ok = false; |
99 | QString start, end; | 101 | QString start, end; |
100 | QDate ds, de; | 102 | QDate ds, de; |
101 | if ( e->doesRecur() ) { | 103 | if ( e->doesRecur() ) { |
102 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 104 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
103 | if ( ok ) { | 105 | if ( ok ) { |
104 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 106 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
105 | start = KGlobal::locale()->formatDate(ds,true); | 107 | start = KGlobal::locale()->formatDate(ds,true); |
106 | de = ds.addDays( days); | 108 | de = ds.addDays( days); |
107 | end = KGlobal::locale()->formatDate(de,true); | 109 | end = KGlobal::locale()->formatDate(de,true); |
108 | } | 110 | } |
109 | 111 | ||
110 | } | 112 | } |
111 | if ( ! ok ) { | 113 | if ( ! ok ) { |
112 | start =e->dtStartDateStr(); | 114 | start =e->dtStartDateStr(); |
113 | end = e->dtEndDateStr(); | 115 | end = e->dtEndDateStr(); |
114 | ds = e->dtStart().date(); | 116 | ds = e->dtStart().date(); |
115 | de = e->dtEnd().date(); | 117 | de = e->dtEnd().date(); |
116 | } | 118 | } |
117 | mItem->setText(0,e->summary()); | 119 | mItem->setText(0,e->summary()); |
118 | mItem->setText(1,start); | 120 | mItem->setText(1,start); |
119 | if ( e->doesFloat() ) | 121 | if ( e->doesFloat() ) |
120 | mItem->setText(2,"---"); | 122 | mItem->setText(2,"---"); |
121 | else | 123 | else |
122 | mItem->setText(2,e->dtStartTimeStr()); | 124 | mItem->setText(2,e->dtStartTimeStr()); |
123 | mItem->setText(3,end); | 125 | mItem->setText(3,end); |
124 | if ( e->doesFloat() ) | 126 | if ( e->doesFloat() ) |
125 | mItem->setText(4,"---"); | 127 | mItem->setText(4,"---"); |
126 | else | 128 | else |
127 | mItem->setText(4,e->dtEndTimeStr()); | 129 | mItem->setText(4,e->dtEndTimeStr()); |
128 | if ( e->isAlarmEnabled() ) { | 130 | if ( e->isAlarmEnabled() ) { |
129 | mItem->setText(5,e->alarms().first()->offsetText() ); | 131 | mItem->setText(5,e->alarms().first()->offsetText() ); |
130 | } else { | 132 | } else { |
131 | mItem->setText(5, i18n("No")); | 133 | mItem->setText(5, i18n("No")); |
132 | } | 134 | } |
133 | mItem->setText(6, e->recurrence()->recurrenceText()); | 135 | mItem->setText(6, e->recurrence()->recurrenceText()); |
134 | if( ! e->doesRecur() ) | 136 | if( ! e->doesRecur() ) |
135 | mItem->setSortKey( 6, "-" ); | 137 | mItem->setSortKey( 6, "-" ); |
136 | mItem->setText(7,"---"); | 138 | mItem->setText(7,"---"); |
137 | mItem->setText(8,"---"); | 139 | mItem->setText(8,"---"); |
138 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 140 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
139 | mItem->setText(10,e->categoriesStr()); | 141 | mItem->setText(10,e->categoriesStr()); |
140 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); | 142 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); |
141 | 143 | ||
142 | QString key; | 144 | QString key; |
143 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 145 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
144 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 146 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
145 | mItem->setSortKey(1,key); | 147 | mItem->setSortKey(1,key); |
146 | 148 | ||
147 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 149 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
148 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 150 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
149 | mItem->setSortKey(3,key); | 151 | mItem->setSortKey(3,key); |
150 | return true; | 152 | return true; |
151 | } | 153 | } |
152 | 154 | ||
153 | bool ListItemVisitor::visit(Todo *t) | 155 | bool ListItemVisitor::visit(Todo *t) |
154 | { | 156 | { |
155 | mItem->setText(0,i18n("Todo: %1").arg(t->summary())); | 157 | mItem->setText(0,t->summary()); |
158 | if ( t->isCompleted() ) { | ||
159 | mItem->setSortKey(0,"99"+ t->summary().left(10)); | ||
160 | } else | ||
161 | mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10)); | ||
162 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); | ||
156 | if (t->hasStartDate()) { | 163 | if (t->hasStartDate()) { |
157 | mItem->setText(1,t->dtStartDateStr()); | 164 | mItem->setText(1,t->dtStartDateStr()); |
158 | if (t->doesFloat()) { | 165 | if (t->doesFloat()) { |
159 | mItem->setText(2,"---"); | 166 | mItem->setText(2,"---"); |
160 | } else { | 167 | } else { |
161 | mItem->setText(2,t->dtStartTimeStr()); | 168 | mItem->setText(2,t->dtStartTimeStr()); |
162 | } | 169 | } |
163 | } else { | 170 | } else { |
164 | mItem->setText(1,"---"); | 171 | mItem->setText(1,"---"); |
165 | mItem->setText(2,"---"); | 172 | mItem->setText(2,"---"); |
166 | } | 173 | } |
167 | mItem->setText(3,"---"); | 174 | mItem->setText(3,"---"); |
168 | mItem->setText(4,"---"); | 175 | mItem->setText(4,"---"); |
169 | if ( t->isAlarmEnabled() ) { | 176 | if ( t->isAlarmEnabled() ) { |
170 | mItem->setText(5,t->alarms().first()->offsetText() ); | 177 | mItem->setText(5,t->alarms().first()->offsetText() ); |
171 | } else { | 178 | } else { |
172 | mItem->setText(5, i18n("No")); | 179 | mItem->setText(5, i18n("No")); |
173 | } | 180 | } |
174 | mItem->setText(6, t->recurrence()->recurrenceText()); | 181 | mItem->setText(6, t->recurrence()->recurrenceText()); |
175 | if( ! t->doesRecur() ) | 182 | if( ! t->doesRecur() ) |
176 | mItem->setSortKey( 6, "-" ); | 183 | mItem->setSortKey( 6, "-" ); |
177 | if (t->hasDueDate()) { | 184 | if (t->hasDueDate()) { |
178 | mItem->setText(7,t->dtDueDateStr()); | 185 | mItem->setText(7,t->dtDueDateStr()); |
179 | if (t->doesFloat()) { | 186 | if (t->doesFloat()) { |
180 | mItem->setText(8,"---"); | 187 | mItem->setText(8,"---"); |
181 | } else { | 188 | } else { |
182 | mItem->setText(8,t->dtDueTimeStr()); | 189 | mItem->setText(8,t->dtDueTimeStr()); |
183 | } | 190 | } |
184 | } else { | 191 | } else { |
185 | mItem->setText(7,"---"); | 192 | mItem->setText(7,"---"); |
186 | mItem->setText(8,"---"); | 193 | mItem->setText(8,"---"); |
187 | } | 194 | } |
188 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 195 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
189 | mItem->setText(10,t->categoriesStr()); | 196 | mItem->setText(10,t->categoriesStr()); |
190 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 197 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); |
191 | 198 | ||
192 | QString key; | 199 | QString key; |
193 | QDate d; | 200 | QDate d; |
194 | if (t->hasDueDate()) { | 201 | if (t->hasDueDate()) { |
195 | d = t->dtDue().date(); | 202 | d = t->dtDue().date(); |
196 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
197 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
198 | mItem->setSortKey(7,key); | 205 | mItem->setSortKey(7,key); |
199 | } | 206 | } |
200 | if ( t->hasStartDate() ) { | 207 | if ( t->hasStartDate() ) { |
201 | d = t->dtStart().date(); | 208 | d = t->dtStart().date(); |
202 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 209 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
203 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 210 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
204 | mItem->setSortKey(1,key); | 211 | mItem->setSortKey(1,key); |
205 | } | 212 | } |
206 | return true; | 213 | return true; |
207 | } | 214 | } |
208 | 215 | ||
209 | bool ListItemVisitor::visit(Journal * j) | 216 | bool ListItemVisitor::visit(Journal * j) |
210 | { | 217 | { |
211 | QString des = j->description().left(30); | 218 | QString des = j->description().left(30); |
212 | des = des.simplifyWhiteSpace (); | 219 | des = des.simplifyWhiteSpace (); |
213 | des.replace (QRegExp ("\\n"),"" ); | 220 | des.replace (QRegExp ("\\n"),"" ); |
214 | des.replace (QRegExp ("\\r"),"" ); | 221 | des.replace (QRegExp ("\\r"),"" ); |
215 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 222 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
216 | mItem->setText(1,j->dtStartDateStr()); | 223 | mItem->setText(1,j->dtStartDateStr()); |
217 | mItem->setText(2,"---"); | 224 | mItem->setText(2,"---"); |
218 | mItem->setText(3,"---"); | 225 | mItem->setText(3,"---"); |
219 | mItem->setText(4,"---"); | 226 | mItem->setText(4,"---"); |
220 | mItem->setText(5,"---"); | 227 | mItem->setText(5,"---"); |
221 | mItem->setText(6,"---"); | 228 | mItem->setText(6,"---"); |
222 | mItem->setText(7,j->dtStartDateStr()); | 229 | mItem->setText(7,j->dtStartDateStr()); |
223 | mItem->setText(8,"---"); | 230 | mItem->setText(8,"---"); |
224 | mItem->setText(9,"---"); | 231 | mItem->setText(9,"---"); |
225 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 232 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
226 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 233 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); |
227 | 234 | ||
228 | QString key; | 235 | QString key; |
229 | QDate d = j->dtStart().date(); | 236 | QDate d = j->dtStart().date(); |
230 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 237 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
231 | mItem->setSortKey(1,key); | 238 | mItem->setSortKey(1,key); |
232 | mItem->setSortKey(7,key); | 239 | mItem->setSortKey(7,key); |
233 | 240 | ||
234 | return true; | 241 | return true; |
235 | } | 242 | } |
236 | 243 | ||
237 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 244 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
238 | const char *name) | 245 | const char *name) |
239 | : KOEventView(calendar, parent, name) | 246 | : KOEventView(calendar, parent, name) |
240 | { | 247 | { |
248 | |||
241 | mActiveItem = 0; | 249 | mActiveItem = 0; |
242 | mListView = new KOListViewListView(this); | 250 | mListView = new KOListViewListView(this); |
243 | mListView->addColumn(i18n("Summary")); | 251 | mListView->addColumn(i18n("Summary")); |
244 | mListView->addColumn(i18n("Start Date")); | 252 | mListView->addColumn(i18n("Start Date")); |
245 | mListView->addColumn(i18n("Start Time")); | 253 | mListView->addColumn(i18n("Start Time")); |
246 | mListView->addColumn(i18n("End Date")); | 254 | mListView->addColumn(i18n("End Date")); |
247 | mListView->addColumn(i18n("End Time")); | 255 | mListView->addColumn(i18n("End Time")); |
248 | mListView->addColumn(i18n("Alarm")); // alarm set? | 256 | mListView->addColumn(i18n("Alarm")); // alarm set? |
249 | mListView->addColumn(i18n("Recurs")); // recurs? | 257 | mListView->addColumn(i18n("Recurs")); // recurs? |
250 | mListView->addColumn(i18n("Due Date")); | 258 | mListView->addColumn(i18n("Due Date")); |
251 | mListView->addColumn(i18n("Due Time")); | 259 | mListView->addColumn(i18n("Due Time")); |
252 | mListView->addColumn(i18n("Cancelled")); | 260 | mListView->addColumn(i18n("Cancelled")); |
253 | mListView->addColumn(i18n("Categories")); | 261 | mListView->addColumn(i18n("Categories")); |
254 | mListView->addColumn(i18n("Calendar")); | 262 | mListView->addColumn(i18n("Calendar")); |
255 | 263 | ||
256 | mListView->setColumnAlignment(0,AlignLeft); | 264 | mListView->setColumnAlignment(0,AlignLeft); |
257 | mListView->setColumnAlignment(1,AlignLeft); | 265 | mListView->setColumnAlignment(1,AlignLeft); |
258 | mListView->setColumnAlignment(2,AlignHCenter); | 266 | mListView->setColumnAlignment(2,AlignHCenter); |
259 | mListView->setColumnAlignment(3,AlignLeft); | 267 | mListView->setColumnAlignment(3,AlignLeft); |
260 | mListView->setColumnAlignment(4,AlignHCenter); | 268 | mListView->setColumnAlignment(4,AlignHCenter); |
261 | mListView->setColumnAlignment(5,AlignLeft); | 269 | mListView->setColumnAlignment(5,AlignLeft); |
262 | mListView->setColumnAlignment(6,AlignLeft); | 270 | mListView->setColumnAlignment(6,AlignLeft); |
263 | mListView->setColumnAlignment(7,AlignLeft); | 271 | mListView->setColumnAlignment(7,AlignLeft); |
264 | mListView->setColumnAlignment(8,AlignLeft); | 272 | mListView->setColumnAlignment(8,AlignLeft); |
265 | mListView->setColumnAlignment(9,AlignLeft); | 273 | mListView->setColumnAlignment(9,AlignLeft); |
266 | mListView->setColumnAlignment(10,AlignLeft); | 274 | mListView->setColumnAlignment(10,AlignLeft); |
267 | mListView->setColumnAlignment(11,AlignLeft); | 275 | mListView->setColumnAlignment(11,AlignLeft); |
268 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 276 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
269 | 277 | ||
270 | int iii = 0; | 278 | int iii = 0; |
271 | for ( iii = 0; iii< 12 ; ++iii ) | 279 | for ( iii = 0; iii< 12 ; ++iii ) |
272 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 280 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
273 | 281 | ||
274 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 282 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
275 | layoutTop->addWidget(mListView); | 283 | layoutTop->addWidget(mListView); |
276 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 284 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
277 | mPopupMenu = eventPopup(); | 285 | mPopupMenu = eventPopup(); |
278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 286 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
279 | i18n("Select all"),this, | 287 | i18n("Select all"),this, |
280 | SLOT(allSelection()),true); | 288 | SLOT(allSelection()),true); |
281 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 289 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
282 | i18n("Deselect all"),this, | 290 | i18n("Deselect all"),this, |
283 | SLOT(clearSelection()),true); | 291 | SLOT(clearSelection()),true); |
284 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 292 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
285 | i18n("Delete all selected"),this, | 293 | i18n("Delete all selected"),this, |
286 | SLOT(deleteAll()),true); | 294 | SLOT(deleteAll()),true); |
287 | 295 | ||
288 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 296 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
289 | i18n("Hide all selected"),this, | 297 | i18n("Hide all selected"),this, |
290 | SLOT(hideAll()),true); | 298 | SLOT(hideAll()),true); |
291 | 299 | ||
292 | mPopupMenu->insertSeparator(); | 300 | mPopupMenu->insertSeparator(); |
293 | #ifdef DESKTOP_VERSION | 301 | #ifdef DESKTOP_VERSION |
294 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 302 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
295 | i18n("Print complete list"),this, | 303 | i18n("Print complete list"),this, |
296 | SLOT(printList()),true); | 304 | SLOT(printList()),true); |
297 | mPopupMenu->insertSeparator(); | 305 | mPopupMenu->insertSeparator(); |
298 | #endif | 306 | #endif |
299 | mCalPopup = new QPopupMenu ( this ); | 307 | mCalPopup = new QPopupMenu ( this ); |
300 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); | 308 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); |
301 | 309 | ||
302 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 310 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
303 | SLOT( populateCalPopup() )); | 311 | SLOT( populateCalPopup() )); |
304 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 312 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
305 | SLOT( setCalendar( int ) )); | 313 | SLOT( setCalendar( int ) )); |
306 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 314 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
307 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); | 315 | mPopupMenu->insertItem( i18n("Export selected"), exportPO ); |
308 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 316 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
309 | SLOT(saveToFile())); | 317 | SLOT(saveToFile())); |
310 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 318 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
311 | SLOT(saveToFileVCS())); | 319 | SLOT(saveToFileVCS())); |
312 | exportPO->insertItem( i18n("Journal/Details..."),this, | 320 | exportPO->insertItem( i18n("Journal/Details..."),this, |
313 | SLOT(saveDescriptionToFile())); | 321 | SLOT(saveDescriptionToFile())); |
314 | // mPopupMenu->insertSeparator(); | 322 | // mPopupMenu->insertSeparator(); |
315 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 323 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
316 | i18n("Add Categ. to selected..."),this, | 324 | i18n("Add Categ. to selected..."),this, |
317 | SLOT(addCat()),true); | 325 | SLOT(addCat()),true); |
318 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 326 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
319 | i18n("Set Categ. for selected..."),this, | 327 | i18n("Set Categ. for selected..."),this, |
320 | SLOT(setCat()),true); | 328 | SLOT(setCat()),true); |
321 | //mPopupMenu->insertSeparator(); | 329 | //mPopupMenu->insertSeparator(); |
322 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
323 | i18n("Set alarm for selected..."),this, | 331 | i18n("Set alarm for selected..."),this, |
324 | SLOT(setAlarm()),true); | 332 | SLOT(setAlarm()),true); |
325 | 333 | ||
326 | 334 | ||
327 | 335 | ||
328 | #ifndef DESKTOP_VERSION | 336 | #ifndef DESKTOP_VERSION |
329 | mPopupMenu->insertSeparator(); | 337 | mPopupMenu->insertSeparator(); |
330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 338 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
331 | i18n("Beam selected via IR"),this, | 339 | i18n("Beam selected via IR"),this, |
332 | SLOT(beamSelected()),true); | 340 | SLOT(beamSelected()),true); |
333 | #endif | 341 | #endif |
334 | /* | 342 | /* |
335 | mPopupMenu = new QPopupMenu; | 343 | mPopupMenu = new QPopupMenu; |
336 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 344 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
337 | SLOT (editEvent())); | 345 | SLOT (editEvent())); |
338 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 346 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
339 | SLOT (deleteEvent())); | 347 | SLOT (deleteEvent())); |
340 | mPopupMenu->insertSeparator(); | 348 | mPopupMenu->insertSeparator(); |
341 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 349 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
342 | SLOT(showDates())); | 350 | SLOT(showDates())); |
343 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 351 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
344 | SLOT(hideDates())); | 352 | SLOT(hideDates())); |
345 | */ | 353 | */ |
346 | QObject::connect(mListView,SIGNAL( newEvent()), | 354 | QObject::connect(mListView,SIGNAL( newEvent()), |
347 | this,SIGNAL(signalNewEvent())); | 355 | this,SIGNAL(signalNewEvent())); |
348 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 356 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
349 | this,SLOT(defaultItemAction(QListViewItem *))); | 357 | this,SLOT(defaultItemAction(QListViewItem *))); |
350 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 358 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
351 | const QPoint &, int )), | 359 | const QPoint &, int )), |
352 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 360 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
353 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 361 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
354 | SLOT(processSelectionChange(QListViewItem *))); | 362 | SLOT(processSelectionChange(QListViewItem *))); |
355 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 363 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
356 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 364 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
357 | 365 | ||
358 | readSettings(KOGlobals::config(),"KOListView Layout"); | 366 | readSettings(KOGlobals::config(),"KOListView Layout"); |
359 | } | 367 | } |
360 | 368 | ||
361 | KOListView::~KOListView() | 369 | KOListView::~KOListView() |
362 | { | 370 | { |
363 | delete mPopupMenu; | 371 | delete mPopupMenu; |
364 | #if QT_VERSION >= 0x030000 | 372 | #if QT_VERSION >= 0x030000 |
365 | 373 | ||
366 | #else | 374 | #else |
367 | delete mKOListViewWhatsThis; | 375 | delete mKOListViewWhatsThis; |
368 | #endif | 376 | #endif |
369 | } | 377 | } |
370 | 378 | ||
371 | QString KOListView::getWhatsThisText(QPoint p) | 379 | QString KOListView::getWhatsThisText(QPoint p) |
372 | { | 380 | { |
373 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 381 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
374 | if ( item ) | 382 | if ( item ) |
375 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 383 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
376 | KOPrefs::instance()->mWTshowDetails, | 384 | KOPrefs::instance()->mWTshowDetails, |
377 | KOPrefs::instance()->mWTshowCreated, | 385 | KOPrefs::instance()->mWTshowCreated, |
378 | KOPrefs::instance()->mWTshowChanged); | 386 | KOPrefs::instance()->mWTshowChanged); |
379 | return i18n("That is the list view" ); | 387 | return i18n("That is the list view" ); |
380 | 388 | ||
381 | } | 389 | } |
382 | 390 | ||
383 | void KOListView::setCalendar( int c ) | 391 | void KOListView::setCalendar( int c ) |
384 | { | 392 | { |
385 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 393 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
386 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 394 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
387 | i18n("Continue"), i18n("Cancel"), 0, | 395 | i18n("Continue"), i18n("Cancel"), 0, |
388 | 0, 1 ); | 396 | 0, 1 ); |
389 | if ( result != 0 ) { | 397 | if ( result != 0 ) { |
390 | return; | 398 | return; |
391 | } | 399 | } |
392 | 400 | ||
393 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 401 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
394 | int icount = delSel.count(); | 402 | int icount = delSel.count(); |
395 | if ( icount ) { | 403 | if ( icount ) { |
396 | Incidence *incidence = delSel.first(); | 404 | Incidence *incidence = delSel.first(); |
397 | while ( incidence ) { | 405 | while ( incidence ) { |
398 | incidence->setCalID( c ); | 406 | incidence->setCalID( c ); |
399 | KOListViewItem * item = getItemForEvent( incidence ); | 407 | KOListViewItem * item = getItemForEvent( incidence ); |
400 | if ( item ) { | 408 | if ( item ) { |
401 | ListItemVisitor v(item, mStartDate ); | 409 | ListItemVisitor v(item, mStartDate ); |
402 | incidence->accept(v); | 410 | incidence->accept(v); |
403 | } | 411 | } |
404 | incidence = delSel.next(); | 412 | incidence = delSel.next(); |
405 | } | 413 | } |
406 | } | 414 | } |
407 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 415 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
408 | KopiCalendarFile * cal = calendars.first(); | 416 | KopiCalendarFile * cal = calendars.first(); |
409 | while ( cal ) { | 417 | while ( cal ) { |
410 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 418 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
411 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 419 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
412 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 420 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
413 | if ( cal->isStandard ) | 421 | if ( cal->isStandard ) |
414 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 422 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
415 | cal = calendars.next(); | 423 | cal = calendars.next(); |
416 | } | 424 | } |
417 | mCalendar->setSyncEventsReadOnly(); | 425 | mCalendar->setSyncEventsReadOnly(); |
418 | mCalendar->reInitAlarmSettings(); | 426 | mCalendar->reInitAlarmSettings(); |
419 | 427 | ||
420 | } | 428 | } |
421 | void KOListView::populateCalPopup() | 429 | void KOListView::populateCalPopup() |
422 | { | 430 | { |
423 | mCalPopup->clear(); | 431 | mCalPopup->clear(); |
424 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 432 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
425 | while ( kkf ) { | 433 | while ( kkf ) { |
426 | mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); | 434 | mCalPopup->insertItem( kkf->mName, kkf->mCalNumber); |
427 | kkf = KOPrefs::instance()->mCalendars.next(); | 435 | kkf = KOPrefs::instance()->mCalendars.next(); |
428 | } | 436 | } |
429 | } | 437 | } |
430 | void KOListView::updateList() | 438 | void KOListView::updateList() |
431 | { | 439 | { |
432 | // qDebug(" KOListView::updateList() "); | 440 | // qDebug(" KOListView::updateList() "); |
433 | 441 | ||
434 | } | 442 | } |
435 | 443 | ||
436 | void KOListView::clearList() | 444 | void KOListView::clearList() |
437 | { | 445 | { |
438 | clear (); | 446 | clear (); |
439 | } | 447 | } |
440 | void KOListView::addCat( ) | 448 | void KOListView::addCat( ) |
441 | { | 449 | { |
442 | setCategories( false ); | 450 | setCategories( false ); |
443 | } | 451 | } |
444 | void KOListView::setCat() | 452 | void KOListView::setCat() |
445 | { | 453 | { |
446 | setCategories( true ); | 454 | setCategories( true ); |
447 | } | 455 | } |
448 | 456 | ||
449 | void KOListView::setAlarm() | 457 | void KOListView::setAlarm() |
450 | { | 458 | { |
451 | KOAlarmPrefs kap( this); | 459 | KOAlarmPrefs kap( this); |
452 | if ( !kap.exec() ) | 460 | if ( !kap.exec() ) |
453 | return; | 461 | return; |
454 | QStringList itemList; | 462 | QStringList itemList; |
455 | QPtrList<KOListViewItem> sel ; | 463 | QPtrList<KOListViewItem> sel ; |
456 | QListViewItem *qitem = mListView->firstChild (); | 464 | QListViewItem *qitem = mListView->firstChild (); |
457 | while ( qitem ) { | 465 | while ( qitem ) { |
458 | if ( qitem->isSelected() ) { | 466 | if ( qitem->isSelected() ) { |
459 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 467 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
460 | if ( inc->typeID() != journalID ) { | 468 | if ( inc->typeID() != journalID ) { |
461 | if ( inc->typeID() == todoID ) { | 469 | if ( inc->typeID() == todoID ) { |
462 | if ( ((Todo*)inc)->hasDueDate() ) | 470 | if ( ((Todo*)inc)->hasDueDate() ) |
463 | sel.append(((KOListViewItem *)qitem)); | 471 | sel.append(((KOListViewItem *)qitem)); |
464 | } else | 472 | } else |
465 | sel.append(((KOListViewItem *)qitem)); | 473 | sel.append(((KOListViewItem *)qitem)); |
466 | } | 474 | } |
467 | } | 475 | } |
468 | qitem = qitem->nextSibling(); | 476 | qitem = qitem->nextSibling(); |
469 | } | 477 | } |
470 | int count = 0; | 478 | int count = 0; |
471 | KOListViewItem * item, *temp; | 479 | KOListViewItem * item, *temp; |
472 | item = sel.first(); | 480 | item = sel.first(); |
473 | Incidence* inc; | 481 | Incidence* inc; |
474 | while ( item ) { | 482 | while ( item ) { |
475 | inc = item->data(); | 483 | inc = item->data(); |
476 | ++count; | 484 | ++count; |
477 | if (kap.mAlarmButton->isChecked()) { | 485 | if (kap.mAlarmButton->isChecked()) { |
478 | if (inc->alarms().count() == 0) | 486 | if (inc->alarms().count() == 0) |
479 | inc->newAlarm(); | 487 | inc->newAlarm(); |
480 | QPtrList<Alarm> alarms = inc->alarms(); | 488 | QPtrList<Alarm> alarms = inc->alarms(); |
481 | Alarm *alarm; | 489 | Alarm *alarm; |
482 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 490 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
483 | alarm->setEnabled(true); | 491 | alarm->setEnabled(true); |
484 | int j = kap.mAlarmTimeEdit->value()* -60; | 492 | int j = kap.mAlarmTimeEdit->value()* -60; |
485 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 493 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
486 | j = j * 60; | 494 | j = j * 60; |
487 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 495 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
488 | j = j * (60 * 24); | 496 | j = j * (60 * 24); |
489 | alarm->setStartOffset( j ); | 497 | alarm->setStartOffset( j ); |
490 | 498 | ||
491 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 499 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
492 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 500 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
493 | } | 501 | } |
494 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 502 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
495 | alarm->setAudioAlarm(kap.mAlarmSound); | 503 | alarm->setAudioAlarm(kap.mAlarmSound); |
496 | else | 504 | else |
497 | alarm->setType(Alarm::Invalid); | 505 | alarm->setType(Alarm::Invalid); |
498 | //alarm->setAudioAlarm("default"); | 506 | //alarm->setAudioAlarm("default"); |
499 | // TODO: Deal with multiple alarms | 507 | // TODO: Deal with multiple alarms |
500 | break; // For now, stop after the first alarm | 508 | break; // For now, stop after the first alarm |
501 | } | 509 | } |
502 | } else { | 510 | } else { |
503 | Alarm* alarm = inc->alarms().first(); | 511 | Alarm* alarm = inc->alarms().first(); |
504 | if ( alarm ) { | 512 | if ( alarm ) { |
505 | alarm->setEnabled(false); | 513 | alarm->setEnabled(false); |
506 | alarm->setType(Alarm::Invalid); | 514 | alarm->setType(Alarm::Invalid); |
507 | } | 515 | } |
508 | } | 516 | } |
509 | ListItemVisitor v(item, mStartDate ); | 517 | ListItemVisitor v(item, mStartDate ); |
510 | inc->accept(v); | 518 | inc->accept(v); |
511 | item = sel.next(); | 519 | item = sel.next(); |
512 | } | 520 | } |
513 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 521 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
514 | qDebug("KO: Set alarm for %d items", count); | 522 | qDebug("KO: Set alarm for %d items", count); |
515 | calendar()->reInitAlarmSettings(); | 523 | calendar()->reInitAlarmSettings(); |
516 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 524 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
517 | } | 525 | } |
518 | void KOListView::setCategories( bool removeOld ) | 526 | void KOListView::setCategories( bool removeOld ) |
519 | { | 527 | { |
520 | 528 | ||
521 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 529 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
522 | csd->setColorEnabled(); | 530 | csd->setColorEnabled(); |
523 | if (! csd->exec()) { | 531 | if (! csd->exec()) { |
524 | delete csd; | 532 | delete csd; |
525 | return; | 533 | return; |
526 | } | 534 | } |
527 | QStringList catList = csd->selectedCategories(); | 535 | QStringList catList = csd->selectedCategories(); |
528 | delete csd; | 536 | delete csd; |
529 | // if ( catList.count() == 0 ) | 537 | // if ( catList.count() == 0 ) |
530 | // return; | 538 | // return; |
531 | //catList.sort(); | 539 | //catList.sort(); |
532 | QString categoriesStr = catList.join(","); | 540 | QString categoriesStr = catList.join(","); |
533 | int i; | 541 | int i; |
534 | QStringList itemList; | 542 | QStringList itemList; |
535 | QPtrList<KOListViewItem> sel ; | 543 | QPtrList<KOListViewItem> sel ; |
536 | QListViewItem *qitem = mListView->firstChild (); | 544 | QListViewItem *qitem = mListView->firstChild (); |
537 | while ( qitem ) { | 545 | while ( qitem ) { |
538 | if ( qitem->isSelected() ) { | 546 | if ( qitem->isSelected() ) { |
539 | sel.append(((KOListViewItem *)qitem)); | 547 | sel.append(((KOListViewItem *)qitem)); |
540 | } | 548 | } |
541 | qitem = qitem->nextSibling(); | 549 | qitem = qitem->nextSibling(); |
542 | } | 550 | } |
543 | KOListViewItem * item, *temp; | 551 | KOListViewItem * item, *temp; |
544 | item = sel.first(); | 552 | item = sel.first(); |
545 | if( item ) { | 553 | if( item ) { |
546 | Incidence* inc = item->data() ; | 554 | Incidence* inc = item->data() ; |
547 | bool setSub = false; | 555 | bool setSub = false; |
548 | if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) { | 556 | if( inc->typeID() == todoID && sel.count() == 1 && inc->relations().count() > 0 ) { |
549 | int result = KMessageBox::warningYesNoCancel(this, | 557 | int result = KMessageBox::warningYesNoCancel(this, |
550 | i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), | 558 | i18n("The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?").arg( inc->summary().left ( 25 ) ), |
551 | i18n("Todo has subtodos"), | 559 | i18n("Todo has subtodos"), |
552 | i18n("Yes"), | 560 | i18n("Yes"), |
553 | i18n("No")); | 561 | i18n("No")); |
554 | if (result == KMessageBox::Cancel) item = 0; | 562 | if (result == KMessageBox::Cancel) item = 0; |
555 | if (result == KMessageBox::Yes) setSub = true; | 563 | if (result == KMessageBox::Yes) setSub = true; |
556 | } | 564 | } |
557 | while ( item ) { | 565 | while ( item ) { |
558 | inc = item->data(); | 566 | inc = item->data(); |
559 | if ( removeOld ) { | 567 | if ( removeOld ) { |
560 | inc->setCategories( catList, setSub ); | 568 | inc->setCategories( catList, setSub ); |
561 | } else { | 569 | } else { |
562 | inc->addCategories( catList, setSub ); | 570 | inc->addCategories( catList, setSub ); |
563 | } | 571 | } |
564 | ListItemVisitor v(item, mStartDate ); | 572 | ListItemVisitor v(item, mStartDate ); |
565 | inc->accept(v); | 573 | inc->accept(v); |
566 | item = sel.next(); | 574 | item = sel.next(); |
567 | } | 575 | } |
568 | } | 576 | } |
569 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 577 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
570 | } | 578 | } |
571 | 579 | ||
572 | void KOListView::beamSelected() | 580 | void KOListView::beamSelected() |
573 | { | 581 | { |
574 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 582 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
575 | int icount = delSel.count(); | 583 | int icount = delSel.count(); |
576 | if ( icount ) { | 584 | if ( icount ) { |
577 | emit beamIncidenceList( delSel ); | 585 | emit beamIncidenceList( delSel ); |
578 | return; | 586 | return; |
579 | QString fn ; | 587 | QString fn ; |
580 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; | 588 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; |
581 | QString mes; | 589 | QString mes; |
582 | bool createbup = true; | 590 | bool createbup = true; |
583 | if ( createbup ) { | 591 | if ( createbup ) { |
584 | QString description = "\n"; | 592 | QString description = "\n"; |
585 | CalendarLocal* cal = new CalendarLocal(); | 593 | CalendarLocal* cal = new CalendarLocal(); |
586 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 594 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
587 | Incidence *incidence = delSel.first(); | 595 | Incidence *incidence = delSel.first(); |
588 | while ( incidence ) { | 596 | while ( incidence ) { |
589 | Incidence *in = incidence->clone(); | 597 | Incidence *in = incidence->clone(); |
590 | description += in->summary() + "\n"; | 598 | description += in->summary() + "\n"; |
591 | cal->addIncidence( in ); | 599 | cal->addIncidence( in ); |
592 | incidence = delSel.next(); | 600 | incidence = delSel.next(); |
593 | } | 601 | } |
594 | FileStorage storage( cal, fn, new VCalFormat ); | 602 | FileStorage storage( cal, fn, new VCalFormat ); |
595 | storage.save(); | 603 | storage.save(); |
596 | delete cal; | 604 | delete cal; |
597 | mes = i18n("KO/Pi: Ready for beaming"); | 605 | mes = i18n("KO/Pi: Ready for beaming"); |
598 | topLevelWidget()->setCaption(mes); | 606 | topLevelWidget()->setCaption(mes); |
599 | 607 | ||
600 | #ifndef DESKTOP_VERSION | 608 | #ifndef DESKTOP_VERSION |
601 | Ir *ir = new Ir( this ); | 609 | Ir *ir = new Ir( this ); |
602 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 610 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
603 | ir->send( fn, description, "text/x-vCalendar" ); | 611 | ir->send( fn, description, "text/x-vCalendar" ); |
604 | #endif | 612 | #endif |
605 | } | 613 | } |
606 | } | 614 | } |
607 | } | 615 | } |
608 | void KOListView::beamDone( Ir *ir ) | 616 | void KOListView::beamDone( Ir *ir ) |
609 | { | 617 | { |
610 | #ifndef DESKTOP_VERSION | 618 | #ifndef DESKTOP_VERSION |
611 | delete ir; | 619 | delete ir; |
612 | #endif | 620 | #endif |
613 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); | 621 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); |
614 | } | 622 | } |
615 | 623 | ||
616 | void KOListView::saveDescriptionToFile() | 624 | void KOListView::saveDescriptionToFile() |
617 | { | 625 | { |
618 | 626 | ||
619 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 627 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
620 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 628 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
621 | i18n("Continue"), i18n("Cancel"), 0, | 629 | i18n("Continue"), i18n("Cancel"), 0, |
622 | 0, 1 ); | 630 | 0, 1 ); |
623 | if ( result != 0 ) { | 631 | if ( result != 0 ) { |
624 | return; | 632 | return; |