summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (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,752 +1,760 @@
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;
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,648 +1,677 @@
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
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