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