summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-06 19:41:06 (UTC)
committer zautrix <zautrix>2005-07-06 19:41:06 (UTC)
commit984e2132871c79990f6d9eac5702f7f32186f235 (patch) (unidiff)
tree2bc4b50ee8b8284e74fd53bdfb78d6d3107806a0
parentc79a8a4950c098fa6f5a7ae8396feb4dd3a91577 (diff)
downloadkdepimpi-984e2132871c79990f6d9eac5702f7f32186f235.zip
kdepimpi-984e2132871c79990f6d9eac5702f7f32186f235.tar.gz
kdepimpi-984e2132871c79990f6d9eac5702f7f32186f235.tar.bz2
fixxx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp7
-rw-r--r--korganizer/mainwindow.cpp13
-rw-r--r--korganizer/mainwindow.h2
3 files changed, 18 insertions, 4 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 5690bdb..5f90dc6 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,1447 +1,1450 @@
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
70extern QPixmap* sgListViewCompletedPix[6]; 70extern QPixmap* sgListViewCompletedPix[6];
71extern QPixmap* sgListViewJournalPix;
71 72
72class KOListViewWhatsThis :public QWhatsThis 73class KOListViewWhatsThis :public QWhatsThis
73{ 74{
74public: 75public:
75 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 76 KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
76 77
77protected: 78protected:
78 virtual QString text( const QPoint& p) 79 virtual QString text( const QPoint& p)
79 { 80 {
80 return _view->getWhatsThisText(p) ; 81 return _view->getWhatsThisText(p) ;
81 } 82 }
82private: 83private:
83 QWidget* _wid; 84 QWidget* _wid;
84 KOListView * _view; 85 KOListView * _view;
85}; 86};
86 87
87 88
88ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 89ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
89{ 90{
90 mItem = item; 91 mItem = item;
91 mDate = date; 92 mDate = date;
92} 93}
93 94
94ListItemVisitor::~ListItemVisitor() 95ListItemVisitor::~ListItemVisitor()
95{ 96{
96} 97}
97 98
98bool ListItemVisitor::visit(Event *e) 99bool ListItemVisitor::visit(Event *e)
99{ 100{
100 bool ok = false; 101 bool ok = false;
101 QString start, end; 102 QString start, end;
102 QDate ds, de; 103 QDate ds, de;
103 if ( e->doesRecur() ) { 104 if ( e->doesRecur() ) {
104 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 105 ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
105 if ( ok ) { 106 if ( ok ) {
106 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 107 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
107 start = KGlobal::locale()->formatDate(ds,true); 108 start = KGlobal::locale()->formatDate(ds,true);
108 de = ds.addDays( days); 109 de = ds.addDays( days);
109 end = KGlobal::locale()->formatDate(de,true); 110 end = KGlobal::locale()->formatDate(de,true);
110 } 111 }
111 112
112 } 113 }
113 if ( ! ok ) { 114 if ( ! ok ) {
114 start =e->dtStartDateStr(); 115 start =e->dtStartDateStr();
115 end = e->dtEndDateStr(); 116 end = e->dtEndDateStr();
116 ds = e->dtStart().date(); 117 ds = e->dtStart().date();
117 de = e->dtEnd().date(); 118 de = e->dtEnd().date();
118 } 119 }
119 mItem->setText(0,e->summary()); 120 mItem->setText(0,e->summary());
120 mItem->setText(1,start); 121 mItem->setText(1,start);
121 if ( e->doesFloat() ) 122 if ( e->doesFloat() )
122 mItem->setText(2,"---"); 123 mItem->setText(2,"---");
123 else 124 else
124 mItem->setText(2,e->dtStartTimeStr()); 125 mItem->setText(2,e->dtStartTimeStr());
125 mItem->setText(3,end); 126 mItem->setText(3,end);
126 if ( e->doesFloat() ) 127 if ( e->doesFloat() )
127 mItem->setText(4,"---"); 128 mItem->setText(4,"---");
128 else 129 else
129 mItem->setText(4,e->dtEndTimeStr()); 130 mItem->setText(4,e->dtEndTimeStr());
130 if ( e->isAlarmEnabled() ) { 131 if ( e->isAlarmEnabled() ) {
131 mItem->setText(5,e->alarms().first()->offsetText() ); 132 mItem->setText(5,e->alarms().first()->offsetText() );
132 } else { 133 } else {
133 mItem->setText(5, i18n("No")); 134 mItem->setText(5, i18n("No"));
134 } 135 }
135 mItem->setText(6, e->recurrence()->recurrenceText()); 136 mItem->setText(6, e->recurrence()->recurrenceText());
136 if( ! e->doesRecur() ) 137 if( ! e->doesRecur() )
137 mItem->setSortKey( 6, "-" ); 138 mItem->setSortKey( 6, "-" );
138 mItem->setText(7,"---"); 139 mItem->setText(7,"---");
139 mItem->setText(8,"---"); 140 mItem->setText(8,"---");
140 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 141 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
141 mItem->setText(10,e->categoriesStr()); 142 mItem->setText(10,e->categoriesStr());
142 mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); 143 mItem->setText(11, KOPrefs::instance()->calName( e->calID() ));
143 mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); 144 mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true ));
144 145
145 QString key; 146 QString key;
146 QDate d = e->lastModified().date(); 147 QDate d = e->lastModified().date();
147 QTime t = e->lastModified().time(); 148 QTime t = e->lastModified().time();
148 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); 149 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() );
149 mItem->setSortKey(12,key); 150 mItem->setSortKey(12,key);
150 t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); 151 t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
151 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); 152 key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
152 mItem->setSortKey(1,key); 153 mItem->setSortKey(1,key);
153 154
154 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); 155 t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
155 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); 156 key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
156 mItem->setSortKey(3,key); 157 mItem->setSortKey(3,key);
157 return true; 158 return true;
158} 159}
159 160
160bool ListItemVisitor::visit(Todo *t) 161bool ListItemVisitor::visit(Todo *t)
161{ 162{
162 mItem->setText(0,t->summary()); 163 mItem->setText(0,t->summary());
163 if ( t->isCompleted() ) { 164 if ( t->isCompleted() ) {
164 mItem->setSortKey(0,"99"+ t->summary().left(10)); 165 mItem->setSortKey(0,"99"+ t->summary().left(10));
165 } else 166 } else
166 mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10)); 167 mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10));
167 mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); 168 mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20]));
168 if (t->hasStartDate()) { 169 if (t->hasStartDate()) {
169 mItem->setText(1,t->dtStartDateStr()); 170 mItem->setText(1,t->dtStartDateStr());
170 if (t->doesFloat()) { 171 if (t->doesFloat()) {
171 mItem->setText(2,"---"); 172 mItem->setText(2,"---");
172 } else { 173 } else {
173 mItem->setText(2,t->dtStartTimeStr()); 174 mItem->setText(2,t->dtStartTimeStr());
174 } 175 }
175 } else { 176 } else {
176 mItem->setText(1,"---"); 177 mItem->setText(1,"---");
177 mItem->setText(2,"---"); 178 mItem->setText(2,"---");
178 } 179 }
179 mItem->setText(3,"---"); 180 mItem->setText(3,"---");
180 mItem->setText(4,"---"); 181 mItem->setText(4,"---");
181 if ( t->isAlarmEnabled() ) { 182 if ( t->isAlarmEnabled() ) {
182 mItem->setText(5,t->alarms().first()->offsetText() ); 183 mItem->setText(5,t->alarms().first()->offsetText() );
183 } else { 184 } else {
184 mItem->setText(5, i18n("No")); 185 mItem->setText(5, i18n("No"));
185 } 186 }
186 mItem->setText(6, t->recurrence()->recurrenceText()); 187 mItem->setText(6, t->recurrence()->recurrenceText());
187 if( ! t->doesRecur() ) 188 if( ! t->doesRecur() )
188 mItem->setSortKey( 6, "-" ); 189 mItem->setSortKey( 6, "-" );
189 if (t->hasDueDate()) { 190 if (t->hasDueDate()) {
190 mItem->setText(7,t->dtDueDateStr()); 191 mItem->setText(7,t->dtDueDateStr());
191 if (t->doesFloat()) { 192 if (t->doesFloat()) {
192 mItem->setText(8,"---"); 193 mItem->setText(8,"---");
193 } else { 194 } else {
194 mItem->setText(8,t->dtDueTimeStr()); 195 mItem->setText(8,t->dtDueTimeStr());
195 } 196 }
196 } else { 197 } else {
197 mItem->setText(7,"---"); 198 mItem->setText(7,"---");
198 mItem->setText(8,"---"); 199 mItem->setText(8,"---");
199 } 200 }
200 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 201 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
201 mItem->setText(10,t->categoriesStr()); 202 mItem->setText(10,t->categoriesStr());
202 mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); 203 mItem->setText(11, KOPrefs::instance()->calName( t->calID() ));
203 mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); 204 mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true ));
204 QString key; 205 QString key;
205 QDate d = t->lastModified().date(); 206 QDate d = t->lastModified().date();
206 QTime tm = t->lastModified().time(); 207 QTime tm = t->lastModified().time();
207 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); 208 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() );
208 mItem->setSortKey(12,key); 209 mItem->setSortKey(12,key);
209 if (t->hasDueDate()) { 210 if (t->hasDueDate()) {
210 d = t->dtDue().date(); 211 d = t->dtDue().date();
211 tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 212 tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
212 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 213 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
213 mItem->setSortKey(7,key); 214 mItem->setSortKey(7,key);
214 } 215 }
215 if ( t->hasStartDate() ) { 216 if ( t->hasStartDate() ) {
216 d = t->dtStart().date(); 217 d = t->dtStart().date();
217 tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 218 tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
218 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 219 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
219 mItem->setSortKey(1,key); 220 mItem->setSortKey(1,key);
220 } 221 }
221 return true; 222 return true;
222} 223}
223 224
224bool ListItemVisitor::visit(Journal * j) 225bool ListItemVisitor::visit(Journal * j)
225{ 226{
226 227
227 QString des; 228 QString des;
229 mItem->setPixmap( 0, *sgListViewJournalPix);
228 if ( !j->summary().isEmpty() ) { 230 if ( !j->summary().isEmpty() ) {
229 des = j->summary(); 231 des = j->summary();
230 } else { 232 } else {
231 des = j->description().left(30); 233 des = j->description().left(30);
232 des = des.simplifyWhiteSpace (); 234 des = des.simplifyWhiteSpace ();
233 des.replace (QRegExp ("\\n"),"" ); 235 des.replace (QRegExp ("\\n"),"" );
234 des.replace (QRegExp ("\\r"),"" ); 236 des.replace (QRegExp ("\\r"),"" );
235 } 237 }
236 mItem->setText(0,i18n("Journal: ")+des.left(25)); 238 mItem->setText(0,des.left(25));
239 mItem->setSortKey(0,"0"+ des.left(25));
237 mItem->setText(1,j->dtStartDateStr()); 240 mItem->setText(1,j->dtStartDateStr());
238 mItem->setText(2,"---"); 241 mItem->setText(2,"---");
239 mItem->setText(3,"---"); 242 mItem->setText(3,"---");
240 mItem->setText(4,"---"); 243 mItem->setText(4,"---");
241 mItem->setText(5,"---"); 244 mItem->setText(5,"---");
242 mItem->setText(6,"---"); 245 mItem->setText(6,"---");
243 mItem->setText(7,j->dtStartDateStr()); 246 mItem->setText(7,j->dtStartDateStr());
244 mItem->setText(8,"---"); 247 mItem->setText(8,"---");
245 mItem->setText(9,"---"); 248 mItem->setText(9,"---");
246 mItem->setText(10,j->categoriesStr()); 249 mItem->setText(10,j->categoriesStr());
247 mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); 250 mItem->setText(11, KOPrefs::instance()->calName( j->calID() ));
248 mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); 251 mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true ));
249 252
250 QString key; 253 QString key;
251 QDate d = j->lastModified().date(); 254 QDate d = j->lastModified().date();
252 QTime tm = j->lastModified().time(); 255 QTime tm = j->lastModified().time();
253 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); 256 key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() );
254 mItem->setSortKey(12,key); 257 mItem->setSortKey(12,key);
255 d = j->dtStart().date(); 258 d = j->dtStart().date();
256 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 259 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
257 mItem->setSortKey(1,key); 260 mItem->setSortKey(1,key);
258 mItem->setSortKey(7,key); 261 mItem->setSortKey(7,key);
259 262
260 return true; 263 return true;
261} 264}
262 265
263KOListView::KOListView(Calendar *calendar, QWidget *parent, 266KOListView::KOListView(Calendar *calendar, QWidget *parent,
264 const char *name) 267 const char *name)
265 : KOEventView(calendar, parent, name) 268 : KOEventView(calendar, parent, name)
266{ 269{
267 270
268 mActiveItem = 0; 271 mActiveItem = 0;
269 mForceShowCompletedTodos = false; 272 mForceShowCompletedTodos = false;
270 mListView = new KOListViewListView(this); 273 mListView = new KOListViewListView(this);
271 mListView->addColumn(i18n("Summary")); 274 mListView->addColumn(i18n("Summary"));
272 mListView->addColumn(i18n("Start Date")); 275 mListView->addColumn(i18n("Start Date"));
273 mListView->addColumn(i18n("Start Time")); 276 mListView->addColumn(i18n("Start Time"));
274 mListView->addColumn(i18n("End Date")); 277 mListView->addColumn(i18n("End Date"));
275 mListView->addColumn(i18n("End Time")); 278 mListView->addColumn(i18n("End Time"));
276 mListView->addColumn(i18n("Alarm")); // alarm set? 279 mListView->addColumn(i18n("Alarm")); // alarm set?
277 mListView->addColumn(i18n("Recurs")); // recurs? 280 mListView->addColumn(i18n("Recurs")); // recurs?
278 mListView->addColumn(i18n("Due Date")); 281 mListView->addColumn(i18n("Due Date"));
279 mListView->addColumn(i18n("Due Time")); 282 mListView->addColumn(i18n("Due Time"));
280 mListView->addColumn(i18n("Cancelled")); 283 mListView->addColumn(i18n("Cancelled"));
281 mListView->addColumn(i18n("Categories")); 284 mListView->addColumn(i18n("Categories"));
282 mListView->addColumn(i18n("Calendar")); 285 mListView->addColumn(i18n("Calendar"));
283 mListView->addColumn(i18n("Last Modified")); 286 mListView->addColumn(i18n("Last Modified"));
284 287
285 mListView->setColumnAlignment(0,AlignLeft); 288 mListView->setColumnAlignment(0,AlignLeft);
286 mListView->setColumnAlignment(1,AlignLeft); 289 mListView->setColumnAlignment(1,AlignLeft);
287 mListView->setColumnAlignment(2,AlignHCenter); 290 mListView->setColumnAlignment(2,AlignHCenter);
288 mListView->setColumnAlignment(3,AlignLeft); 291 mListView->setColumnAlignment(3,AlignLeft);
289 mListView->setColumnAlignment(4,AlignHCenter); 292 mListView->setColumnAlignment(4,AlignHCenter);
290 mListView->setColumnAlignment(5,AlignLeft); 293 mListView->setColumnAlignment(5,AlignLeft);
291 mListView->setColumnAlignment(6,AlignLeft); 294 mListView->setColumnAlignment(6,AlignLeft);
292 mListView->setColumnAlignment(7,AlignLeft); 295 mListView->setColumnAlignment(7,AlignLeft);
293 mListView->setColumnAlignment(8,AlignLeft); 296 mListView->setColumnAlignment(8,AlignLeft);
294 mListView->setColumnAlignment(9,AlignLeft); 297 mListView->setColumnAlignment(9,AlignLeft);
295 mListView->setColumnAlignment(10,AlignLeft); 298 mListView->setColumnAlignment(10,AlignLeft);
296 mListView->setColumnAlignment(11,AlignLeft); 299 mListView->setColumnAlignment(11,AlignLeft);
297 mListView->setColumnAlignment(12,AlignLeft); 300 mListView->setColumnAlignment(12,AlignLeft);
298 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); 301 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
299 302
300 int iii = 0; 303 int iii = 0;
301 for ( iii = 0; iii< 13 ; ++iii ) 304 for ( iii = 0; iii< 13 ; ++iii )
302 mListView->setColumnWidthMode( iii, QListView::Manual ); 305 mListView->setColumnWidthMode( iii, QListView::Manual );
303 306
304 QBoxLayout *layoutTop = new QVBoxLayout(this); 307 QBoxLayout *layoutTop = new QVBoxLayout(this);
305 layoutTop->addWidget(mListView); 308 layoutTop->addWidget(mListView);
306 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 309 mListView->setFont ( KOPrefs::instance()->mListViewFont );
307 mPopupMenu = eventPopup(); 310 mPopupMenu = eventPopup();
308 QPopupMenu* selPopup = new QPopupMenu ( this ); 311 QPopupMenu* selPopup = new QPopupMenu ( this );
309 mPopupMenu->insertSeparator(); 312 mPopupMenu->insertSeparator();
310 313
311 selPopup->insertItem(i18n("All"),this, 314 selPopup->insertItem(i18n("All"),this,
312 SLOT(allSelection())); 315 SLOT(allSelection()));
313 selPopup->insertItem(i18n("None"),this, 316 selPopup->insertItem(i18n("None"),this,
314 SLOT(clearSelection())); 317 SLOT(clearSelection()));
315 selPopup->insertItem(i18n("Delete selected..."),this, 318 selPopup->insertItem(i18n("Delete selected..."),this,
316 SLOT(deleteAll())); 319 SLOT(deleteAll()));
317 mPopupMenu->insertItem(i18n("Selection"), selPopup ); 320 mPopupMenu->insertItem(i18n("Selection"), selPopup );
318 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 321 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
319 i18n("Hide all selected"),this, 322 i18n("Hide all selected"),this,
320 SLOT(hideAll()),true); 323 SLOT(hideAll()),true);
321 324
322 selPopup->insertSeparator(); 325 selPopup->insertSeparator();
323 QPopupMenu * exportPO = new QPopupMenu ( this ); 326 QPopupMenu * exportPO = new QPopupMenu ( this );
324 selPopup->insertItem( i18n("Export"), exportPO ); 327 selPopup->insertItem( i18n("Export"), exportPO );
325#ifdef DESKTOP_VERSION 328#ifdef DESKTOP_VERSION
326 mPopupMenu->insertSeparator(); 329 mPopupMenu->insertSeparator();
327 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 330 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
328 i18n("Print complete list..."),this, 331 i18n("Print complete list..."),this,
329 SLOT(printList()),true); 332 SLOT(printList()),true);
330#endif 333#endif
331 mCalPopup = new QPopupMenu ( this ); 334 mCalPopup = new QPopupMenu ( this );
332 selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); 335 selPopup->insertItem( i18n("Set Calendar"), mCalPopup );
333 336
334 selPopup->insertItem(i18n("Set categories")+"...",this, 337 selPopup->insertItem(i18n("Set categories")+"...",this,
335 SLOT(setCat()) ); 338 SLOT(setCat()) );
336 selPopup->insertItem( i18n("Set alarm..."),this, 339 selPopup->insertItem( i18n("Set alarm..."),this,
337 SLOT(setAlarm())); 340 SLOT(setAlarm()));
338#if 0 341#if 0
339 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 342 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
340 i18n("Set categories")+"...",this, 343 i18n("Set categories")+"...",this,
341 SLOT(setCat()),true); 344 SLOT(setCat()),true);
342 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 345 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
343 i18n("Set alarm..."),this, 346 i18n("Set alarm..."),this,
344 SLOT(setAlarm()),true); 347 SLOT(setAlarm()),true);
345#endif 348#endif
346 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, 349 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
347 SLOT( populateCalPopup() )); 350 SLOT( populateCalPopup() ));
348 QObject::connect(mCalPopup,SIGNAL(activated( int )),this, 351 QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
349 SLOT( setCalendar( int ) )); 352 SLOT( setCalendar( int ) ));
350 QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, 353 QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this,
351 SLOT( catChanged( Incidence * ) )); 354 SLOT( catChanged( Incidence * ) ));
352 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 355 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
353 SLOT(saveToFile())); 356 SLOT(saveToFile()));
354 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 357 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
355 SLOT(saveToFileVCS())); 358 SLOT(saveToFileVCS()));
356 exportPO->insertItem( i18n("Journal/Details..."),this, 359 exportPO->insertItem( i18n("Journal/Details..."),this,
357 SLOT(saveDescriptionToFile())); 360 SLOT(saveDescriptionToFile()));
358 // mPopupMenu->insertSeparator(); 361 // mPopupMenu->insertSeparator();
359 // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 362 // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
360 // i18n("Add Categ. to selected..."),this, 363 // i18n("Add Categ. to selected..."),this,
361 // SLOT(addCat()),true); 364 // SLOT(addCat()),true);
362 //mPopupMenu->insertSeparator(); 365 //mPopupMenu->insertSeparator();
363#ifndef DESKTOP_VERSION 366#ifndef DESKTOP_VERSION
364 selPopup->insertSeparator(); 367 selPopup->insertSeparator();
365 selPopup->insertItem( i18n("Beam via IR..."),this, 368 selPopup->insertItem( i18n("Beam via IR..."),this,
366 SLOT(beamSelected())); 369 SLOT(beamSelected()));
367#if 0 370#if 0
368 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 371 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
369 i18n("Beam via IR"),this, 372 i18n("Beam via IR"),this,
370 SLOT(beamSelected()),true); 373 SLOT(beamSelected()),true);
371#endif 374#endif
372#endif 375#endif
373 /* 376 /*
374 mPopupMenu = new QPopupMenu; 377 mPopupMenu = new QPopupMenu;
375 mPopupMenu->insertItem(i18n("Edit Event"), this, 378 mPopupMenu->insertItem(i18n("Edit Event"), this,
376 SLOT (editEvent())); 379 SLOT (editEvent()));
377 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 380 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
378 SLOT (deleteEvent())); 381 SLOT (deleteEvent()));
379 mPopupMenu->insertSeparator(); 382 mPopupMenu->insertSeparator();
380 mPopupMenu->insertItem(i18n("Show Dates"), this, 383 mPopupMenu->insertItem(i18n("Show Dates"), this,
381 SLOT(showDates())); 384 SLOT(showDates()));
382 mPopupMenu->insertItem(i18n("Hide Dates"), this, 385 mPopupMenu->insertItem(i18n("Hide Dates"), this,
383 SLOT(hideDates())); 386 SLOT(hideDates()));
384 */ 387 */
385 QObject::connect(mListView,SIGNAL( newEvent()), 388 QObject::connect(mListView,SIGNAL( newEvent()),
386 this,SIGNAL(signalNewEvent())); 389 this,SIGNAL(signalNewEvent()));
387 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 390 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
388 this,SLOT(defaultItemAction(QListViewItem *))); 391 this,SLOT(defaultItemAction(QListViewItem *)));
389 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 392 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
390 const QPoint &, int )), 393 const QPoint &, int )),
391 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 394 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
392 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 395 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
393 SLOT(processSelectionChange(QListViewItem *))); 396 SLOT(processSelectionChange(QListViewItem *)));
394 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 397 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
395 SIGNAL(showIncidenceSignal(Incidence *)) ); 398 SIGNAL(showIncidenceSignal(Incidence *)) );
396 399
397 readSettings(KOGlobals::config(),"KOListView Layout"); 400 readSettings(KOGlobals::config(),"KOListView Layout");
398} 401}
399 402
400KOListView::~KOListView() 403KOListView::~KOListView()
401{ 404{
402 delete mPopupMenu; 405 delete mPopupMenu;
403#if QT_VERSION >= 0x030000 406#if QT_VERSION >= 0x030000
404 407
405#else 408#else
406 delete mKOListViewWhatsThis; 409 delete mKOListViewWhatsThis;
407#endif 410#endif
408} 411}
409 412
410void KOListView::catChanged( Incidence* inc) 413void KOListView::catChanged( Incidence* inc)
411{ 414{
412 KOListViewItem* item = getItemForEvent(inc); 415 KOListViewItem* item = getItemForEvent(inc);
413 if (item) { 416 if (item) {
414 ListItemVisitor v(item, mStartDate ); 417 ListItemVisitor v(item, mStartDate );
415 inc->accept(v); 418 inc->accept(v);
416 } 419 }
417} 420}
418QString KOListView::getWhatsThisText(QPoint p) 421QString KOListView::getWhatsThisText(QPoint p)
419{ 422{
420 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 423 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
421 if ( item ) 424 if ( item )
422 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 425 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
423 KOPrefs::instance()->mWTshowDetails, 426 KOPrefs::instance()->mWTshowDetails,
424 KOPrefs::instance()->mWTshowCreated, 427 KOPrefs::instance()->mWTshowCreated,
425 KOPrefs::instance()->mWTshowChanged); 428 KOPrefs::instance()->mWTshowChanged);
426 return i18n("That is the list view" ); 429 return i18n("That is the list view" );
427 430
428} 431}
429 432
430void KOListView::setCalendar( int c ) 433void KOListView::setCalendar( int c )
431{ 434{
432 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 435 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
433 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), 436 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ),
434 i18n("Continue"), i18n("Cancel"), 0, 437 i18n("Continue"), i18n("Cancel"), 0,
435 0, 1 ); 438 0, 1 );
436 if ( result != 0 ) { 439 if ( result != 0 ) {
437 return; 440 return;
438 } 441 }
439 442
440 QPtrList<Incidence> delSel = getSelectedIncidences() ; 443 QPtrList<Incidence> delSel = getSelectedIncidences() ;
441 int icount = delSel.count(); 444 int icount = delSel.count();
442 if ( icount ) { 445 if ( icount ) {
443 Incidence *incidence = delSel.first(); 446 Incidence *incidence = delSel.first();
444 while ( incidence ) { 447 while ( incidence ) {
445 incidence->setCalID( c ); 448 incidence->setCalID( c );
446 KOListViewItem * item = getItemForEvent( incidence ); 449 KOListViewItem * item = getItemForEvent( incidence );
447 if ( item ) { 450 if ( item ) {
448 ListItemVisitor v(item, mStartDate ); 451 ListItemVisitor v(item, mStartDate );
449 incidence->accept(v); 452 incidence->accept(v);
450 } 453 }
451 incidence = delSel.next(); 454 incidence = delSel.next();
452 } 455 }
453 } 456 }
454 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 457 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
455 KopiCalendarFile * cal = calendars.first(); 458 KopiCalendarFile * cal = calendars.first();
456 while ( cal ) { 459 while ( cal ) {
457 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); 460 mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled );
458 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); 461 mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled );
459 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); 462 mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly );
460 if ( cal->isStandard ) 463 if ( cal->isStandard )
461 mCalendar->setDefaultCalendar( cal->mCalNumber ); 464 mCalendar->setDefaultCalendar( cal->mCalNumber );
462 cal = calendars.next(); 465 cal = calendars.next();
463 } 466 }
464 mCalendar->setSyncEventsReadOnly(); 467 mCalendar->setSyncEventsReadOnly();
465 mCalendar->reInitAlarmSettings(); 468 mCalendar->reInitAlarmSettings();
466 469
467} 470}
468void KOListView::populateCalPopup() 471void KOListView::populateCalPopup()
469{ 472{
470 mCalPopup->clear(); 473 mCalPopup->clear();
471 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 474 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
472 while ( kkf ) { 475 while ( kkf ) {
473 int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); 476 int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber);
474 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 477 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
475 mCalPopup->setItemEnabled( index, false ); 478 mCalPopup->setItemEnabled( index, false );
476 kkf = KOPrefs::instance()->mCalendars.next(); 479 kkf = KOPrefs::instance()->mCalendars.next();
477 } 480 }
478} 481}
479void KOListView::updateList() 482void KOListView::updateList()
480{ 483{
481 // qDebug(" KOListView::updateList() "); 484 // qDebug(" KOListView::updateList() ");
482 485
483} 486}
484 487
485void KOListView::clearList() 488void KOListView::clearList()
486{ 489{
487 clear (); 490 clear ();
488} 491}
489 492
490void KOListView::setCat() 493void KOListView::setCat()
491{ 494{
492 495
493 bool set = true; 496 bool set = true;
494 int result = KMessageBox::warningYesNoCancel(this, 497 int result = KMessageBox::warningYesNoCancel(this,
495 i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), 498 i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"),
496 i18n("Set categories"), 499 i18n("Set categories"),
497 i18n("Add"), 500 i18n("Add"),
498 i18n("Reset")); 501 i18n("Reset"));
499 if (result == KMessageBox::Cancel) return; 502 if (result == KMessageBox::Cancel) return;
500 if (result == KMessageBox::Yes) set = false; 503 if (result == KMessageBox::Yes) set = false;
501 setCategories( set ); 504 setCategories( set );
502} 505}
503 506
504void KOListView::setAlarm() 507void KOListView::setAlarm()
505{ 508{
506 KOAlarmPrefs kap( this); 509 KOAlarmPrefs kap( this);
507 if ( !kap.exec() ) 510 if ( !kap.exec() )
508 return; 511 return;
509 QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos 512 QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos
510 Incidence* inc = delSel.first(); 513 Incidence* inc = delSel.first();
511 int count = 0; 514 int count = 0;
512 while ( inc ) { 515 while ( inc ) {
513 ++count; 516 ++count;
514 if (kap.mAlarmButton->isChecked()) { 517 if (kap.mAlarmButton->isChecked()) {
515 if (inc->alarms().count() == 0) 518 if (inc->alarms().count() == 0)
516 inc->newAlarm(); 519 inc->newAlarm();
517 QPtrList<Alarm> alarms = inc->alarms(); 520 QPtrList<Alarm> alarms = inc->alarms();
518 Alarm *alarm; 521 Alarm *alarm;
519 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 522 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
520 alarm->setEnabled(true); 523 alarm->setEnabled(true);
521 int j = kap.mAlarmTimeEdit->value()* -60; 524 int j = kap.mAlarmTimeEdit->value()* -60;
522 if (kap.mAlarmIncrCombo->currentItem() == 1) 525 if (kap.mAlarmIncrCombo->currentItem() == 1)
523 j = j * 60; 526 j = j * 60;
524 else if (kap.mAlarmIncrCombo->currentItem() == 2) 527 else if (kap.mAlarmIncrCombo->currentItem() == 2)
525 j = j * (60 * 24); 528 j = j * (60 * 24);
526 alarm->setStartOffset( j ); 529 alarm->setStartOffset( j );
527 530
528 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 531 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
529 alarm->setProcedureAlarm(kap.mAlarmProgram); 532 alarm->setProcedureAlarm(kap.mAlarmProgram);
530 } 533 }
531 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 534 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
532 alarm->setAudioAlarm(kap.mAlarmSound); 535 alarm->setAudioAlarm(kap.mAlarmSound);
533 else 536 else
534 alarm->setType(Alarm::Invalid); 537 alarm->setType(Alarm::Invalid);
535 //alarm->setAudioAlarm("default"); 538 //alarm->setAudioAlarm("default");
536 // TODO: Deal with multiple alarms 539 // TODO: Deal with multiple alarms
537 break; // For now, stop after the first alarm 540 break; // For now, stop after the first alarm
538 } 541 }
539 } else { 542 } else {
540 Alarm* alarm = inc->alarms().first(); 543 Alarm* alarm = inc->alarms().first();
541 if ( alarm ) { 544 if ( alarm ) {
542 alarm->setEnabled(false); 545 alarm->setEnabled(false);
543 alarm->setType(Alarm::Invalid); 546 alarm->setType(Alarm::Invalid);
544 } 547 }
545 } 548 }
546 KOListViewItem* item = getItemForEvent(inc); 549 KOListViewItem* item = getItemForEvent(inc);
547 if (item) { 550 if (item) {
548 ListItemVisitor v(item, mStartDate ); 551 ListItemVisitor v(item, mStartDate );
549 inc->accept(v); 552 inc->accept(v);
550 } 553 }
551 inc = delSel.next(); 554 inc = delSel.next();
552 } 555 }
553 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); 556 topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) );
554 qDebug("KO: Set alarm for %d items", count); 557 qDebug("KO: Set alarm for %d items", count);
555 calendar()->reInitAlarmSettings(); 558 calendar()->reInitAlarmSettings();
556 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 559 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
557} 560}
558void KOListView::setCategories( bool removeOld ) 561void KOListView::setCategories( bool removeOld )
559{ 562{
560 563
561 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 564 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
562 csd->setColorEnabled(); 565 csd->setColorEnabled();
563 if (! csd->exec()) { 566 if (! csd->exec()) {
564 delete csd; 567 delete csd;
565 return; 568 return;
566 } 569 }
567 QStringList catList = csd->selectedCategories(); 570 QStringList catList = csd->selectedCategories();
568 delete csd; 571 delete csd;
569 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 572 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
570 Incidence* inc = delSel.first(); 573 Incidence* inc = delSel.first();
571 while ( inc ) { 574 while ( inc ) {
572 if ( removeOld ) { 575 if ( removeOld ) {
573 inc->setCategories( catList, false ); 576 inc->setCategories( catList, false );
574 } else { 577 } else {
575 inc->addCategories( catList, false ); 578 inc->addCategories( catList, false );
576 } 579 }
577 KOListViewItem* item = getItemForEvent(inc); 580 KOListViewItem* item = getItemForEvent(inc);
578 if (item) { 581 if (item) {
579 ListItemVisitor v(item, mStartDate ); 582 ListItemVisitor v(item, mStartDate );
580 inc->accept(v); 583 inc->accept(v);
581 } 584 }
582 inc = delSel.next(); 585 inc = delSel.next();
583 } 586 }
584 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 587 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
585} 588}
586 589
587void KOListView::beamSelected() 590void KOListView::beamSelected()
588{ 591{
589 QPtrList<Incidence> delSel = getSelectedIncidences() ; 592 QPtrList<Incidence> delSel = getSelectedIncidences() ;
590 if ( delSel.count() ) 593 if ( delSel.count() )
591 emit beamIncidenceList( delSel ); 594 emit beamIncidenceList( delSel );
592} 595}
593 596
594void KOListView::saveDescriptionToFile() 597void KOListView::saveDescriptionToFile()
595{ 598{
596 599
597 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 600 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
598 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 601 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
599 i18n("Continue"), i18n("Cancel"), 0, 602 i18n("Continue"), i18n("Cancel"), 0,
600 0, 1 ); 603 0, 1 );
601 if ( result != 0 ) { 604 if ( result != 0 ) {
602 return; 605 return;
603 } 606 }
604 QPtrList<Incidence> delSel = getSelectedIncidences() ; 607 QPtrList<Incidence> delSel = getSelectedIncidences() ;
605 int icount = delSel.count(); 608 int icount = delSel.count();
606 if ( icount ) { 609 if ( icount ) {
607 QString fn = KOPrefs::instance()->mLastSaveFile; 610 QString fn = KOPrefs::instance()->mLastSaveFile;
608 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 611 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
609 612
610 if ( fn == "" ) 613 if ( fn == "" )
611 return; 614 return;
612 QFileInfo info; 615 QFileInfo info;
613 info.setFile( fn ); 616 info.setFile( fn );
614 QString mes; 617 QString mes;
615 bool createbup = true; 618 bool createbup = true;
616 if ( info. exists() ) { 619 if ( info. exists() ) {
617 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 620 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
618 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 621 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
619 i18n("Overwrite!"), i18n("Cancel"), 0, 622 i18n("Overwrite!"), i18n("Cancel"), 0,
620 0, 1 ); 623 0, 1 );
621 if ( result != 0 ) { 624 if ( result != 0 ) {
622 createbup = false; 625 createbup = false;
623 } 626 }
624 } 627 }
625 if ( createbup ) { 628 if ( createbup ) {
626 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 629 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
627 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 630 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
628 Incidence *incidence = delSel.first(); 631 Incidence *incidence = delSel.first();
629 icount = 0; 632 icount = 0;
630 while ( incidence ) { 633 while ( incidence ) {
631 if ( incidence->typeID() == journalID ) { 634 if ( incidence->typeID() == journalID ) {
632 text += "\n************************************\n"; 635 text += "\n************************************\n";
633 if ( !incidence->summary().isEmpty() ) 636 if ( !incidence->summary().isEmpty() )
634 text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); 637 text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false );
635 else 638 else
636 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 639 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
637 if ( !incidence->location().isEmpty() ) 640 if ( !incidence->location().isEmpty() )
638 text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; 641 text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
639 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 642 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
640 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 643 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
641 ++icount; 644 ++icount;
642 645
643 } else { 646 } else {
644 if ( !incidence->description().isEmpty() ) { 647 if ( !incidence->description().isEmpty() ) {
645 text += "\n************************************\n"; 648 text += "\n************************************\n";
646 if ( incidence->typeID() == todoID ) 649 if ( incidence->typeID() == todoID )
647 text += i18n("To-Do: "); 650 text += i18n("To-Do: ");
648 text += incidence->summary(); 651 text += incidence->summary();
649 if ( !incidence->location().isEmpty() ) 652 if ( !incidence->location().isEmpty() )
650 text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; 653 text +="\n(" + i18n("Location: ") + incidence->location()+ ")";
651 if ( incidence->hasStartDate() ) 654 if ( incidence->hasStartDate() )
652 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 655 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
653 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 656 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
654 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 657 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
655 ++icount; 658 ++icount;
656 659
657 } 660 }
658 } 661 }
659 incidence = delSel.next(); 662 incidence = delSel.next();
660 } 663 }
661 QFile file( fn ); 664 QFile file( fn );
662 if (!file.open( IO_WriteOnly ) ) { 665 if (!file.open( IO_WriteOnly ) ) {
663 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 666 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
664 return; 667 return;
665 } 668 }
666 QTextStream ts( &file ); 669 QTextStream ts( &file );
667 ts << text; 670 ts << text;
668 file.close(); 671 file.close();
669 //qDebug("%s ", text.latin1()); 672 //qDebug("%s ", text.latin1());
670 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 673 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
671 KOPrefs::instance()->mLastSaveFile = fn; 674 KOPrefs::instance()->mLastSaveFile = fn;
672 topLevelWidget()->setCaption(mes); 675 topLevelWidget()->setCaption(mes);
673 } 676 }
674 } 677 }
675} 678}
676void KOListView::saveToFileVCS() 679void KOListView::saveToFileVCS()
677{ 680{
678 writeToFile( false ); 681 writeToFile( false );
679} 682}
680void KOListView::saveToFile() 683void KOListView::saveToFile()
681{ 684{
682 writeToFile( true ); 685 writeToFile( true );
683} 686}
684QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) 687QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos )
685{ 688{
686 QPtrList<Incidence> delSel ; 689 QPtrList<Incidence> delSel ;
687 bool addSubTodos = false; 690 bool addSubTodos = false;
688 bool askSubTodos = true; 691 bool askSubTodos = true;
689 QListViewItem *item = mListView->firstChild (); 692 QListViewItem *item = mListView->firstChild ();
690 while ( item ) { 693 while ( item ) {
691 if ( item->isSelected() ) { 694 if ( item->isSelected() ) {
692 Incidence* inc = ((KOListViewItem *)item)->data(); 695 Incidence* inc = ((KOListViewItem *)item)->data();
693 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { 696 if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) {
694 if ( (inc->typeID() == todoID && includeTodos) || 697 if ( (inc->typeID() == todoID && includeTodos) ||
695 (inc->typeID() == eventID && includeEvents) || 698 (inc->typeID() == eventID && includeEvents) ||
696 (inc->typeID() == journalID && includeJournals) ) { 699 (inc->typeID() == journalID && includeJournals) ) {
697 if ( inc->typeID() == todoID && onlyDueTodos ) { 700 if ( inc->typeID() == todoID && onlyDueTodos ) {
698 if ( ((Todo*)inc)->hasDueDate() ) 701 if ( ((Todo*)inc)->hasDueDate() )
699 delSel.append( inc ); 702 delSel.append( inc );
700 } else 703 } else
701 delSel.append( inc ); 704 delSel.append( inc );
702 705
703 } 706 }
704 } 707 }
705 if ( inc->typeID() == todoID ) { 708 if ( inc->typeID() == todoID ) {
706 Todo * todo = (Todo*) inc; 709 Todo * todo = (Todo*) inc;
707 if ( todo->relations().count() ) { 710 if ( todo->relations().count() ) {
708 if ( askSubTodos ) { 711 if ( askSubTodos ) {
709 int result = KMessageBox::warningYesNoCancel(this, 712 int result = KMessageBox::warningYesNoCancel(this,
710 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), 713 i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"),
711 i18n("Todo has subtodos"), 714 i18n("Todo has subtodos"),
712 i18n("Yes"), 715 i18n("Yes"),
713 i18n("No")); 716 i18n("No"));
714 if ( result == KMessageBox::Cancel ) { 717 if ( result == KMessageBox::Cancel ) {
715 delSel.clear(); 718 delSel.clear();
716 return delSel; 719 return delSel;
717 } 720 }
718 if (result == KMessageBox::Yes) 721 if (result == KMessageBox::Yes)
719 addSubTodos = true; 722 addSubTodos = true;
720 askSubTodos = false; 723 askSubTodos = false;
721 } 724 }
722 if ( addSubTodos ) { 725 if ( addSubTodos ) {
723 QPtrList<Incidence> tempSel ; 726 QPtrList<Incidence> tempSel ;
724 inc->addRelationsToList( &tempSel ); 727 inc->addRelationsToList( &tempSel );
725 Incidence* tempinc = tempSel.first(); 728 Incidence* tempinc = tempSel.first();
726 while ( tempinc ) { 729 while ( tempinc ) {
727 if ( delSel.findRef( tempinc ) == -1 ) { 730 if ( delSel.findRef( tempinc ) == -1 ) {
728 if ( tempinc->typeID() == todoID && onlyDueTodos ) { 731 if ( tempinc->typeID() == todoID && onlyDueTodos ) {
729 if ( ((Todo*)tempinc)->hasDueDate() ) 732 if ( ((Todo*)tempinc)->hasDueDate() )
730 delSel.append( tempinc ); 733 delSel.append( tempinc );
731 } else 734 } else
732 delSel.append( tempinc ); 735 delSel.append( tempinc );
733 } 736 }
734 tempinc = tempSel.next(); 737 tempinc = tempSel.next();
735 } 738 }
736 } 739 }
737 } 740 }
738 } 741 }
739 } 742 }
740 item = item->nextSibling(); 743 item = item->nextSibling();
741 } 744 }
742 return delSel; 745 return delSel;
743} 746}
744 747
745void KOListView::writeToFile( bool iCal ) 748void KOListView::writeToFile( bool iCal )
746{ 749{
747 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; 750 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;
748 if ( !iCal ) { 751 if ( !iCal ) {
749 bool journal = false; 752 bool journal = false;
750 Incidence *incidence = delSel.first(); 753 Incidence *incidence = delSel.first();
751 while ( incidence ) { 754 while ( incidence ) {
752 if ( incidence->typeID() == journalID ) { 755 if ( incidence->typeID() == journalID ) {
753 journal = true; 756 journal = true;
754 break; 757 break;
755 } 758 }
756 incidence = delSel.next(); 759 incidence = delSel.next();
757 } 760 }
758 if ( journal ) { 761 if ( journal ) {
759 int result = KMessageBox::warningContinueCancel(this, 762 int result = KMessageBox::warningContinueCancel(this,
760 i18n("The journal entries can not be\nexported to a vCalendar file."), 763 i18n("The journal entries can not be\nexported to a vCalendar file."),
761 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), 764 i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"),
762 true); 765 true);
763 if (result != KMessageBox::Continue) return; 766 if (result != KMessageBox::Continue) return;
764 } 767 }
765 } 768 }
766 if ( delSel.count() ) { 769 if ( delSel.count() ) {
767 QString fn = KOPrefs::instance()->mLastSaveFile; 770 QString fn = KOPrefs::instance()->mLastSaveFile;
768 QString extension; 771 QString extension;
769 if ( iCal ) { 772 if ( iCal ) {
770 if ( fn.right( 4 ).lower() == ".vcs" ) { 773 if ( fn.right( 4 ).lower() == ".vcs" ) {
771 fn = fn.left( fn.length() -3) + "ics"; 774 fn = fn.left( fn.length() -3) + "ics";
772 } 775 }
773 } else { 776 } else {
774 if ( fn.right( 4 ).lower() == ".ics" ) { 777 if ( fn.right( 4 ).lower() == ".ics" ) {
775 fn = fn.left( fn.length() -3) + "vcs"; 778 fn = fn.left( fn.length() -3) + "vcs";
776 } 779 }
777 } 780 }
778 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 781 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
779 782
780 if ( fn == "" ) 783 if ( fn == "" )
781 return; 784 return;
782 QFileInfo info; 785 QFileInfo info;
783 info.setFile( fn ); 786 info.setFile( fn );
784 QString mes; 787 QString mes;
785 bool createbup = true; 788 bool createbup = true;
786 if ( info. exists() ) { 789 if ( info. exists() ) {
787 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 790 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
788 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 791 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
789 i18n("Overwrite!"), i18n("Cancel"), 0, 792 i18n("Overwrite!"), i18n("Cancel"), 0,
790 0, 1 ); 793 0, 1 );
791 if ( result != 0 ) { 794 if ( result != 0 ) {
792 createbup = false; 795 createbup = false;
793 } 796 }
794 } 797 }
795 if ( createbup ) { 798 if ( createbup ) {
796 CalendarLocal cal; 799 CalendarLocal cal;
797 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 800 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
798 Incidence *incidence = delSel.first(); 801 Incidence *incidence = delSel.first();
799 while ( incidence ) { 802 while ( incidence ) {
800 cal.addIncidence( incidence->clone() ); 803 cal.addIncidence( incidence->clone() );
801 incidence = delSel.next(); 804 incidence = delSel.next();
802 } 805 }
803 if ( iCal ) { 806 if ( iCal ) {
804 ICalFormat format; 807 ICalFormat format;
805 format.save( &cal, fn ); 808 format.save( &cal, fn );
806 } else { 809 } else {
807 810
808 VCalFormat format; 811 VCalFormat format;
809 format.save( &cal, fn ); 812 format.save( &cal, fn );
810 } 813 }
811 mes = i18n("KO/Pi:Saved %1").arg(fn ); 814 mes = i18n("KO/Pi:Saved %1").arg(fn );
812 KOPrefs::instance()->mLastSaveFile = fn; 815 KOPrefs::instance()->mLastSaveFile = fn;
813 topLevelWidget()->setCaption(mes); 816 topLevelWidget()->setCaption(mes);
814 } 817 }
815 } 818 }
816 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 819 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
817} 820}
818void KOListView::hideAll() 821void KOListView::hideAll()
819{ 822{
820 QPtrList<QListViewItem> delSel ; 823 QPtrList<QListViewItem> delSel ;
821 QListViewItem *item = mListView->firstChild (); 824 QListViewItem *item = mListView->firstChild ();
822 while ( item ) { 825 while ( item ) {
823 if ( item->isSelected() ) { 826 if ( item->isSelected() ) {
824 delSel.append(item); 827 delSel.append(item);
825 } 828 }
826 item = item->nextSibling(); 829 item = item->nextSibling();
827 } 830 }
828 item = delSel.first() ; 831 item = delSel.first() ;
829 while ( item ) { 832 while ( item ) {
830 QListViewItem * del = item; 833 QListViewItem * del = item;
831 item = delSel.next(); 834 item = delSel.next();
832 delete del; 835 delete del;
833 } 836 }
834} 837}
835void KOListView::printList() 838void KOListView::printList()
836{ 839{
837 mListView->printList(); 840 mListView->printList();
838} 841}
839void KOListView::deleteAll() 842void KOListView::deleteAll()
840{ 843{
841 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; 844 QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;;
842 if ( delSel.count() ) { 845 if ( delSel.count() ) {
843 int icount = delSel.count(); 846 int icount = delSel.count();
844 Incidence *incidence = delSel.first(); 847 Incidence *incidence = delSel.first();
845 Incidence *toDelete; 848 Incidence *toDelete;
846 KOPrefs *p = KOPrefs::instance(); 849 KOPrefs *p = KOPrefs::instance();
847 bool confirm = p->mConfirm; 850 bool confirm = p->mConfirm;
848 QString mess; 851 QString mess;
849 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 852 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
850 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 853 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
851 p->mConfirm = false; 854 p->mConfirm = false;
852 int delCounter = 0; 855 int delCounter = 0;
853 QDialog dia ( this, "p-dialog", true ); 856 QDialog dia ( this, "p-dialog", true );
854 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 857 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
855 QVBoxLayout lay( &dia ); 858 QVBoxLayout lay( &dia );
856 lay.setMargin(7); 859 lay.setMargin(7);
857 lay.setSpacing(7); 860 lay.setSpacing(7);
858 lay.addWidget( &lab); 861 lay.addWidget( &lab);
859 QProgressBar bar( icount, &dia ); 862 QProgressBar bar( icount, &dia );
860 lay.addWidget( &bar); 863 lay.addWidget( &bar);
861 int w = 220; 864 int w = 220;
862 int h = 50; 865 int h = 50;
863 int dw = QApplication::desktop()->width(); 866 int dw = QApplication::desktop()->width();
864 int dh = QApplication::desktop()->height(); 867 int dh = QApplication::desktop()->height();
865 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 868 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
866 //dia.resize( 240,50 ); 869 //dia.resize( 240,50 );
867 dia.show(); 870 dia.show();
868 KOPrefs::instance()->mGlobalUpdateDisabled = true; 871 KOPrefs::instance()->mGlobalUpdateDisabled = true;
869 while ( incidence ) { 872 while ( incidence ) {
870 bar.setProgress( delCounter ); 873 bar.setProgress( delCounter );
871 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 874 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
872 dia.setCaption( mess ); 875 dia.setCaption( mess );
873 qApp->processEvents(); 876 qApp->processEvents();
874 toDelete = (incidence); 877 toDelete = (incidence);
875 incidence = delSel.next(); 878 incidence = delSel.next();
876 emit deleteIncidenceSignal(toDelete ); 879 emit deleteIncidenceSignal(toDelete );
877 if ( dia.result() != 0 ) 880 if ( dia.result() != 0 )
878 break; 881 break;
879 882
880 } 883 }
881 KOPrefs::instance()->mGlobalUpdateDisabled = false; 884 KOPrefs::instance()->mGlobalUpdateDisabled = false;
882 emit deleteIncidenceSignal( 0 ); 885 emit deleteIncidenceSignal( 0 );
883 mess = mess.sprintf( i18n("%d items remaining in list."), count() ); 886 mess = mess.sprintf( i18n("%d items remaining in list."), count() );
884 topLevelWidget ()->setCaption( mess ); 887 topLevelWidget ()->setCaption( mess );
885 p->mConfirm = confirm; 888 p->mConfirm = confirm;
886 } 889 }
887 } 890 }
888 891
889 892
890} 893}
891int KOListView::maxDatesHint() 894int KOListView::maxDatesHint()
892{ 895{
893 return 0; 896 return 0;
894} 897}
895 898
896int KOListView::currentDateCount() 899int KOListView::currentDateCount()
897{ 900{
898 return 0; 901 return 0;
899} 902}
900 903
901QPtrList<Incidence> KOListView::selectedIncidences() 904QPtrList<Incidence> KOListView::selectedIncidences()
902{ 905{
903 QPtrList<Incidence> eventList; 906 QPtrList<Incidence> eventList;
904 QListViewItem *item = mListView->firstChild (); 907 QListViewItem *item = mListView->firstChild ();
905 while ( item ) { 908 while ( item ) {
906 if ( item->isSelected() ) { 909 if ( item->isSelected() ) {
907 eventList.append(((KOListViewItem *)item)->data()); 910 eventList.append(((KOListViewItem *)item)->data());
908 } 911 }
909 912
910 item = item->nextSibling(); 913 item = item->nextSibling();
911 } 914 }
912 915
913 // // QListViewItem *item = mListView->selectedItem(); 916 // // QListViewItem *item = mListView->selectedItem();
914 //if (item) eventList.append(((KOListViewItem *)item)->data()); 917 //if (item) eventList.append(((KOListViewItem *)item)->data());
915 918
916 return eventList; 919 return eventList;
917} 920}
918 921
919DateList KOListView::selectedDates() 922DateList KOListView::selectedDates()
920{ 923{
921 DateList eventList; 924 DateList eventList;
922 return eventList; 925 return eventList;
923} 926}
924 927
925void KOListView::showDates(bool show) 928void KOListView::showDates(bool show)
926{ 929{
927 // Shouldn't we set it to a value greater 0? When showDates is called with 930 // Shouldn't we set it to a value greater 0? When showDates is called with
928 // show == true at first, then the columnwidths are set to zero. 931 // show == true at first, then the columnwidths are set to zero.
929 static int oldColWidth1 = 0; 932 static int oldColWidth1 = 0;
930 static int oldColWidth3 = 0; 933 static int oldColWidth3 = 0;
931 934
932 if (!show) { 935 if (!show) {
933 oldColWidth1 = mListView->columnWidth(1); 936 oldColWidth1 = mListView->columnWidth(1);
934 oldColWidth3 = mListView->columnWidth(3); 937 oldColWidth3 = mListView->columnWidth(3);
935 mListView->setColumnWidth(1, 0); 938 mListView->setColumnWidth(1, 0);
936 mListView->setColumnWidth(3, 0); 939 mListView->setColumnWidth(3, 0);
937 } else { 940 } else {
938 mListView->setColumnWidth(1, oldColWidth1); 941 mListView->setColumnWidth(1, oldColWidth1);
939 mListView->setColumnWidth(3, oldColWidth3); 942 mListView->setColumnWidth(3, oldColWidth3);
940 } 943 }
941 mListView->repaint(); 944 mListView->repaint();
942} 945}
943 946
944void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, 947void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd,
945 const QDate &td) 948 const QDate &td)
946{ 949{
947#ifndef KORG_NOPRINTER 950#ifndef KORG_NOPRINTER
948 calPrinter->preview(CalPrinter::Day, fd, td); 951 calPrinter->preview(CalPrinter::Day, fd, td);
949#endif 952#endif
950} 953}
951 954
952void KOListView::showDates() 955void KOListView::showDates()
953{ 956{
954 showDates(true); 957 showDates(true);
955} 958}
956 959
957void KOListView::hideDates() 960void KOListView::hideDates()
958{ 961{
959 showDates(false); 962 showDates(false);
960} 963}
961 964
962void KOListView::resetFocus() 965void KOListView::resetFocus()
963{ 966{
964 topLevelWidget()->setActiveWindow(); 967 topLevelWidget()->setActiveWindow();
965 topLevelWidget()->raise(); 968 topLevelWidget()->raise();
966 mListView->setFocus(); 969 mListView->setFocus();
967} 970}
968void KOListView::updateView() 971void KOListView::updateView()
969{ 972{
970 mListView->setFocus(); 973 mListView->setFocus();
971 if ( mListView->firstChild () ) 974 if ( mListView->firstChild () )
972 mListView->setCurrentItem( mListView->firstChild () ); 975 mListView->setCurrentItem( mListView->firstChild () );
973} 976}
974void KOListView::updateConfig() 977void KOListView::updateConfig()
975{ 978{
976 979
977 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 980 mListView->setFont ( KOPrefs::instance()->mListViewFont );
978 updateView(); 981 updateView();
979 982
980} 983}
981void KOListView::setStartDate(const QDate &start) 984void KOListView::setStartDate(const QDate &start)
982{ 985{
983 mStartDate = start; 986 mStartDate = start;
984} 987}
985 988
986void KOListView::showDates(const QDate &start, const QDate &end) 989void KOListView::showDates(const QDate &start, const QDate &end)
987{ 990{
988 clear(); 991 clear();
989 mStartDate = start; 992 mStartDate = start;
990 QDate date = start; 993 QDate date = start;
991 while( date <= end ) { 994 while( date <= end ) {
992 addEvents(calendar()->events(date)); 995 addEvents(calendar()->events(date));
993 addTodos(calendar()->todos(date)); 996 addTodos(calendar()->todos(date));
994 addJournals( calendar()->journals4Date(date) ); 997 addJournals( calendar()->journals4Date(date) );
995 date = date.addDays( 1 ); 998 date = date.addDays( 1 );
996 } 999 }
997 emit incidenceSelected( 0 ); 1000 emit incidenceSelected( 0 );
998 updateView(); 1001 updateView();
999 1002
1000} 1003}
1001 1004
1002void KOListView::addEvents(QPtrList<Event> eventList) 1005void KOListView::addEvents(QPtrList<Event> eventList)
1003{ 1006{
1004 1007
1005 Event *ev; 1008 Event *ev;
1006 for(ev = eventList.first(); ev; ev = eventList.next()) { 1009 for(ev = eventList.first(); ev; ev = eventList.next()) {
1007 addIncidence(ev); 1010 addIncidence(ev);
1008 } 1011 }
1009 if ( !mListView->currentItem() ){ 1012 if ( !mListView->currentItem() ){
1010 updateView(); 1013 updateView();
1011 } 1014 }
1012} 1015}
1013 1016
1014void KOListView::addTodos(QPtrList<Todo> eventList) 1017void KOListView::addTodos(QPtrList<Todo> eventList)
1015{ 1018{
1016 Todo *ev; 1019 Todo *ev;
1017 for(ev = eventList.first(); ev; ev = eventList.next()) { 1020 for(ev = eventList.first(); ev; ev = eventList.next()) {
1018 addIncidence(ev); 1021 addIncidence(ev);
1019 } 1022 }
1020 if ( !mListView->currentItem() ){ 1023 if ( !mListView->currentItem() ){
1021 updateView(); 1024 updateView();
1022 } 1025 }
1023} 1026}
1024void KOListView::addJournals(QPtrList<Journal> eventList) 1027void KOListView::addJournals(QPtrList<Journal> eventList)
1025{ 1028{
1026 Journal *ev; 1029 Journal *ev;
1027 for(ev = eventList.first(); ev; ev = eventList.next()) { 1030 for(ev = eventList.first(); ev; ev = eventList.next()) {
1028 addIncidence(ev); 1031 addIncidence(ev);
1029 } 1032 }
1030 if ( !mListView->currentItem() ){ 1033 if ( !mListView->currentItem() ){
1031 updateView(); 1034 updateView();
1032 } 1035 }
1033} 1036}
1034 1037
1035void KOListView::showCompletedTodos() 1038void KOListView::showCompletedTodos()
1036{ 1039{
1037 mForceShowCompletedTodos = true; 1040 mForceShowCompletedTodos = true;
1038} 1041}
1039void KOListView::addIncidence(Incidence *incidence) 1042void KOListView::addIncidence(Incidence *incidence)
1040{ 1043{
1041 if ( mUidDict.find( incidence->uid() ) ) return; 1044 if ( mUidDict.find( incidence->uid() ) ) return;
1042 1045
1043 // mListView->setFont ( KOPrefs::instance()->mListViewFont ); 1046 // mListView->setFont ( KOPrefs::instance()->mListViewFont );
1044 if ( incidence->typeID() == todoID ) { 1047 if ( incidence->typeID() == todoID ) {
1045 if ( ! mForceShowCompletedTodos ) { 1048 if ( ! mForceShowCompletedTodos ) {
1046 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) 1049 if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() )
1047 return; 1050 return;
1048 } 1051 }
1049 } 1052 }
1050 mUidDict.insert( incidence->uid(), incidence ); 1053 mUidDict.insert( incidence->uid(), incidence );
1051 KOListViewItem *item = new KOListViewItem( incidence, mListView ); 1054 KOListViewItem *item = new KOListViewItem( incidence, mListView );
1052 ListItemVisitor v(item, mStartDate ); 1055 ListItemVisitor v(item, mStartDate );
1053 if (incidence->accept(v)) { 1056 if (incidence->accept(v)) {
1054 return; 1057 return;
1055 } 1058 }
1056 else delete item; 1059 else delete item;
1057} 1060}
1058 1061
1059void KOListView::showEvents(QPtrList<Event> eventList) 1062void KOListView::showEvents(QPtrList<Event> eventList)
1060{ 1063{
1061 clear(); 1064 clear();
1062 1065
1063 addEvents(eventList); 1066 addEvents(eventList);
1064 1067
1065 // After new creation of list view no events are selected. 1068 // After new creation of list view no events are selected.
1066 emit incidenceSelected( 0 ); 1069 emit incidenceSelected( 0 );
1067} 1070}
1068int KOListView::count() 1071int KOListView::count()
1069{ 1072{
1070 return mListView->childCount(); 1073 return mListView->childCount();
1071} 1074}
1072 1075
1073void KOListView::changeEventDisplay(Event *event, int action) 1076void KOListView::changeEventDisplay(Event *event, int action)
1074{ 1077{
1075 KOListViewItem *item; 1078 KOListViewItem *item;
1076 1079
1077 switch(action) { 1080 switch(action) {
1078 case KOGlobals::EVENTADDED: 1081 case KOGlobals::EVENTADDED:
1079 addIncidence( event ); 1082 addIncidence( event );
1080 break; 1083 break;
1081 case KOGlobals::EVENTEDITED: 1084 case KOGlobals::EVENTEDITED:
1082 item = getItemForEvent(event); 1085 item = getItemForEvent(event);
1083 if (item) { 1086 if (item) {
1084 ListItemVisitor v(item, mStartDate ); 1087 ListItemVisitor v(item, mStartDate );
1085 ((Incidence*)event)->accept(v); 1088 ((Incidence*)event)->accept(v);
1086 } 1089 }
1087 break; 1090 break;
1088 case KOGlobals::EVENTDELETED: 1091 case KOGlobals::EVENTDELETED:
1089 item = getItemForEvent(event); 1092 item = getItemForEvent(event);
1090 if (item) { 1093 if (item) {
1091 mUidDict.remove( event->uid() ); 1094 mUidDict.remove( event->uid() );
1092 delete item; 1095 delete item;
1093 } 1096 }
1094 break; 1097 break;
1095 default: 1098 default:
1096 ; 1099 ;
1097 } 1100 }
1098} 1101}
1099 1102
1100KOListViewItem *KOListView::getItemForEvent(Incidence *event) 1103KOListViewItem *KOListView::getItemForEvent(Incidence *event)
1101{ 1104{
1102 KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); 1105 KOListViewItem *item = (KOListViewItem *)mListView->firstChild();
1103 while (item) { 1106 while (item) {
1104 if (item->data() == event) return item; 1107 if (item->data() == event) return item;
1105 item = (KOListViewItem *)item->nextSibling(); 1108 item = (KOListViewItem *)item->nextSibling();
1106 } 1109 }
1107 return 0; 1110 return 0;
1108} 1111}
1109 1112
1110void KOListView::defaultItemAction(QListViewItem *i) 1113void KOListView::defaultItemAction(QListViewItem *i)
1111{ 1114{
1112 KOListViewItem *item = static_cast<KOListViewItem *>( i ); 1115 KOListViewItem *item = static_cast<KOListViewItem *>( i );
1113 if ( item ) defaultAction( item->data() ); 1116 if ( item ) defaultAction( item->data() );
1114 1117
1115} 1118}
1116 1119
1117void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) 1120void KOListView::popupMenu(QListViewItem *item,const QPoint &,int)
1118{ 1121{
1119 mActiveItem = (KOListViewItem *)item; 1122 mActiveItem = (KOListViewItem *)item;
1120 if (mActiveItem) { 1123 if (mActiveItem) {
1121 Incidence *incidence = mActiveItem->data(); 1124 Incidence *incidence = mActiveItem->data();
1122 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); 1125 mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) );
1123 mPopupMenu->showIncidencePopup(incidence); 1126 mPopupMenu->showIncidencePopup(incidence);
1124 1127
1125 /* 1128 /*
1126 if ( incidence && incidence->type() == "Event" ) { 1129 if ( incidence && incidence->type() == "Event" ) {
1127 Event *event = static_cast<Event *>( incidence ); 1130 Event *event = static_cast<Event *>( incidence );
1128 mPopupMenu->showEventPopup(event); 1131 mPopupMenu->showEventPopup(event);
1129 } 1132 }
1130 */ 1133 */
1131 } 1134 }
1132} 1135}
1133 1136
1134void KOListView::readSettings(KConfig *config, QString setting) 1137void KOListView::readSettings(KConfig *config, QString setting)
1135{ 1138{
1136 // qDebug("KOListView::readSettings "); 1139 // qDebug("KOListView::readSettings ");
1137 mListView->restoreLayout(config,setting); 1140 mListView->restoreLayout(config,setting);
1138} 1141}
1139 1142
1140void KOListView::writeSettings(KConfig *config, QString setting) 1143void KOListView::writeSettings(KConfig *config, QString setting)
1141{ 1144{
1142 // qDebug("KOListView::writeSettings "); 1145 // qDebug("KOListView::writeSettings ");
1143 mListView->saveLayout(config, setting); 1146 mListView->saveLayout(config, setting);
1144} 1147}
1145 1148
1146void KOListView::processSelectionChange(QListViewItem *) 1149void KOListView::processSelectionChange(QListViewItem *)
1147{ 1150{
1148 1151
1149 KOListViewItem *item = 1152 KOListViewItem *item =
1150 static_cast<KOListViewItem *>( mListView->currentItem() ); 1153 static_cast<KOListViewItem *>( mListView->currentItem() );
1151 1154
1152 if ( !item ) { 1155 if ( !item ) {
1153 emit incidenceSelected( 0 ); 1156 emit incidenceSelected( 0 );
1154 } else { 1157 } else {
1155 emit incidenceSelected( item->data() ); 1158 emit incidenceSelected( item->data() );
1156 } 1159 }
1157} 1160}
1158 1161
1159void KOListView::clearSelection() 1162void KOListView::clearSelection()
1160{ 1163{
1161 mListView->selectAll( false ); 1164 mListView->selectAll( false );
1162} 1165}
1163void KOListView::allSelection() 1166void KOListView::allSelection()
1164{ 1167{
1165 mListView->selectAll( true ); 1168 mListView->selectAll( true );
1166} 1169}
1167 1170
1168void KOListView::clear() 1171void KOListView::clear()
1169{ 1172{
1170 mListView->clear(); 1173 mListView->clear();
1171 mUidDict.clear(); 1174 mUidDict.clear();
1172} 1175}
1173 1176
1174Incidence* KOListView::currentItem() 1177Incidence* KOListView::currentItem()
1175{ 1178{
1176 if ( mListView->currentItem() ) 1179 if ( mListView->currentItem() )
1177 return ((KOListViewItem*) mListView->currentItem())->data(); 1180 return ((KOListViewItem*) mListView->currentItem())->data();
1178 return 0; 1181 return 0;
1179} 1182}
1180void KOListView::keyPressEvent ( QKeyEvent *e) 1183void KOListView::keyPressEvent ( QKeyEvent *e)
1181{ 1184{
1182 1185
1183 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { 1186 if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) {
1184 deleteAll(); 1187 deleteAll();
1185 return; 1188 return;
1186 } 1189 }
1187 1190
1188 e->ignore(); 1191 e->ignore();
1189} 1192}
1190void KOListViewListView::keyPressEvent ( QKeyEvent *e) 1193void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1191{ 1194{
1192 1195
1193 switch ( e->key() ) { 1196 switch ( e->key() ) {
1194 case Qt::Key_Down: 1197 case Qt::Key_Down:
1195 if ( e->state() == ShiftButton ) { 1198 if ( e->state() == ShiftButton ) {
1196 QListViewItem* cn = currentItem(); 1199 QListViewItem* cn = currentItem();
1197 if ( !cn ) 1200 if ( !cn )
1198 cn = firstChild(); 1201 cn = firstChild();
1199 if ( !cn ) 1202 if ( !cn )
1200 return; 1203 return;
1201 while ( cn->nextSibling() ) 1204 while ( cn->nextSibling() )
1202 cn = cn->nextSibling(); 1205 cn = cn->nextSibling();
1203 setCurrentItem ( cn ); 1206 setCurrentItem ( cn );
1204 ensureItemVisible ( cn ); 1207 ensureItemVisible ( cn );
1205 1208
1206 e->accept(); 1209 e->accept();
1207 return; 1210 return;
1208 } 1211 }
1209 if ( e->state() == ControlButton ) { 1212 if ( e->state() == ControlButton ) {
1210 int count = childCount (); 1213 int count = childCount ();
1211 int jump = count / 5; 1214 int jump = count / 5;
1212 QListViewItem* cn; 1215 QListViewItem* cn;
1213 cn = currentItem(); 1216 cn = currentItem();
1214 if ( ! cn ) 1217 if ( ! cn )
1215 return; 1218 return;
1216 if ( jump == 0 ) 1219 if ( jump == 0 )
1217 jump = 1; 1220 jump = 1;
1218 while ( jump && cn->nextSibling() ) { 1221 while ( jump && cn->nextSibling() ) {
1219 cn = cn->nextSibling(); 1222 cn = cn->nextSibling();
1220 --jump; 1223 --jump;
1221 } 1224 }
1222 setCurrentItem ( cn ); 1225 setCurrentItem ( cn );
1223 ensureItemVisible ( cn ); 1226 ensureItemVisible ( cn );
1224 1227
1225 } else 1228 } else
1226 QListView::keyPressEvent ( e ) ; 1229 QListView::keyPressEvent ( e ) ;
1227 e->accept(); 1230 e->accept();
1228 break; 1231 break;
1229 1232
1230 case Qt::Key_Up: 1233 case Qt::Key_Up:
1231 if ( e->state() == ShiftButton ) { 1234 if ( e->state() == ShiftButton ) {
1232 QListViewItem* cn = firstChild(); 1235 QListViewItem* cn = firstChild();
1233 if ( cn ) { 1236 if ( cn ) {
1234 setCurrentItem ( cn ); 1237 setCurrentItem ( cn );
1235 ensureItemVisible ( cn ); 1238 ensureItemVisible ( cn );
1236 } 1239 }
1237 e->accept(); 1240 e->accept();
1238 return; 1241 return;
1239 } 1242 }
1240 if ( e->state() == ControlButton ) { 1243 if ( e->state() == ControlButton ) {
1241 int count = childCount (); 1244 int count = childCount ();
1242 int jump = count / 5; 1245 int jump = count / 5;
1243 QListViewItem* cn; 1246 QListViewItem* cn;
1244 cn = currentItem(); 1247 cn = currentItem();
1245 if ( ! cn ) 1248 if ( ! cn )
1246 return; 1249 return;
1247 if ( jump == 0 ) 1250 if ( jump == 0 )
1248 jump = 1; 1251 jump = 1;
1249 while ( jump && cn->itemAbove ()) { 1252 while ( jump && cn->itemAbove ()) {
1250 cn = cn->itemAbove (); 1253 cn = cn->itemAbove ();
1251 --jump; 1254 --jump;
1252 } 1255 }
1253 setCurrentItem ( cn ); 1256 setCurrentItem ( cn );
1254 ensureItemVisible ( cn ); 1257 ensureItemVisible ( cn );
1255 } else 1258 } else
1256 QListView::keyPressEvent ( e ) ; 1259 QListView::keyPressEvent ( e ) ;
1257 e->accept(); 1260 e->accept();
1258 break; 1261 break;
1259 case Qt::Key_I: { 1262 case Qt::Key_I: {
1260 QListViewItem* cn; 1263 QListViewItem* cn;
1261 cn = currentItem(); 1264 cn = currentItem();
1262 if ( cn ) { 1265 if ( cn ) {
1263 KOListViewItem* ci = (KOListViewItem*)( cn ); 1266 KOListViewItem* ci = (KOListViewItem*)( cn );
1264 if ( ci ){ 1267 if ( ci ){
1265 //emit showIncidence( ci->data()); 1268 //emit showIncidence( ci->data());
1266 cn = cn->nextSibling(); 1269 cn = cn->nextSibling();
1267 if ( cn ) { 1270 if ( cn ) {
1268 setCurrentItem ( cn ); 1271 setCurrentItem ( cn );
1269 ensureItemVisible ( cn ); 1272 ensureItemVisible ( cn );
1270 } 1273 }
1271 emit showIncidence( ci->data()); 1274 emit showIncidence( ci->data());
1272 } 1275 }
1273 } 1276 }
1274 e->accept(); 1277 e->accept();
1275 } 1278 }
1276 break; 1279 break;
1277 case Qt::Key_Return: 1280 case Qt::Key_Return:
1278 case Qt::Key_Enter: 1281 case Qt::Key_Enter:
1279 { 1282 {
1280 QListViewItem* cn; 1283 QListViewItem* cn;
1281 cn = currentItem(); 1284 cn = currentItem();
1282 if ( cn ) { 1285 if ( cn ) {
1283 KOListViewItem* ci = (KOListViewItem*)( cn ); 1286 KOListViewItem* ci = (KOListViewItem*)( cn );
1284 if ( ci ){ 1287 if ( ci ){
1285 if ( e->state() == ShiftButton ) 1288 if ( e->state() == ShiftButton )
1286 ci->setSelected( false ); 1289 ci->setSelected( false );
1287 else 1290 else
1288 ci->setSelected( true ); 1291 ci->setSelected( true );
1289 cn = cn->nextSibling(); 1292 cn = cn->nextSibling();
1290 if ( cn ) { 1293 if ( cn ) {
1291 setCurrentItem ( cn ); 1294 setCurrentItem ( cn );
1292 ensureItemVisible ( cn ); 1295 ensureItemVisible ( cn );
1293 } 1296 }
1294 } 1297 }
1295 } 1298 }
1296 e->accept(); 1299 e->accept();
1297 } 1300 }
1298 break; 1301 break;
1299 default: 1302 default:
1300 e->ignore(); 1303 e->ignore();
1301 } 1304 }
1302} 1305}
1303KOListViewListView::KOListViewListView(KOListView * lv ) 1306KOListViewListView::KOListViewListView(KOListView * lv )
1304 : KListView( lv, "kolistlistview", false ) 1307 : KListView( lv, "kolistlistview", false )
1305{ 1308{
1306 mYMousePos = 0; 1309 mYMousePos = 0;
1307 mPopupTimer = new QTimer(this); 1310 mPopupTimer = new QTimer(this);
1308 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 1311 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
1309#ifndef DESKTOP_VERSION 1312#ifndef DESKTOP_VERSION
1310 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1313 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1311#endif 1314#endif
1312 setSelectionMode( QListView::Multi ); 1315 setSelectionMode( QListView::Multi );
1313 setMultiSelection( true); 1316 setMultiSelection( true);
1314} 1317}
1315bool KOListViewListView::hasMultiSelection(QListViewItem* item) 1318bool KOListViewListView::hasMultiSelection(QListViewItem* item)
1316{ 1319{
1317 QListViewItem *qitem = firstChild (); 1320 QListViewItem *qitem = firstChild ();
1318 while ( qitem ) { 1321 while ( qitem ) {
1319 if ( qitem->isSelected() && item != qitem ) 1322 if ( qitem->isSelected() && item != qitem )
1320 return true; 1323 return true;
1321 qitem = qitem->nextSibling(); 1324 qitem = qitem->nextSibling();
1322 } 1325 }
1323 return false; 1326 return false;
1324} 1327}
1325void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1328void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1326{ 1329{
1327 if (!e) return; 1330 if (!e) return;
1328 QPoint vp = contentsToViewport(e->pos()); 1331 QPoint vp = contentsToViewport(e->pos());
1329 QListViewItem *item = itemAt(vp); 1332 QListViewItem *item = itemAt(vp);
1330 if (!item) { 1333 if (!item) {
1331 emit newEvent(); 1334 emit newEvent();
1332 return; 1335 return;
1333 } 1336 }
1334 KListView::contentsMouseDoubleClickEvent(e); 1337 KListView::contentsMouseDoubleClickEvent(e);
1335} 1338}
1336#if 0 1339#if 0
1337void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1340void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1338{ 1341{
1339 //qDebug("contentsMousePressEvent++++ "); 1342 //qDebug("contentsMousePressEvent++++ ");
1340 KListView::contentsMousePressEvent( e ); 1343 KListView::contentsMousePressEvent( e );
1341 if ( e->button() == RightButton ) { 1344 if ( e->button() == RightButton ) {
1342 QListViewItem* ci = currentItem(); 1345 QListViewItem* ci = currentItem();
1343 clearSelection () ; 1346 clearSelection () ;
1344 if ( ci ) 1347 if ( ci )
1345 ci->setSelected( true ); 1348 ci->setSelected( true );
1346 } 1349 }
1347} 1350}
1348void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1351void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1349{ 1352{
1350 KListView::contentsMouseReleaseEvent(e); 1353 KListView::contentsMouseReleaseEvent(e);
1351} 1354}
1352void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1355void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1353{ 1356{
1354 KListView::contentsMouseMoveEvent(e); 1357 KListView::contentsMouseMoveEvent(e);
1355} 1358}
1356#endif 1359#endif
1357void KOListViewListView::popupMenu() 1360void KOListViewListView::popupMenu()
1358{ 1361{
1359 mPopupTimer->stop(); 1362 mPopupTimer->stop();
1360 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1363 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
1361 QApplication::postEvent( this->viewport(), e ); 1364 QApplication::postEvent( this->viewport(), e );
1362 1365
1363} 1366}
1364void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1367void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1365{ 1368{
1366 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); 1369 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1367 mYMousePos = mapToGlobal( (e->pos())).y(); 1370 mYMousePos = mapToGlobal( (e->pos())).y();
1368 if ( e->button() == LeftButton ) { 1371 if ( e->button() == LeftButton ) {
1369 mPopupTimer->start( 600 ); 1372 mPopupTimer->start( 600 );
1370 mEventPos = contentsToViewport(e->pos()); 1373 mEventPos = contentsToViewport(e->pos());
1371 mEventGlobalPos = e->globalPos(); 1374 mEventGlobalPos = e->globalPos();
1372 } 1375 }
1373 KListView::contentsMousePressEvent( e ); 1376 KListView::contentsMousePressEvent( e );
1374 if ( e->button() == RightButton ) { 1377 if ( e->button() == RightButton ) {
1375 QListViewItem* ci = currentItem(); 1378 QListViewItem* ci = currentItem();
1376 //clearSelection(); 1379 //clearSelection();
1377 if ( ci ) 1380 if ( ci )
1378 ci->setSelected( true ); 1381 ci->setSelected( true );
1379 } 1382 }
1380} 1383}
1381void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1384void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1382{ 1385{
1383 mPopupTimer->stop(); 1386 mPopupTimer->stop();
1384 KListView::contentsMouseReleaseEvent(e); 1387 KListView::contentsMouseReleaseEvent(e);
1385} 1388}
1386void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1389void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1387{ 1390{
1388 // qDebug("contentsMouseMoveEv....... "); 1391 // qDebug("contentsMouseMoveEv....... ");
1389 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1392 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1390 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1393 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1391 if ( diff < 0 ) diff = -diff; 1394 if ( diff < 0 ) diff = -diff;
1392 if ( diff > 15 ) 1395 if ( diff > 15 )
1393 mPopupTimer->stop(); 1396 mPopupTimer->stop();
1394 else { 1397 else {
1395 mEventPos = contentsToViewport(e->pos()); 1398 mEventPos = contentsToViewport(e->pos());
1396 mEventGlobalPos = e->globalPos(); 1399 mEventGlobalPos = e->globalPos();
1397 } 1400 }
1398 KListView::contentsMouseMoveEvent(e); 1401 KListView::contentsMouseMoveEvent(e);
1399} 1402}
1400 1403
1401#define protected public 1404#define protected public
1402#include <qheader.h> 1405#include <qheader.h>
1403#undef protected 1406#undef protected
1404void KOListViewListView::printList() 1407void KOListViewListView::printList()
1405{ 1408{
1406#ifdef DESKTOP_VERSION 1409#ifdef DESKTOP_VERSION
1407 KOPrintPrefs pp ( this ); 1410 KOPrintPrefs pp ( this );
1408 if (!pp.exec() ) 1411 if (!pp.exec() )
1409 return; 1412 return;
1410 int scaleval = pp.printMode() ; 1413 int scaleval = pp.printMode() ;
1411 1414
1412 QPrinter printer; 1415 QPrinter printer;
1413 if (!printer.setup() ) 1416 if (!printer.setup() )
1414 return; 1417 return;
1415 clearSelection (); 1418 clearSelection ();
1416 QPainter p; 1419 QPainter p;
1417 p.begin ( &printer ); 1420 p.begin ( &printer );
1418 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 1421 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
1419 float dx, dy; 1422 float dx, dy;
1420 int wid = (m.width() * 9)/10; 1423 int wid = (m.width() * 9)/10;
1421 dx = (float) wid/(float)contentsWidth (); 1424 dx = (float) wid/(float)contentsWidth ();
1422 dy = (float)(m.height()) / (float)contentsHeight (); 1425 dy = (float)(m.height()) / (float)contentsHeight ();
1423 float scale; 1426 float scale;
1424 // scale to fit the width or height of the paper 1427 // scale to fit the width or height of the paper
1425 if ( dx < dy ) 1428 if ( dx < dy )
1426 scale = dx; 1429 scale = dx;
1427 else 1430 else
1428 scale = dy; 1431 scale = dy;
1429 1432
1430 p.translate( m.width()/10,m.width()/10 ); 1433 p.translate( m.width()/10,m.width()/10 );
1431 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { 1434 if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) {
1432 p.scale( scale, scale ); 1435 p.scale( scale, scale );
1433 } 1436 }
1434 1437
1435 int cou = header()->count(); 1438 int cou = header()->count();
1436 int iii; 1439 int iii;
1437 QRect rect ( 0,0,0, header()->height()); 1440 QRect rect ( 0,0,0, header()->height());
1438 for ( iii = 0; iii < cou; ++iii ) { 1441 for ( iii = 0; iii < cou; ++iii ) {
1439 rect.setLeft ( header()->sectionPos( iii ) ); 1442 rect.setLeft ( header()->sectionPos( iii ) );
1440 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); 1443 rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii));
1441 header()->paintSection ( & p, header()->mapToIndex (iii), rect ); 1444 header()->paintSection ( & p, header()->mapToIndex (iii), rect );
1442 } 1445 }
1443 p.translate( 0, header()->height()); 1446 p.translate( 0, header()->height());
1444 drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); 1447 drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () );
1445 p.end(); 1448 p.end();
1446#endif 1449#endif
1447} 1450}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index e960424..9c2ac82 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2580 +1,2591 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "kojournalview.h" 50#include "kojournalview.h"
51#include "koagenda.h" 51#include "koagenda.h"
52#include "kodialogmanager.h" 52#include "kodialogmanager.h"
53#include "kdialogbase.h" 53#include "kdialogbase.h"
54#include "kapplication.h" 54#include "kapplication.h"
55#include "kofilterview.h" 55#include "kofilterview.h"
56#include "kstandarddirs.h" 56#include "kstandarddirs.h"
57#include "koprefs.h" 57#include "koprefs.h"
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koglobals.h" 59#include "koglobals.h"
60#include "kglobal.h" 60#include "kglobal.h"
61#include "ktoolbar.h" 61#include "ktoolbar.h"
62#include "klocale.h" 62#include "klocale.h"
63#include "kconfig.h" 63#include "kconfig.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65#include <kglobalsettings.h> 65#include <kglobalsettings.h>
66 66
67using namespace KCal; 67using namespace KCal;
68#ifndef _WIN32_ 68#ifndef _WIN32_
69#include <unistd.h> 69#include <unistd.h>
70#else 70#else
71#ifdef _OL_IMPORT_ 71#ifdef _OL_IMPORT_
72#include "koimportoldialog.h" 72#include "koimportoldialog.h"
73#endif 73#endif
74#endif 74#endif
75#include "mainwindow.h" 75#include "mainwindow.h"
76 76
77 77
78class KOex2phonePrefs : public QDialog 78class KOex2phonePrefs : public QDialog
79{ 79{
80 public: 80 public:
81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 81 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
82 QDialog( parent, name, true ) 82 QDialog( parent, name, true )
83 { 83 {
84 setCaption( i18n("Export to phone options") ); 84 setCaption( i18n("Export to phone options") );
85 QVBoxLayout* lay = new QVBoxLayout( this ); 85 QVBoxLayout* lay = new QVBoxLayout( this );
86 lay->setSpacing( 3 ); 86 lay->setSpacing( 3 );
87 lay->setMargin( 3 ); 87 lay->setMargin( 3 );
88 QLabel *lab; 88 QLabel *lab;
89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 89 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
90 lab->setAlignment (AlignHCenter ); 90 lab->setAlignment (AlignHCenter );
91 QHBox* temphb; 91 QHBox* temphb;
92 temphb = new QHBox( this ); 92 temphb = new QHBox( this );
93 new QLabel( i18n("I/O device: "), temphb ); 93 new QLabel( i18n("I/O device: "), temphb );
94 mPhoneDevice = new QLineEdit( temphb); 94 mPhoneDevice = new QLineEdit( temphb);
95 lay->addWidget( temphb ); 95 lay->addWidget( temphb );
96 temphb = new QHBox( this ); 96 temphb = new QHBox( this );
97 new QLabel( i18n("Connection: "), temphb ); 97 new QLabel( i18n("Connection: "), temphb );
98 mPhoneConnection = new QLineEdit( temphb); 98 mPhoneConnection = new QLineEdit( temphb);
99 lay->addWidget( temphb ); 99 lay->addWidget( temphb );
100 temphb = new QHBox( this ); 100 temphb = new QHBox( this );
101 new QLabel( i18n("Model(opt.): "), temphb ); 101 new QLabel( i18n("Model(opt.): "), temphb );
102 mPhoneModel = new QLineEdit( temphb); 102 mPhoneModel = new QLineEdit( temphb);
103 lay->addWidget( temphb ); 103 lay->addWidget( temphb );
104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 104 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
105 mWriteBackFuture->setChecked( true ); 105 mWriteBackFuture->setChecked( true );
106 lay->addWidget( mWriteBackFuture ); 106 lay->addWidget( mWriteBackFuture );
107 temphb = new QHBox( this ); 107 temphb = new QHBox( this );
108 new QLabel( i18n("Max. weeks in future: ") , temphb ); 108 new QLabel( i18n("Max. weeks in future: ") , temphb );
109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 109 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
110 mWriteBackFutureWeeks->setValue( 8 ); 110 mWriteBackFutureWeeks->setValue( 8 );
111 lay->addWidget( temphb ); 111 lay->addWidget( temphb );
112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 112 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
113 lab->setAlignment (AlignHCenter ); 113 lab->setAlignment (AlignHCenter );
114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 114 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
115 lay->addWidget( ok ); 115 lay->addWidget( ok );
116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 116 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
117 lay->addWidget( cancel ); 117 lay->addWidget( cancel );
118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 118 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 119 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
120 resize( 220, 240 ); 120 resize( 220, 240 );
121 qApp->processEvents(); 121 qApp->processEvents();
122 int dw = QApplication::desktop()->width(); 122 int dw = QApplication::desktop()->width();
123 int dh = QApplication::desktop()->height(); 123 int dh = QApplication::desktop()->height();
124 move( (dw-width())/2, (dh - height() )/2 ); 124 move( (dw-width())/2, (dh - height() )/2 );
125 } 125 }
126 126
127public: 127public:
128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 128 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
129 QCheckBox* mWriteBackFuture; 129 QCheckBox* mWriteBackFuture;
130 QSpinBox* mWriteBackFutureWeeks; 130 QSpinBox* mWriteBackFutureWeeks;
131}; 131};
132 132
133QPixmap* sgListViewCompletedPix[6]; 133QPixmap* sgListViewCompletedPix[6];
134QPixmap* sgListViewJournalPix;
134 135
135 136
136int globalFlagBlockStartup; 137int globalFlagBlockStartup;
137MainWindow::MainWindow( QWidget *parent, const char *name ) : 138MainWindow::MainWindow( QWidget *parent, const char *name ) :
138 QMainWindow( parent, name ) 139 QMainWindow( parent, name )
139{ 140{
140 sgListViewCompletedPix[5] = &listviewPix; 141 sgListViewCompletedPix[5] = &listviewPix;
141 sgListViewCompletedPix[0] = &listviewPix0; 142 sgListViewCompletedPix[0] = &listviewPix0;
142 sgListViewCompletedPix[1] = &listviewPix20; 143 sgListViewCompletedPix[1] = &listviewPix20;
143 sgListViewCompletedPix[2] = &listviewPix40; 144 sgListViewCompletedPix[2] = &listviewPix40;
144 sgListViewCompletedPix[3] = &listviewPix60; 145 sgListViewCompletedPix[3] = &listviewPix60;
145 sgListViewCompletedPix[4] = &listviewPix80; 146 sgListViewCompletedPix[4] = &listviewPix80;
146 if ( sgListViewCompletedPix[5]->height() < 5 ) {
147 //int size = 12; 147 //int size = 12;
148 {
148 sgListViewCompletedPix[5]->resize( 11, 11 ); 149 sgListViewCompletedPix[5]->resize( 11, 11 );
149 sgListViewCompletedPix[5]->fill( Qt::white ); 150 sgListViewCompletedPix[5]->fill( Qt::white );
150 QPainter p ( sgListViewCompletedPix[5] ); 151 QPainter p ( sgListViewCompletedPix[5] );
151 p.drawRect( 0,0,11,11); 152 p.drawRect( 0,0,11,11);
152 p.drawLine ( 2, 5, 4 , 7 ) ; 153 p.drawLine ( 2, 5, 4 , 7 ) ;
153 p.drawLine ( 4 , 7 , 8, 3) ; 154 p.drawLine ( 4 , 7 , 8, 3) ;
154 int iii = 0; 155 int iii = 0;
155 for ( iii = 0; iii < 5; ++iii ) { 156 for ( iii = 0; iii < 5; ++iii ) {
156 sgListViewCompletedPix[iii]->resize( 11, 11 ); 157 sgListViewCompletedPix[iii]->resize( 11, 11 );
157 sgListViewCompletedPix[iii]->fill( Qt::white ); 158 sgListViewCompletedPix[iii]->fill( Qt::white );
158 QPainter p ( sgListViewCompletedPix[iii] ); 159 QPainter p ( sgListViewCompletedPix[iii] );
159 p.drawRect( 0,0,11,11); 160 p.drawRect( 0,0,11,11);
160 if ( iii ) 161 if ( iii )
161 p.fillRect( 1,1,iii*2,9,Qt::gray ); 162 p.fillRect( 1,1,iii*2,9,Qt::gray );
162 } 163 }
164 sgListViewJournalPix = &journalPix;
165 sgListViewJournalPix->resize( 11, 11 );
166 sgListViewJournalPix->fill( Qt::white );
167 {
168 QPainter p ( sgListViewJournalPix );
169 p.drawRect( 0,0,11,11);
170 p.drawLine( 2,3,5,3);
171 p.drawLine( 2,5,8,5);
172 p.drawLine( 2,7,6,7);
173 }
163 } 174 }
164 mClosed = false; 175 mClosed = false;
165 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 176 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
166 QString confFile = locateLocal("config","korganizerrc"); 177 QString confFile = locateLocal("config","korganizerrc");
167 QFileInfo finf ( confFile ); 178 QFileInfo finf ( confFile );
168 bool showWarning = !finf.exists(); 179 bool showWarning = !finf.exists();
169 setIcon(SmallIcon( "ko24" ) ); 180 setIcon(SmallIcon( "ko24" ) );
170 mBlockAtStartup = true; 181 mBlockAtStartup = true;
171 mFlagKeyPressed = false; 182 mFlagKeyPressed = false;
172 setCaption("KO/Pi"); 183 setCaption("KO/Pi");
173 KOPrefs *p = KOPrefs::instance(); 184 KOPrefs *p = KOPrefs::instance();
174 //KPimGlobalPrefs::instance()->setGlobalConfig(); 185 //KPimGlobalPrefs::instance()->setGlobalConfig();
175 p->mCurrentDisplayedView = 0; 186 p->mCurrentDisplayedView = 0;
176 if ( p->mHourSize > 22 ) 187 if ( p->mHourSize > 22 )
177 p->mHourSize = 22; 188 p->mHourSize = 22;
178 QMainWindow::ToolBarDock tbd; 189 QMainWindow::ToolBarDock tbd;
179 if ( p->mToolBarHor ) { 190 if ( p->mToolBarHor ) {
180 if ( p->mToolBarUp ) 191 if ( p->mToolBarUp )
181 tbd = Bottom; 192 tbd = Bottom;
182 else 193 else
183 tbd = Top; 194 tbd = Top;
184 } 195 }
185 else { 196 else {
186 if ( p->mToolBarUp ) 197 if ( p->mToolBarUp )
187 tbd = Right; 198 tbd = Right;
188 else 199 else
189 tbd = Left; 200 tbd = Left;
190 } 201 }
191 if ( KOPrefs::instance()->mUseAppColors ) 202 if ( KOPrefs::instance()->mUseAppColors )
192 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 203 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
193 globalFlagBlockStartup = 1; 204 globalFlagBlockStartup = 1;
194 iconToolBar = new QPEToolBar( this ); 205 iconToolBar = new QPEToolBar( this );
195 addToolBar (iconToolBar , tbd ); 206 addToolBar (iconToolBar , tbd );
196 207
197#ifdef DESKTOP_VERSION 208#ifdef DESKTOP_VERSION
198 if ( KOPrefs::instance()->mShowIconFilter ) 209 if ( KOPrefs::instance()->mShowIconFilter )
199#else 210#else
200 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 211 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
201#endif 212#endif
202 213
203{ 214{
204 if ( p->mToolBarHorF ) { 215 if ( p->mToolBarHorF ) {
205 if ( p->mToolBarUpF ) 216 if ( p->mToolBarUpF )
206 tbd = Bottom; 217 tbd = Bottom;
207 else 218 else
208 tbd = Top; 219 tbd = Top;
209 } 220 }
210 else { 221 else {
211 if ( p->mToolBarUpF ) 222 if ( p->mToolBarUpF )
212 tbd = Right; 223 tbd = Right;
213 else 224 else
214 tbd = Left; 225 tbd = Left;
215 } 226 }
216 filterToolBar = new QPEToolBar ( this ); 227 filterToolBar = new QPEToolBar ( this );
217 filterMenubar = new QMenuBar( 0 ); 228 filterMenubar = new QMenuBar( 0 );
218 QFontMetrics fm ( filterMenubar->font() ); 229 QFontMetrics fm ( filterMenubar->font() );
219 230
220 filterPopupMenu = new QPopupMenu( this ); 231 filterPopupMenu = new QPopupMenu( this );
221 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 232 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
222 QString addTest = "A"; 233 QString addTest = "A";
223 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); 234 filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) );
224#ifdef DESKTOP_VERSION 235#ifdef DESKTOP_VERSION
225 addTest = "AAABBBCCCx"; 236 addTest = "AAABBBCCCx";
226#else 237#else
227 addTest = "AAx"; 238 addTest = "AAx";
228#endif 239#endif
229 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); 240 filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) );
230 addToolBar (filterToolBar , tbd ); 241 addToolBar (filterToolBar , tbd );
231 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 242 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
232 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 243 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
233 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 244 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
234 filterToolBar->hide(); 245 filterToolBar->hide();
235 } else { 246 } else {
236 filterToolBar = 0; 247 filterToolBar = 0;
237 filterMenubar = 0; 248 filterMenubar = 0;
238 filterPopupMenu = 0; 249 filterPopupMenu = 0;
239 } 250 }
240 if ( p->mShowIconOnetoolbar ) { 251 if ( p->mShowIconOnetoolbar ) {
241 viewToolBar = iconToolBar ; 252 viewToolBar = iconToolBar ;
242 navigatorToolBar = iconToolBar ; 253 navigatorToolBar = iconToolBar ;
243 } else { 254 } else {
244#ifndef DESKTOP_VERSION 255#ifndef DESKTOP_VERSION
245 setToolBarsMovable( false ); 256 setToolBarsMovable( false );
246#endif 257#endif
247 if ( p->mToolBarHorV ) { 258 if ( p->mToolBarHorV ) {
248 if ( p->mToolBarUpV ) 259 if ( p->mToolBarUpV )
249 tbd = Bottom; 260 tbd = Bottom;
250 else 261 else
251 tbd = Top; 262 tbd = Top;
252 } 263 }
253 else { 264 else {
254 if ( p->mToolBarUpV ) 265 if ( p->mToolBarUpV )
255 tbd = Right; 266 tbd = Right;
256 else 267 else
257 tbd = Left; 268 tbd = Left;
258 } 269 }
259 viewToolBar = new QPEToolBar( this ); 270 viewToolBar = new QPEToolBar( this );
260 addToolBar (viewToolBar , tbd ); 271 addToolBar (viewToolBar , tbd );
261 if ( p->mToolBarHorN ) { 272 if ( p->mToolBarHorN ) {
262 if ( p->mToolBarUpN ) 273 if ( p->mToolBarUpN )
263 tbd = Bottom; 274 tbd = Bottom;
264 else 275 else
265 tbd = Top; 276 tbd = Top;
266 } 277 }
267 else { 278 else {
268 if ( p->mToolBarUpN ) 279 if ( p->mToolBarUpN )
269 tbd = Right; 280 tbd = Right;
270 else 281 else
271 tbd = Left; 282 tbd = Left;
272 } 283 }
273 navigatorToolBar = new QPEToolBar( this ); 284 navigatorToolBar = new QPEToolBar( this );
274 addToolBar (navigatorToolBar , tbd ); 285 addToolBar (navigatorToolBar , tbd );
275 } 286 }
276 287
277 288
278 289
279 mCalendarModifiedFlag = false; 290 mCalendarModifiedFlag = false;
280 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 291 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
281 splash->setAlignment ( AlignCenter ); 292 splash->setAlignment ( AlignCenter );
282 setCentralWidget( splash ); 293 setCentralWidget( splash );
283#ifndef DESKTOP_VERSION 294#ifndef DESKTOP_VERSION
284 showMaximized(); 295 showMaximized();
285#endif 296#endif
286 297
287 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 298 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
288 setDefaultPreferences(); 299 setDefaultPreferences();
289 mCalendar = new CalendarLocal(); 300 mCalendar = new CalendarLocal();
290 mView = new CalendarView( mCalendar, this,"mCalendar " ); 301 mView = new CalendarView( mCalendar, this,"mCalendar " );
291 mView->hide(); 302 mView->hide();
292 //mView->resize(splash->size() ); 303 //mView->resize(splash->size() );
293 initActions(); 304 initActions();
294 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 305 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
295 mSyncManager->setBlockSave(false); 306 mSyncManager->setBlockSave(false);
296 mView->setSyncManager(mSyncManager); 307 mView->setSyncManager(mSyncManager);
297#ifndef DESKTOP_VERSION 308#ifndef DESKTOP_VERSION
298 iconToolBar->show(); 309 iconToolBar->show();
299 qApp->processEvents(); 310 qApp->processEvents();
300#endif 311#endif
301 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 312 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
302 int vh = height() ; 313 int vh = height() ;
303 int vw = width(); 314 int vw = width();
304 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 315 //qDebug("Toolbar hei %d ",iconToolBar->height() );
305 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 316 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
306 vh -= iconToolBar->height(); 317 vh -= iconToolBar->height();
307 } else { 318 } else {
308 vw -= iconToolBar->height(); 319 vw -= iconToolBar->height();
309 } 320 }
310 //mView->setMaximumSize( splash->size() ); 321 //mView->setMaximumSize( splash->size() );
311 //mView->resize( splash->size() ); 322 //mView->resize( splash->size() );
312 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 323 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
313 mView->readSettings(); 324 mView->readSettings();
314 bool newFile = false; 325 bool newFile = false;
315 if( !QFile::exists( defaultFileName() ) ) { 326 if( !QFile::exists( defaultFileName() ) ) {
316 QFileInfo finfo ( defaultFileName() ); 327 QFileInfo finfo ( defaultFileName() );
317 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 328 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
318 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 329 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
319 finfo.setFile( oldFile ); 330 finfo.setFile( oldFile );
320 if (finfo.exists() ) { 331 if (finfo.exists() ) {
321 KMessageBox::information( this, message); 332 KMessageBox::information( this, message);
322 mView->openCalendar( oldFile ); 333 mView->openCalendar( oldFile );
323 qApp->processEvents(); 334 qApp->processEvents();
324 } else { 335 } else {
325 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 336 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
326 finfo.setFile( oldFile ); 337 finfo.setFile( oldFile );
327 if (finfo.exists() ) { 338 if (finfo.exists() ) {
328 KMessageBox::information( this, message); 339 KMessageBox::information( this, message);
329 mView->openCalendar( oldFile ); 340 mView->openCalendar( oldFile );
330 qApp->processEvents(); 341 qApp->processEvents();
331 } 342 }
332 } 343 }
333 mView->saveCalendar( defaultFileName() ); 344 mView->saveCalendar( defaultFileName() );
334 newFile = true; 345 newFile = true;
335 } 346 }
336 347
337 QTime neededSaveTime = QDateTime::currentDateTime().time(); 348 QTime neededSaveTime = QDateTime::currentDateTime().time();
338 mView->loadCalendars(); 349 mView->loadCalendars();
339 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 350 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
340 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 351 qDebug("KO: Calendar loading time: %d ms",msNeeded );
341 352
342 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 353 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
343 KOPrefs::instance()->setAllDefaults(); 354 KOPrefs::instance()->setAllDefaults();
344 } 355 }
345 processIncidenceSelection( 0 ); 356 processIncidenceSelection( 0 );
346 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 357 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
347 SLOT( processIncidenceSelection( Incidence * ) ) ); 358 SLOT( processIncidenceSelection( Incidence * ) ) );
348 connect( mView, SIGNAL( modifiedChanged( bool ) ), 359 connect( mView, SIGNAL( modifiedChanged( bool ) ),
349 SLOT( slotModifiedChanged( bool ) ) ); 360 SLOT( slotModifiedChanged( bool ) ) );
350 361
351 362
352 connect( mView, SIGNAL( tempDisableBR(bool) ), 363 connect( mView, SIGNAL( tempDisableBR(bool) ),
353 SLOT( disableBR(bool) ) ); 364 SLOT( disableBR(bool) ) );
354 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 365 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
355 mView->setModified( false ); 366 mView->setModified( false );
356 mBlockAtStartup = false; 367 mBlockAtStartup = false;
357 mView->setModified( false ); 368 mView->setModified( false );
358 setCentralWidget( mView ); 369 setCentralWidget( mView );
359 globalFlagBlockStartup = 0; 370 globalFlagBlockStartup = 0;
360 mView->show(); 371 mView->show();
361 delete splash; 372 delete splash;
362 if ( newFile ) 373 if ( newFile )
363 mView->updateConfig(); 374 mView->updateConfig();
364 // qApp->processEvents(); 375 // qApp->processEvents();
365 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 376 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
366 //fillSyncMenu(); 377 //fillSyncMenu();
367 378
368 379
369 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 380 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
370 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 381 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
371 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 382 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
372 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 383 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
373 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 384 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
374 mSyncManager->setDefaultFileName( sentSyncFile()); 385 mSyncManager->setDefaultFileName( sentSyncFile());
375 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 386 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
376 mSyncManager->fillSyncMenu(); 387 mSyncManager->fillSyncMenu();
377 388
378 389
379 390
380 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 391 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
381 if ( showWarning ) { 392 if ( showWarning ) {
382 KMessageBox::information( this, 393 KMessageBox::information( this,
383 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 394 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
384 qApp->processEvents(); 395 qApp->processEvents();
385 mView->dialogManager()->showSyncOptions(); 396 mView->dialogManager()->showSyncOptions();
386 } 397 }
387 398
388 //US listen for result adressed from Ka/Pi 399 //US listen for result adressed from Ka/Pi
389#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
390 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 401 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
391#endif 402#endif
392#ifndef DESKTOP_VERSION 403#ifndef DESKTOP_VERSION
393 infrared = 0; 404 infrared = 0;
394#endif 405#endif
395 updateFilterToolbar(); 406 updateFilterToolbar();
396 updateWeek( mView->startDate() ); 407 updateWeek( mView->startDate() );
397 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 408 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
398 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 409 SLOT( updateWeekNum( const KCal::DateList & ) ) );
399 mBRdisabled = false; 410 mBRdisabled = false;
400 //toggleBeamReceive(); 411 //toggleBeamReceive();
401 412
402 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() )); 413 QTimer::singleShot( 1000, mView, SLOT ( checkFiles() ));
403} 414}
404MainWindow::~MainWindow() 415MainWindow::~MainWindow()
405{ 416{
406 //qDebug("MainWindow::~MainWindow() "); 417 //qDebug("MainWindow::~MainWindow() ");
407 //save toolbar location 418 //save toolbar location
408 delete mCalendar; 419 delete mCalendar;
409 delete mSyncManager; 420 delete mSyncManager;
410#ifndef DESKTOP_VERSION 421#ifndef DESKTOP_VERSION
411 if ( infrared ) 422 if ( infrared )
412 delete infrared; 423 delete infrared;
413#endif 424#endif
414 425
415 426
416} 427}
417 428
418void MainWindow::disableBR(bool b) 429void MainWindow::disableBR(bool b)
419{ 430{
420#ifndef DESKTOP_VERSION 431#ifndef DESKTOP_VERSION
421 if ( b ) { 432 if ( b ) {
422 if ( infrared ) { 433 if ( infrared ) {
423 toggleBeamReceive(); 434 toggleBeamReceive();
424 mBRdisabled = true; 435 mBRdisabled = true;
425 } 436 }
426 mBRdisabled = true; 437 mBRdisabled = true;
427 } else { 438 } else {
428 if ( mBRdisabled ) { 439 if ( mBRdisabled ) {
429 mBRdisabled = false; 440 mBRdisabled = false;
430 //makes no sense,because other cal ap is probably running 441 //makes no sense,because other cal ap is probably running
431 // toggleBeamReceive(); 442 // toggleBeamReceive();
432 } 443 }
433 } 444 }
434#endif 445#endif
435 446
436} 447}
437bool MainWindow::beamReceiveEnabled() 448bool MainWindow::beamReceiveEnabled()
438{ 449{
439#ifndef DESKTOP_VERSION 450#ifndef DESKTOP_VERSION
440 return ( infrared != 0 ); 451 return ( infrared != 0 );
441#endif 452#endif
442 return false; 453 return false;
443} 454}
444 455
445void MainWindow::toggleBeamReceive() 456void MainWindow::toggleBeamReceive()
446{ 457{
447 if ( mBRdisabled ) 458 if ( mBRdisabled )
448 return; 459 return;
449#ifndef DESKTOP_VERSION 460#ifndef DESKTOP_VERSION
450 if ( infrared ) { 461 if ( infrared ) {
451 qDebug("KO: Disable BeamReceive "); 462 qDebug("KO: Disable BeamReceive ");
452 delete infrared; 463 delete infrared;
453 infrared = 0; 464 infrared = 0;
454 brAction->setOn(false); 465 brAction->setOn(false);
455 return; 466 return;
456 } 467 }
457 qDebug("KO: Enable BeamReceive "); 468 qDebug("KO: Enable BeamReceive ");
458 brAction->setOn(true); 469 brAction->setOn(true);
459 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 470 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
460 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 471 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
461#endif 472#endif
462} 473}
463void MainWindow::showMaximized () 474void MainWindow::showMaximized ()
464{ 475{
465#ifndef DESKTOP_VERSION 476#ifndef DESKTOP_VERSION
466 if ( ! globalFlagBlockStartup ) 477 if ( ! globalFlagBlockStartup )
467 if ( mClosed ) 478 if ( mClosed )
468 mView->goToday(); 479 mView->goToday();
469#endif 480#endif
470 QWidget::showMaximized () ; 481 QWidget::showMaximized () ;
471 mClosed = false; 482 mClosed = false;
472} 483}
473void MainWindow::closeEvent( QCloseEvent* ce ) 484void MainWindow::closeEvent( QCloseEvent* ce )
474{ 485{
475 486
476 487
477 488
478 if ( ! KOPrefs::instance()->mAskForQuit ) { 489 if ( ! KOPrefs::instance()->mAskForQuit ) {
479 saveOnClose(); 490 saveOnClose();
480 mClosed = true; 491 mClosed = true;
481 ce->accept(); 492 ce->accept();
482 return; 493 return;
483 494
484 } 495 }
485 496
486 switch( QMessageBox::information( this, "KO/Pi", 497 switch( QMessageBox::information( this, "KO/Pi",
487 i18n("Do you really want\nto close KO/Pi?"), 498 i18n("Do you really want\nto close KO/Pi?"),
488 i18n("Close"), i18n("No"), 499 i18n("Close"), i18n("No"),
489 0, 0 ) ) { 500 0, 0 ) ) {
490 case 0: 501 case 0:
491 saveOnClose(); 502 saveOnClose();
492 mClosed = true; 503 mClosed = true;
493 ce->accept(); 504 ce->accept();
494 break; 505 break;
495 case 1: 506 case 1:
496 ce->ignore(); 507 ce->ignore();
497 break; 508 break;
498 case 2: 509 case 2:
499 510
500 default: 511 default:
501 break; 512 break;
502 } 513 }
503 514
504 515
505} 516}
506 517
507void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 518void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
508{ 519{
509 QDataStream stream( data, IO_ReadOnly ); 520 QDataStream stream( data, IO_ReadOnly );
510 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 521 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
511 //QString datamess; 522 //QString datamess;
512 //qDebug("message "); 523 //qDebug("message ");
513 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 524 qDebug("KO: QCOP message received: %s ", cmsg.data() );
514 525
515 if ( cmsg == "setDocument(QString)" ) { 526 if ( cmsg == "setDocument(QString)" ) {
516 QDataStream stream( data, IO_ReadOnly ); 527 QDataStream stream( data, IO_ReadOnly );
517 QString fileName; 528 QString fileName;
518 stream >> fileName; 529 stream >> fileName;
519 //qDebug("filename %s ", fileName.latin1()); 530 //qDebug("filename %s ", fileName.latin1());
520 showMaximized(); 531 showMaximized();
521 raise(); 532 raise();
522 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 533 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
523 mSyncManager->slotSyncMenu( 1002 ); 534 mSyncManager->slotSyncMenu( 1002 );
524 return; 535 return;
525 } 536 }
526 537
527 if ( cmsg == "-writeFile" ) { 538 if ( cmsg == "-writeFile" ) {
528 // I made from the "-writeFile" an "-writeAlarm" 539 // I made from the "-writeFile" an "-writeAlarm"
529 mView->viewManager()->showWhatsNextView(); 540 mView->viewManager()->showWhatsNextView();
530 mCalendar->checkAlarmForIncidence( 0, true); 541 mCalendar->checkAlarmForIncidence( 0, true);
531 showMaximized(); 542 showMaximized();
532 raise(); 543 raise();
533 return; 544 return;
534 545
535 } 546 }
536 if ( cmsg == "-writeFileSilent" ) { 547 if ( cmsg == "-writeFileSilent" ) {
537 // I made from the "-writeFile" an "-writeAlarm" 548 // I made from the "-writeFile" an "-writeAlarm"
538 // mView->viewManager()->showWhatsNextView(); 549 // mView->viewManager()->showWhatsNextView();
539 mCalendar->checkAlarmForIncidence( 0, true); 550 mCalendar->checkAlarmForIncidence( 0, true);
540 //showMaximized(); 551 //showMaximized();
541 //raise(); 552 //raise();
542 hide(); 553 hide();
543 return; 554 return;
544 } 555 }
545 if ( cmsg == "-newCountdown" ) { 556 if ( cmsg == "-newCountdown" ) {
546 qDebug("newCountdown "); 557 qDebug("newCountdown ");
547 558
548 } 559 }
549 QString msg ; 560 QString msg ;
550 QString allmsg = cmsg; 561 QString allmsg = cmsg;
551 while ( allmsg.length() > 0 ) { 562 while ( allmsg.length() > 0 ) {
552 int nextC = allmsg.find( "-", 1 ); 563 int nextC = allmsg.find( "-", 1 );
553 if ( nextC == -1 ) { 564 if ( nextC == -1 ) {
554 msg = allmsg; 565 msg = allmsg;
555 allmsg = ""; 566 allmsg = "";
556 } else{ 567 } else{
557 msg = allmsg.left( nextC ); 568 msg = allmsg.left( nextC );
558 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 569 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
559 } 570 }
560 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 571 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
561 if ( msg == "-newEvent" ) { 572 if ( msg == "-newEvent" ) {
562 QTimer::singleShot( 0, mView, SLOT ( newEvent())); 573 QTimer::singleShot( 0, mView, SLOT ( newEvent()));
563 } 574 }
564 if ( msg == "-newTodo" ) { 575 if ( msg == "-newTodo" ) {
565 QTimer::singleShot( 0, mView, SLOT ( newTodo())); 576 QTimer::singleShot( 0, mView, SLOT ( newTodo()));
566 } 577 }
567 if ( msg == "-showWN" ) { 578 if ( msg == "-showWN" ) {
568 mView->viewManager()->showWhatsNextView(); 579 mView->viewManager()->showWhatsNextView();
569 } 580 }
570 if ( msg == "-showTodo" ) { 581 if ( msg == "-showTodo" ) {
571 mView->viewManager()->showTodoView(); 582 mView->viewManager()->showTodoView();
572 } 583 }
573 if ( msg == "-showList" ) { 584 if ( msg == "-showList" ) {
574 mView->viewManager()->showListView(); 585 mView->viewManager()->showListView();
575 } 586 }
576 else if ( msg == "-showDay" ) { 587 else if ( msg == "-showDay" ) {
577 mView->viewManager()->showDayView(); 588 mView->viewManager()->showDayView();
578 } 589 }
579 else if ( msg == "-showWWeek" ) { 590 else if ( msg == "-showWWeek" ) {
580 mView->viewManager()->showWorkWeekView(); 591 mView->viewManager()->showWorkWeekView();
581 } 592 }
582 else if ( msg == "-ringSync" ) { 593 else if ( msg == "-ringSync" ) {
583 QTimer::singleShot( 0, this, SLOT (startMultiSync())); 594 QTimer::singleShot( 0, this, SLOT (startMultiSync()));
584 } 595 }
585 else if ( msg == "-showWeek" ) { 596 else if ( msg == "-showWeek" ) {
586 mView->viewManager()->showWeekView(); 597 mView->viewManager()->showWeekView();
587 } 598 }
588 else if ( msg == "-showTodo" ) { 599 else if ( msg == "-showTodo" ) {
589 mView->viewManager()->showTodoView(); 600 mView->viewManager()->showTodoView();
590 } 601 }
591 else if ( msg == "-showJournal" ) { 602 else if ( msg == "-showJournal" ) {
592 mView->dateNavigator()->selectDates( 1 ); 603 mView->dateNavigator()->selectDates( 1 );
593 mView->dateNavigator()->selectToday(); 604 mView->dateNavigator()->selectToday();
594 mView->viewManager()->showJournalView(); 605 mView->viewManager()->showJournalView();
595 } 606 }
596 else if ( msg == "-showKO" ) { 607 else if ( msg == "-showKO" ) {
597 mView->viewManager()->showNextXView(); 608 mView->viewManager()->showNextXView();
598 } 609 }
599 else if ( msg == "-showWNext" ) { 610 else if ( msg == "-showWNext" ) {
600 mView->viewManager()->showWhatsNextView(); 611 mView->viewManager()->showWhatsNextView();
601 } 612 }
602 else if ( msg == "nextView()" ) { 613 else if ( msg == "nextView()" ) {
603 mView->viewManager()->showNextView(); 614 mView->viewManager()->showNextView();
604 } 615 }
605 else if ( msg == "-showNextXView" ) { 616 else if ( msg == "-showNextXView" ) {
606 mView->viewManager()->showNextXView(); 617 mView->viewManager()->showNextXView();
607 } 618 }
608 619
609 620
610 } 621 }
611 622
612 showMaximized(); 623 showMaximized();
613 raise(); 624 raise();
614} 625}
615void MainWindow::startMultiSync() 626void MainWindow::startMultiSync()
616{ 627{
617 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 628 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
618 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"), 629 if ( QMessageBox::information( this, i18n("KDE-Pim Sync"),
619 question, 630 question,
620 i18n("Yes"), i18n("No"), 631 i18n("Yes"), i18n("No"),
621 0, 0 ) != 0 ) { 632 0, 0 ) != 0 ) {
622 setCaption(i18n("Aborted! Nothing synced!")); 633 setCaption(i18n("Aborted! Nothing synced!"));
623 return; 634 return;
624 } 635 }
625 mSyncManager->multiSync( false ); 636 mSyncManager->multiSync( false );
626#ifndef DESKTOP_VERSION 637#ifndef DESKTOP_VERSION
627 QCopEnvelope e("QPE/Application/kapi", "doRingSync"); 638 QCopEnvelope e("QPE/Application/kapi", "doRingSync");
628#endif 639#endif
629} 640}
630QPixmap MainWindow::loadPixmap( QString name ) 641QPixmap MainWindow::loadPixmap( QString name )
631{ 642{
632 return SmallIcon( name ); 643 return SmallIcon( name );
633 644
634} 645}
635void MainWindow::setUsesBigPixmaps ( bool b ) 646void MainWindow::setUsesBigPixmaps ( bool b )
636{ 647{
637 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b); 648 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
638 if ( b ) 649 if ( b )
639 qDebug("KO: BigPixmaps are not supported "); 650 qDebug("KO: BigPixmaps are not supported ");
640} 651}
641void MainWindow::initActions() 652void MainWindow::initActions()
642{ 653{
643 //KOPrefs::instance()->mShowFullMenu 654 //KOPrefs::instance()->mShowFullMenu
644 iconToolBar->clear(); 655 iconToolBar->clear();
645 KOPrefs *p = KOPrefs::instance(); 656 KOPrefs *p = KOPrefs::instance();
646 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 657 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
647 658
648 QPopupMenu *viewMenu = new QPopupMenu( this ); 659 QPopupMenu *viewMenu = new QPopupMenu( this );
649 QPopupMenu *actionMenu = new QPopupMenu( this ); 660 QPopupMenu *actionMenu = new QPopupMenu( this );
650 mCurrentItemMenu = new QPopupMenu ( this ); 661 mCurrentItemMenu = new QPopupMenu ( this );
651 QPopupMenu *importMenu = new QPopupMenu( this ); 662 QPopupMenu *importMenu = new QPopupMenu( this );
652 QPopupMenu *importMenu_X = new QPopupMenu( this ); 663 QPopupMenu *importMenu_X = new QPopupMenu( this );
653 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 664 QPopupMenu *exportMenu_X = new QPopupMenu( this );
654 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 665 QPopupMenu *beamMenu_X = new QPopupMenu( this );
655 selectFilterMenu = new QPopupMenu( this ); 666 selectFilterMenu = new QPopupMenu( this );
656 selectFilterMenu->setCheckable( true ); 667 selectFilterMenu->setCheckable( true );
657 syncMenu = new QPopupMenu( this ); 668 syncMenu = new QPopupMenu( this );
658 configureAgendaMenu = new QPopupMenu( this ); 669 configureAgendaMenu = new QPopupMenu( this );
659 configureToolBarMenu = new QPopupMenu( this ); 670 configureToolBarMenu = new QPopupMenu( this );
660 QPopupMenu *helpMenu = new QPopupMenu( this ); 671 QPopupMenu *helpMenu = new QPopupMenu( this );
661 QIconSet icon; 672 QIconSet icon;
662 int pixWid = 22, pixHei = 22; 673 int pixWid = 22, pixHei = 22;
663 QString pathString = ""; 674 QString pathString = "";
664 if ( !p->mToolBarMiniIcons ) { 675 if ( !p->mToolBarMiniIcons ) {
665 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) { 676 if ( QApplication::desktop()->width() < 480 /*|| QApplication::desktop()->height() < 320*/) {
666 pathString += "icons16/"; 677 pathString += "icons16/";
667 pixWid = 18; pixHei = 16; 678 pixWid = 18; pixHei = 16;
668 } 679 }
669 } else { 680 } else {
670 pathString += "iconsmini/"; 681 pathString += "iconsmini/";
671 pixWid = 18; pixHei = 16; 682 pixWid = 18; pixHei = 16;
672 } 683 }
673 if ( KOPrefs::instance()->mShowFullMenu ) { 684 if ( KOPrefs::instance()->mShowFullMenu ) {
674 QMenuBar *menuBar1; 685 QMenuBar *menuBar1;
675 menuBar1 = menuBar(); 686 menuBar1 = menuBar();
676 menuBar1->insertItem( i18n("File"), importMenu ); 687 menuBar1->insertItem( i18n("File"), importMenu );
677 menuBar1->insertItem( i18n("View"), viewMenu ); 688 menuBar1->insertItem( i18n("View"), viewMenu );
678 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu ); 689 menuBar1->insertItem( i18n("Edit"), mCurrentItemMenu );
679 menuBar1->insertItem( i18n("Action"), actionMenu ); 690 menuBar1->insertItem( i18n("Action"), actionMenu );
680#ifdef DESKTOP_VERSION 691#ifdef DESKTOP_VERSION
681 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 692 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
682 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 693 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
683#else 694#else
684 menuBar1->insertItem( i18n("Sync"), syncMenu ); 695 menuBar1->insertItem( i18n("Sync"), syncMenu );
685 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 696 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
686#endif 697#endif
687 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 698 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
688 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 699 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
689 menuBar1->insertItem( i18n("Help"), helpMenu ); 700 menuBar1->insertItem( i18n("Help"), helpMenu );
690 } else { 701 } else {
691 QPEMenuBar *menuBar1; 702 QPEMenuBar *menuBar1;
692 menuBar1 = new QPEMenuBar( iconToolBar ); 703 menuBar1 = new QPEMenuBar( iconToolBar );
693 QPopupMenu *menuBar = new QPopupMenu( this ); 704 QPopupMenu *menuBar = new QPopupMenu( this );
694 icon = loadPixmap( pathString + "z_menu" ); 705 icon = loadPixmap( pathString + "z_menu" );
695 menuBar1->insertItem( icon.pixmap(), menuBar); 706 menuBar1->insertItem( icon.pixmap(), menuBar);
696 //menuBar1->insertItem( i18n("ME"), menuBar); 707 //menuBar1->insertItem( i18n("ME"), menuBar);
697 menuBar->insertItem( i18n("File"), importMenu ); 708 menuBar->insertItem( i18n("File"), importMenu );
698 menuBar->insertItem( i18n("View"), viewMenu ); 709 menuBar->insertItem( i18n("View"), viewMenu );
699 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu ); 710 menuBar->insertItem( i18n("Edit"), mCurrentItemMenu );
700 menuBar->insertItem( i18n("Action"), actionMenu ); 711 menuBar->insertItem( i18n("Action"), actionMenu );
701 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 712 menuBar->insertItem( i18n("Synchronize"), syncMenu );
702 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 713 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
703 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 714 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
704 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 715 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
705 menuBar->insertItem( i18n("Help"), helpMenu ); 716 menuBar->insertItem( i18n("Help"), helpMenu );
706 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 717 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
707 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 718 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
708 } 719 }
709 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 720 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
710 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 721 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
711 722
712 723
713 mWeekBgColor = iconToolBar->backgroundColor(); 724 mWeekBgColor = iconToolBar->backgroundColor();
714 mWeekPixmap.resize( pixWid , pixHei ); 725 mWeekPixmap.resize( pixWid , pixHei );
715 mWeekPixmap.fill( mWeekBgColor ); 726 mWeekPixmap.fill( mWeekBgColor );
716 icon = mWeekPixmap; 727 icon = mWeekPixmap;
717 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 728 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
718 if ( p-> mShowIconWeekNum ) 729 if ( p-> mShowIconWeekNum )
719 mWeekAction->addTo( iconToolBar ); 730 mWeekAction->addTo( iconToolBar );
720 mWeekFont = font(); 731 mWeekFont = font();
721 732
722 int fontPoint = mWeekFont.pointSize(); 733 int fontPoint = mWeekFont.pointSize();
723 QFontMetrics f( mWeekFont ); 734 QFontMetrics f( mWeekFont );
724 int fontWid = f.width( "30" ); 735 int fontWid = f.width( "30" );
725 while ( fontWid > pixWid ) { 736 while ( fontWid > pixWid ) {
726 --fontPoint; 737 --fontPoint;
727 mWeekFont.setPointSize( fontPoint ); 738 mWeekFont.setPointSize( fontPoint );
728 QFontMetrics f( mWeekFont ); 739 QFontMetrics f( mWeekFont );
729 fontWid = f.width( "30" ); 740 fontWid = f.width( "30" );
730 //qDebug("dec-- "); 741 //qDebug("dec-- ");
731 } 742 }
732 743
733 connect( mWeekAction, SIGNAL( activated() ), 744 connect( mWeekAction, SIGNAL( activated() ),
734 this, SLOT( weekAction() ) ); 745 this, SLOT( weekAction() ) );
735 746
736 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 747 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
737 if ( p->mShowIconFilterview ) { 748 if ( p->mShowIconFilterview ) {
738 icon = loadPixmap( pathString + "filter" ); 749 icon = loadPixmap( pathString + "filter" );
739 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 750 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
740 connect( actionFilterMenuTB, SIGNAL( activated() ), 751 connect( actionFilterMenuTB, SIGNAL( activated() ),
741 this, SLOT( fillFilterMenuTB() ) ); 752 this, SLOT( fillFilterMenuTB() ) );
742 actionFilterMenuTB->addTo( iconToolBar ); 753 actionFilterMenuTB->addTo( iconToolBar );
743 selectFilterMenuTB = new QPopupMenu( this ); 754 selectFilterMenuTB = new QPopupMenu( this );
744 selectFilterMenuTB->setCheckable( true ); 755 selectFilterMenuTB->setCheckable( true );
745 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 756 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
746 } 757 }
747 758
748 //#endif 759 //#endif
749 // ****************** 760 // ******************
750 QAction *action; 761 QAction *action;
751 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 762 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
752 configureToolBarMenu->setCheckable( true ); 763 configureToolBarMenu->setCheckable( true );
753 764
754 765
755 configureAgendaMenu->setCheckable( true ); 766 configureAgendaMenu->setCheckable( true );
756 int iii ; 767 int iii ;
757 for ( iii = 1;iii<= 10 ;++iii ){ 768 for ( iii = 1;iii<= 10 ;++iii ){
758 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 769 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
759 } 770 }
760 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 771 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
761 772
762 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 773 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
763 this, SLOT( showConfigureAgenda( ) ) ); 774 this, SLOT( showConfigureAgenda( ) ) );
764 icon = loadPixmap( pathString + "today" ); 775 icon = loadPixmap( pathString + "today" );
765 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 776 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
766 today_action->addTo( actionMenu ); 777 today_action->addTo( actionMenu );
767 connect( today_action, SIGNAL( activated() ), 778 connect( today_action, SIGNAL( activated() ),
768 mView, SLOT( goToday() ) ); 779 mView, SLOT( goToday() ) );
769 780
770 icon = loadPixmap( pathString + "picker" ); 781 icon = loadPixmap( pathString + "picker" );
771 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this ); 782 QAction* dPickerAction = new QAction( i18n("Select Date..."), icon, i18n("Select Date..."), 0, this );
772 dPickerAction->addTo( actionMenu ); 783 dPickerAction->addTo( actionMenu );
773 connect( dPickerAction, SIGNAL( activated() ), 784 connect( dPickerAction, SIGNAL( activated() ),
774 mView, SLOT( showDatePicker() ) ); 785 mView, SLOT( showDatePicker() ) );
775 786
776 icon = loadPixmap( pathString + "search" ); 787 icon = loadPixmap( pathString + "search" );
777 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 788 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
778 search_action->addTo( actionMenu ); 789 search_action->addTo( actionMenu );
779 connect( search_action, SIGNAL( activated() ), 790 connect( search_action, SIGNAL( activated() ),
780 mView->dialogManager(), SLOT( showSearchDialog() ) ); 791 mView->dialogManager(), SLOT( showSearchDialog() ) );
781 792
782 actionMenu->insertSeparator(); 793 actionMenu->insertSeparator();
783 794
784 795
785 796
786 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 797 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
787 action->addTo( mCurrentItemMenu ); 798 action->addTo( mCurrentItemMenu );
788 connect( action, SIGNAL( activated() ), 799 connect( action, SIGNAL( activated() ),
789 mView, SLOT( undo_delete() ) ); 800 mView, SLOT( undo_delete() ) );
790 mCurrentItemMenu->insertSeparator(); 801 mCurrentItemMenu->insertSeparator();
791 icon = loadPixmap( pathString + "newevent" ); 802 icon = loadPixmap( pathString + "newevent" );
792 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 803 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
793 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 804 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
794 configureToolBarMenu->insertSeparator(); 805 configureToolBarMenu->insertSeparator();
795 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 806 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
796 configureToolBarMenu->insertSeparator(); 807 configureToolBarMenu->insertSeparator();
797 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 808 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
798 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 809 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
799 810
800 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu); 811 //actionMenu->insertItem ( i18n("Selected Item"), mCurrentItemMenu);
801 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this ); 812 mShowAction = new QAction( "show_incidence", i18n("Show"), 0, this );
802 mShowAction->addTo( mCurrentItemMenu ); 813 mShowAction->addTo( mCurrentItemMenu );
803 connect( mShowAction, SIGNAL( activated() ), 814 connect( mShowAction, SIGNAL( activated() ),
804 mView, SLOT( showIncidence() ) ); 815 mView, SLOT( showIncidence() ) );
805 816
806 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 817 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
807 mEditAction->addTo( mCurrentItemMenu ); 818 mEditAction->addTo( mCurrentItemMenu );
808 connect( mEditAction, SIGNAL( activated() ), 819 connect( mEditAction, SIGNAL( activated() ),
809 mView, SLOT( editIncidence() ) ); 820 mView, SLOT( editIncidence() ) );
810 821
811 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 822 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
812 mDeleteAction->addTo( mCurrentItemMenu ); 823 mDeleteAction->addTo( mCurrentItemMenu );
813 connect( mDeleteAction, SIGNAL( activated() ), 824 connect( mDeleteAction, SIGNAL( activated() ),
814 mView, SLOT( deleteIncidence() ) ); 825 mView, SLOT( deleteIncidence() ) );
815 826
816 827
817 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 828 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
818 mCloneAction->addTo( mCurrentItemMenu ); 829 mCloneAction->addTo( mCurrentItemMenu );
819 connect( mCloneAction, SIGNAL( activated() ), 830 connect( mCloneAction, SIGNAL( activated() ),
820 mView, SLOT( cloneIncidence() ) ); 831 mView, SLOT( cloneIncidence() ) );
821 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 832 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
822 mMoveAction->addTo( mCurrentItemMenu ); 833 mMoveAction->addTo( mCurrentItemMenu );
823 connect( mMoveAction, SIGNAL( activated() ), 834 connect( mMoveAction, SIGNAL( activated() ),
824 mView, SLOT( moveIncidence() ) ); 835 mView, SLOT( moveIncidence() ) );
825#ifndef DESKTOP_VERSION 836#ifndef DESKTOP_VERSION
826 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 837 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
827 mBeamAction->addTo(mCurrentItemMenu ); 838 mBeamAction->addTo(mCurrentItemMenu );
828 connect( mBeamAction, SIGNAL( activated() ), 839 connect( mBeamAction, SIGNAL( activated() ),
829 mView, SLOT( beamIncidence() ) ); 840 mView, SLOT( beamIncidence() ) );
830#endif 841#endif
831 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 842 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
832 mCancelAction->addTo( mCurrentItemMenu ); 843 mCancelAction->addTo( mCurrentItemMenu );
833 connect( mCancelAction, SIGNAL( activated() ), 844 connect( mCancelAction, SIGNAL( activated() ),
834 mView, SLOT( toggleCancelIncidence() ) ); 845 mView, SLOT( toggleCancelIncidence() ) );
835 846
836 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 847 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
837 ne_action->addTo( actionMenu ); 848 ne_action->addTo( actionMenu );
838 connect( ne_action, SIGNAL( activated() ), 849 connect( ne_action, SIGNAL( activated() ),
839 mView, SLOT( newEvent() ) ); 850 mView, SLOT( newEvent() ) );
840 icon = loadPixmap( pathString + "newtodo" ); 851 icon = loadPixmap( pathString + "newtodo" );
841 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 852 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
842 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 853 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
843 nt_action->addTo( actionMenu ); 854 nt_action->addTo( actionMenu );
844 connect( nt_action, SIGNAL( activated() ), 855 connect( nt_action, SIGNAL( activated() ),
845 mView, SLOT( newTodo() ) ); 856 mView, SLOT( newTodo() ) );
846 857
847 858
848 859
849 // *********************** 860 // ***********************
850 if ( KOPrefs::instance()->mVerticalScreen ) { 861 if ( KOPrefs::instance()->mVerticalScreen ) {
851 icon = SmallIcon( "1updownarrow" ); 862 icon = SmallIcon( "1updownarrow" );
852 } else { 863 } else {
853 icon = SmallIcon("1leftrightarrow" ); 864 icon = SmallIcon("1leftrightarrow" );
854 } 865 }
855 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 866 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
856 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 867 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
857 FSaction->addTo( viewMenu ); 868 FSaction->addTo( viewMenu );
858 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 869 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
859 870
860 871
861 icon = loadPixmap( pathString + "filter" ); 872 icon = loadPixmap( pathString + "filter" );
862 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 873 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
863 icon = loadPixmap( pathString + "configure" ); 874 icon = loadPixmap( pathString + "configure" );
864 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 875 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
865 action->addTo( viewMenu ); 876 action->addTo( viewMenu );
866 connect( action, SIGNAL( activated() ), 877 connect( action, SIGNAL( activated() ),
867 mView, SLOT( toggleFilter() ) ); 878 mView, SLOT( toggleFilter() ) );
868 mToggleFilter = action; 879 mToggleFilter = action;
869 icon = loadPixmap( pathString + "navi" ); 880 icon = loadPixmap( pathString + "navi" );
870 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 881 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
871 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 882 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
872 action->addTo( viewMenu ); 883 action->addTo( viewMenu );
873 connect( action, SIGNAL( activated() ), 884 connect( action, SIGNAL( activated() ),
874 mView, SLOT( toggleDateNavigatorWidget() ) ); 885 mView, SLOT( toggleDateNavigatorWidget() ) );
875 mToggleNav = action ; 886 mToggleNav = action ;
876 icon = loadPixmap( pathString + "allday" ); 887 icon = loadPixmap( pathString + "allday" );
877 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 888 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
878 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 889 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
879 action->addTo( viewMenu ); 890 action->addTo( viewMenu );
880 connect( action, SIGNAL( activated() ), 891 connect( action, SIGNAL( activated() ),
881 mView, SLOT( toggleAllDaySize() ) ); 892 mView, SLOT( toggleAllDaySize() ) );
882 mToggleAllday = action; 893 mToggleAllday = action;
883 894
884 895
885 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 896 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
886 mToggleNav, SLOT( setEnabled ( bool ) ) ); 897 mToggleNav, SLOT( setEnabled ( bool ) ) );
887 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 898 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
888 // mToggleFilter, SLOT( setEnabled ( bool ) ) ); 899 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
889 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 900 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
890 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 901 mToggleAllday, SLOT( setEnabled ( bool ) ) );
891 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 902 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
892 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 903 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
893 904
894 905
895 dPickerAction->addTo( iconToolBar ); 906 dPickerAction->addTo( iconToolBar );
896 viewMenu->insertSeparator(); 907 viewMenu->insertSeparator();
897 908
898 if ( p-> mShowIconToggleFull ) 909 if ( p-> mShowIconToggleFull )
899 FSaction->addTo( iconToolBar ); 910 FSaction->addTo( iconToolBar );
900 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 911 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
901 912
902 //******************** 913 //********************
903 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 914 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
904 915
905 916
906 icon = loadPixmap( pathString + "whatsnext" ); 917 icon = loadPixmap( pathString + "whatsnext" );
907 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 918 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
908 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 919 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
909 whatsnext_action->addTo( viewMenu ); 920 whatsnext_action->addTo( viewMenu );
910 connect( whatsnext_action, SIGNAL( activated() ), 921 connect( whatsnext_action, SIGNAL( activated() ),
911 mView->viewManager(), SLOT( showWhatsNextView() ) ); 922 mView->viewManager(), SLOT( showWhatsNextView() ) );
912 923
913 icon = loadPixmap( pathString + "xdays" ); 924 icon = loadPixmap( pathString + "xdays" );
914 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 925 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
915 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 926 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
916 xdays_action->addTo( viewMenu ); 927 xdays_action->addTo( viewMenu );
917 connect( xdays_action, SIGNAL( activated() ), 928 connect( xdays_action, SIGNAL( activated() ),
918 mView->viewManager(), SLOT( showNextXView() ) ); 929 mView->viewManager(), SLOT( showNextXView() ) );
919 930
920 931
921 icon = loadPixmap( pathString + "journal" ); 932 icon = loadPixmap( pathString + "journal" );
922 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 933 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
923 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 934 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
924 viewjournal_action->addTo( viewMenu ); 935 viewjournal_action->addTo( viewMenu );
925 connect( viewjournal_action, SIGNAL( activated() ), 936 connect( viewjournal_action, SIGNAL( activated() ),
926 mView->viewManager(), SLOT( showJournalView() ) ); 937 mView->viewManager(), SLOT( showJournalView() ) );
927 938
928 939
929 icon = loadPixmap( pathString + "day" ); 940 icon = loadPixmap( pathString + "day" );
930 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 941 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
931 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 942 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
932 day1_action->addTo( viewMenu ); 943 day1_action->addTo( viewMenu );
933 // action->addTo( toolBar ); 944 // action->addTo( toolBar );
934 connect( day1_action, SIGNAL( activated() ), 945 connect( day1_action, SIGNAL( activated() ),
935 mView->viewManager(), SLOT( showDayView() ) ); 946 mView->viewManager(), SLOT( showDayView() ) );
936 947
937 icon = loadPixmap( pathString + "workweek" ); 948 icon = loadPixmap( pathString + "workweek" );
938 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 949 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
939 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 950 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
940 day5_action->addTo( viewMenu ); 951 day5_action->addTo( viewMenu );
941 connect( day5_action, SIGNAL( activated() ), 952 connect( day5_action, SIGNAL( activated() ),
942 mView->viewManager(), SLOT( showWorkWeekView() ) ); 953 mView->viewManager(), SLOT( showWorkWeekView() ) );
943 954
944 icon = loadPixmap( pathString + "week" ); 955 icon = loadPixmap( pathString + "week" );
945 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 956 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
946 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 957 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
947 day7_action->addTo( viewMenu ); 958 day7_action->addTo( viewMenu );
948 connect( day7_action, SIGNAL( activated() ), 959 connect( day7_action, SIGNAL( activated() ),
949 mView->viewManager(), SLOT( showWeekView() ) ); 960 mView->viewManager(), SLOT( showWeekView() ) );
950 961
951 icon = loadPixmap( pathString + "workweek2" ); 962 icon = loadPixmap( pathString + "workweek2" );
952 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 963 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
953 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 964 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
954 day6_action->addTo( viewMenu ); 965 day6_action->addTo( viewMenu );
955 connect( day6_action, SIGNAL( activated() ), 966 connect( day6_action, SIGNAL( activated() ),
956 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 967 mView->viewManager(), SLOT( showMonthViewWeek() ) );
957 968
958 icon = loadPixmap( pathString + "month" ); 969 icon = loadPixmap( pathString + "month" );
959 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 970 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
960 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 971 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
961 month_action->addTo( viewMenu ); 972 month_action->addTo( viewMenu );
962 connect( month_action, SIGNAL( activated() ), 973 connect( month_action, SIGNAL( activated() ),
963 mView->viewManager(), SLOT( showMonthView() ) ); 974 mView->viewManager(), SLOT( showMonthView() ) );
964 975
965 icon = loadPixmap( pathString + "list" ); 976 icon = loadPixmap( pathString + "list" );
966 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 977 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
967 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 978 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
968 showlist_action->addTo( viewMenu ); 979 showlist_action->addTo( viewMenu );
969 connect( showlist_action, SIGNAL( activated() ), 980 connect( showlist_action, SIGNAL( activated() ),
970 mView->viewManager(), SLOT( showListView() ) ); 981 mView->viewManager(), SLOT( showListView() ) );
971 982
972 icon = loadPixmap( pathString + "todo" ); 983 icon = loadPixmap( pathString + "todo" );
973 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 984 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
974 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 985 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
975 todoview_action->addTo( viewMenu ); 986 todoview_action->addTo( viewMenu );
976 connect( todoview_action, SIGNAL( activated() ), 987 connect( todoview_action, SIGNAL( activated() ),
977 mView->viewManager(), SLOT( showTodoView() ) ); 988 mView->viewManager(), SLOT( showTodoView() ) );
978 989
979 990
980 991
981#if 0 992#if 0
982 action = new QAction( "view_timespan", "Time Span", 0, this ); 993 action = new QAction( "view_timespan", "Time Span", 0, this );
983 action->addTo( viewMenu ); 994 action->addTo( viewMenu );
984 connect( action, SIGNAL( activated() ), 995 connect( action, SIGNAL( activated() ),
985 mView->viewManager(), SLOT( showTimeSpanView() ) ); 996 mView->viewManager(), SLOT( showTimeSpanView() ) );
986#endif 997#endif
987 998
988 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 999 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
989 this ); 1000 this );
990 mNewSubTodoAction->addTo( actionMenu ); 1001 mNewSubTodoAction->addTo( actionMenu );
991 connect( mNewSubTodoAction, SIGNAL( activated() ), 1002 connect( mNewSubTodoAction, SIGNAL( activated() ),
992 mView, SLOT( newSubTodo() ) ); 1003 mView, SLOT( newSubTodo() ) );
993 1004
994 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, 1005 action = new QAction( "purge_completed", i18n("Purge Completed..."), 0,
995 this ); 1006 this );
996 action->addTo( actionMenu ); 1007 action->addTo( actionMenu );
997 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 1008 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
998 1009
999 1010
1000 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 1011 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
1001 1012
1002 1013
1003 1014
1004 actionMenu->insertSeparator(); 1015 actionMenu->insertSeparator();
1005 action = new QAction( "manage cat", i18n("Edit category list..."), 0, 1016 action = new QAction( "manage cat", i18n("Edit category list..."), 0,
1006 this ); 1017 this );
1007 action->addTo( actionMenu ); 1018 action->addTo( actionMenu );
1008 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) ); 1019 connect( action, SIGNAL( activated() ), mView, SLOT( editCategories() ) );
1009 1020
1010 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1021 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1011 this ); 1022 this );
1012 action->addTo( actionMenu ); 1023 action->addTo( actionMenu );
1013 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1024 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1014 1025
1015 1026
1016 actionMenu->insertSeparator(); 1027 actionMenu->insertSeparator();
1017 icon = loadPixmap( pathString + "configure" ); 1028 icon = loadPixmap( pathString + "configure" );
1018 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 1029 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
1019 action->addTo( actionMenu ); 1030 action->addTo( actionMenu );
1020 connect( action, SIGNAL( activated() ), 1031 connect( action, SIGNAL( activated() ),
1021 mView, SLOT( edit_options() ) ); 1032 mView, SLOT( edit_options() ) );
1022 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this ); 1033 action = new QAction( i18n("Configure"),icon, i18n("Configure Calendar Files..."), 0, this );
1023 action->addTo( actionMenu ); 1034 action->addTo( actionMenu );
1024 connect( action, SIGNAL( activated() ), 1035 connect( action, SIGNAL( activated() ),
1025 this, SLOT( calHint() ) ); 1036 this, SLOT( calHint() ) );
1026 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 1037 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
1027 action->addTo( actionMenu ); 1038 action->addTo( actionMenu );
1028 connect( action, SIGNAL( activated() ), 1039 connect( action, SIGNAL( activated() ),
1029 mView, SLOT( edit_global_options() ) ); 1040 mView, SLOT( edit_global_options() ) );
1030 if ( KOPrefs::instance()->mShowFullMenu ) { 1041 if ( KOPrefs::instance()->mShowFullMenu ) {
1031 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 1042 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
1032 1043
1033 } 1044 }
1034 // actionMenu->insertSeparator(); 1045 // actionMenu->insertSeparator();
1035 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 1046 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
1036 this ); 1047 this );
1037 action->addTo( importMenu_X ); 1048 action->addTo( importMenu_X );
1038 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 1049 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
1039 action = new QAction( "import_quick", i18n("Import last file"), 0, 1050 action = new QAction( "import_quick", i18n("Import last file"), 0,
1040 this ); 1051 this );
1041 action->addTo( importMenu_X ); 1052 action->addTo( importMenu_X );
1042 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 1053 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
1043 importMenu_X->insertSeparator(); 1054 importMenu_X->insertSeparator();
1044 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 1055 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
1045 this ); 1056 this );
1046 action->addTo( importMenu_X ); 1057 action->addTo( importMenu_X );
1047 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 1058 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
1048 //#ifndef DESKTOP_VERSION 1059 //#ifndef DESKTOP_VERSION
1049 importMenu_X->insertSeparator(); 1060 importMenu_X->insertSeparator();
1050 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 1061 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
1051 this ); 1062 this );
1052 action->addTo( importMenu_X ); 1063 action->addTo( importMenu_X );
1053 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 1064 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
1054 //#else 1065 //#else
1055#ifdef _OL_IMPORT_ 1066#ifdef _OL_IMPORT_
1056 importMenu_X->insertSeparator(); 1067 importMenu_X->insertSeparator();
1057 action = new QAction( "import_ol", i18n("Import from OL"), 0, 1068 action = new QAction( "import_ol", i18n("Import from OL"), 0,
1058 this ); 1069 this );
1059 action->addTo( importMenu_X ); 1070 action->addTo( importMenu_X );
1060 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 1071 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
1061#endif 1072#endif
1062 //#endif 1073 //#endif
1063 1074
1064 //importMenu->insertSeparator(); 1075 //importMenu->insertSeparator();
1065#if 0 1076#if 0
1066 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 1077 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
1067 this ); 1078 this );
1068 action->addTo( importMenu ); 1079 action->addTo( importMenu );
1069 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 1080 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
1070#endif 1081#endif
1071 action = new QAction( "save_cal", i18n("Save Backup..."), 0, 1082 action = new QAction( "save_cal", i18n("Save Backup..."), 0,
1072 this ); 1083 this );
1073 action->addTo( importMenu ); 1084 action->addTo( importMenu );
1074 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 1085 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
1075 importMenu->insertSeparator(); 1086 importMenu->insertSeparator();
1076 importMenu->insertItem( i18n("Import"), importMenu_X ); 1087 importMenu->insertItem( i18n("Import"), importMenu_X );
1077 //importMenu->insertSeparator(); 1088 //importMenu->insertSeparator();
1078 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 1089 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
1079 this ); 1090 this );
1080 action->addTo( exportMenu_X ); 1091 action->addTo( exportMenu_X );
1081 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1092 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1082 1093
1083 1094
1084 //LR 1095 //LR
1085 QPopupMenu *ex2phone = new QPopupMenu( this ); 1096 QPopupMenu *ex2phone = new QPopupMenu( this );
1086 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1097 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1087 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1098 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1088 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1099 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1089 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1100 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1090 1101
1091 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1102 importMenu->insertItem( i18n("Export"), exportMenu_X );
1092#ifndef DESKTOP_VERSION 1103#ifndef DESKTOP_VERSION
1093 //importMenu->insertSeparator(); 1104 //importMenu->insertSeparator();
1094 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1105 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1095 this ); 1106 this );
1096 brAction->addTo( beamMenu_X ); 1107 brAction->addTo( beamMenu_X );
1097 brAction->setToggleAction (true ) ; 1108 brAction->setToggleAction (true ) ;
1098 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1109 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1099 1110
1100 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1111 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1101 this ); 1112 this );
1102 action->addTo( beamMenu_X ); 1113 action->addTo( beamMenu_X );
1103 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1114 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1104 1115
1105 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1116 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1106 this ); 1117 this );
1107 action->addTo( beamMenu_X ); 1118 action->addTo( beamMenu_X );
1108 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1119 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1109 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1120 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1110#else 1121#else
1111 //importMenu->insertSeparator(); 1122 //importMenu->insertSeparator();
1112 icon = loadPixmap( pathString + "print" ); 1123 icon = loadPixmap( pathString + "print" );
1113 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1124 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1114 action->addTo( beamMenu_X ); 1125 action->addTo( beamMenu_X );
1115 connect( action, SIGNAL( activated() ), 1126 connect( action, SIGNAL( activated() ),
1116 this, SLOT( printCal() ) ); 1127 this, SLOT( printCal() ) );
1117 1128
1118 icon = loadPixmap( pathString + "print" ); 1129 icon = loadPixmap( pathString + "print" );
1119 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1130 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1120 action->addTo( beamMenu_X ); 1131 action->addTo( beamMenu_X );
1121 connect( action, SIGNAL( activated() ), 1132 connect( action, SIGNAL( activated() ),
1122 this, SLOT( printSel() ) ); 1133 this, SLOT( printSel() ) );
1123 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1134 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1124 action->addTo( beamMenu_X ); 1135 action->addTo( beamMenu_X );
1125 connect( action, SIGNAL( activated() ), 1136 connect( action, SIGNAL( activated() ),
1126 mView->viewManager(), SLOT( slotprintWNV() ) ); 1137 mView->viewManager(), SLOT( slotprintWNV() ) );
1127 1138
1128 1139
1129 icon = loadPixmap( pathString + "print" ); 1140 icon = loadPixmap( pathString + "print" );
1130 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this ); 1141 action = new QAction( i18n("Print List View..."),icon,i18n("Print List View..."), 0, this );
1131 action->addTo( beamMenu_X ); 1142 action->addTo( beamMenu_X );
1132 connect( action, SIGNAL( activated() ), 1143 connect( action, SIGNAL( activated() ),
1133 this, SLOT( printListView() ) ); 1144 this, SLOT( printListView() ) );
1134 1145
1135 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1146 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1136 action->addTo( beamMenu_X ); 1147 action->addTo( beamMenu_X );
1137 connect( action, SIGNAL( activated() ), 1148 connect( action, SIGNAL( activated() ),
1138 mView, SLOT( slotprintSelInc() ) ); 1149 mView, SLOT( slotprintSelInc() ) );
1139 1150
1140 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1151 importMenu->insertItem( i18n("Print"), beamMenu_X );
1141#endif 1152#endif
1142 1153
1143 importMenu->insertSeparator(); 1154 importMenu->insertSeparator();
1144 action = new QAction( "beam all", i18n("Save"), 0, 1155 action = new QAction( "beam all", i18n("Save"), 0,
1145 this ); 1156 this );
1146 action->addTo( importMenu ); 1157 action->addTo( importMenu );
1147 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1158 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1148 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1159 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1149 this ); 1160 this );
1150 action->addTo( importMenu ); 1161 action->addTo( importMenu );
1151 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1162 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1152 1163
1153 //menuBar->insertItem( "Configure",configureMenu ); 1164 //menuBar->insertItem( "Configure",configureMenu );
1154 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1165 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1155 icon = loadPixmap( "korganizer/korganizer" ); 1166 icon = loadPixmap( "korganizer/korganizer" );
1156 1167
1157 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1168 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1158 action->addTo( helpMenu ); 1169 action->addTo( helpMenu );
1159 connect( action, SIGNAL( activated() ), 1170 connect( action, SIGNAL( activated() ),
1160 SLOT( whatsNew() ) ); 1171 SLOT( whatsNew() ) );
1161 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1172 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1162 action->addTo( helpMenu ); 1173 action->addTo( helpMenu );
1163 connect( action, SIGNAL( activated() ), 1174 connect( action, SIGNAL( activated() ),
1164 SLOT( features() ) ); 1175 SLOT( features() ) );
1165 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1176 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1166 action->addTo( helpMenu ); 1177 action->addTo( helpMenu );
1167 connect( action, SIGNAL( activated() ), 1178 connect( action, SIGNAL( activated() ),
1168 SLOT( keyBindings() ) ); 1179 SLOT( keyBindings() ) );
1169 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); 1180 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1170 action->addTo( helpMenu ); 1181 action->addTo( helpMenu );
1171 connect( action, SIGNAL( activated() ), 1182 connect( action, SIGNAL( activated() ),
1172 SLOT( storagehowto() ) ); 1183 SLOT( storagehowto() ) );
1173 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this ); 1184 action = new QAction( "Timetracking Howto", i18n("Timetracking HowTo..."), 0,this );
1174 action->addTo( helpMenu ); 1185 action->addTo( helpMenu );
1175 connect( action, SIGNAL( activated() ), 1186 connect( action, SIGNAL( activated() ),
1176 SLOT( timetrackinghowto() ) ); 1187 SLOT( timetrackinghowto() ) );
1177 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1188 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1178 action->addTo( helpMenu ); 1189 action->addTo( helpMenu );
1179 connect( action, SIGNAL( activated() ), 1190 connect( action, SIGNAL( activated() ),
1180 SLOT( synchowto() ) ); 1191 SLOT( synchowto() ) );
1181 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1192 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1182 action->addTo( helpMenu ); 1193 action->addTo( helpMenu );
1183 connect( action, SIGNAL( activated() ), 1194 connect( action, SIGNAL( activated() ),
1184 SLOT( kdesynchowto() ) ); 1195 SLOT( kdesynchowto() ) );
1185 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1196 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1186 action->addTo( helpMenu ); 1197 action->addTo( helpMenu );
1187 connect( action, SIGNAL( activated() ), 1198 connect( action, SIGNAL( activated() ),
1188 SLOT( multisynchowto() ) ); 1199 SLOT( multisynchowto() ) );
1189 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1200 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1190 action->addTo( helpMenu ); 1201 action->addTo( helpMenu );
1191 connect( action, SIGNAL( activated() ), 1202 connect( action, SIGNAL( activated() ),
1192 SLOT( aboutAutoSaving() ) ); 1203 SLOT( aboutAutoSaving() ) );
1193 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1204 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1194 action->addTo( helpMenu ); 1205 action->addTo( helpMenu );
1195 connect( action, SIGNAL( activated() ), 1206 connect( action, SIGNAL( activated() ),
1196 SLOT( aboutKnownBugs() ) ); 1207 SLOT( aboutKnownBugs() ) );
1197 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1208 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1198 action->addTo( helpMenu ); 1209 action->addTo( helpMenu );
1199 connect( action, SIGNAL( activated() ), 1210 connect( action, SIGNAL( activated() ),
1200 SLOT( usertrans() ) ); 1211 SLOT( usertrans() ) );
1201 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1212 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1202 action->addTo( helpMenu ); 1213 action->addTo( helpMenu );
1203 connect( action, SIGNAL( activated() ), 1214 connect( action, SIGNAL( activated() ),
1204 SLOT( faq() ) ); 1215 SLOT( faq() ) );
1205 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1216 action = new QAction( "licence", i18n("Licence..."), 0, this );
1206 action->addTo( helpMenu ); 1217 action->addTo( helpMenu );
1207 connect( action, SIGNAL( activated() ), 1218 connect( action, SIGNAL( activated() ),
1208 SLOT( licence() ) ); 1219 SLOT( licence() ) );
1209 action = new QAction( "about", i18n("About..."), 0, this ); 1220 action = new QAction( "about", i18n("About..."), 0, this );
1210 action->addTo( helpMenu ); 1221 action->addTo( helpMenu );
1211 connect( action, SIGNAL( activated() ), 1222 connect( action, SIGNAL( activated() ),
1212 SLOT( about() ) ); 1223 SLOT( about() ) );
1213 //menuBar->insertSeparator(); 1224 //menuBar->insertSeparator();
1214 1225
1215 // ****************************************************** 1226 // ******************************************************
1216 // menubar icons 1227 // menubar icons
1217 1228
1218 1229
1219 1230
1220 //menuBar->insertItem( iconToolBar ); 1231 //menuBar->insertItem( iconToolBar );
1221 //xdays_action 1232 //xdays_action
1222 if (p-> mShowIconNewEvent) 1233 if (p-> mShowIconNewEvent)
1223 ne_action->addTo( iconToolBar ); 1234 ne_action->addTo( iconToolBar );
1224 if (p->mShowIconNewTodo ) 1235 if (p->mShowIconNewTodo )
1225 nt_action->addTo( iconToolBar ); 1236 nt_action->addTo( iconToolBar );
1226 if (p-> mShowIconSearch) 1237 if (p-> mShowIconSearch)
1227 search_action->addTo( iconToolBar ); 1238 search_action->addTo( iconToolBar );
1228 if (p-> mShowIconWhatsThis) 1239 if (p-> mShowIconWhatsThis)
1229 QWhatsThis::whatsThisButton ( iconToolBar ); 1240 QWhatsThis::whatsThisButton ( iconToolBar );
1230 if (p-> mShowIconNext) 1241 if (p-> mShowIconNext)
1231 whatsnext_action->addTo( viewToolBar ); 1242 whatsnext_action->addTo( viewToolBar );
1232 if (p-> mShowIconNextDays) 1243 if (p-> mShowIconNextDays)
1233 xdays_action->addTo( viewToolBar ); 1244 xdays_action->addTo( viewToolBar );
1234 if (p-> mShowIconJournal) 1245 if (p-> mShowIconJournal)
1235 viewjournal_action->addTo( viewToolBar ); 1246 viewjournal_action->addTo( viewToolBar );
1236 if (p-> mShowIconDay1) 1247 if (p-> mShowIconDay1)
1237 day1_action->addTo( viewToolBar ); 1248 day1_action->addTo( viewToolBar );
1238 if (p-> mShowIconDay5) 1249 if (p-> mShowIconDay5)
1239 day5_action->addTo( viewToolBar ); 1250 day5_action->addTo( viewToolBar );
1240 if (p-> mShowIconDay7) 1251 if (p-> mShowIconDay7)
1241 day7_action->addTo( viewToolBar ); 1252 day7_action->addTo( viewToolBar );
1242 if (p-> mShowIconDay6) 1253 if (p-> mShowIconDay6)
1243 day6_action->addTo( viewToolBar ); 1254 day6_action->addTo( viewToolBar );
1244 if (p-> mShowIconMonth) 1255 if (p-> mShowIconMonth)
1245 month_action->addTo( viewToolBar ); 1256 month_action->addTo( viewToolBar );
1246 if (p-> mShowIconList) 1257 if (p-> mShowIconList)
1247 showlist_action->addTo( viewToolBar ); 1258 showlist_action->addTo( viewToolBar );
1248 if (p-> mShowIconTodoview) 1259 if (p-> mShowIconTodoview)
1249 todoview_action->addTo( viewToolBar ); 1260 todoview_action->addTo( viewToolBar );
1250 1261
1251 icon = loadPixmap( pathString + "2leftarrowB" ); 1262 icon = loadPixmap( pathString + "2leftarrowB" );
1252 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1263 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1253 if (p-> mShowIconBackFast) { 1264 if (p-> mShowIconBackFast) {
1254 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1265 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1255 connect( action, SIGNAL( activated() ), 1266 connect( action, SIGNAL( activated() ),
1256 mView, SLOT( goPreviousMonth() ) ); 1267 mView, SLOT( goPreviousMonth() ) );
1257 action->addTo( navigatorToolBar ); 1268 action->addTo( navigatorToolBar );
1258 } 1269 }
1259 icon = loadPixmap( pathString + "1leftarrowB" ); 1270 icon = loadPixmap( pathString + "1leftarrowB" );
1260 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1271 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1261 if (p-> mShowIconBack) { 1272 if (p-> mShowIconBack) {
1262 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1273 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1263 connect( action, SIGNAL( activated() ), 1274 connect( action, SIGNAL( activated() ),
1264 mView, SLOT( goPrevious() ) ); 1275 mView, SLOT( goPrevious() ) );
1265 action->addTo( navigatorToolBar ); 1276 action->addTo( navigatorToolBar );
1266 } 1277 }
1267 icon = loadPixmap( pathString + "today" ); 1278 icon = loadPixmap( pathString + "today" );
1268 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1279 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1269 if (p-> mShowIconToday) 1280 if (p-> mShowIconToday)
1270 today_action->addTo( navigatorToolBar ); 1281 today_action->addTo( navigatorToolBar );
1271 icon = loadPixmap( pathString + "1rightarrowB" ); 1282 icon = loadPixmap( pathString + "1rightarrowB" );
1272 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1283 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1273 if (p-> mShowIconForward) { 1284 if (p-> mShowIconForward) {
1274 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1285 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1275 connect( action, SIGNAL( activated() ), 1286 connect( action, SIGNAL( activated() ),
1276 mView, SLOT( goNext() ) ); 1287 mView, SLOT( goNext() ) );
1277 action->addTo( navigatorToolBar ); 1288 action->addTo( navigatorToolBar );
1278 } 1289 }
1279 icon = loadPixmap( pathString + "2rightarrowB" ); 1290 icon = loadPixmap( pathString + "2rightarrowB" );
1280 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1291 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1281 if (p-> mShowIconForwardFast) { 1292 if (p-> mShowIconForwardFast) {
1282 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1293 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1283 connect( action, SIGNAL( activated() ), 1294 connect( action, SIGNAL( activated() ),
1284 mView, SLOT( goNextMonth() ) ); 1295 mView, SLOT( goNextMonth() ) );
1285 action->addTo( navigatorToolBar ); 1296 action->addTo( navigatorToolBar );
1286 } 1297 }
1287 1298
1288 1299
1289 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1300 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1290 1301
1291 1302
1292 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1303 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1293 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1304 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1294 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1305 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1295 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1306 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1296 1307
1297 if (p-> mShowIconNewEvent) 1308 if (p-> mShowIconNewEvent)
1298 configureToolBarMenu->setItemChecked( 10, true ); 1309 configureToolBarMenu->setItemChecked( 10, true );
1299 if (p->mShowIconNewTodo ) 1310 if (p->mShowIconNewTodo )
1300 configureToolBarMenu->setItemChecked( 20, true ); 1311 configureToolBarMenu->setItemChecked( 20, true );
1301 if (p-> mShowIconSearch) 1312 if (p-> mShowIconSearch)
1302 configureToolBarMenu->setItemChecked( 120, true ); 1313 configureToolBarMenu->setItemChecked( 120, true );
1303 if (p-> mShowIconList) 1314 if (p-> mShowIconList)
1304 configureToolBarMenu->setItemChecked( 30, true ); 1315 configureToolBarMenu->setItemChecked( 30, true );
1305 if (p-> mShowIconDay1) 1316 if (p-> mShowIconDay1)
1306 configureToolBarMenu->setItemChecked( 40, true ); 1317 configureToolBarMenu->setItemChecked( 40, true );
1307 if (p-> mShowIconDay5) 1318 if (p-> mShowIconDay5)
1308 configureToolBarMenu->setItemChecked( 50, true ); 1319 configureToolBarMenu->setItemChecked( 50, true );
1309 if (p-> mShowIconDay6) 1320 if (p-> mShowIconDay6)
1310 configureToolBarMenu->setItemChecked( 75, true ); 1321 configureToolBarMenu->setItemChecked( 75, true );
1311 if (p-> mShowIconDay7) 1322 if (p-> mShowIconDay7)
1312 configureToolBarMenu->setItemChecked( 60, true ); 1323 configureToolBarMenu->setItemChecked( 60, true );
1313 if (p-> mShowIconMonth) 1324 if (p-> mShowIconMonth)
1314 configureToolBarMenu->setItemChecked( 70, true ); 1325 configureToolBarMenu->setItemChecked( 70, true );
1315 if (p-> mShowIconTodoview) 1326 if (p-> mShowIconTodoview)
1316 configureToolBarMenu->setItemChecked( 80, true ); 1327 configureToolBarMenu->setItemChecked( 80, true );
1317 if (p-> mShowIconBackFast) 1328 if (p-> mShowIconBackFast)
1318 configureToolBarMenu->setItemChecked( 200, true ); 1329 configureToolBarMenu->setItemChecked( 200, true );
1319 if (p-> mShowIconBack) 1330 if (p-> mShowIconBack)
1320 configureToolBarMenu->setItemChecked( 210, true ); 1331 configureToolBarMenu->setItemChecked( 210, true );
1321 if (p-> mShowIconToday) 1332 if (p-> mShowIconToday)
1322 configureToolBarMenu->setItemChecked( 130, true ); 1333 configureToolBarMenu->setItemChecked( 130, true );
1323 if (p-> mShowIconForward) 1334 if (p-> mShowIconForward)
1324 configureToolBarMenu->setItemChecked( 220, true ); 1335 configureToolBarMenu->setItemChecked( 220, true );
1325 if (p-> mShowIconForwardFast) 1336 if (p-> mShowIconForwardFast)
1326 configureToolBarMenu->setItemChecked( 230, true ); 1337 configureToolBarMenu->setItemChecked( 230, true );
1327 if (p-> mShowIconNextDays) 1338 if (p-> mShowIconNextDays)
1328 configureToolBarMenu->setItemChecked( 100, true ); 1339 configureToolBarMenu->setItemChecked( 100, true );
1329 if (p-> mShowIconNext) 1340 if (p-> mShowIconNext)
1330 configureToolBarMenu->setItemChecked( 110, true ); 1341 configureToolBarMenu->setItemChecked( 110, true );
1331 if (p-> mShowIconJournal) 1342 if (p-> mShowIconJournal)
1332 configureToolBarMenu->setItemChecked( 90, true ); 1343 configureToolBarMenu->setItemChecked( 90, true );
1333 if (p-> mShowIconWhatsThis) 1344 if (p-> mShowIconWhatsThis)
1334 configureToolBarMenu->setItemChecked( 300, true ); 1345 configureToolBarMenu->setItemChecked( 300, true );
1335 if (p-> mShowIconWeekNum) 1346 if (p-> mShowIconWeekNum)
1336 configureToolBarMenu->setItemChecked( 400, true ); 1347 configureToolBarMenu->setItemChecked( 400, true );
1337 if (!p-> mShowIconStretch) { 1348 if (!p-> mShowIconStretch) {
1338 QLabel* dummy = new QLabel( iconToolBar ); 1349 QLabel* dummy = new QLabel( iconToolBar );
1339 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1350 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1340 dummy->setMinimumWidth( 0 ); 1351 dummy->setMinimumWidth( 0 );
1341 iconToolBar->setStretchableWidget ( dummy ) ; 1352 iconToolBar->setStretchableWidget ( dummy ) ;
1342 } 1353 }
1343 else { 1354 else {
1344 iconToolBar->setHorizontalStretchable (true ); 1355 iconToolBar->setHorizontalStretchable (true );
1345 viewToolBar->setHorizontalStretchable (true ); 1356 viewToolBar->setHorizontalStretchable (true );
1346 navigatorToolBar->setHorizontalStretchable (true ); 1357 navigatorToolBar->setHorizontalStretchable (true );
1347 iconToolBar->setVerticalStretchable (true ); 1358 iconToolBar->setVerticalStretchable (true );
1348 viewToolBar->setVerticalStretchable (true ); 1359 viewToolBar->setVerticalStretchable (true );
1349 navigatorToolBar->setVerticalStretchable (true ); 1360 navigatorToolBar->setVerticalStretchable (true );
1350 configureToolBarMenu->setItemChecked( 5, true ); 1361 configureToolBarMenu->setItemChecked( 5, true );
1351 } 1362 }
1352 if (p-> mShowIconFilter) 1363 if (p-> mShowIconFilter)
1353 configureToolBarMenu->setItemChecked( 7, true ); 1364 configureToolBarMenu->setItemChecked( 7, true );
1354 if (p-> mShowIconOnetoolbar) 1365 if (p-> mShowIconOnetoolbar)
1355 configureToolBarMenu->setItemChecked( 6, true ); 1366 configureToolBarMenu->setItemChecked( 6, true );
1356 1367
1357 1368
1358 if ( filterMenubar ) { 1369 if ( filterMenubar ) {
1359 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) ); 1370 filterMenubar->reparent(filterToolBar,0,QPoint(0,0) );
1360 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) ); 1371 connect( mView, SIGNAL( filtersUpdated() ), SLOT( updateFilterToolbar() ) );
1361 } 1372 }
1362 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1373 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1363 configureAgenda( p->mHourSize ); 1374 configureAgenda( p->mHourSize );
1364 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1375 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1365} 1376}
1366void MainWindow::calHint() 1377void MainWindow::calHint()
1367{ 1378{
1368 QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>."); 1379 QString message = i18n("You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.");
1369 1380
1370 KMessageBox::information( this, message); 1381 KMessageBox::information( this, message);
1371} 1382}
1372void MainWindow::exportToPhone( int mode ) 1383void MainWindow::exportToPhone( int mode )
1373{ 1384{
1374 1385
1375 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1386 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1376 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1387 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1377 KOex2phonePrefs ex2phone; 1388 KOex2phonePrefs ex2phone;
1378 1389
1379 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1390 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1380 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1391 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1381 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1392 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1382 if ( mode == 1 ) 1393 if ( mode == 1 )
1383 ex2phone.setCaption(i18n("Export complete calendar")); 1394 ex2phone.setCaption(i18n("Export complete calendar"));
1384 if ( mode == 2 ) 1395 if ( mode == 2 )
1385 ex2phone.setCaption(i18n("Export filtered calendar")); 1396 ex2phone.setCaption(i18n("Export filtered calendar"));
1386 1397
1387 if ( !ex2phone.exec() ) { 1398 if ( !ex2phone.exec() ) {
1388 return; 1399 return;
1389 } 1400 }
1390 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1401 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1391 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1402 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1392 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1403 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1393 1404
1394 int inFuture = 0; 1405 int inFuture = 0;
1395 if ( ex2phone.mWriteBackFuture->isChecked() ) 1406 if ( ex2phone.mWriteBackFuture->isChecked() )
1396 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1407 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1397 QPtrList<Incidence> delSel; 1408 QPtrList<Incidence> delSel;
1398 if ( mode == 1 ) 1409 if ( mode == 1 )
1399 delSel = mCalendar->rawIncidences(); 1410 delSel = mCalendar->rawIncidences();
1400 if ( mode == 2 ) 1411 if ( mode == 2 )
1401 delSel = mCalendar->incidences(); 1412 delSel = mCalendar->incidences();
1402 CalendarLocal* cal = new CalendarLocal(); 1413 CalendarLocal* cal = new CalendarLocal();
1403 cal->setLocalTime(); 1414 cal->setLocalTime();
1404 Incidence *incidence = delSel.first(); 1415 Incidence *incidence = delSel.first();
1405 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1416 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1406 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1417 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1407 while ( incidence ) { 1418 while ( incidence ) {
1408 if ( incidence->typeID() != journalID ) { 1419 if ( incidence->typeID() != journalID ) {
1409 bool add = true; 1420 bool add = true;
1410 if ( inFuture ) { 1421 if ( inFuture ) {
1411 QDateTime dt; 1422 QDateTime dt;
1412 if ( incidence->typeID() == todoID ) { 1423 if ( incidence->typeID() == todoID ) {
1413 Todo * t = (Todo*)incidence; 1424 Todo * t = (Todo*)incidence;
1414 if ( t->hasDueDate() ) 1425 if ( t->hasDueDate() )
1415 dt = t->dtDue(); 1426 dt = t->dtDue();
1416 else 1427 else
1417 dt = cur.addSecs( 62 ); 1428 dt = cur.addSecs( 62 );
1418 } 1429 }
1419 else { 1430 else {
1420 bool ok; 1431 bool ok;
1421 dt = incidence->getNextOccurence( cur, &ok ); 1432 dt = incidence->getNextOccurence( cur, &ok );
1422 if ( !ok ) 1433 if ( !ok )
1423 dt = cur.addSecs( -62 ); 1434 dt = cur.addSecs( -62 );
1424 } 1435 }
1425 if ( dt < cur || dt > end ) { 1436 if ( dt < cur || dt > end ) {
1426 add = false; 1437 add = false;
1427 } 1438 }
1428 } 1439 }
1429 if ( add ) { 1440 if ( add ) {
1430 Incidence *in = incidence->clone(); 1441 Incidence *in = incidence->clone();
1431 cal->addIncidence( in ); 1442 cal->addIncidence( in );
1432 } 1443 }
1433 } 1444 }
1434 incidence = delSel.next(); 1445 incidence = delSel.next();
1435 } 1446 }
1436 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1447 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1437 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1448 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1438 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1449 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1439 1450
1440 setCaption( i18n("Writing to phone...")); 1451 setCaption( i18n("Writing to phone..."));
1441 if ( PhoneFormat::writeToPhone( cal ) ) 1452 if ( PhoneFormat::writeToPhone( cal ) )
1442 setCaption( i18n("Export to phone successful!")); 1453 setCaption( i18n("Export to phone successful!"));
1443 else 1454 else
1444 setCaption( i18n("Error exporting to phone!")); 1455 setCaption( i18n("Error exporting to phone!"));
1445 delete cal; 1456 delete cal;
1446} 1457}
1447 1458
1448 1459
1449void MainWindow::setDefaultPreferences() 1460void MainWindow::setDefaultPreferences()
1450{ 1461{
1451 KOPrefs *p = KOPrefs::instance(); 1462 KOPrefs *p = KOPrefs::instance();
1452 1463
1453 p->mCompactDialogs = true; 1464 p->mCompactDialogs = true;
1454 p->mConfirm = true; 1465 p->mConfirm = true;
1455 // p->mEnableQuickTodo = false; 1466 // p->mEnableQuickTodo = false;
1456 1467
1457} 1468}
1458 1469
1459QString MainWindow::resourcePath() 1470QString MainWindow::resourcePath()
1460{ 1471{
1461 return KGlobal::iconLoader()->iconPath(); 1472 return KGlobal::iconLoader()->iconPath();
1462} 1473}
1463 1474
1464void MainWindow::displayText( QString text ,QString cap ) 1475void MainWindow::displayText( QString text ,QString cap )
1465{ 1476{
1466 QDialog dia( this, "name", true ); ; 1477 QDialog dia( this, "name", true ); ;
1467 dia.setCaption( cap ); 1478 dia.setCaption( cap );
1468 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1479 QVBoxLayout* lay = new QVBoxLayout( &dia );
1469 lay->setSpacing( 3 ); 1480 lay->setSpacing( 3 );
1470 lay->setMargin( 3 ); 1481 lay->setMargin( 3 );
1471 QTextBrowser tb ( &dia ); 1482 QTextBrowser tb ( &dia );
1472 lay->addWidget( &tb ); 1483 lay->addWidget( &tb );
1473 tb.setText( text ); 1484 tb.setText( text );
1474#ifdef DESKTOP_VERSION 1485#ifdef DESKTOP_VERSION
1475 dia.resize( 640, 480); 1486 dia.resize( 640, 480);
1476#else 1487#else
1477 dia.showMaximized(); 1488 dia.showMaximized();
1478#endif 1489#endif
1479 dia.exec(); 1490 dia.exec();
1480} 1491}
1481 1492
1482void MainWindow::features() 1493void MainWindow::features()
1483{ 1494{
1484 1495
1485 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1496 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1486} 1497}
1487 1498
1488void MainWindow::usertrans() 1499void MainWindow::usertrans()
1489{ 1500{
1490 1501
1491 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1502 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1492} 1503}
1493 1504
1494void MainWindow::storagehowto() 1505void MainWindow::storagehowto()
1495{ 1506{
1496 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); 1507 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1497} 1508}
1498void MainWindow::timetrackinghowto() 1509void MainWindow::timetrackinghowto()
1499{ 1510{
1500 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" ); 1511 KApplication::showFile( "KO/Pi Timetracking HowTo", "kdepim/timetrackerhowto.txt" );
1501} 1512}
1502void MainWindow::kdesynchowto() 1513void MainWindow::kdesynchowto()
1503{ 1514{
1504 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1515 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1505} 1516}
1506void MainWindow::multisynchowto() 1517void MainWindow::multisynchowto()
1507{ 1518{
1508 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1519 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1509} 1520}
1510void MainWindow::synchowto() 1521void MainWindow::synchowto()
1511{ 1522{
1512 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1523 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1513} 1524}
1514void MainWindow::faq() 1525void MainWindow::faq()
1515{ 1526{
1516 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1527 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1517 1528
1518} 1529}
1519void MainWindow::whatsNew() 1530void MainWindow::whatsNew()
1520{ 1531{
1521 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1532 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1522 1533
1523} 1534}
1524void MainWindow::licence() 1535void MainWindow::licence()
1525{ 1536{
1526 KApplication::showLicence(); 1537 KApplication::showLicence();
1527 1538
1528} 1539}
1529void MainWindow::about() 1540void MainWindow::about()
1530{ 1541{
1531 QString version; 1542 QString version;
1532#include <../version> 1543#include <../version>
1533 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1544 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1534 i18n("KOrganizer/Platform-independent\n") + 1545 i18n("KOrganizer/Platform-independent\n") +
1535 "(KO/Pi) " + version + " - " + 1546 "(KO/Pi) " + version + " - " +
1536 1547
1537#ifdef DESKTOP_VERSION 1548#ifdef DESKTOP_VERSION
1538 i18n("Desktop Edition\n") + 1549 i18n("Desktop Edition\n") +
1539#else 1550#else
1540 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1551 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1541#endif 1552#endif
1542 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1553 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1543} 1554}
1544void MainWindow::keyBindings() 1555void MainWindow::keyBindings()
1545{ 1556{
1546 QString cap = i18n("KO/Pi Keys + Colors"); 1557 QString cap = i18n("KO/Pi Keys + Colors");
1547 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1558 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1548 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1559 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1549 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1560 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1550 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1561 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1551 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1562 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1552 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1563 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1553 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ 1564 i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+
1554 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1565 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1555 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1566 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1556 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1567 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1557 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1568 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1558 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1569 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1559 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1570 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1560 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1571 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1561 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1572 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1562 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1573 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1563 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1574 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1564 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1575 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1565 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1576 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1566 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1577 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1567 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1578 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1568 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1579 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1569 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1580 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1570 i18n("<p><h3>In agenda view:</h3></p>\n") + 1581 i18n("<p><h3>In agenda view:</h3></p>\n") +
1571 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1582 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1572 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1583 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1573 i18n("<p><h3>In todo view:</h3></p>\n") + 1584 i18n("<p><h3>In todo view:</h3></p>\n") +
1574 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1585 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1575 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1586 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1576 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1587 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1577 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1588 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1578 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1589 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1579 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1590 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1580 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1591 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1581 i18n("<p><h3>In list view:</h3></p>\n") + 1592 i18n("<p><h3>In list view:</h3></p>\n") +
1582 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1593 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1583 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1594 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1584 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1595 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1585 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1596 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1586 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1597 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1587 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1598 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1588 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1599 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1589 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1600 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1590 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1601 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1591 i18n("<p><b>E</b>: Edit item</p>\n") + 1602 i18n("<p><b>E</b>: Edit item</p>\n") +
1592 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1603 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1593 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1604 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1594 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1605 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1595 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1606 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1596 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1607 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1597 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1608 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1598 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1609 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1599 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1610 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1600 i18n("<p><b>White</b>: Item readonly</p>\n"); 1611 i18n("<p><b>White</b>: Item readonly</p>\n");
1601 displayText( text, cap); 1612 displayText( text, cap);
1602} 1613}
1603void MainWindow::aboutAutoSaving() 1614void MainWindow::aboutAutoSaving()
1604{ 1615{
1605 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1616 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1606 1617
1607 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1618 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1608 1619
1609} 1620}
1610void MainWindow::aboutKnownBugs() 1621void MainWindow::aboutKnownBugs()
1611{ 1622{
1612 QMessageBox* msg; 1623 QMessageBox* msg;
1613 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1624 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1614 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1625 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1615 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1626 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1616 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1627 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1617 i18n("\nor report them in the bugtracker on\n") + 1628 i18n("\nor report them in the bugtracker on\n") +
1618 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1629 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1619 QMessageBox::NoIcon, 1630 QMessageBox::NoIcon,
1620 QMessageBox::Ok, 1631 QMessageBox::Ok,
1621 QMessageBox::NoButton, 1632 QMessageBox::NoButton,
1622 QMessageBox::NoButton); 1633 QMessageBox::NoButton);
1623 msg->exec(); 1634 msg->exec();
1624 delete msg; 1635 delete msg;
1625 1636
1626} 1637}
1627 1638
1628QString MainWindow::defaultFileName() 1639QString MainWindow::defaultFileName()
1629{ 1640{
1630 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1641 return locateLocal( "data", "korganizer/mycalendar.ics" );
1631} 1642}
1632QString MainWindow::syncFileName() 1643QString MainWindow::syncFileName()
1633{ 1644{
1634#ifdef DESKTOP_VERSION 1645#ifdef DESKTOP_VERSION
1635 return locateLocal( "tmp", "synccalendar.ics" ); 1646 return locateLocal( "tmp", "synccalendar.ics" );
1636#else 1647#else
1637 return QString( "/tmp/synccalendar.ics" ); 1648 return QString( "/tmp/synccalendar.ics" );
1638#endif 1649#endif
1639} 1650}
1640#include "koglobals.h" 1651#include "koglobals.h"
1641#include <kcalendarsystem.h> 1652#include <kcalendarsystem.h>
1642void MainWindow::updateWeek(QDate seda) 1653void MainWindow::updateWeek(QDate seda)
1643{ 1654{
1644 int weekNum = KGlobal::locale()->weekNum ( seda ); 1655 int weekNum = KGlobal::locale()->weekNum ( seda );
1645 mWeekPixmap.fill( mWeekBgColor ); 1656 mWeekPixmap.fill( mWeekBgColor );
1646 QPainter p ( &mWeekPixmap ); 1657 QPainter p ( &mWeekPixmap );
1647 p.setFont( mWeekFont ); 1658 p.setFont( mWeekFont );
1648 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1659 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1649 p.end(); 1660 p.end();
1650 QIconSet icon3 ( mWeekPixmap ); 1661 QIconSet icon3 ( mWeekPixmap );
1651 mWeekAction->setIconSet ( icon3 ); 1662 mWeekAction->setIconSet ( icon3 );
1652 1663
1653} 1664}
1654void MainWindow::updateWeekNum(const DateList &selectedDates) 1665void MainWindow::updateWeekNum(const DateList &selectedDates)
1655{ 1666{
1656 updateWeek( selectedDates.first() ); 1667 updateWeek( selectedDates.first() );
1657} 1668}
1658void MainWindow::processIncidenceSelection( Incidence *incidence ) 1669void MainWindow::processIncidenceSelection( Incidence *incidence )
1659{ 1670{
1660 if ( !incidence ) { 1671 if ( !incidence ) {
1661 mShowAction->setMenuText( i18n("Show") ); 1672 mShowAction->setMenuText( i18n("Show") );
1662 enableIncidenceActions( false ); 1673 enableIncidenceActions( false );
1663 mNewSubTodoAction->setEnabled( false ); 1674 mNewSubTodoAction->setEnabled( false );
1664 setCaptionToDates(); 1675 setCaptionToDates();
1665 return; 1676 return;
1666 } 1677 }
1667 QString startString = ""; 1678 QString startString = "";
1668 if ( incidence->typeID() != todoID ) { 1679 if ( incidence->typeID() != todoID ) {
1669 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1680 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1670 if ( incidence->doesFloat() ) { 1681 if ( incidence->doesFloat() ) {
1671 startString += ": "+incidence->dtStartDateStr( true ); 1682 startString += ": "+incidence->dtStartDateStr( true );
1672 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1683 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1673 } else { 1684 } else {
1674 startString = ": "+incidence->dtStartStr(true); 1685 startString = ": "+incidence->dtStartStr(true);
1675 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1686 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1676 } 1687 }
1677 } else { 1688 } else {
1678 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1689 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1679 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1690 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1680 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1691 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1681 if ( incidence->isBirthday() || incidence->isAnniversary() ) { 1692 if ( incidence->isBirthday() || incidence->isAnniversary() ) {
1682 bool ok; 1693 bool ok;
1683 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1694 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1684 if ( ok ) { 1695 if ( ok ) {
1685 int years = noc.date().year() - incidence->dtStart().date().year(); 1696 int years = noc.date().year() - incidence->dtStart().date().year();
1686 startString += i18n(" (%1 y.)"). arg( years ); 1697 startString += i18n(" (%1 y.)"). arg( years );
1687 } 1698 }
1688 } 1699 }
1689 else 1700 else
1690 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1701 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1691 } 1702 }
1692 } 1703 }
1693 else { 1704 else {
1694 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 ) 1705 if ( (( KCal::Todo*)incidence)->percentComplete() == 100 )
1695 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) ); 1706 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+i18n("completed on %1").arg( (( KCal::Todo*)incidence)->completedStr(true) );
1696 else 1707 else
1697 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1708 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1698 } 1709 }
1699 if ( !incidence->location().isEmpty() ) 1710 if ( !incidence->location().isEmpty() )
1700 startString += " (" +incidence->location()+")"; 1711 startString += " (" +incidence->location()+")";
1701 setCaption( incidence->summary()+startString); 1712 setCaption( incidence->summary()+startString);
1702 enableIncidenceActions( true ); 1713 enableIncidenceActions( true );
1703 if ( incidence->typeID() == eventID ) { 1714 if ( incidence->typeID() == eventID ) {
1704 mShowAction->setMenuText( i18n("Show Event") ); 1715 mShowAction->setMenuText( i18n("Show Event") );
1705 mNewSubTodoAction->setEnabled( false ); 1716 mNewSubTodoAction->setEnabled( false );
1706 } else if ( incidence->typeID() == todoID ) { 1717 } else if ( incidence->typeID() == todoID ) {
1707 mShowAction->setMenuText( i18n("Show Todo") ); 1718 mShowAction->setMenuText( i18n("Show Todo") );
1708 mNewSubTodoAction->setEnabled( true ); 1719 mNewSubTodoAction->setEnabled( true );
1709 } else { 1720 } else {
1710 mShowAction->setMenuText( i18n("Show") ); 1721 mShowAction->setMenuText( i18n("Show") );
1711 mNewSubTodoAction->setEnabled( false ); 1722 mNewSubTodoAction->setEnabled( false );
1712 } 1723 }
1713} 1724}
1714 1725
1715void MainWindow::enableIncidenceActions( bool enabled ) 1726void MainWindow::enableIncidenceActions( bool enabled )
1716{ 1727{
1717 mShowAction->setEnabled( enabled ); 1728 mShowAction->setEnabled( enabled );
1718 mEditAction->setEnabled( enabled ); 1729 mEditAction->setEnabled( enabled );
1719 mDeleteAction->setEnabled( enabled ); 1730 mDeleteAction->setEnabled( enabled );
1720 1731
1721 mCloneAction->setEnabled( enabled ); 1732 mCloneAction->setEnabled( enabled );
1722 mMoveAction->setEnabled( enabled ); 1733 mMoveAction->setEnabled( enabled );
1723#ifndef DESKTOP_VERSION 1734#ifndef DESKTOP_VERSION
1724 mBeamAction->setEnabled( enabled ); 1735 mBeamAction->setEnabled( enabled );
1725#endif 1736#endif
1726 mCancelAction->setEnabled( enabled ); 1737 mCancelAction->setEnabled( enabled );
1727} 1738}
1728 1739
1729void MainWindow::importOL() 1740void MainWindow::importOL()
1730{ 1741{
1731#ifdef _OL_IMPORT_ 1742#ifdef _OL_IMPORT_
1732 mView->clearAllViews(); 1743 mView->clearAllViews();
1733 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1744 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1734 id->exec(); 1745 id->exec();
1735 delete id; 1746 delete id;
1736 mView->calendar()->checkAlarmForIncidence( 0, true ); 1747 mView->calendar()->checkAlarmForIncidence( 0, true );
1737 mView->updateView(); 1748 mView->updateView();
1738#endif 1749#endif
1739} 1750}
1740void MainWindow::importBday() 1751void MainWindow::importBday()
1741{ 1752{
1742 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"), 1753 int result = QMessageBox::warning( this, i18n("KO/Pi import information!"),
1743 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1754 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1744 i18n("Import!"), i18n("Cancel"), 0, 1755 i18n("Import!"), i18n("Cancel"), 0,
1745 0, 1 ); 1756 0, 1 );
1746 if ( result == 0 ) { 1757 if ( result == 0 ) {
1747 mView->importBday(); 1758 mView->importBday();
1748 1759
1749 } 1760 }
1750 1761
1751 1762
1752} 1763}
1753void MainWindow::importQtopia() 1764void MainWindow::importQtopia()
1754{ 1765{
1755 //#ifndef DESKTOP_VERSION 1766 //#ifndef DESKTOP_VERSION
1756 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1767 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1757#ifdef DESKTOP_VERSION 1768#ifdef DESKTOP_VERSION
1758 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1769 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1759#endif 1770#endif
1760 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1771 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1761 i18n("Import!"), i18n("Cancel"), 0, 1772 i18n("Import!"), i18n("Cancel"), 0,
1762 0, 1 ); 1773 0, 1 );
1763 if ( result == 0 ) { 1774 if ( result == 0 ) {
1764#ifndef DESKTOP_VERSION 1775#ifndef DESKTOP_VERSION
1765 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1776 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1766 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1777 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1767 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1778 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1768#else 1779#else
1769 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1780 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1770 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1781 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1771 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1782 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1772#endif 1783#endif
1773 mView->importQtopia( categories, datebook, todolist ); 1784 mView->importQtopia( categories, datebook, todolist );
1774 } 1785 }
1775 mView->calendar()->reInitAlarmSettings(); 1786 mView->calendar()->reInitAlarmSettings();
1776#if 0 1787#if 0
1777 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1788 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1778 i18n("Not supported \non desktop!\n"), 1789 i18n("Not supported \non desktop!\n"),
1779 i18n("Ok"), i18n("Cancel"), 0, 1790 i18n("Ok"), i18n("Cancel"), 0,
1780 0, 1 ); 1791 0, 1 );
1781 1792
1782#endif 1793#endif
1783} 1794}
1784 1795
1785void MainWindow::saveOnClose() 1796void MainWindow::saveOnClose()
1786{ 1797{
1787 KOPrefs *p = KOPrefs::instance(); 1798 KOPrefs *p = KOPrefs::instance();
1788 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1799 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1789 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1800 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1790 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1801 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1791 if ( filterToolBar ) { 1802 if ( filterToolBar ) {
1792 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1803 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1793 } 1804 }
1794#ifdef DESKTOP_VERSION 1805#ifdef DESKTOP_VERSION
1795 1806
1796 QPoint myP; 1807 QPoint myP;
1797 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1808 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1798 if ( p->mToolBarHor ) 1809 if ( p->mToolBarHor )
1799 p->mToolBarUp = myP.y() > height()/2; 1810 p->mToolBarUp = myP.y() > height()/2;
1800 else 1811 else
1801 p->mToolBarUp = myP.x() > width()/2; 1812 p->mToolBarUp = myP.x() > width()/2;
1802 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1813 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1803 if ( p->mToolBarHorV ) 1814 if ( p->mToolBarHorV )
1804 p->mToolBarUpV = myP.y() > height()/2; 1815 p->mToolBarUpV = myP.y() > height()/2;
1805 else 1816 else
1806 p->mToolBarUpV = myP.x() > width()/2 ; 1817 p->mToolBarUpV = myP.x() > width()/2 ;
1807 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1818 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1808 if ( p->mToolBarHorN ) 1819 if ( p->mToolBarHorN )
1809 p->mToolBarUpN = myP.y() > height()/2; 1820 p->mToolBarUpN = myP.y() > height()/2;
1810 else 1821 else
1811 p->mToolBarUpN = myP.x() > width()/2 ; 1822 p->mToolBarUpN = myP.x() > width()/2 ;
1812 if ( filterToolBar ) { 1823 if ( filterToolBar ) {
1813 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1824 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1814 if ( p->mToolBarHorF ) 1825 if ( p->mToolBarHorF )
1815 p->mToolBarUpF = myP.y() > height()/2; 1826 p->mToolBarUpF = myP.y() > height()/2;
1816 else 1827 else
1817 p->mToolBarUpF = myP.x() > width()/2 ; 1828 p->mToolBarUpF = myP.x() > width()/2 ;
1818 } 1829 }
1819#else 1830#else
1820 if ( p->mToolBarHor ) 1831 if ( p->mToolBarHor )
1821 p->mToolBarUp = iconToolBar->y() > height()/2; 1832 p->mToolBarUp = iconToolBar->y() > height()/2;
1822 else 1833 else
1823 p->mToolBarUp = iconToolBar->x() > width()/2; 1834 p->mToolBarUp = iconToolBar->x() > width()/2;
1824 if ( p->mToolBarHorV ) 1835 if ( p->mToolBarHorV )
1825 p->mToolBarUpV = viewToolBar->y() > height()/2; 1836 p->mToolBarUpV = viewToolBar->y() > height()/2;
1826 else 1837 else
1827 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1838 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1828 1839
1829 if ( p->mToolBarHorN ) 1840 if ( p->mToolBarHorN )
1830 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1841 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1831 else 1842 else
1832 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1843 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1833 if ( filterToolBar ) { 1844 if ( filterToolBar ) {
1834 if ( p->mToolBarHorF ) 1845 if ( p->mToolBarHorF )
1835 p->mToolBarUpF = filterToolBar->y() > height()/2; 1846 p->mToolBarUpF = filterToolBar->y() > height()/2;
1836 else 1847 else
1837 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1848 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1838 } 1849 }
1839#endif 1850#endif
1840 save(); 1851 save();
1841 mView->writeSettings(); 1852 mView->writeSettings();
1842 mView->checkSuspendAlarm(); 1853 mView->checkSuspendAlarm();
1843} 1854}
1844void MainWindow::slotModifiedChanged( bool ) 1855void MainWindow::slotModifiedChanged( bool )
1845{ 1856{
1846 if ( mBlockAtStartup ) 1857 if ( mBlockAtStartup )
1847 return; 1858 return;
1848 1859
1849 int msec; 1860 int msec;
1850 // we store the changes after 1 minute, 1861 // we store the changes after 1 minute,
1851 // and for safety reasons after 10 minutes again 1862 // and for safety reasons after 10 minutes again
1852 if ( !mSyncManager->blockSave() ) 1863 if ( !mSyncManager->blockSave() )
1853 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1864 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1854 else 1865 else
1855 msec = 1000 * 600; 1866 msec = 1000 * 600;
1856 mSaveTimer.start( msec, true ); // 1 minute 1867 mSaveTimer.start( msec, true ); // 1 minute
1857 qDebug("KO: Saving File in %d secs!", msec/1000); 1868 qDebug("KO: Saving File in %d secs!", msec/1000);
1858 mCalendarModifiedFlag = true; 1869 mCalendarModifiedFlag = true;
1859} 1870}
1860void MainWindow::saveStopTimer() 1871void MainWindow::saveStopTimer()
1861{ 1872{
1862 mSaveTimer.stop(); 1873 mSaveTimer.stop();
1863} 1874}
1864void MainWindow::backupAllFiles() 1875void MainWindow::backupAllFiles()
1865{ 1876{
1866 QDate reference ( 2000,1,1); 1877 QDate reference ( 2000,1,1);
1867 int daysTo = reference.daysTo ( QDate::currentDate() ); 1878 int daysTo = reference.daysTo ( QDate::currentDate() );
1868 setCaption(i18n("Creating backup ... please wait ..." )); 1879 setCaption(i18n("Creating backup ... please wait ..." ));
1869 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); 1880 qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate);
1870 // we need the file path, the backup dir and the number of bups as param 1881 // we need the file path, the backup dir and the number of bups as param
1871 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 1882 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
1872 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 1883 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
1873 bupDir = KGlobalSettings::backupDataDir(); 1884 bupDir = KGlobalSettings::backupDataDir();
1874 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1885 int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1875 if ( retval == 0 ) { 1886 if ( retval == 0 ) {
1876 setCaption(i18n("Backup cancelled" )); 1887 setCaption(i18n("Backup cancelled" ));
1877 qDebug("KO: Backup cancelled. Will try again tomorrow "); 1888 qDebug("KO: Backup cancelled. Will try again tomorrow ");
1878 // retval == 0 : backup skipped for today, try again tomorrow 1889 // retval == 0 : backup skipped for today, try again tomorrow
1879 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; 1890 KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1;
1880 } else if ( retval == 1 ){ 1891 } else if ( retval == 1 ){
1881 qDebug("KO: Backup created."); 1892 qDebug("KO: Backup created.");
1882 // backup ok 1893 // backup ok
1883 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 1894 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
1884 KopiCalendarFile * cal = calendars.first(); 1895 KopiCalendarFile * cal = calendars.first();
1885 cal = calendars.next(); 1896 cal = calendars.next();
1886 while ( cal ) { 1897 while ( cal ) {
1887 if ( !cal->mErrorOnLoad ) { 1898 if ( !cal->mErrorOnLoad ) {
1888 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); 1899 KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
1889 } 1900 }
1890 cal = calendars.next(); 1901 cal = calendars.next();
1891 } 1902 }
1892 KOPrefs::instance()->mLastBackupDate = daysTo; 1903 KOPrefs::instance()->mLastBackupDate = daysTo;
1893 setCaption(i18n("Backup succesfully finished" )); 1904 setCaption(i18n("Backup succesfully finished" ));
1894 } else if ( retval == 2 ){ 1905 } else if ( retval == 2 ){
1895 setCaption(i18n("Backup globally disabled" )); 1906 setCaption(i18n("Backup globally disabled" ));
1896 qDebug("KO: Backup globally cancelled."); 1907 qDebug("KO: Backup globally cancelled.");
1897 // backup globally cancelled 1908 // backup globally cancelled
1898 KPimGlobalPrefs::instance()->mBackupEnabled = false; 1909 KPimGlobalPrefs::instance()->mBackupEnabled = false;
1899 } 1910 }
1900 // retval == 3: do nothing, try again later 1911 // retval == 3: do nothing, try again later
1901} 1912}
1902void MainWindow::save() 1913void MainWindow::save()
1903{ 1914{
1904 1915
1905 if ( mView->viewManager()->journalView() ) 1916 if ( mView->viewManager()->journalView() )
1906 mView->viewManager()->journalView()->checkModified(); 1917 mView->viewManager()->journalView()->checkModified();
1907 if ( !mCalendarModifiedFlag ) { 1918 if ( !mCalendarModifiedFlag ) {
1908 qDebug("KO: Calendar not modified. Nothing saved."); 1919 qDebug("KO: Calendar not modified. Nothing saved.");
1909 return; 1920 return;
1910 } 1921 }
1911 if ( mSyncManager->blockSave() ) 1922 if ( mSyncManager->blockSave() )
1912 return; 1923 return;
1913 mSyncManager->setBlockSave(true); 1924 mSyncManager->setBlockSave(true);
1914 if ( mView->checkAllFileVersions() ) { 1925 if ( mView->checkAllFileVersions() ) {
1915 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1926 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1916 QDate reference ( 2000,1,1); 1927 QDate reference ( 2000,1,1);
1917 int daysTo = reference.daysTo ( QDate::currentDate() ); 1928 int daysTo = reference.daysTo ( QDate::currentDate() );
1918 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1929 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
1919 backupAllFiles(); 1930 backupAllFiles();
1920 } 1931 }
1921 ; // KPimGlobalPrefs::instance()->mLastBackupDate 1932 ; // KPimGlobalPrefs::instance()->mLastBackupDate
1922 } 1933 }
1923 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1934 QTime neededSaveTime = QDateTime::currentDateTime().time();
1924 if ( !isMinimized () ) 1935 if ( !isMinimized () )
1925 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1936 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1926 qDebug("KO: Start saving data to file!"); 1937 qDebug("KO: Start saving data to file!");
1927 mView->saveCalendars(); 1938 mView->saveCalendars();
1928 mCalendarModifiedFlag = false; 1939 mCalendarModifiedFlag = false;
1929 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1940 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1930 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1941 qDebug("KO: Needed %d ms for saving.",msNeeded );
1931 QString savemes; 1942 QString savemes;
1932 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1943 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1933 if ( !isMinimized () ) 1944 if ( !isMinimized () )
1934 setCaption(savemes); 1945 setCaption(savemes);
1935 else 1946 else
1936 qDebug(savemes); 1947 qDebug(savemes);
1937 } else 1948 } else
1938 setCaption(i18n("Saving cancelled!")); 1949 setCaption(i18n("Saving cancelled!"));
1939 mSyncManager->setBlockSave( false ); 1950 mSyncManager->setBlockSave( false );
1940} 1951}
1941 1952
1942void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1953void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1943{ 1954{
1944 if ( !e->isAutoRepeat() ) { 1955 if ( !e->isAutoRepeat() ) {
1945 mFlagKeyPressed = false; 1956 mFlagKeyPressed = false;
1946 } 1957 }
1947} 1958}
1948void MainWindow::keyPressEvent ( QKeyEvent * e ) 1959void MainWindow::keyPressEvent ( QKeyEvent * e )
1949{ 1960{
1950 qApp->processEvents(); 1961 qApp->processEvents();
1951 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1962 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1952 e->ignore(); 1963 e->ignore();
1953 // qDebug(" ignore %d",e->isAutoRepeat() ); 1964 // qDebug(" ignore %d",e->isAutoRepeat() );
1954 return; 1965 return;
1955 } 1966 }
1956 if (! e->isAutoRepeat() ) 1967 if (! e->isAutoRepeat() )
1957 mFlagKeyPressed = true; 1968 mFlagKeyPressed = true;
1958 KOPrefs *p = KOPrefs::instance(); 1969 KOPrefs *p = KOPrefs::instance();
1959 bool showSelectedDates = false; 1970 bool showSelectedDates = false;
1960 int size; 1971 int size;
1961 int pro = 0; 1972 int pro = 0;
1962 //qDebug("MainWindow::keyPressEvent "); 1973 //qDebug("MainWindow::keyPressEvent ");
1963 switch ( e->key() ) { 1974 switch ( e->key() ) {
1964 case Qt::Key_Right: 1975 case Qt::Key_Right:
1965 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1976 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1966 mView->goNextMonth(); 1977 mView->goNextMonth();
1967 else 1978 else
1968 mView->goNext(); 1979 mView->goNext();
1969 showSelectedDates = true; 1980 showSelectedDates = true;
1970 break; 1981 break;
1971 case Qt::Key_Left: 1982 case Qt::Key_Left:
1972 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1983 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1973 mView->goPreviousMonth(); 1984 mView->goPreviousMonth();
1974 else 1985 else
1975 mView->goPrevious(); 1986 mView->goPrevious();
1976 showSelectedDates = true; 1987 showSelectedDates = true;
1977 break; 1988 break;
1978 case Qt::Key_Down: 1989 case Qt::Key_Down:
1979 mView->viewManager()->agendaView()->scrollOneHourDown(); 1990 mView->viewManager()->agendaView()->scrollOneHourDown();
1980 break; 1991 break;
1981 case Qt::Key_Up: 1992 case Qt::Key_Up:
1982 mView->viewManager()->agendaView()->scrollOneHourUp(); 1993 mView->viewManager()->agendaView()->scrollOneHourUp();
1983 break; 1994 break;
1984 case Qt::Key_K: 1995 case Qt::Key_K:
1985 mView->viewManager()->showMonthViewWeek(); 1996 mView->viewManager()->showMonthViewWeek();
1986 break; 1997 break;
1987 case Qt::Key_I: 1998 case Qt::Key_I:
1988 mView->showIncidence(); 1999 mView->showIncidence();
1989 break; 2000 break;
1990 case Qt::Key_Delete: 2001 case Qt::Key_Delete:
1991 case Qt::Key_Backspace: 2002 case Qt::Key_Backspace:
1992 mView->deleteIncidence(); 2003 mView->deleteIncidence();
1993 break; 2004 break;
1994 case Qt::Key_D: 2005 case Qt::Key_D:
1995 mView->viewManager()->showDayView(); 2006 mView->viewManager()->showDayView();
1996 showSelectedDates = true; 2007 showSelectedDates = true;
1997 break; 2008 break;
1998 case Qt::Key_O: 2009 case Qt::Key_O:
1999 mView->toggleFilerEnabled( ); 2010 mView->toggleFilerEnabled( );
2000 break; 2011 break;
2001 case Qt::Key_0: 2012 case Qt::Key_0:
2002 case Qt::Key_1: 2013 case Qt::Key_1:
2003 case Qt::Key_2: 2014 case Qt::Key_2:
2004 case Qt::Key_3: 2015 case Qt::Key_3:
2005 case Qt::Key_4: 2016 case Qt::Key_4:
2006 case Qt::Key_5: 2017 case Qt::Key_5:
2007 case Qt::Key_6: 2018 case Qt::Key_6:
2008 case Qt::Key_7: 2019 case Qt::Key_7:
2009 case Qt::Key_8: 2020 case Qt::Key_8:
2010 case Qt::Key_9: 2021 case Qt::Key_9:
2011 pro = e->key()-48; 2022 pro = e->key()-48;
2012 if ( pro == 0 ) 2023 if ( pro == 0 )
2013 pro = 10; 2024 pro = 10;
2014 if ( e->state() == Qt::ControlButton) 2025 if ( e->state() == Qt::ControlButton)
2015 pro += 10; 2026 pro += 10;
2016 break; 2027 break;
2017 case Qt::Key_M: 2028 case Qt::Key_M:
2018 mView->viewManager()->showMonthView(); 2029 mView->viewManager()->showMonthView();
2019 showSelectedDates = true; 2030 showSelectedDates = true;
2020 break; 2031 break;
2021 case Qt::Key_Insert: 2032 case Qt::Key_Insert:
2022 mView->newEvent(); 2033 mView->newEvent();
2023 break; 2034 break;
2024 case Qt::Key_S : 2035 case Qt::Key_S :
2025 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 2036 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
2026 mView->newSubTodo(); 2037 mView->newSubTodo();
2027 else 2038 else
2028 mView->dialogManager()->showSearchDialog(); 2039 mView->dialogManager()->showSearchDialog();
2029 break; 2040 break;
2030 case Qt::Key_Y : 2041 case Qt::Key_Y :
2031 case Qt::Key_Z : 2042 case Qt::Key_Z :
2032 mView->viewManager()->showWorkWeekView(); 2043 mView->viewManager()->showWorkWeekView();
2033 showSelectedDates = true; 2044 showSelectedDates = true;
2034 break; 2045 break;
2035 case Qt::Key_U : 2046 case Qt::Key_U :
2036 mView->viewManager()->showWeekView(); 2047 mView->viewManager()->showWeekView();
2037 showSelectedDates = true; 2048 showSelectedDates = true;
2038 break; 2049 break;
2039 case Qt::Key_H : 2050 case Qt::Key_H :
2040 keyBindings(); 2051 keyBindings();
2041 break; 2052 break;
2042 case Qt::Key_W: 2053 case Qt::Key_W:
2043 mView->viewManager()->showWhatsNextView(); 2054 mView->viewManager()->showWhatsNextView();
2044 break; 2055 break;
2045 case Qt::Key_L: 2056 case Qt::Key_L:
2046 mView->viewManager()->showListView(); 2057 mView->viewManager()->showListView();
2047 break; 2058 break;
2048 case Qt::Key_N: 2059 case Qt::Key_N:
2049 mView->viewManager()->showNextView(); 2060 mView->viewManager()->showNextView();
2050 break; 2061 break;
2051 case Qt::Key_V: 2062 case Qt::Key_V:
2052 mView->viewManager()->showTodoView(); 2063 mView->viewManager()->showTodoView();
2053 break; 2064 break;
2054 case Qt::Key_C: 2065 case Qt::Key_C:
2055 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 2066 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
2056 break; 2067 break;
2057 case Qt::Key_P: 2068 case Qt::Key_P:
2058 mView->showDatePicker( ); 2069 mView->showDatePicker( );
2059 break; 2070 break;
2060 case Qt::Key_F: 2071 case Qt::Key_F:
2061 mView->editFilters(); 2072 mView->editFilters();
2062 break; 2073 break;
2063 case Qt::Key_R: 2074 case Qt::Key_R:
2064 mView->toggleFilter(); 2075 mView->toggleFilter();
2065 break; 2076 break;
2066 case Qt::Key_X: 2077 case Qt::Key_X:
2067 if ( e->state() == Qt::ControlButton ) 2078 if ( e->state() == Qt::ControlButton )
2068 mView->toggleDateNavigatorWidget(); 2079 mView->toggleDateNavigatorWidget();
2069 else { 2080 else {
2070 mView->viewManager()->showNextXView(); 2081 mView->viewManager()->showNextXView();
2071 showSelectedDates = true; 2082 showSelectedDates = true;
2072 } 2083 }
2073 break; 2084 break;
2074 case Qt::Key_Space: 2085 case Qt::Key_Space:
2075 mView->toggleExpand(); 2086 mView->toggleExpand();
2076 break; 2087 break;
2077 case Qt::Key_A: 2088 case Qt::Key_A:
2078 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 2089 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
2079 mView->showNextAlarms(); 2090 mView->showNextAlarms();
2080 else 2091 else
2081 mView->toggleAllDaySize(); 2092 mView->toggleAllDaySize();
2082 break; 2093 break;
2083 case Qt::Key_T: 2094 case Qt::Key_T:
2084 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2095 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2085 mView->newTodo(); 2096 mView->newTodo();
2086 else { 2097 else {
2087 mView->goToday(); 2098 mView->goToday();
2088 showSelectedDates = true; 2099 showSelectedDates = true;
2089 } 2100 }
2090 break; 2101 break;
2091 case Qt::Key_J: 2102 case Qt::Key_J:
2092 mView->viewManager()->showJournalView(); 2103 mView->viewManager()->showJournalView();
2093 break; 2104 break;
2094 case Qt::Key_B: 2105 case Qt::Key_B:
2095 mView->editIncidenceDescription();; 2106 mView->editIncidenceDescription();;
2096 break; 2107 break;
2097 // case Qt::Key_Return: 2108 // case Qt::Key_Return:
2098 case Qt::Key_E: 2109 case Qt::Key_E:
2099 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 2110 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
2100 mView->newEvent(); 2111 mView->newEvent();
2101 else 2112 else
2102 mView->editIncidence(); 2113 mView->editIncidence();
2103 break; 2114 break;
2104 case Qt::Key_Plus: 2115 case Qt::Key_Plus:
2105 size = p->mHourSize +2; 2116 size = p->mHourSize +2;
2106 if ( size <= 22 ) 2117 if ( size <= 22 )
2107 configureAgenda( size ); 2118 configureAgenda( size );
2108 break; 2119 break;
2109 case Qt::Key_Minus: 2120 case Qt::Key_Minus:
2110 size = p->mHourSize - 2; 2121 size = p->mHourSize - 2;
2111 if ( size >= 4 ) 2122 if ( size >= 4 )
2112 configureAgenda( size ); 2123 configureAgenda( size );
2113 break; 2124 break;
2114 2125
2115 2126
2116 default: 2127 default:
2117 e->ignore(); 2128 e->ignore();
2118 } 2129 }
2119 if ( pro > 0 ) { 2130 if ( pro > 0 ) {
2120 selectFilter( pro+1 ); 2131 selectFilter( pro+1 );
2121 } 2132 }
2122 if ( showSelectedDates ) { 2133 if ( showSelectedDates ) {
2123 ;// setCaptionToDates(); 2134 ;// setCaptionToDates();
2124 } 2135 }
2125 2136
2126} 2137}
2127void MainWindow::fillFilterMenuTB() 2138void MainWindow::fillFilterMenuTB()
2128{ 2139{
2129 selectFilterMenuTB->clear(); 2140 selectFilterMenuTB->clear();
2130 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 2141 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
2131 selectFilterMenuTB->insertSeparator(); 2142 selectFilterMenuTB->insertSeparator();
2132 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 2143 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
2133 2144
2134 selectFilterMenuTB->insertSeparator(); 2145 selectFilterMenuTB->insertSeparator();
2135 QPtrList<CalFilter> fili = mView->filters(); 2146 QPtrList<CalFilter> fili = mView->filters();
2136 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2147 CalFilter *curfilter = mView->filterView()->selectedFilter();
2137 CalFilter *filter = fili.first(); 2148 CalFilter *filter = fili.first();
2138 int iii = 2; 2149 int iii = 2;
2139 bool checkitem = mView->filterView()->filtersEnabled(); 2150 bool checkitem = mView->filterView()->filtersEnabled();
2140 while(filter) { 2151 while(filter) {
2141 selectFilterMenuTB->insertItem( filter->name(), iii ); 2152 selectFilterMenuTB->insertItem( filter->name(), iii );
2142 if ( filter == curfilter) 2153 if ( filter == curfilter)
2143 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2154 selectFilterMenuTB->setItemChecked( iii, checkitem );
2144 filter = fili.next(); 2155 filter = fili.next();
2145 ++iii; 2156 ++iii;
2146 } 2157 }
2147 if ( !checkitem ) 2158 if ( !checkitem )
2148 selectFilterMenuTB->setItemChecked( 1, true ); 2159 selectFilterMenuTB->setItemChecked( 1, true );
2149 2160
2150 int x = 0; 2161 int x = 0;
2151 int y = iconToolBar->height(); 2162 int y = iconToolBar->height();
2152 int dX = 0; 2163 int dX = 0;
2153 int dY = 0; 2164 int dY = 0;
2154 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2165 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2155 if ( iconToolBar->y() > height()/2 ) { 2166 if ( iconToolBar->y() > height()/2 ) {
2156 dY = selectFilterMenuTB->sizeHint().height()+8; 2167 dY = selectFilterMenuTB->sizeHint().height()+8;
2157 y = 0; 2168 y = 0;
2158 } 2169 }
2159 } else { 2170 } else {
2160 if ( iconToolBar->x() > width()/2 ) { // right side 2171 if ( iconToolBar->x() > width()/2 ) { // right side
2161 x=0; 2172 x=0;
2162 dX= selectFilterMenuTB->sizeHint().width()+8; 2173 dX= selectFilterMenuTB->sizeHint().width()+8;
2163 y = 0; 2174 y = 0;
2164 } else { 2175 } else {
2165 x= iconToolBar->width(); 2176 x= iconToolBar->width();
2166 y = 0; 2177 y = 0;
2167 } 2178 }
2168 } 2179 }
2169 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2180 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2170 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2181 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2171} 2182}
2172void MainWindow::fillFilterMenu() 2183void MainWindow::fillFilterMenu()
2173{ 2184{
2174 selectFilterMenu->clear(); 2185 selectFilterMenu->clear();
2175 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2186 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2176 selectFilterMenu->insertSeparator(); 2187 selectFilterMenu->insertSeparator();
2177 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2188 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2178 2189
2179 selectFilterMenu->insertSeparator(); 2190 selectFilterMenu->insertSeparator();
2180 QPtrList<CalFilter> fili = mView->filters(); 2191 QPtrList<CalFilter> fili = mView->filters();
2181 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2192 CalFilter *curfilter = mView->filterView()->selectedFilter();
2182 CalFilter *filter = fili.first(); 2193 CalFilter *filter = fili.first();
2183 int iii = 2; 2194 int iii = 2;
2184 bool checkitem = mView->filterView()->filtersEnabled(); 2195 bool checkitem = mView->filterView()->filtersEnabled();
2185 while(filter) { 2196 while(filter) {
2186 selectFilterMenu->insertItem( filter->name(), iii ); 2197 selectFilterMenu->insertItem( filter->name(), iii );
2187 if ( filter == curfilter) 2198 if ( filter == curfilter)
2188 selectFilterMenu->setItemChecked( iii, checkitem ); 2199 selectFilterMenu->setItemChecked( iii, checkitem );
2189 filter = fili.next(); 2200 filter = fili.next();
2190 ++iii; 2201 ++iii;
2191 } 2202 }
2192 if ( !checkitem ) 2203 if ( !checkitem )
2193 selectFilterMenu->setItemChecked( 1, true ); 2204 selectFilterMenu->setItemChecked( 1, true );
2194} 2205}
2195void MainWindow::fillFilterMenuPopup() 2206void MainWindow::fillFilterMenuPopup()
2196{ 2207{
2197 filterPopupMenu->clear(); 2208 filterPopupMenu->clear();
2198 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2209 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2199 2210
2200 filterPopupMenu->insertSeparator(); 2211 filterPopupMenu->insertSeparator();
2201 QPtrList<CalFilter> fili = mView->filters(); 2212 QPtrList<CalFilter> fili = mView->filters();
2202 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2213 CalFilter *curfilter = mView->filterView()->selectedFilter();
2203 CalFilter *filter = fili.first(); 2214 CalFilter *filter = fili.first();
2204 int iii = 1; 2215 int iii = 1;
2205 bool checkitem = mView->filterView()->filtersEnabled(); 2216 bool checkitem = mView->filterView()->filtersEnabled();
2206 while(filter) { 2217 while(filter) {
2207 filterPopupMenu->insertItem( filter->name(), iii ); 2218 filterPopupMenu->insertItem( filter->name(), iii );
2208 if ( filter == curfilter) 2219 if ( filter == curfilter)
2209 filterPopupMenu->setItemChecked( iii, checkitem ); 2220 filterPopupMenu->setItemChecked( iii, checkitem );
2210 filter = fili.next(); 2221 filter = fili.next();
2211 ++iii; 2222 ++iii;
2212 } 2223 }
2213 if ( !checkitem ) 2224 if ( !checkitem )
2214 filterPopupMenu->setItemChecked( 0, true ); 2225 filterPopupMenu->setItemChecked( 0, true );
2215} 2226}
2216void MainWindow::selectFilter( int fil ) 2227void MainWindow::selectFilter( int fil )
2217{ 2228{
2218 2229
2219 if ( fil == 0 ) { 2230 if ( fil == 0 ) {
2220 mView->editFilters( ); 2231 mView->editFilters( );
2221 } else if ( fil == 1 ){ 2232 } else if ( fil == 1 ){
2222 if ( mView->filterView()->filtersEnabled() ) 2233 if ( mView->filterView()->filtersEnabled() )
2223 mView->toggleFilerEnabled( ); 2234 mView->toggleFilerEnabled( );
2224 } else { 2235 } else {
2225 if ( !mView->filterView()->filtersEnabled() ) { 2236 if ( !mView->filterView()->filtersEnabled() ) {
2226 mView->filterView()->blockSignals( true ); 2237 mView->filterView()->blockSignals( true );
2227 mView->toggleFilerEnabled( ); 2238 mView->toggleFilerEnabled( );
2228 mView->filterView()->blockSignals( false ); 2239 mView->filterView()->blockSignals( false );
2229 } 2240 }
2230 mView->selectFilter( fil-2 ); 2241 mView->selectFilter( fil-2 );
2231 } 2242 }
2232} 2243}
2233void MainWindow::updateFilterToolbar() 2244void MainWindow::updateFilterToolbar()
2234{ 2245{
2235 if ( filterMenubar ) { 2246 if ( filterMenubar ) {
2236 if ( !mView->filterView()->filtersEnabled() ) { 2247 if ( !mView->filterView()->filtersEnabled() ) {
2237 filterMenubar->changeItem( 0, i18n("No Filter") ); 2248 filterMenubar->changeItem( 0, i18n("No Filter") );
2238 } else { 2249 } else {
2239 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2250 CalFilter *curfilter = mView->filterView()->selectedFilter();
2240 if ( curfilter ) { 2251 if ( curfilter ) {
2241 filterMenubar->changeItem( 0, curfilter->name() ); 2252 filterMenubar->changeItem( 0, curfilter->name() );
2242 } 2253 }
2243 } 2254 }
2244 } 2255 }
2245} 2256}
2246void MainWindow::selectFilterPopup( int fil ) 2257void MainWindow::selectFilterPopup( int fil )
2247{ 2258{
2248 selectFilter( fil + 1 ); 2259 selectFilter( fil + 1 );
2249 2260
2250} 2261}
2251void MainWindow::configureToolBar( int item ) 2262void MainWindow::configureToolBar( int item )
2252{ 2263{
2253 2264
2254 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2265 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2255 KOPrefs *p = KOPrefs::instance(); 2266 KOPrefs *p = KOPrefs::instance();
2256 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2267 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2257 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2268 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2258 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2269 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2259 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2270 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2260 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2271 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2261 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2272 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2262 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2273 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2263 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2274 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2264 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2275 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2265 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2276 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2266 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2277 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2267 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2278 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2268 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2279 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2269 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2280 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2270 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2281 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2271 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2282 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2272 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2283 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2273 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2284 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2274 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2285 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2275 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2286 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2276 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2287 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2277 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2288 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2278 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2289 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2279 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2290 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2280 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2291 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2281 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2292 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2282 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2293 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2283 // initActions(); 2294 // initActions();
2284 setCaption ( i18n("Toolbar changes needs a restart!") ); 2295 setCaption ( i18n("Toolbar changes needs a restart!") );
2285} 2296}
2286void MainWindow::setCaption ( const QString & c ) 2297void MainWindow::setCaption ( const QString & c )
2287{ 2298{
2288 QString cap = c; 2299 QString cap = c;
2289 cap.replace( QRegExp("\n"), " " ); 2300 cap.replace( QRegExp("\n"), " " );
2290 cap = cap.stripWhiteSpace(); 2301 cap = cap.stripWhiteSpace();
2291 if ( cap.isEmpty() ) 2302 if ( cap.isEmpty() )
2292 cap = "KO/Pi"; 2303 cap = "KO/Pi";
2293 QWidget::setCaption( cap ); 2304 QWidget::setCaption( cap );
2294} 2305}
2295void MainWindow::setCaptionToDates() 2306void MainWindow::setCaptionToDates()
2296{ 2307{
2297 QString selDates; 2308 QString selDates;
2298 QDate date = mView->startDate(); 2309 QDate date = mView->startDate();
2299 if ( ! date.isValid() ) { 2310 if ( ! date.isValid() ) {
2300 setCaption(""); 2311 setCaption("");
2301 return; 2312 return;
2302 } 2313 }
2303 selDates = KGlobal::locale()->formatDate( date, true); 2314 selDates = KGlobal::locale()->formatDate( date, true);
2304 if (mView->startDate() < mView->endDate() ) 2315 if (mView->startDate() < mView->endDate() )
2305 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2316 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2306 else { 2317 else {
2307 QString addString; 2318 QString addString;
2308 if ( date == QDateTime::currentDateTime().date() ) 2319 if ( date == QDateTime::currentDateTime().date() )
2309 addString = i18n("Today"); 2320 addString = i18n("Today");
2310 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2321 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2311 addString = i18n("Tomorrow"); 2322 addString = i18n("Tomorrow");
2312 if ( !addString.isEmpty() ) 2323 if ( !addString.isEmpty() )
2313 selDates = addString+", "+selDates ; 2324 selDates = addString+", "+selDates ;
2314 } 2325 }
2315 setCaption( i18n("Dates: ") + selDates ); 2326 setCaption( i18n("Dates: ") + selDates );
2316 2327
2317} 2328}
2318void MainWindow::showConfigureAgenda( ) 2329void MainWindow::showConfigureAgenda( )
2319{ 2330{
2320 int iii; 2331 int iii;
2321 for ( iii = 1;iii<= 10 ;++iii ){ 2332 for ( iii = 1;iii<= 10 ;++iii ){
2322 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2333 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2323 } 2334 }
2324 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2335 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2325} 2336}
2326void MainWindow::configureAgenda( int item ) 2337void MainWindow::configureAgenda( int item )
2327{ 2338{
2328 if ( KOPrefs::instance()->mHourSize == item ) 2339 if ( KOPrefs::instance()->mHourSize == item )
2329 return; 2340 return;
2330 KOPrefs::instance()->mHourSize=item; 2341 KOPrefs::instance()->mHourSize=item;
2331 mView->viewManager()->agendaView()->updateConfig(); 2342 mView->viewManager()->agendaView()->updateConfig();
2332} 2343}
2333 2344
2334void MainWindow::saveCalendar() 2345void MainWindow::saveCalendar()
2335{ 2346{
2336 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; 2347 QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
2337 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) 2348 if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
2338 bupDir = KGlobalSettings::backupDataDir(); 2349 bupDir = KGlobalSettings::backupDataDir();
2339 bupDir = KGlobal::formatMessage ( bupDir, 0 ); 2350 bupDir = KGlobal::formatMessage ( bupDir, 0 );
2340 QString bupHint; 2351 QString bupHint;
2341 if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) 2352 if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
2342 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); 2353 bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
2343 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; 2354 if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return;
2344 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled; 2355 bool enabled = KPimGlobalPrefs::instance()->mBackupEnabled;
2345 KPimGlobalPrefs::instance()->mBackupEnabled = false; 2356 KPimGlobalPrefs::instance()->mBackupEnabled = false;
2346 save(); 2357 save();
2347 KPimGlobalPrefs::instance()->mBackupEnabled = enabled; 2358 KPimGlobalPrefs::instance()->mBackupEnabled = enabled;
2348 backupAllFiles(); 2359 backupAllFiles();
2349} 2360}
2350void MainWindow::loadCalendar() 2361void MainWindow::loadCalendar()
2351{ 2362{
2352 2363
2353 2364
2354#if 0 2365#if 0
2355 QString fn = KOPrefs::instance()->mLastLoadFile; 2366 QString fn = KOPrefs::instance()->mLastLoadFile;
2356 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2367 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2357 2368
2358 if ( fn == "" ) 2369 if ( fn == "" )
2359 return; 2370 return;
2360 QFileInfo info; 2371 QFileInfo info;
2361 info.setFile( fn ); 2372 info.setFile( fn );
2362 QString mess; 2373 QString mess;
2363 bool loadbup = true; 2374 bool loadbup = true;
2364 if ( info. exists() ) { 2375 if ( info. exists() ) {
2365 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2376 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2366 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2377 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2367 mess, 2378 mess,
2368 i18n("Load!"), i18n("Cancel"), 0, 2379 i18n("Load!"), i18n("Cancel"), 0,
2369 0, 1 ); 2380 0, 1 );
2370 if ( result != 0 ) { 2381 if ( result != 0 ) {
2371 loadbup = false; 2382 loadbup = false;
2372 } 2383 }
2373 } else { 2384 } else {
2374 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2385 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2375 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2386 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2376 0, 1 ); 2387 0, 1 );
2377 2388
2378 return; 2389 return;
2379 } 2390 }
2380 if ( loadbup ) { 2391 if ( loadbup ) {
2381 mView->openCalendar( fn ); 2392 mView->openCalendar( fn );
2382 KOPrefs::instance()->mLastLoadFile = fn; 2393 KOPrefs::instance()->mLastLoadFile = fn;
2383 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2394 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2384 setCaption(mess); 2395 setCaption(mess);
2385 } 2396 }
2386#endif 2397#endif
2387 2398
2388} 2399}
2389void MainWindow::quickImportIcal() 2400void MainWindow::quickImportIcal()
2390{ 2401{
2391 importFile( KOPrefs::instance()->mLastImportFile, false ); 2402 importFile( KOPrefs::instance()->mLastImportFile, false );
2392} 2403}
2393void MainWindow::importFile( QString fn, bool quick ) 2404void MainWindow::importFile( QString fn, bool quick )
2394{ 2405{
2395 QFileInfo info; 2406 QFileInfo info;
2396 info.setFile( fn ); 2407 info.setFile( fn );
2397 QString mess; 2408 QString mess;
2398 if ( !info. exists() ) { 2409 if ( !info. exists() ) {
2399 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2410 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2400 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2411 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2401 mess ); 2412 mess );
2402 return; 2413 return;
2403 } 2414 }
2404 int result = 0; 2415 int result = 0;
2405 if ( !quick ) { 2416 if ( !quick ) {
2406 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2417 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2407 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2418 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2408 mess, 2419 mess,
2409 "Import", "Cancel", 0, 2420 "Import", "Cancel", 0,
2410 0, 1 ); 2421 0, 1 );
2411 } 2422 }
2412 if ( result == 0 ) { 2423 if ( result == 0 ) {
2413 if ( mView->openCalendar( fn, true )) { 2424 if ( mView->openCalendar( fn, true )) {
2414 KOPrefs::instance()->mLastImportFile = fn; 2425 KOPrefs::instance()->mLastImportFile = fn;
2415 setCaption(i18n("Imported file successfully")); 2426 setCaption(i18n("Imported file successfully"));
2416 } else { 2427 } else {
2417 setCaption(i18n("Error importing file")); 2428 setCaption(i18n("Error importing file"));
2418 } 2429 }
2419 } 2430 }
2420} 2431}
2421 2432
2422void MainWindow::importIcal() 2433void MainWindow::importIcal()
2423{ 2434{
2424 2435
2425 QString fn =KOPrefs::instance()->mLastImportFile; 2436 QString fn =KOPrefs::instance()->mLastImportFile;
2426 2437
2427 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2438 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2428 if ( fn == "" ) 2439 if ( fn == "" )
2429 return; 2440 return;
2430 importFile( fn, true ); 2441 importFile( fn, true );
2431 2442
2432} 2443}
2433 2444
2434void MainWindow::exportVCalendar() 2445void MainWindow::exportVCalendar()
2435{ 2446{
2436 QString fn = KOPrefs::instance()->mLastVcalFile; 2447 QString fn = KOPrefs::instance()->mLastVcalFile;
2437 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2448 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2438 if ( fn == "" ) 2449 if ( fn == "" )
2439 return; 2450 return;
2440 QFileInfo info; 2451 QFileInfo info;
2441 info.setFile( fn ); 2452 info.setFile( fn );
2442 QString mes; 2453 QString mes;
2443 bool createbup = true; 2454 bool createbup = true;
2444 if ( info. exists() ) { 2455 if ( info. exists() ) {
2445 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2456 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2446 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2457 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2447 i18n("Overwrite!"), i18n("Cancel"), 0, 2458 i18n("Overwrite!"), i18n("Cancel"), 0,
2448 0, 1 ); 2459 0, 1 );
2449 if ( result != 0 ) { 2460 if ( result != 0 ) {
2450 createbup = false; 2461 createbup = false;
2451 } 2462 }
2452 } 2463 }
2453 if ( createbup ) { 2464 if ( createbup ) {
2454 if ( mView->exportVCalendar( fn ) ) { 2465 if ( mView->exportVCalendar( fn ) ) {
2455 KOPrefs::instance()->mLastVcalFile = fn; 2466 KOPrefs::instance()->mLastVcalFile = fn;
2456 if ( fn.length() > 20 ) 2467 if ( fn.length() > 20 )
2457 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2468 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2458 else 2469 else
2459 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2470 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2460 setCaption(mes); 2471 setCaption(mes);
2461 } 2472 }
2462 } 2473 }
2463 2474
2464} 2475}
2465QString MainWindow::sentSyncFile() 2476QString MainWindow::sentSyncFile()
2466{ 2477{
2467#ifdef DESKTOP_VERSION 2478#ifdef DESKTOP_VERSION
2468 return locateLocal( "tmp", "copysynccal.ics" ); 2479 return locateLocal( "tmp", "copysynccal.ics" );
2469#else 2480#else
2470 return QString( "/tmp/copysynccal.ics" ); 2481 return QString( "/tmp/copysynccal.ics" );
2471#endif 2482#endif
2472} 2483}
2473 2484
2474void MainWindow::syncFileRequest() 2485void MainWindow::syncFileRequest()
2475{ 2486{
2476 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2487 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2477 mSyncManager->slotSyncMenu( 999 ); 2488 mSyncManager->slotSyncMenu( 999 );
2478 } 2489 }
2479 2490
2480 setCaption(i18n("Saving Data to temp file ..." )); 2491 setCaption(i18n("Saving Data to temp file ..." ));
2481 mView->saveCalendar( sentSyncFile() ); 2492 mView->saveCalendar( sentSyncFile() );
2482 setCaption(i18n("Data saved to temp file!" )); 2493 setCaption(i18n("Data saved to temp file!" ));
2483 2494
2484} 2495}
2485void MainWindow::getFile( bool success ) 2496void MainWindow::getFile( bool success )
2486{ 2497{
2487 if ( ! success ) { 2498 if ( ! success ) {
2488 setCaption( i18n("Error receiving file. Nothing changed!") ); 2499 setCaption( i18n("Error receiving file. Nothing changed!") );
2489 return; 2500 return;
2490 } 2501 }
2491 mView->openCalendar( sentSyncFile() ); 2502 mView->openCalendar( sentSyncFile() );
2492 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2503 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2493 mSyncManager->slotSyncMenu( 999 ); 2504 mSyncManager->slotSyncMenu( 999 );
2494 } 2505 }
2495 setCaption( i18n("Pi-Sync successful!") ); 2506 setCaption( i18n("Pi-Sync successful!") );
2496} 2507}
2497void MainWindow::printListView() 2508void MainWindow::printListView()
2498{ 2509{
2499 2510
2500 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items."); 2511 QString message = i18n("You can make a printout of the <b>List View</b> and the list view in the <b>Search Dialog</b>! To do this, please go to the <b>List View/Search Dialog</b>. Right click on the list. Select in the popup menu the entry <b>Print complete list</b>. That prints the list as you see it. You can remove items from the list before printing without deleting the corresponding event/todo! Simply select all items you do not want to print out. Then right click on one of the items and choose <b>Hide selected items</b>. After that you can print the list without these items.");
2501 2512
2502 KMessageBox::information( this, message); 2513 KMessageBox::information( this, message);
2503} 2514}
2504void MainWindow::printSel( ) 2515void MainWindow::printSel( )
2505{ 2516{
2506 mView->viewManager()->agendaView()->agenda()->printSelection(); 2517 mView->viewManager()->agendaView()->agenda()->printSelection();
2507} 2518}
2508 2519
2509void MainWindow::printCal() 2520void MainWindow::printCal()
2510{ 2521{
2511 mView->print();//mCp->showDialog(); 2522 mView->print();//mCp->showDialog();
2512} 2523}
2513 2524
2514 2525
2515#include "libkdepim/kdatepicker.h" 2526#include "libkdepim/kdatepicker.h"
2516#include <kdatetbl.h> 2527#include <kdatetbl.h>
2517 2528
2518void MainWindow::weekAction() 2529void MainWindow::weekAction()
2519{ 2530{
2520 int month; 2531 int month;
2521 KPopupFrame* popup = new KPopupFrame(this); 2532 KPopupFrame* popup = new KPopupFrame(this);
2522 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2533 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2523 // ----- 2534 // -----
2524 picker->resize(picker->sizeHint()); 2535 picker->resize(picker->sizeHint());
2525 popup->setMainWidget(picker); 2536 popup->setMainWidget(picker);
2526 picker->setFocus(); 2537 picker->setFocus();
2527 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2538 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2528 int x = 0; 2539 int x = 0;
2529 int y = iconToolBar->height(); 2540 int y = iconToolBar->height();
2530 int dX = 0; 2541 int dX = 0;
2531 int dY = 0; 2542 int dY = 0;
2532 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2543 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2533 if ( iconToolBar->y() > height()/2 ) { 2544 if ( iconToolBar->y() > height()/2 ) {
2534 dY = picker->sizeHint().height()+8; 2545 dY = picker->sizeHint().height()+8;
2535 y = 0; 2546 y = 0;
2536 } 2547 }
2537 } else { 2548 } else {
2538 if ( iconToolBar->x() > width()/2 ) { // right side 2549 if ( iconToolBar->x() > width()/2 ) { // right side
2539 x=0; 2550 x=0;
2540 dX= picker->sizeHint().width()+8; 2551 dX= picker->sizeHint().width()+8;
2541 y = 0; 2552 y = 0;
2542 } else { 2553 } else {
2543 x= iconToolBar->width(); 2554 x= iconToolBar->width();
2544 y = 0; 2555 y = 0;
2545 } 2556 }
2546 } 2557 }
2547 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2558 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2548 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2559 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2549 { 2560 {
2550 month = picker->getResult(); 2561 month = picker->getResult();
2551 emit selectWeek ( month ); 2562 emit selectWeek ( month );
2552 //qDebug("weekSelected %d ", month); 2563 //qDebug("weekSelected %d ", month);
2553 } 2564 }
2554 delete popup; 2565 delete popup;
2555} 2566}
2556 2567
2557void MainWindow::hideEvent ( QHideEvent * ) 2568void MainWindow::hideEvent ( QHideEvent * )
2558{ 2569{
2559 QString message; 2570 QString message;
2560 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2571 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2561 if ( nextA.isValid() ) { 2572 if ( nextA.isValid() ) {
2562 QString sum = mCalendar->nextSummary(); 2573 QString sum = mCalendar->nextSummary();
2563 2574
2564 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2575 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2565 setCaption( message ); 2576 setCaption( message );
2566 } 2577 }
2567} 2578}
2568 2579
2569void MainWindow::resizeEvent( QResizeEvent* e) 2580void MainWindow::resizeEvent( QResizeEvent* e)
2570{ 2581{
2571#ifndef DESKTOP_VERSION 2582#ifndef DESKTOP_VERSION
2572 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { 2583 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) {
2573 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2584 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2574 filterToolBar->hide(); 2585 filterToolBar->hide();
2575 else 2586 else
2576 filterToolBar->show(); 2587 filterToolBar->show();
2577 } 2588 }
2578#endif 2589#endif
2579 QMainWindow::resizeEvent( e); 2590 QMainWindow::resizeEvent( e);
2580} 2591}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index adab95d..41d5807 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,173 +1,173 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0 ); 39 MainWindow( QWidget *parent = 0, const char *name = 0 );
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setUsesBigPixmaps ( bool ); 46 void setUsesBigPixmaps ( bool );
47 void setCaption ( const QString & ); 47 void setCaption ( const QString & );
48 void updateWeekNum(const KCal::DateList &); 48 void updateWeekNum(const KCal::DateList &);
49 void updateWeek(QDate); 49 void updateWeek(QDate);
50 void updateFilterToolbar(); 50 void updateFilterToolbar();
51 virtual void showMaximized (); 51 virtual void showMaximized ();
52 void configureAgenda( int ); 52 void configureAgenda( int );
53 void recieve( const QCString& msg, const QByteArray& data ); 53 void recieve( const QCString& msg, const QByteArray& data );
54 protected slots: 54 protected slots:
55 void calHint(); 55 void calHint();
56 void startMultiSync(); 56 void startMultiSync();
57 void setCaptionToDates(); 57 void setCaptionToDates();
58 void weekAction(); 58 void weekAction();
59 void about(); 59 void about();
60 void licence(); 60 void licence();
61 void faq(); 61 void faq();
62 void usertrans(); 62 void usertrans();
63 void features(); 63 void features();
64 void synchowto(); 64 void synchowto();
65 void storagehowto(); 65 void storagehowto();
66 void timetrackinghowto(); 66 void timetrackinghowto();
67 void kdesynchowto(); 67 void kdesynchowto();
68 void multisynchowto(); 68 void multisynchowto();
69 void whatsNew(); 69 void whatsNew();
70 void keyBindings(); 70 void keyBindings();
71 void aboutAutoSaving();; 71 void aboutAutoSaving();;
72 void aboutKnownBugs(); 72 void aboutKnownBugs();
73 73
74 void processIncidenceSelection( Incidence * ); 74 void processIncidenceSelection( Incidence * );
75 75
76 void importQtopia(); 76 void importQtopia();
77 void importBday(); 77 void importBday();
78 void importOL(); 78 void importOL();
79 void importIcal(); 79 void importIcal();
80 void importFile( QString, bool ); 80 void importFile( QString, bool );
81 void quickImportIcal(); 81 void quickImportIcal();
82 82
83 void slotModifiedChanged( bool ); 83 void slotModifiedChanged( bool );
84 84
85 void save(); 85 void save();
86 void backupAllFiles(); 86 void backupAllFiles();
87 void saveStopTimer(); 87 void saveStopTimer();
88 void configureToolBar( int ); 88 void configureToolBar( int );
89 void printSel(); 89 void printSel();
90 void printCal(); 90 void printCal();
91 void printListView(); 91 void printListView();
92 void saveCalendar(); 92 void saveCalendar();
93 void loadCalendar(); 93 void loadCalendar();
94 void exportVCalendar(); 94 void exportVCalendar();
95 void fillFilterMenu(); 95 void fillFilterMenu();
96 void fillFilterMenuTB(); 96 void fillFilterMenuTB();
97 void selectFilter( int ); 97 void selectFilter( int );
98 void fillFilterMenuPopup(); 98 void fillFilterMenuPopup();
99 void selectFilterPopup( int ); 99 void selectFilterPopup( int );
100 void exportToPhone( int ); 100 void exportToPhone( int );
101 void toggleBeamReceive(); 101 void toggleBeamReceive();
102 void disableBR(bool); 102 void disableBR(bool);
103 signals: 103 signals:
104 void selectWeek ( int ); 104 void selectWeek ( int );
105 private slots: 105 private slots:
106 void showConfigureAgenda(); 106 void showConfigureAgenda();
107 void getFile( bool ); 107 void getFile( bool );
108 void syncFileRequest(); 108 void syncFileRequest();
109 109
110 protected: 110 protected:
111 void hideEvent ( QHideEvent * ); 111 void hideEvent ( QHideEvent * );
112 QString sentSyncFile(); 112 QString sentSyncFile();
113 void displayText( QString, QString); 113 void displayText( QString, QString);
114 void enableIncidenceActions( bool ); 114 void enableIncidenceActions( bool );
115 115
116 private: 116 private:
117 bool mBRdisabled; 117 bool mBRdisabled;
118#ifndef DESKTOP_VERSION 118#ifndef DESKTOP_VERSION
119 QCopChannel* infrared; 119 QCopChannel* infrared;
120#endif 120#endif
121 QAction* brAction; 121 QAction* brAction;
122 KSyncManager* mSyncManager; 122 KSyncManager* mSyncManager;
123 bool mClosed; 123 bool mClosed;
124 void saveOnClose(); 124 void saveOnClose();
125 bool mFlagKeyPressed; 125 bool mFlagKeyPressed;
126 bool mBlockAtStartup; 126 bool mBlockAtStartup;
127 QPEToolBar *iconToolBar; 127 QPEToolBar *iconToolBar;
128 QPEToolBar *viewToolBar; 128 QPEToolBar *viewToolBar;
129 QPEToolBar *navigatorToolBar; 129 QPEToolBar *navigatorToolBar;
130 QPEToolBar *filterToolBar; 130 QPEToolBar *filterToolBar;
131 QMenuBar *filterMenubar; 131 QMenuBar *filterMenubar;
132 QPopupMenu * filterPopupMenu; 132 QPopupMenu * filterPopupMenu;
133 QPopupMenu * mCurrentItemMenu; 133 QPopupMenu * mCurrentItemMenu;
134 void initActions(); 134 void initActions();
135 void setDefaultPreferences(); 135 void setDefaultPreferences();
136 void resizeEvent( QResizeEvent* e); 136 void resizeEvent( QResizeEvent* e);
137 void keyPressEvent ( QKeyEvent * ) ; 137 void keyPressEvent ( QKeyEvent * ) ;
138 void keyReleaseEvent ( QKeyEvent * ) ; 138 void keyReleaseEvent ( QKeyEvent * ) ;
139 QPopupMenu *configureToolBarMenu; 139 QPopupMenu *configureToolBarMenu;
140 QPopupMenu *selectFilterMenu; 140 QPopupMenu *selectFilterMenu;
141 QPopupMenu *selectFilterMenuTB; 141 QPopupMenu *selectFilterMenuTB;
142 QPopupMenu *configureAgendaMenu, *syncMenu; 142 QPopupMenu *configureAgendaMenu, *syncMenu;
143 CalendarLocal *mCalendar; 143 CalendarLocal *mCalendar;
144 CalendarView *mView; 144 CalendarView *mView;
145 QAction *mNewSubTodoAction; 145 QAction *mNewSubTodoAction;
146 QAction *mWeekAction; 146 QAction *mWeekAction;
147 QFont mWeekFont; 147 QFont mWeekFont;
148 QPixmap mWeekPixmap; 148 QPixmap mWeekPixmap;
149 QColor mWeekBgColor; 149 QColor mWeekBgColor;
150 150
151 QAction *mShowAction; 151 QAction *mShowAction;
152 QAction *mEditAction; 152 QAction *mEditAction;
153 QAction *mDeleteAction; 153 QAction *mDeleteAction;
154 QAction *mCloneAction; 154 QAction *mCloneAction;
155 QAction *mMoveAction; 155 QAction *mMoveAction;
156 QAction *mBeamAction; 156 QAction *mBeamAction;
157 QAction *mCancelAction; 157 QAction *mCancelAction;
158 158
159 QAction *mToggleNav; 159 QAction *mToggleNav;
160 QAction *mToggleFilter; 160 QAction *mToggleFilter;
161 QAction *mToggleAllday; 161 QAction *mToggleAllday;
162 QAction *actionFilterMenuTB; 162 QAction *actionFilterMenuTB;
163 163
164 void closeEvent( QCloseEvent* ce ); 164 void closeEvent( QCloseEvent* ce );
165 QTimer mSaveTimer; 165 QTimer mSaveTimer;
166 //bool mBlockSaveFlag; 166 //bool mBlockSaveFlag;
167 bool mCalendarModifiedFlag; 167 bool mCalendarModifiedFlag;
168 QPixmap loadPixmap( QString ); 168 QPixmap loadPixmap( QString );
169 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80; 169 QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix;
170}; 170};
171 171
172 172
173#endif 173#endif