summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-19 11:41:45 (UTC)
committer zautrix <zautrix>2005-01-19 11:41:45 (UTC)
commit0d878a0144644499ead17b2532cc94abb545bcdb (patch) (unidiff)
tree241010225cf2b26847750c5f511ff15a9ebef9e1 /korganizer
parentaf56077eeeab7b46b98ad5159c6653114abf6602 (diff)
downloadkdepimpi-0d878a0144644499ead17b2532cc94abb545bcdb.zip
kdepimpi-0d878a0144644499ead17b2532cc94abb545bcdb.tar.gz
kdepimpi-0d878a0144644499ead17b2532cc94abb545bcdb.tar.bz2
translation added
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index f8bfc8b..b21b419 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,481 +1,482 @@
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 <qregexp.h> 35#include <qregexp.h>
36 36
37#include <klocale.h> 37#include <klocale.h>
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kiconloader.h> 39#include <kiconloader.h>
40#include <kglobal.h> 40#include <kglobal.h>
41 41
42#include <libkdepim/kpimglobalprefs.h> 42#include <libkdepim/kpimglobalprefs.h>
43#include <libkcal/calendar.h> 43#include <libkcal/calendar.h>
44#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46#include <libkcal/vcalformat.h> 46#include <libkcal/vcalformat.h>
47#include <libkcal/recurrence.h> 47#include <libkcal/recurrence.h>
48#include <libkcal/filestorage.h> 48#include <libkcal/filestorage.h>
49#include <libkdepim/categoryselectdialog.h> 49#include <libkdepim/categoryselectdialog.h>
50#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
51#include <qpe/qpeapplication.h> 51#include <qpe/qpeapplication.h>
52#else 52#else
53#include <qapplication.h> 53#include <qapplication.h>
54#endif 54#endif
55 55
56#ifndef KORG_NOPRINTER 56#ifndef KORG_NOPRINTER
57#include "calprinter.h" 57#include "calprinter.h"
58#endif 58#endif
59#include "koglobals.h" 59#include "koglobals.h"
60#include "koprefs.h" 60#include "koprefs.h"
61#include "kfiledialog.h" 61#include "kfiledialog.h"
62 62
63#include "kolistview.h" 63#include "kolistview.h"
64 64
65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
66{ 66{
67 mItem = item; 67 mItem = item;
68 mDate = date; 68 mDate = date;
69} 69}
70 70
71ListItemVisitor::~ListItemVisitor() 71ListItemVisitor::~ListItemVisitor()
72{ 72{
73} 73}
74 74
75bool ListItemVisitor::visit(Event *e) 75bool ListItemVisitor::visit(Event *e)
76{ 76{
77 77
78 bool ok = false; 78 bool ok = false;
79 QString start, end; 79 QString start, end;
80 QDate ds, de; 80 QDate ds, de;
81 if ( e->doesRecur() ) { 81 if ( e->doesRecur() ) {
82 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 82 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
83 if ( ok ) { 83 if ( ok ) {
84 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 84 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
85 start = KGlobal::locale()->formatDate(ds,true); 85 start = KGlobal::locale()->formatDate(ds,true);
86 de = ds.addDays( days); 86 de = ds.addDays( days);
87 end = KGlobal::locale()->formatDate(de,true); 87 end = KGlobal::locale()->formatDate(de,true);
88 } 88 }
89 89
90 } 90 }
91 if ( ! ok ) { 91 if ( ! ok ) {
92 start =e->dtStartDateStr(); 92 start =e->dtStartDateStr();
93 end = e->dtEndDateStr(); 93 end = e->dtEndDateStr();
94 ds = e->dtStart().date(); 94 ds = e->dtStart().date();
95 de = e->dtEnd().date(); 95 de = e->dtEnd().date();
96 } 96 }
97 mItem->setText(0,e->summary()); 97 mItem->setText(0,e->summary());
98 mItem->setText(1,start); 98 mItem->setText(1,start);
99 mItem->setText(2,e->dtStartTimeStr()); 99 mItem->setText(2,e->dtStartTimeStr());
100 mItem->setText(3,end); 100 mItem->setText(3,end);
101 mItem->setText(4,e->dtEndTimeStr()); 101 mItem->setText(4,e->dtEndTimeStr());
102 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 102 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
103 mItem->setText(6, e->recurrence()->recurrenceText()); 103 mItem->setText(6, e->recurrence()->recurrenceText());
104 mItem->setText(7,"---"); 104 mItem->setText(7,"---");
105 mItem->setText(8,"---"); 105 mItem->setText(8,"---");
106 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 106 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
107 mItem->setText(10,e->categoriesStr()); 107 mItem->setText(10,e->categoriesStr());
108 108
109 QString key; 109 QString key;
110 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 110 QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
111 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 111 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
112 mItem->setSortKey(1,key); 112 mItem->setSortKey(1,key);
113 113
114 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 114 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
115 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 115 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
116 mItem->setSortKey(3,key); 116 mItem->setSortKey(3,key);
117 117
118 return true; 118 return true;
119} 119}
120 120
121bool ListItemVisitor::visit(Todo *t) 121bool ListItemVisitor::visit(Todo *t)
122{ 122{
123 mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); 123 mItem->setText(0,i18n("To-Do: %1").arg(t->summary()));
124 if (t->hasStartDate()) { 124 if (t->hasStartDate()) {
125 mItem->setText(1,t->dtStartDateStr()); 125 mItem->setText(1,t->dtStartDateStr());
126 if (t->doesFloat()) { 126 if (t->doesFloat()) {
127 mItem->setText(2,"---"); 127 mItem->setText(2,"---");
128 } else { 128 } else {
129 mItem->setText(2,t->dtStartTimeStr()); 129 mItem->setText(2,t->dtStartTimeStr());
130 } 130 }
131 } else { 131 } else {
132 mItem->setText(1,"---"); 132 mItem->setText(1,"---");
133 mItem->setText(2,"---"); 133 mItem->setText(2,"---");
134 } 134 }
135 mItem->setText(3,"---"); 135 mItem->setText(3,"---");
136 mItem->setText(4,"---"); 136 mItem->setText(4,"---");
137 mItem->setText(5,"---"); 137 mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
138 mItem->setText(6,"---"); 138 mItem->setText(6,"---");
139 if (t->hasDueDate()) { 139 if (t->hasDueDate()) {
140 mItem->setText(7,t->dtDueDateStr()); 140 mItem->setText(7,t->dtDueDateStr());
141 if (t->doesFloat()) { 141 if (t->doesFloat()) {
142 mItem->setText(8,"---"); 142 mItem->setText(8,"---");
143 } else { 143 } else {
144 mItem->setText(8,t->dtDueTimeStr()); 144 mItem->setText(8,t->dtDueTimeStr());
145 } 145 }
146 } else { 146 } else {
147 mItem->setText(7,"---"); 147 mItem->setText(7,"---");
148 mItem->setText(8,"---"); 148 mItem->setText(8,"---");
149 } 149 }
150 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 150 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
151 mItem->setText(10,t->categoriesStr()); 151 mItem->setText(10,t->categoriesStr());
152 152
153 QString key; 153 QString key;
154 QDate d; 154 QDate d;
155 if (t->hasDueDate()) { 155 if (t->hasDueDate()) {
156 d = t->dtDue().date(); 156 d = t->dtDue().date();
157 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 157 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
158 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 158 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
159 mItem->setSortKey(7,key); 159 mItem->setSortKey(7,key);
160 } 160 }
161 if ( t->hasStartDate() ) { 161 if ( t->hasStartDate() ) {
162 d = t->dtStart().date(); 162 d = t->dtStart().date();
163 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 163 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
164 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 164 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
165 mItem->setSortKey(1,key); 165 mItem->setSortKey(1,key);
166 } 166 }
167 return true; 167 return true;
168} 168}
169 169
170bool ListItemVisitor::visit(Journal * j) 170bool ListItemVisitor::visit(Journal * j)
171{ 171{
172 QString des = j->description().left(50); 172 QString des = j->description().left(50);
173 des = des.simplifyWhiteSpace (); 173 des = des.simplifyWhiteSpace ();
174 des.replace (QRegExp ("\\n"),"" ); 174 des.replace (QRegExp ("\\n"),"" );
175 des.replace (QRegExp ("\\r"),"" ); 175 des.replace (QRegExp ("\\r"),"" );
176 mItem->setText(0,i18n("Journal")+": "+des.left(25)); 176 mItem->setText(0,i18n("Journal")+": "+des.left(25));
177 mItem->setText(1,j->dtStartDateStr()); 177 mItem->setText(1,j->dtStartDateStr());
178 mItem->setText(2,"---"); 178 mItem->setText(2,"---");
179 mItem->setText(3,"---"); 179 mItem->setText(3,"---");
180 mItem->setText(4,"---"); 180 mItem->setText(4,"---");
181 mItem->setText(5,"---"); 181 mItem->setText(5,"---");
182 mItem->setText(6,"---"); 182 mItem->setText(6,"---");
183 mItem->setText(7,j->dtStartDateStr()); 183 mItem->setText(7,j->dtStartDateStr());
184 mItem->setText(8,"---"); 184 mItem->setText(8,"---");
185 mItem->setText(9,"---"); 185 mItem->setText(9,"---");
186 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 186 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
187 187
188 QString key; 188 QString key;
189 QDate d = j->dtStart().date(); 189 QDate d = j->dtStart().date();
190 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 190 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
191 mItem->setSortKey(1,key); 191 mItem->setSortKey(1,key);
192 mItem->setSortKey(7,key); 192 mItem->setSortKey(7,key);
193 193
194 return true; 194 return true;
195} 195}
196 196
197KOListView::KOListView(Calendar *calendar, QWidget *parent, 197KOListView::KOListView(Calendar *calendar, QWidget *parent,
198 const char *name) 198 const char *name)
199 : KOEventView(calendar, parent, name) 199 : KOEventView(calendar, parent, name)
200{ 200{
201 mActiveItem = 0; 201 mActiveItem = 0;
202 mListView = new KOListViewListView(this); 202 mListView = new KOListViewListView(this);
203 mListView->addColumn(i18n("Summary")); 203 mListView->addColumn(i18n("Summary"));
204 mListView->addColumn(i18n("Start Date")); 204 mListView->addColumn(i18n("Start Date"));
205 mListView->addColumn(i18n("Start Time")); 205 mListView->addColumn(i18n("Start Time"));
206 mListView->addColumn(i18n("End Date")); 206 mListView->addColumn(i18n("End Date"));
207 mListView->addColumn(i18n("End Time")); 207 mListView->addColumn(i18n("End Time"));
208 mListView->addColumn(i18n("Alarm")); // alarm set? 208 mListView->addColumn(i18n("Alarm")); // alarm set?
209 mListView->addColumn(i18n("Recurs")); // recurs? 209 mListView->addColumn(i18n("Recurs")); // recurs?
210 mListView->addColumn(i18n("Due Date")); 210 mListView->addColumn(i18n("Due Date"));
211 mListView->addColumn(i18n("Due Time")); 211 mListView->addColumn(i18n("Due Time"));
212 mListView->addColumn(i18n("Cancelled")); 212 mListView->addColumn(i18n("Cancelled"));
213 mListView->addColumn(i18n("Categories")); 213 mListView->addColumn(i18n("Categories"));
214 214
215 mListView->setColumnAlignment(0,AlignLeft); 215 mListView->setColumnAlignment(0,AlignLeft);
216 mListView->setColumnAlignment(1,AlignLeft); 216 mListView->setColumnAlignment(1,AlignLeft);
217 mListView->setColumnAlignment(2,AlignHCenter); 217 mListView->setColumnAlignment(2,AlignHCenter);
218 mListView->setColumnAlignment(3,AlignLeft); 218 mListView->setColumnAlignment(3,AlignLeft);
219 mListView->setColumnAlignment(4,AlignHCenter); 219 mListView->setColumnAlignment(4,AlignHCenter);
220 mListView->setColumnAlignment(5,AlignLeft); 220 mListView->setColumnAlignment(5,AlignLeft);
221 mListView->setColumnAlignment(6,AlignLeft); 221 mListView->setColumnAlignment(6,AlignLeft);
222 mListView->setColumnAlignment(7,AlignLeft); 222 mListView->setColumnAlignment(7,AlignLeft);
223 mListView->setColumnAlignment(8,AlignLeft); 223 mListView->setColumnAlignment(8,AlignLeft);
224 mListView->setColumnAlignment(9,AlignLeft); 224 mListView->setColumnAlignment(9,AlignLeft);
225 mListView->setColumnAlignment(10,AlignLeft); 225 mListView->setColumnAlignment(10,AlignLeft);
226 mListView->setColumnWidthMode(10, QListView::Manual);
226 227
227 int iii = 0; 228 int iii = 0;
228 for ( iii = 0; iii< 10 ; ++iii ) 229 for ( iii = 0; iii< 10 ; ++iii )
229 mListView->setColumnWidthMode( iii, QListView::Manual ); 230 mListView->setColumnWidthMode( iii, QListView::Manual );
230 231
231 QBoxLayout *layoutTop = new QVBoxLayout(this); 232 QBoxLayout *layoutTop = new QVBoxLayout(this);
232 layoutTop->addWidget(mListView); 233 layoutTop->addWidget(mListView);
233 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 234 mListView->setFont ( KOPrefs::instance()->mListViewFont );
234 mPopupMenu = eventPopup(); 235 mPopupMenu = eventPopup();
235 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 236 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
236 i18n("Select all"),this, 237 i18n("Select all"),this,
237 SLOT(allSelection()),true); 238 SLOT(allSelection()),true);
238 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 239 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
239 i18n("Deselect All"),this, 240 i18n("Deselect All"),this,
240 SLOT(clearSelection()),true); 241 SLOT(clearSelection()),true);
241 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 242 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
242 i18n("Delete all selected"),this, 243 i18n("Delete all selected"),this,
243 SLOT(deleteAll()),true); 244 SLOT(deleteAll()),true);
244 mPopupMenu->insertSeparator(); 245 mPopupMenu->insertSeparator();
245 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 246 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
246 i18n("Save selected to file..."),this, 247 i18n("Save selected to file..."),this,
247 SLOT(saveToFile()),true); 248 SLOT(saveToFile()),true);
248 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 249 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
249 i18n("Save Journal/Description..."),this, 250 i18n("Save Journal/Description..."),this,
250 SLOT(saveDescriptionToFile()),true); 251 SLOT(saveDescriptionToFile()),true);
251 mPopupMenu->insertSeparator(); 252 mPopupMenu->insertSeparator();
252 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 253 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
253 i18n("Add Categ. to selected..."),this, 254 i18n("Add Categ. to selected..."),this,
254 SLOT(addCat()),true); 255 SLOT(addCat()),true);
255 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 256 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
256 i18n("Set Categ. for selected..."),this, 257 i18n("Set Categ. for selected..."),this,
257 SLOT(setCat()),true); 258 SLOT(setCat()),true);
258 mPopupMenu->insertSeparator(); 259 mPopupMenu->insertSeparator();
259 260
260 261
261#ifndef DESKTOP_VERSION 262#ifndef DESKTOP_VERSION
262 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 263 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
263 i18n("Beam selected via IR"),this, 264 i18n("Beam selected via IR"),this,
264 SLOT(beamSelected()),true); 265 SLOT(beamSelected()),true);
265#endif 266#endif
266 /* 267 /*
267 mPopupMenu = new QPopupMenu; 268 mPopupMenu = new QPopupMenu;
268 mPopupMenu->insertItem(i18n("Edit Event"), this, 269 mPopupMenu->insertItem(i18n("Edit Event"), this,
269 SLOT (editEvent())); 270 SLOT (editEvent()));
270 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 271 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
271 SLOT (deleteEvent())); 272 SLOT (deleteEvent()));
272 mPopupMenu->insertSeparator(); 273 mPopupMenu->insertSeparator();
273 mPopupMenu->insertItem(i18n("Show Dates"), this, 274 mPopupMenu->insertItem(i18n("Show Dates"), this,
274 SLOT(showDates())); 275 SLOT(showDates()));
275 mPopupMenu->insertItem(i18n("Hide Dates"), this, 276 mPopupMenu->insertItem(i18n("Hide Dates"), this,
276 SLOT(hideDates())); 277 SLOT(hideDates()));
277 */ 278 */
278 QObject::connect(mListView,SIGNAL( newEvent()), 279 QObject::connect(mListView,SIGNAL( newEvent()),
279 this,SIGNAL(signalNewEvent())); 280 this,SIGNAL(signalNewEvent()));
280 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 281 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
281 this,SLOT(defaultItemAction(QListViewItem *))); 282 this,SLOT(defaultItemAction(QListViewItem *)));
282 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 283 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
283 const QPoint &, int )), 284 const QPoint &, int )),
284 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 285 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
285 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 286 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
286 SLOT(processSelectionChange(QListViewItem *))); 287 SLOT(processSelectionChange(QListViewItem *)));
287 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 288 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
288 SIGNAL(showIncidenceSignal(Incidence *)) ); 289 SIGNAL(showIncidenceSignal(Incidence *)) );
289 290
290 readSettings(KOGlobals::config(),"KOListView Layout"); 291 readSettings(KOGlobals::config(),"KOListView Layout");
291} 292}
292 293
293KOListView::~KOListView() 294KOListView::~KOListView()
294{ 295{
295 delete mPopupMenu; 296 delete mPopupMenu;
296} 297}
297 298
298void KOListView::updateList() 299void KOListView::updateList()
299{ 300{
300 // qDebug(" KOListView::updateList() "); 301 // qDebug(" KOListView::updateList() ");
301 302
302} 303}
303 304
304void KOListView::addCat( ) 305void KOListView::addCat( )
305{ 306{
306 setCategories( false ); 307 setCategories( false );
307} 308}
308void KOListView::setCat() 309void KOListView::setCat()
309{ 310{
310 setCategories( true ); 311 setCategories( true );
311} 312}
312void KOListView::setCategories( bool removeOld ) 313void KOListView::setCategories( bool removeOld )
313{ 314{
314 315
315 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 316 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
316 if (! csd->exec()) { 317 if (! csd->exec()) {
317 delete csd; 318 delete csd;
318 return; 319 return;
319 } 320 }
320 QStringList catList = csd->selectedCategories(); 321 QStringList catList = csd->selectedCategories();
321 delete csd; 322 delete csd;
322 // if ( catList.count() == 0 ) 323 // if ( catList.count() == 0 )
323 // return; 324 // return;
324 catList.sort(); 325 catList.sort();
325 QString categoriesStr = catList.join(","); 326 QString categoriesStr = catList.join(",");
326 int i; 327 int i;
327 QStringList itemList; 328 QStringList itemList;
328 QPtrList<KOListViewItem> sel ; 329 QPtrList<KOListViewItem> sel ;
329 QListViewItem *qitem = mListView->firstChild (); 330 QListViewItem *qitem = mListView->firstChild ();
330 while ( qitem ) { 331 while ( qitem ) {
331 if ( qitem->isSelected() ) { 332 if ( qitem->isSelected() ) {
332 sel.append(((KOListViewItem *)qitem)); 333 sel.append(((KOListViewItem *)qitem));
333 } 334 }
334 qitem = qitem->nextSibling(); 335 qitem = qitem->nextSibling();
335 } 336 }
336 KOListViewItem * item, *temp; 337 KOListViewItem * item, *temp;
337 item = sel.first(); 338 item = sel.first();
338 Incidence* inc; 339 Incidence* inc;
339 while ( item ) { 340 while ( item ) {
340 inc = item->data(); 341 inc = item->data();
341 if ( removeOld ) { 342 if ( removeOld ) {
342 inc->setCategories( categoriesStr ); 343 inc->setCategories( categoriesStr );
343 } else { 344 } else {
344 itemList = QStringList::split (",", inc->categoriesStr() ); 345 itemList = QStringList::split (",", inc->categoriesStr() );
345 for( i = 0; i< catList.count(); ++i ) { 346 for( i = 0; i< catList.count(); ++i ) {
346 if ( !itemList.contains (catList[i])) 347 if ( !itemList.contains (catList[i]))
347 itemList.append( catList[i] ); 348 itemList.append( catList[i] );
348 } 349 }
349 itemList.sort(); 350 itemList.sort();
350 inc->setCategories( itemList.join(",") ); 351 inc->setCategories( itemList.join(",") );
351 } 352 }
352 temp = item; 353 temp = item;
353 item = sel.next(); 354 item = sel.next();
354 mUidDict.remove( inc->uid() ); 355 mUidDict.remove( inc->uid() );
355 delete temp;; 356 delete temp;;
356 addIncidence( inc ); 357 addIncidence( inc );
357 } 358 }
358} 359}
359 360
360void KOListView::beamSelected() 361void KOListView::beamSelected()
361{ 362{
362 int icount = 0; 363 int icount = 0;
363 QPtrList<Incidence> delSel ; 364 QPtrList<Incidence> delSel ;
364 QListViewItem *item = mListView->firstChild (); 365 QListViewItem *item = mListView->firstChild ();
365 while ( item ) { 366 while ( item ) {
366 if ( item->isSelected() ) { 367 if ( item->isSelected() ) {
367 delSel.append(((KOListViewItem *)item)->data()); 368 delSel.append(((KOListViewItem *)item)->data());
368 ++icount; 369 ++icount;
369 } 370 }
370 371
371 item = item->nextSibling(); 372 item = item->nextSibling();
372 } 373 }
373 if ( icount ) { 374 if ( icount ) {
374 emit beamIncidenceList( delSel ); 375 emit beamIncidenceList( delSel );
375 return; 376 return;
376 QString fn ; 377 QString fn ;
377 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 378 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
378 QString mes; 379 QString mes;
379 bool createbup = true; 380 bool createbup = true;
380 if ( createbup ) { 381 if ( createbup ) {
381 QString description = "\n"; 382 QString description = "\n";
382 CalendarLocal* cal = new CalendarLocal(); 383 CalendarLocal* cal = new CalendarLocal();
383 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 384 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
384 Incidence *incidence = delSel.first(); 385 Incidence *incidence = delSel.first();
385 while ( incidence ) { 386 while ( incidence ) {
386 Incidence *in = incidence->clone(); 387 Incidence *in = incidence->clone();
387 description += in->summary() + "\n"; 388 description += in->summary() + "\n";
388 cal->addIncidence( in ); 389 cal->addIncidence( in );
389 incidence = delSel.next(); 390 incidence = delSel.next();
390 } 391 }
391 FileStorage storage( cal, fn, new VCalFormat ); 392 FileStorage storage( cal, fn, new VCalFormat );
392 storage.save(); 393 storage.save();
393 delete cal; 394 delete cal;
394 mes = i18n("KO/Pi: Ready for beaming"); 395 mes = i18n("KO/Pi: Ready for beaming");
395 topLevelWidget()->setCaption(mes); 396 topLevelWidget()->setCaption(mes);
396 397
397#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
398 Ir *ir = new Ir( this ); 399 Ir *ir = new Ir( this );
399 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 400 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
400 ir->send( fn, description, "text/x-vCalendar" ); 401 ir->send( fn, description, "text/x-vCalendar" );
401#endif 402#endif
402 } 403 }
403 } 404 }
404} 405}
405void KOListView::beamDone( Ir *ir ) 406void KOListView::beamDone( Ir *ir )
406{ 407{
407#ifndef DESKTOP_VERSION 408#ifndef DESKTOP_VERSION
408 delete ir; 409 delete ir;
409#endif 410#endif
410 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 411 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
411} 412}
412 413
413void KOListView::saveDescriptionToFile() 414void KOListView::saveDescriptionToFile()
414{ 415{
415 416
416 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 417 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
417 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 418 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
418 i18n("Continue"), i18n("Cancel"), 0, 419 i18n("Continue"), i18n("Cancel"), 0,
419 0, 1 ); 420 0, 1 );
420 if ( result != 0 ) { 421 if ( result != 0 ) {
421 return; 422 return;
422 } 423 }
423 int icount = 0; 424 int icount = 0;
424 QPtrList<Incidence> delSel ; 425 QPtrList<Incidence> delSel ;
425 QListViewItem *item = mListView->firstChild (); 426 QListViewItem *item = mListView->firstChild ();
426 while ( item ) { 427 while ( item ) {
427 if ( item->isSelected() ) { 428 if ( item->isSelected() ) {
428 delSel.append(((KOListViewItem *)item)->data()); 429 delSel.append(((KOListViewItem *)item)->data());
429 ++icount; 430 ++icount;
430 } 431 }
431 432
432 item = item->nextSibling(); 433 item = item->nextSibling();
433 } 434 }
434 if ( icount ) { 435 if ( icount ) {
435 QString fn = KOPrefs::instance()->mLastSaveFile; 436 QString fn = KOPrefs::instance()->mLastSaveFile;
436 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 437 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
437 438
438 if ( fn == "" ) 439 if ( fn == "" )
439 return; 440 return;
440 QFileInfo info; 441 QFileInfo info;
441 info.setFile( fn ); 442 info.setFile( fn );
442 QString mes; 443 QString mes;
443 bool createbup = true; 444 bool createbup = true;
444 if ( info. exists() ) { 445 if ( info. exists() ) {
445 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 446 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
446 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 447 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
447 i18n("Overwrite!"), i18n("Cancel"), 0, 448 i18n("Overwrite!"), i18n("Cancel"), 0,
448 0, 1 ); 449 0, 1 );
449 if ( result != 0 ) { 450 if ( result != 0 ) {
450 createbup = false; 451 createbup = false;
451 } 452 }
452 } 453 }
453 if ( createbup ) { 454 if ( createbup ) {
454 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 455 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
455 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 456 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
456 Incidence *incidence = delSel.first(); 457 Incidence *incidence = delSel.first();
457 icount = 0; 458 icount = 0;
458 while ( incidence ) { 459 while ( incidence ) {
459 if ( incidence->type() == "Journal" ) { 460 if ( incidence->type() == "Journal" ) {
460 text += "\n************************************\n"; 461 text += "\n************************************\n";
461 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 462 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
462 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 463 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
463 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 464 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
464 ++icount; 465 ++icount;
465 466
466 } else { 467 } else {
467 if ( !incidence->description().isEmpty() ) { 468 if ( !incidence->description().isEmpty() ) {
468 text += "\n************************************\n"; 469 text += "\n************************************\n";
469 if ( incidence->type() == "Todo" ) 470 if ( incidence->type() == "Todo" )
470 text += i18n("To-Do: "); 471 text += i18n("To-Do: ");
471 text += incidence->summary(); 472 text += incidence->summary();
472 if ( incidence->hasStartDate() ) 473 if ( incidence->hasStartDate() )
473 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 474 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
474 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 475 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
475 if ( !incidence->location().isEmpty() ) 476 if ( !incidence->location().isEmpty() )
476 text += "\n" +i18n("Location: ") + incidence->location(); 477 text += "\n" +i18n("Location: ") + incidence->location();
477 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 478 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
478 ++icount; 479 ++icount;
479 480
480 } 481 }
481 } 482 }