-rw-r--r-- | korganizer/kolistview.cpp | 7 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 13 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 5690bdb..5f90dc6 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,428 +1,431 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 1999 Preston Brown | 3 | Copyright (c) 1999 Preston Brown |
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpopupmenu.h> | 28 | #include <qpopupmenu.h> |
29 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qpaintdevicemetrics.h> | 38 | #include <qpaintdevicemetrics.h> |
39 | 39 | ||
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | 44 | ||
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | #include <libkcal/calendar.h> | 46 | #include <libkcal/calendar.h> |
47 | #include <libkcal/calendarlocal.h> | 47 | #include <libkcal/calendarlocal.h> |
48 | #include <libkcal/icalformat.h> | 48 | #include <libkcal/icalformat.h> |
49 | #include <libkcal/vcalformat.h> | 49 | #include <libkcal/vcalformat.h> |
50 | #include <libkcal/recurrence.h> | 50 | #include <libkcal/recurrence.h> |
51 | #include <libkcal/filestorage.h> | 51 | #include <libkcal/filestorage.h> |
52 | #include <libkdepim/categoryselectdialog.h> | 52 | #include <libkdepim/categoryselectdialog.h> |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
55 | #include <qpe/qpeapplication.h> | 55 | #include <qpe/qpeapplication.h> |
56 | #else | 56 | #else |
57 | #include <qapplication.h> | 57 | #include <qapplication.h> |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifndef KORG_NOPRINTER | 60 | #ifndef KORG_NOPRINTER |
61 | #include "calprinter.h" | 61 | #include "calprinter.h" |
62 | #endif | 62 | #endif |
63 | #include "koglobals.h" | 63 | #include "koglobals.h" |
64 | #include "koprefs.h" | 64 | #include "koprefs.h" |
65 | #include "kfiledialog.h" | 65 | #include "kfiledialog.h" |
66 | 66 | ||
67 | #include "kolistview.h" | 67 | #include "kolistview.h" |
68 | #include "koeventviewer.h" | 68 | #include "koeventviewer.h" |
69 | 69 | ||
70 | extern QPixmap* sgListViewCompletedPix[6]; | 70 | extern QPixmap* sgListViewCompletedPix[6]; |
71 | extern QPixmap* sgListViewJournalPix; | ||
71 | 72 | ||
72 | class KOListViewWhatsThis :public QWhatsThis | 73 | class KOListViewWhatsThis :public QWhatsThis |
73 | { | 74 | { |
74 | public: | 75 | public: |
75 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
76 | 77 | ||
77 | protected: | 78 | protected: |
78 | virtual QString text( const QPoint& p) | 79 | virtual QString text( const QPoint& p) |
79 | { | 80 | { |
80 | return _view->getWhatsThisText(p) ; | 81 | return _view->getWhatsThisText(p) ; |
81 | } | 82 | } |
82 | private: | 83 | private: |
83 | QWidget* _wid; | 84 | QWidget* _wid; |
84 | KOListView * _view; | 85 | KOListView * _view; |
85 | }; | 86 | }; |
86 | 87 | ||
87 | 88 | ||
88 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
89 | { | 90 | { |
90 | mItem = item; | 91 | mItem = item; |
91 | mDate = date; | 92 | mDate = date; |
92 | } | 93 | } |
93 | 94 | ||
94 | ListItemVisitor::~ListItemVisitor() | 95 | ListItemVisitor::~ListItemVisitor() |
95 | { | 96 | { |
96 | } | 97 | } |
97 | 98 | ||
98 | bool ListItemVisitor::visit(Event *e) | 99 | bool ListItemVisitor::visit(Event *e) |
99 | { | 100 | { |
100 | bool ok = false; | 101 | bool ok = false; |
101 | QString start, end; | 102 | QString start, end; |
102 | QDate ds, de; | 103 | QDate ds, de; |
103 | if ( e->doesRecur() ) { | 104 | if ( e->doesRecur() ) { |
104 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
105 | if ( ok ) { | 106 | if ( ok ) { |
106 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
107 | start = KGlobal::locale()->formatDate(ds,true); | 108 | start = KGlobal::locale()->formatDate(ds,true); |
108 | de = ds.addDays( days); | 109 | de = ds.addDays( days); |
109 | end = KGlobal::locale()->formatDate(de,true); | 110 | end = KGlobal::locale()->formatDate(de,true); |
110 | } | 111 | } |
111 | 112 | ||
112 | } | 113 | } |
113 | if ( ! ok ) { | 114 | if ( ! ok ) { |
114 | start =e->dtStartDateStr(); | 115 | start =e->dtStartDateStr(); |
115 | end = e->dtEndDateStr(); | 116 | end = e->dtEndDateStr(); |
116 | ds = e->dtStart().date(); | 117 | ds = e->dtStart().date(); |
117 | de = e->dtEnd().date(); | 118 | de = e->dtEnd().date(); |
118 | } | 119 | } |
119 | mItem->setText(0,e->summary()); | 120 | mItem->setText(0,e->summary()); |
120 | mItem->setText(1,start); | 121 | mItem->setText(1,start); |
121 | if ( e->doesFloat() ) | 122 | if ( e->doesFloat() ) |
122 | mItem->setText(2,"---"); | 123 | mItem->setText(2,"---"); |
123 | else | 124 | else |
124 | mItem->setText(2,e->dtStartTimeStr()); | 125 | mItem->setText(2,e->dtStartTimeStr()); |
125 | mItem->setText(3,end); | 126 | mItem->setText(3,end); |
126 | if ( e->doesFloat() ) | 127 | if ( e->doesFloat() ) |
127 | mItem->setText(4,"---"); | 128 | mItem->setText(4,"---"); |
128 | else | 129 | else |
129 | mItem->setText(4,e->dtEndTimeStr()); | 130 | mItem->setText(4,e->dtEndTimeStr()); |
130 | if ( e->isAlarmEnabled() ) { | 131 | if ( e->isAlarmEnabled() ) { |
131 | mItem->setText(5,e->alarms().first()->offsetText() ); | 132 | mItem->setText(5,e->alarms().first()->offsetText() ); |
132 | } else { | 133 | } else { |
133 | mItem->setText(5, i18n("No")); | 134 | mItem->setText(5, i18n("No")); |
134 | } | 135 | } |
135 | mItem->setText(6, e->recurrence()->recurrenceText()); | 136 | mItem->setText(6, e->recurrence()->recurrenceText()); |
136 | if( ! e->doesRecur() ) | 137 | if( ! e->doesRecur() ) |
137 | mItem->setSortKey( 6, "-" ); | 138 | mItem->setSortKey( 6, "-" ); |
138 | mItem->setText(7,"---"); | 139 | mItem->setText(7,"---"); |
139 | mItem->setText(8,"---"); | 140 | mItem->setText(8,"---"); |
140 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
141 | mItem->setText(10,e->categoriesStr()); | 142 | mItem->setText(10,e->categoriesStr()); |
142 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); | 143 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); |
143 | mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); | 144 | mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); |
144 | 145 | ||
145 | QString key; | 146 | QString key; |
146 | QDate d = e->lastModified().date(); | 147 | QDate d = e->lastModified().date(); |
147 | QTime t = e->lastModified().time(); | 148 | QTime t = e->lastModified().time(); |
148 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | 149 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); |
149 | mItem->setSortKey(12,key); | 150 | mItem->setSortKey(12,key); |
150 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 151 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
151 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 152 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
152 | mItem->setSortKey(1,key); | 153 | mItem->setSortKey(1,key); |
153 | 154 | ||
154 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 155 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
155 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 156 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
156 | mItem->setSortKey(3,key); | 157 | mItem->setSortKey(3,key); |
157 | return true; | 158 | return true; |
158 | } | 159 | } |
159 | 160 | ||
160 | bool ListItemVisitor::visit(Todo *t) | 161 | bool ListItemVisitor::visit(Todo *t) |
161 | { | 162 | { |
162 | mItem->setText(0,t->summary()); | 163 | mItem->setText(0,t->summary()); |
163 | if ( t->isCompleted() ) { | 164 | if ( t->isCompleted() ) { |
164 | mItem->setSortKey(0,"99"+ t->summary().left(10)); | 165 | mItem->setSortKey(0,"99"+ t->summary().left(10)); |
165 | } else | 166 | } else |
166 | mItem->setSortKey(0,QString::number( t->percentComplete() )+ t->summary().left(10)); | 167 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); |
167 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); | 168 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); |
168 | if (t->hasStartDate()) { | 169 | if (t->hasStartDate()) { |
169 | mItem->setText(1,t->dtStartDateStr()); | 170 | mItem->setText(1,t->dtStartDateStr()); |
170 | if (t->doesFloat()) { | 171 | if (t->doesFloat()) { |
171 | mItem->setText(2,"---"); | 172 | mItem->setText(2,"---"); |
172 | } else { | 173 | } else { |
173 | mItem->setText(2,t->dtStartTimeStr()); | 174 | mItem->setText(2,t->dtStartTimeStr()); |
174 | } | 175 | } |
175 | } else { | 176 | } else { |
176 | mItem->setText(1,"---"); | 177 | mItem->setText(1,"---"); |
177 | mItem->setText(2,"---"); | 178 | mItem->setText(2,"---"); |
178 | } | 179 | } |
179 | mItem->setText(3,"---"); | 180 | mItem->setText(3,"---"); |
180 | mItem->setText(4,"---"); | 181 | mItem->setText(4,"---"); |
181 | if ( t->isAlarmEnabled() ) { | 182 | if ( t->isAlarmEnabled() ) { |
182 | mItem->setText(5,t->alarms().first()->offsetText() ); | 183 | mItem->setText(5,t->alarms().first()->offsetText() ); |
183 | } else { | 184 | } else { |
184 | mItem->setText(5, i18n("No")); | 185 | mItem->setText(5, i18n("No")); |
185 | } | 186 | } |
186 | mItem->setText(6, t->recurrence()->recurrenceText()); | 187 | mItem->setText(6, t->recurrence()->recurrenceText()); |
187 | if( ! t->doesRecur() ) | 188 | if( ! t->doesRecur() ) |
188 | mItem->setSortKey( 6, "-" ); | 189 | mItem->setSortKey( 6, "-" ); |
189 | if (t->hasDueDate()) { | 190 | if (t->hasDueDate()) { |
190 | mItem->setText(7,t->dtDueDateStr()); | 191 | mItem->setText(7,t->dtDueDateStr()); |
191 | if (t->doesFloat()) { | 192 | if (t->doesFloat()) { |
192 | mItem->setText(8,"---"); | 193 | mItem->setText(8,"---"); |
193 | } else { | 194 | } else { |
194 | mItem->setText(8,t->dtDueTimeStr()); | 195 | mItem->setText(8,t->dtDueTimeStr()); |
195 | } | 196 | } |
196 | } else { | 197 | } else { |
197 | mItem->setText(7,"---"); | 198 | mItem->setText(7,"---"); |
198 | mItem->setText(8,"---"); | 199 | mItem->setText(8,"---"); |
199 | } | 200 | } |
200 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 201 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
201 | mItem->setText(10,t->categoriesStr()); | 202 | mItem->setText(10,t->categoriesStr()); |
202 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 203 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); |
203 | mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | 204 | mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); |
204 | QString key; | 205 | QString key; |
205 | QDate d = t->lastModified().date(); | 206 | QDate d = t->lastModified().date(); |
206 | QTime tm = t->lastModified().time(); | 207 | QTime tm = t->lastModified().time(); |
207 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | 208 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); |
208 | mItem->setSortKey(12,key); | 209 | mItem->setSortKey(12,key); |
209 | if (t->hasDueDate()) { | 210 | if (t->hasDueDate()) { |
210 | d = t->dtDue().date(); | 211 | d = t->dtDue().date(); |
211 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 212 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
212 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 213 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
213 | mItem->setSortKey(7,key); | 214 | mItem->setSortKey(7,key); |
214 | } | 215 | } |
215 | if ( t->hasStartDate() ) { | 216 | if ( t->hasStartDate() ) { |
216 | d = t->dtStart().date(); | 217 | d = t->dtStart().date(); |
217 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 218 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
218 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 219 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
219 | mItem->setSortKey(1,key); | 220 | mItem->setSortKey(1,key); |
220 | } | 221 | } |
221 | return true; | 222 | return true; |
222 | } | 223 | } |
223 | 224 | ||
224 | bool ListItemVisitor::visit(Journal * j) | 225 | bool ListItemVisitor::visit(Journal * j) |
225 | { | 226 | { |
226 | 227 | ||
227 | QString des; | 228 | QString des; |
229 | mItem->setPixmap( 0, *sgListViewJournalPix); | ||
228 | if ( !j->summary().isEmpty() ) { | 230 | if ( !j->summary().isEmpty() ) { |
229 | des = j->summary(); | 231 | des = j->summary(); |
230 | } else { | 232 | } else { |
231 | des = j->description().left(30); | 233 | des = j->description().left(30); |
232 | des = des.simplifyWhiteSpace (); | 234 | des = des.simplifyWhiteSpace (); |
233 | des.replace (QRegExp ("\\n"),"" ); | 235 | des.replace (QRegExp ("\\n"),"" ); |
234 | des.replace (QRegExp ("\\r"),"" ); | 236 | des.replace (QRegExp ("\\r"),"" ); |
235 | } | 237 | } |
236 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 238 | mItem->setText(0,des.left(25)); |
239 | mItem->setSortKey(0,"0"+ des.left(25)); | ||
237 | mItem->setText(1,j->dtStartDateStr()); | 240 | mItem->setText(1,j->dtStartDateStr()); |
238 | mItem->setText(2,"---"); | 241 | mItem->setText(2,"---"); |
239 | mItem->setText(3,"---"); | 242 | mItem->setText(3,"---"); |
240 | mItem->setText(4,"---"); | 243 | mItem->setText(4,"---"); |
241 | mItem->setText(5,"---"); | 244 | mItem->setText(5,"---"); |
242 | mItem->setText(6,"---"); | 245 | mItem->setText(6,"---"); |
243 | mItem->setText(7,j->dtStartDateStr()); | 246 | mItem->setText(7,j->dtStartDateStr()); |
244 | mItem->setText(8,"---"); | 247 | mItem->setText(8,"---"); |
245 | mItem->setText(9,"---"); | 248 | mItem->setText(9,"---"); |
246 | mItem->setText(10,j->categoriesStr()); | 249 | mItem->setText(10,j->categoriesStr()); |
247 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 250 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); |
248 | mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); | 251 | mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); |
249 | 252 | ||
250 | QString key; | 253 | QString key; |
251 | QDate d = j->lastModified().date(); | 254 | QDate d = j->lastModified().date(); |
252 | QTime tm = j->lastModified().time(); | 255 | QTime tm = j->lastModified().time(); |
253 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | 256 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); |
254 | mItem->setSortKey(12,key); | 257 | mItem->setSortKey(12,key); |
255 | d = j->dtStart().date(); | 258 | d = j->dtStart().date(); |
256 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 259 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
257 | mItem->setSortKey(1,key); | 260 | mItem->setSortKey(1,key); |
258 | mItem->setSortKey(7,key); | 261 | mItem->setSortKey(7,key); |
259 | 262 | ||
260 | return true; | 263 | return true; |
261 | } | 264 | } |
262 | 265 | ||
263 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 266 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
264 | const char *name) | 267 | const char *name) |
265 | : KOEventView(calendar, parent, name) | 268 | : KOEventView(calendar, parent, name) |
266 | { | 269 | { |
267 | 270 | ||
268 | mActiveItem = 0; | 271 | mActiveItem = 0; |
269 | mForceShowCompletedTodos = false; | 272 | mForceShowCompletedTodos = false; |
270 | mListView = new KOListViewListView(this); | 273 | mListView = new KOListViewListView(this); |
271 | mListView->addColumn(i18n("Summary")); | 274 | mListView->addColumn(i18n("Summary")); |
272 | mListView->addColumn(i18n("Start Date")); | 275 | mListView->addColumn(i18n("Start Date")); |
273 | mListView->addColumn(i18n("Start Time")); | 276 | mListView->addColumn(i18n("Start Time")); |
274 | mListView->addColumn(i18n("End Date")); | 277 | mListView->addColumn(i18n("End Date")); |
275 | mListView->addColumn(i18n("End Time")); | 278 | mListView->addColumn(i18n("End Time")); |
276 | mListView->addColumn(i18n("Alarm")); // alarm set? | 279 | mListView->addColumn(i18n("Alarm")); // alarm set? |
277 | mListView->addColumn(i18n("Recurs")); // recurs? | 280 | mListView->addColumn(i18n("Recurs")); // recurs? |
278 | mListView->addColumn(i18n("Due Date")); | 281 | mListView->addColumn(i18n("Due Date")); |
279 | mListView->addColumn(i18n("Due Time")); | 282 | mListView->addColumn(i18n("Due Time")); |
280 | mListView->addColumn(i18n("Cancelled")); | 283 | mListView->addColumn(i18n("Cancelled")); |
281 | mListView->addColumn(i18n("Categories")); | 284 | mListView->addColumn(i18n("Categories")); |
282 | mListView->addColumn(i18n("Calendar")); | 285 | mListView->addColumn(i18n("Calendar")); |
283 | mListView->addColumn(i18n("Last Modified")); | 286 | mListView->addColumn(i18n("Last Modified")); |
284 | 287 | ||
285 | mListView->setColumnAlignment(0,AlignLeft); | 288 | mListView->setColumnAlignment(0,AlignLeft); |
286 | mListView->setColumnAlignment(1,AlignLeft); | 289 | mListView->setColumnAlignment(1,AlignLeft); |
287 | mListView->setColumnAlignment(2,AlignHCenter); | 290 | mListView->setColumnAlignment(2,AlignHCenter); |
288 | mListView->setColumnAlignment(3,AlignLeft); | 291 | mListView->setColumnAlignment(3,AlignLeft); |
289 | mListView->setColumnAlignment(4,AlignHCenter); | 292 | mListView->setColumnAlignment(4,AlignHCenter); |
290 | mListView->setColumnAlignment(5,AlignLeft); | 293 | mListView->setColumnAlignment(5,AlignLeft); |
291 | mListView->setColumnAlignment(6,AlignLeft); | 294 | mListView->setColumnAlignment(6,AlignLeft); |
292 | mListView->setColumnAlignment(7,AlignLeft); | 295 | mListView->setColumnAlignment(7,AlignLeft); |
293 | mListView->setColumnAlignment(8,AlignLeft); | 296 | mListView->setColumnAlignment(8,AlignLeft); |
294 | mListView->setColumnAlignment(9,AlignLeft); | 297 | mListView->setColumnAlignment(9,AlignLeft); |
295 | mListView->setColumnAlignment(10,AlignLeft); | 298 | mListView->setColumnAlignment(10,AlignLeft); |
296 | mListView->setColumnAlignment(11,AlignLeft); | 299 | mListView->setColumnAlignment(11,AlignLeft); |
297 | mListView->setColumnAlignment(12,AlignLeft); | 300 | mListView->setColumnAlignment(12,AlignLeft); |
298 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 301 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
299 | 302 | ||
300 | int iii = 0; | 303 | int iii = 0; |
301 | for ( iii = 0; iii< 13 ; ++iii ) | 304 | for ( iii = 0; iii< 13 ; ++iii ) |
302 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 305 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
303 | 306 | ||
304 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 307 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
305 | layoutTop->addWidget(mListView); | 308 | layoutTop->addWidget(mListView); |
306 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 309 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
307 | mPopupMenu = eventPopup(); | 310 | mPopupMenu = eventPopup(); |
308 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 311 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
309 | mPopupMenu->insertSeparator(); | 312 | mPopupMenu->insertSeparator(); |
310 | 313 | ||
311 | selPopup->insertItem(i18n("All"),this, | 314 | selPopup->insertItem(i18n("All"),this, |
312 | SLOT(allSelection())); | 315 | SLOT(allSelection())); |
313 | selPopup->insertItem(i18n("None"),this, | 316 | selPopup->insertItem(i18n("None"),this, |
314 | SLOT(clearSelection())); | 317 | SLOT(clearSelection())); |
315 | selPopup->insertItem(i18n("Delete selected..."),this, | 318 | selPopup->insertItem(i18n("Delete selected..."),this, |
316 | SLOT(deleteAll())); | 319 | SLOT(deleteAll())); |
317 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | 320 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); |
318 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 321 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
319 | i18n("Hide all selected"),this, | 322 | i18n("Hide all selected"),this, |
320 | SLOT(hideAll()),true); | 323 | SLOT(hideAll()),true); |
321 | 324 | ||
322 | selPopup->insertSeparator(); | 325 | selPopup->insertSeparator(); |
323 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 326 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
324 | selPopup->insertItem( i18n("Export"), exportPO ); | 327 | selPopup->insertItem( i18n("Export"), exportPO ); |
325 | #ifdef DESKTOP_VERSION | 328 | #ifdef DESKTOP_VERSION |
326 | mPopupMenu->insertSeparator(); | 329 | mPopupMenu->insertSeparator(); |
327 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
328 | i18n("Print complete list..."),this, | 331 | i18n("Print complete list..."),this, |
329 | SLOT(printList()),true); | 332 | SLOT(printList()),true); |
330 | #endif | 333 | #endif |
331 | mCalPopup = new QPopupMenu ( this ); | 334 | mCalPopup = new QPopupMenu ( this ); |
332 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); | 335 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
333 | 336 | ||
334 | selPopup->insertItem(i18n("Set categories")+"...",this, | 337 | selPopup->insertItem(i18n("Set categories")+"...",this, |
335 | SLOT(setCat()) ); | 338 | SLOT(setCat()) ); |
336 | selPopup->insertItem( i18n("Set alarm..."),this, | 339 | selPopup->insertItem( i18n("Set alarm..."),this, |
337 | SLOT(setAlarm())); | 340 | SLOT(setAlarm())); |
338 | #if 0 | 341 | #if 0 |
339 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 342 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
340 | i18n("Set categories")+"...",this, | 343 | i18n("Set categories")+"...",this, |
341 | SLOT(setCat()),true); | 344 | SLOT(setCat()),true); |
342 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 345 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
343 | i18n("Set alarm..."),this, | 346 | i18n("Set alarm..."),this, |
344 | SLOT(setAlarm()),true); | 347 | SLOT(setAlarm()),true); |
345 | #endif | 348 | #endif |
346 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 349 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
347 | SLOT( populateCalPopup() )); | 350 | SLOT( populateCalPopup() )); |
348 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 351 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
349 | SLOT( setCalendar( int ) )); | 352 | SLOT( setCalendar( int ) )); |
350 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 353 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
351 | SLOT( catChanged( Incidence * ) )); | 354 | SLOT( catChanged( Incidence * ) )); |
352 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 355 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
353 | SLOT(saveToFile())); | 356 | SLOT(saveToFile())); |
354 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 357 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
355 | SLOT(saveToFileVCS())); | 358 | SLOT(saveToFileVCS())); |
356 | exportPO->insertItem( i18n("Journal/Details..."),this, | 359 | exportPO->insertItem( i18n("Journal/Details..."),this, |
357 | SLOT(saveDescriptionToFile())); | 360 | SLOT(saveDescriptionToFile())); |
358 | // mPopupMenu->insertSeparator(); | 361 | // mPopupMenu->insertSeparator(); |
359 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 362 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
360 | // i18n("Add Categ. to selected..."),this, | 363 | // i18n("Add Categ. to selected..."),this, |
361 | // SLOT(addCat()),true); | 364 | // SLOT(addCat()),true); |
362 | //mPopupMenu->insertSeparator(); | 365 | //mPopupMenu->insertSeparator(); |
363 | #ifndef DESKTOP_VERSION | 366 | #ifndef DESKTOP_VERSION |
364 | selPopup->insertSeparator(); | 367 | selPopup->insertSeparator(); |
365 | selPopup->insertItem( i18n("Beam via IR..."),this, | 368 | selPopup->insertItem( i18n("Beam via IR..."),this, |
366 | SLOT(beamSelected())); | 369 | SLOT(beamSelected())); |
367 | #if 0 | 370 | #if 0 |
368 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 371 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
369 | i18n("Beam via IR"),this, | 372 | i18n("Beam via IR"),this, |
370 | SLOT(beamSelected()),true); | 373 | SLOT(beamSelected()),true); |
371 | #endif | 374 | #endif |
372 | #endif | 375 | #endif |
373 | /* | 376 | /* |
374 | mPopupMenu = new QPopupMenu; | 377 | mPopupMenu = new QPopupMenu; |
375 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 378 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
376 | SLOT (editEvent())); | 379 | SLOT (editEvent())); |
377 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 380 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
378 | SLOT (deleteEvent())); | 381 | SLOT (deleteEvent())); |
379 | mPopupMenu->insertSeparator(); | 382 | mPopupMenu->insertSeparator(); |
380 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 383 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
381 | SLOT(showDates())); | 384 | SLOT(showDates())); |
382 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 385 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
383 | SLOT(hideDates())); | 386 | SLOT(hideDates())); |
384 | */ | 387 | */ |
385 | QObject::connect(mListView,SIGNAL( newEvent()), | 388 | QObject::connect(mListView,SIGNAL( newEvent()), |
386 | this,SIGNAL(signalNewEvent())); | 389 | this,SIGNAL(signalNewEvent())); |
387 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 390 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
388 | this,SLOT(defaultItemAction(QListViewItem *))); | 391 | this,SLOT(defaultItemAction(QListViewItem *))); |
389 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 392 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
390 | const QPoint &, int )), | 393 | const QPoint &, int )), |
391 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 394 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
392 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 395 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
393 | SLOT(processSelectionChange(QListViewItem *))); | 396 | SLOT(processSelectionChange(QListViewItem *))); |
394 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 397 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
395 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 398 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
396 | 399 | ||
397 | readSettings(KOGlobals::config(),"KOListView Layout"); | 400 | readSettings(KOGlobals::config(),"KOListView Layout"); |
398 | } | 401 | } |
399 | 402 | ||
400 | KOListView::~KOListView() | 403 | KOListView::~KOListView() |
401 | { | 404 | { |
402 | delete mPopupMenu; | 405 | delete mPopupMenu; |
403 | #if QT_VERSION >= 0x030000 | 406 | #if QT_VERSION >= 0x030000 |
404 | 407 | ||
405 | #else | 408 | #else |
406 | delete mKOListViewWhatsThis; | 409 | delete mKOListViewWhatsThis; |
407 | #endif | 410 | #endif |
408 | } | 411 | } |
409 | 412 | ||
410 | void KOListView::catChanged( Incidence* inc) | 413 | void KOListView::catChanged( Incidence* inc) |
411 | { | 414 | { |
412 | KOListViewItem* item = getItemForEvent(inc); | 415 | KOListViewItem* item = getItemForEvent(inc); |
413 | if (item) { | 416 | if (item) { |
414 | ListItemVisitor v(item, mStartDate ); | 417 | ListItemVisitor v(item, mStartDate ); |
415 | inc->accept(v); | 418 | inc->accept(v); |
416 | } | 419 | } |
417 | } | 420 | } |
418 | QString KOListView::getWhatsThisText(QPoint p) | 421 | QString KOListView::getWhatsThisText(QPoint p) |
419 | { | 422 | { |
420 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 423 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
421 | if ( item ) | 424 | if ( item ) |
422 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 425 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
423 | KOPrefs::instance()->mWTshowDetails, | 426 | KOPrefs::instance()->mWTshowDetails, |
424 | KOPrefs::instance()->mWTshowCreated, | 427 | KOPrefs::instance()->mWTshowCreated, |
425 | KOPrefs::instance()->mWTshowChanged); | 428 | KOPrefs::instance()->mWTshowChanged); |
426 | return i18n("That is the list view" ); | 429 | return i18n("That is the list view" ); |
427 | 430 | ||
428 | } | 431 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index e960424..9c2ac82 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,354 +1,365 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "kojournalview.h" | 50 | #include "kojournalview.h" |
51 | #include "koagenda.h" | 51 | #include "koagenda.h" |
52 | #include "kodialogmanager.h" | 52 | #include "kodialogmanager.h" |
53 | #include "kdialogbase.h" | 53 | #include "kdialogbase.h" |
54 | #include "kapplication.h" | 54 | #include "kapplication.h" |
55 | #include "kofilterview.h" | 55 | #include "kofilterview.h" |
56 | #include "kstandarddirs.h" | 56 | #include "kstandarddirs.h" |
57 | #include "koprefs.h" | 57 | #include "koprefs.h" |
58 | #include "kfiledialog.h" | 58 | #include "kfiledialog.h" |
59 | #include "koglobals.h" | 59 | #include "koglobals.h" |
60 | #include "kglobal.h" | 60 | #include "kglobal.h" |
61 | #include "ktoolbar.h" | 61 | #include "ktoolbar.h" |
62 | #include "klocale.h" | 62 | #include "klocale.h" |
63 | #include "kconfig.h" | 63 | #include "kconfig.h" |
64 | #include "externalapphandler.h" | 64 | #include "externalapphandler.h" |
65 | #include <kglobalsettings.h> | 65 | #include <kglobalsettings.h> |
66 | 66 | ||
67 | using namespace KCal; | 67 | using namespace KCal; |
68 | #ifndef _WIN32_ | 68 | #ifndef _WIN32_ |
69 | #include <unistd.h> | 69 | #include <unistd.h> |
70 | #else | 70 | #else |
71 | #ifdef _OL_IMPORT_ | 71 | #ifdef _OL_IMPORT_ |
72 | #include "koimportoldialog.h" | 72 | #include "koimportoldialog.h" |
73 | #endif | 73 | #endif |
74 | #endif | 74 | #endif |
75 | #include "mainwindow.h" | 75 | #include "mainwindow.h" |
76 | 76 | ||
77 | 77 | ||
78 | class KOex2phonePrefs : public QDialog | 78 | class KOex2phonePrefs : public QDialog |
79 | { | 79 | { |
80 | public: | 80 | public: |
81 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 81 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
82 | QDialog( parent, name, true ) | 82 | QDialog( parent, name, true ) |
83 | { | 83 | { |
84 | setCaption( i18n("Export to phone options") ); | 84 | setCaption( i18n("Export to phone options") ); |
85 | QVBoxLayout* lay = new QVBoxLayout( this ); | 85 | QVBoxLayout* lay = new QVBoxLayout( this ); |
86 | lay->setSpacing( 3 ); | 86 | lay->setSpacing( 3 ); |
87 | lay->setMargin( 3 ); | 87 | lay->setMargin( 3 ); |
88 | QLabel *lab; | 88 | QLabel *lab; |
89 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 89 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
90 | lab->setAlignment (AlignHCenter ); | 90 | lab->setAlignment (AlignHCenter ); |
91 | QHBox* temphb; | 91 | QHBox* temphb; |
92 | temphb = new QHBox( this ); | 92 | temphb = new QHBox( this ); |
93 | new QLabel( i18n("I/O device: "), temphb ); | 93 | new QLabel( i18n("I/O device: "), temphb ); |
94 | mPhoneDevice = new QLineEdit( temphb); | 94 | mPhoneDevice = new QLineEdit( temphb); |
95 | lay->addWidget( temphb ); | 95 | lay->addWidget( temphb ); |
96 | temphb = new QHBox( this ); | 96 | temphb = new QHBox( this ); |
97 | new QLabel( i18n("Connection: "), temphb ); | 97 | new QLabel( i18n("Connection: "), temphb ); |
98 | mPhoneConnection = new QLineEdit( temphb); | 98 | mPhoneConnection = new QLineEdit( temphb); |
99 | lay->addWidget( temphb ); | 99 | lay->addWidget( temphb ); |
100 | temphb = new QHBox( this ); | 100 | temphb = new QHBox( this ); |
101 | new QLabel( i18n("Model(opt.): "), temphb ); | 101 | new QLabel( i18n("Model(opt.): "), temphb ); |
102 | mPhoneModel = new QLineEdit( temphb); | 102 | mPhoneModel = new QLineEdit( temphb); |
103 | lay->addWidget( temphb ); | 103 | lay->addWidget( temphb ); |
104 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 104 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
105 | mWriteBackFuture->setChecked( true ); | 105 | mWriteBackFuture->setChecked( true ); |
106 | lay->addWidget( mWriteBackFuture ); | 106 | lay->addWidget( mWriteBackFuture ); |
107 | temphb = new QHBox( this ); | 107 | temphb = new QHBox( this ); |
108 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 108 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
109 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 109 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
110 | mWriteBackFutureWeeks->setValue( 8 ); | 110 | mWriteBackFutureWeeks->setValue( 8 ); |
111 | lay->addWidget( temphb ); | 111 | lay->addWidget( temphb ); |
112 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 112 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
113 | lab->setAlignment (AlignHCenter ); | 113 | lab->setAlignment (AlignHCenter ); |
114 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 114 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
115 | lay->addWidget( ok ); | 115 | lay->addWidget( ok ); |
116 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 116 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
117 | lay->addWidget( cancel ); | 117 | lay->addWidget( cancel ); |
118 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 118 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
119 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 119 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
120 | resize( 220, 240 ); | 120 | resize( 220, 240 ); |
121 | qApp->processEvents(); | 121 | qApp->processEvents(); |
122 | int dw = QApplication::desktop()->width(); | 122 | int dw = QApplication::desktop()->width(); |
123 | int dh = QApplication::desktop()->height(); | 123 | int dh = QApplication::desktop()->height(); |
124 | move( (dw-width())/2, (dh - height() )/2 ); | 124 | move( (dw-width())/2, (dh - height() )/2 ); |
125 | } | 125 | } |
126 | 126 | ||
127 | public: | 127 | public: |
128 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 128 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
129 | QCheckBox* mWriteBackFuture; | 129 | QCheckBox* mWriteBackFuture; |
130 | QSpinBox* mWriteBackFutureWeeks; | 130 | QSpinBox* mWriteBackFutureWeeks; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | QPixmap* sgListViewCompletedPix[6]; | 133 | QPixmap* sgListViewCompletedPix[6]; |
134 | QPixmap* sgListViewJournalPix; | ||
134 | 135 | ||
135 | 136 | ||
136 | int globalFlagBlockStartup; | 137 | int globalFlagBlockStartup; |
137 | MainWindow::MainWindow( QWidget *parent, const char *name ) : | 138 | MainWindow::MainWindow( QWidget *parent, const char *name ) : |
138 | QMainWindow( parent, name ) | 139 | QMainWindow( parent, name ) |
139 | { | 140 | { |
140 | sgListViewCompletedPix[5] = &listviewPix; | 141 | sgListViewCompletedPix[5] = &listviewPix; |
141 | sgListViewCompletedPix[0] = &listviewPix0; | 142 | sgListViewCompletedPix[0] = &listviewPix0; |
142 | sgListViewCompletedPix[1] = &listviewPix20; | 143 | sgListViewCompletedPix[1] = &listviewPix20; |
143 | sgListViewCompletedPix[2] = &listviewPix40; | 144 | sgListViewCompletedPix[2] = &listviewPix40; |
144 | sgListViewCompletedPix[3] = &listviewPix60; | 145 | sgListViewCompletedPix[3] = &listviewPix60; |
145 | sgListViewCompletedPix[4] = &listviewPix80; | 146 | sgListViewCompletedPix[4] = &listviewPix80; |
146 | if ( sgListViewCompletedPix[5]->height() < 5 ) { | ||
147 | //int size = 12; | 147 | //int size = 12; |
148 | { | ||
148 | sgListViewCompletedPix[5]->resize( 11, 11 ); | 149 | sgListViewCompletedPix[5]->resize( 11, 11 ); |
149 | sgListViewCompletedPix[5]->fill( Qt::white ); | 150 | sgListViewCompletedPix[5]->fill( Qt::white ); |
150 | QPainter p ( sgListViewCompletedPix[5] ); | 151 | QPainter p ( sgListViewCompletedPix[5] ); |
151 | p.drawRect( 0,0,11,11); | 152 | p.drawRect( 0,0,11,11); |
152 | p.drawLine ( 2, 5, 4 , 7 ) ; | 153 | p.drawLine ( 2, 5, 4 , 7 ) ; |
153 | p.drawLine ( 4 , 7 , 8, 3) ; | 154 | p.drawLine ( 4 , 7 , 8, 3) ; |
154 | int iii = 0; | 155 | int iii = 0; |
155 | for ( iii = 0; iii < 5; ++iii ) { | 156 | for ( iii = 0; iii < 5; ++iii ) { |
156 | sgListViewCompletedPix[iii]->resize( 11, 11 ); | 157 | sgListViewCompletedPix[iii]->resize( 11, 11 ); |
157 | sgListViewCompletedPix[iii]->fill( Qt::white ); | 158 | sgListViewCompletedPix[iii]->fill( Qt::white ); |
158 | QPainter p ( sgListViewCompletedPix[iii] ); | 159 | QPainter p ( sgListViewCompletedPix[iii] ); |
159 | p.drawRect( 0,0,11,11); | 160 | p.drawRect( 0,0,11,11); |
160 | if ( iii ) | 161 | if ( iii ) |
161 | p.fillRect( 1,1,iii*2,9,Qt::gray ); | 162 | p.fillRect( 1,1,iii*2,9,Qt::gray ); |
162 | } | 163 | } |
164 | sgListViewJournalPix = &journalPix; | ||
165 | sgListViewJournalPix->resize( 11, 11 ); | ||
166 | sgListViewJournalPix->fill( Qt::white ); | ||
167 | { | ||
168 | QPainter p ( sgListViewJournalPix ); | ||
169 | p.drawRect( 0,0,11,11); | ||
170 | p.drawLine( 2,3,5,3); | ||
171 | p.drawLine( 2,5,8,5); | ||
172 | p.drawLine( 2,7,6,7); | ||
173 | } | ||
163 | } | 174 | } |
164 | mClosed = false; | 175 | mClosed = false; |
165 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 176 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
166 | QString confFile = locateLocal("config","korganizerrc"); | 177 | QString confFile = locateLocal("config","korganizerrc"); |
167 | QFileInfo finf ( confFile ); | 178 | QFileInfo finf ( confFile ); |
168 | bool showWarning = !finf.exists(); | 179 | bool showWarning = !finf.exists(); |
169 | setIcon(SmallIcon( "ko24" ) ); | 180 | setIcon(SmallIcon( "ko24" ) ); |
170 | mBlockAtStartup = true; | 181 | mBlockAtStartup = true; |
171 | mFlagKeyPressed = false; | 182 | mFlagKeyPressed = false; |
172 | setCaption("KO/Pi"); | 183 | setCaption("KO/Pi"); |
173 | KOPrefs *p = KOPrefs::instance(); | 184 | KOPrefs *p = KOPrefs::instance(); |
174 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 185 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
175 | p->mCurrentDisplayedView = 0; | 186 | p->mCurrentDisplayedView = 0; |
176 | if ( p->mHourSize > 22 ) | 187 | if ( p->mHourSize > 22 ) |
177 | p->mHourSize = 22; | 188 | p->mHourSize = 22; |
178 | QMainWindow::ToolBarDock tbd; | 189 | QMainWindow::ToolBarDock tbd; |
179 | if ( p->mToolBarHor ) { | 190 | if ( p->mToolBarHor ) { |
180 | if ( p->mToolBarUp ) | 191 | if ( p->mToolBarUp ) |
181 | tbd = Bottom; | 192 | tbd = Bottom; |
182 | else | 193 | else |
183 | tbd = Top; | 194 | tbd = Top; |
184 | } | 195 | } |
185 | else { | 196 | else { |
186 | if ( p->mToolBarUp ) | 197 | if ( p->mToolBarUp ) |
187 | tbd = Right; | 198 | tbd = Right; |
188 | else | 199 | else |
189 | tbd = Left; | 200 | tbd = Left; |
190 | } | 201 | } |
191 | if ( KOPrefs::instance()->mUseAppColors ) | 202 | if ( KOPrefs::instance()->mUseAppColors ) |
192 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 203 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
193 | globalFlagBlockStartup = 1; | 204 | globalFlagBlockStartup = 1; |
194 | iconToolBar = new QPEToolBar( this ); | 205 | iconToolBar = new QPEToolBar( this ); |
195 | addToolBar (iconToolBar , tbd ); | 206 | addToolBar (iconToolBar , tbd ); |
196 | 207 | ||
197 | #ifdef DESKTOP_VERSION | 208 | #ifdef DESKTOP_VERSION |
198 | if ( KOPrefs::instance()->mShowIconFilter ) | 209 | if ( KOPrefs::instance()->mShowIconFilter ) |
199 | #else | 210 | #else |
200 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 211 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
201 | #endif | 212 | #endif |
202 | 213 | ||
203 | { | 214 | { |
204 | if ( p->mToolBarHorF ) { | 215 | if ( p->mToolBarHorF ) { |
205 | if ( p->mToolBarUpF ) | 216 | if ( p->mToolBarUpF ) |
206 | tbd = Bottom; | 217 | tbd = Bottom; |
207 | else | 218 | else |
208 | tbd = Top; | 219 | tbd = Top; |
209 | } | 220 | } |
210 | else { | 221 | else { |
211 | if ( p->mToolBarUpF ) | 222 | if ( p->mToolBarUpF ) |
212 | tbd = Right; | 223 | tbd = Right; |
213 | else | 224 | else |
214 | tbd = Left; | 225 | tbd = Left; |
215 | } | 226 | } |
216 | filterToolBar = new QPEToolBar ( this ); | 227 | filterToolBar = new QPEToolBar ( this ); |
217 | filterMenubar = new QMenuBar( 0 ); | 228 | filterMenubar = new QMenuBar( 0 ); |
218 | QFontMetrics fm ( filterMenubar->font() ); | 229 | QFontMetrics fm ( filterMenubar->font() ); |
219 | 230 | ||
220 | filterPopupMenu = new QPopupMenu( this ); | 231 | filterPopupMenu = new QPopupMenu( this ); |
221 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 232 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
222 | QString addTest = "A"; | 233 | QString addTest = "A"; |
223 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); | 234 | filterMenubar->setMinimumWidth( fm.width( i18n("No Filter")+addTest ) ); |
224 | #ifdef DESKTOP_VERSION | 235 | #ifdef DESKTOP_VERSION |
225 | addTest = "AAABBBCCCx"; | 236 | addTest = "AAABBBCCCx"; |
226 | #else | 237 | #else |
227 | addTest = "AAx"; | 238 | addTest = "AAx"; |
228 | #endif | 239 | #endif |
229 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); | 240 | filterMenubar->setMaximumWidth( fm.width( i18n("No Filter")+addTest ) ); |
230 | addToolBar (filterToolBar , tbd ); | 241 | addToolBar (filterToolBar , tbd ); |
231 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 242 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
232 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 243 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
233 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 244 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
234 | filterToolBar->hide(); | 245 | filterToolBar->hide(); |
235 | } else { | 246 | } else { |
236 | filterToolBar = 0; | 247 | filterToolBar = 0; |
237 | filterMenubar = 0; | 248 | filterMenubar = 0; |
238 | filterPopupMenu = 0; | 249 | filterPopupMenu = 0; |
239 | } | 250 | } |
240 | if ( p->mShowIconOnetoolbar ) { | 251 | if ( p->mShowIconOnetoolbar ) { |
241 | viewToolBar = iconToolBar ; | 252 | viewToolBar = iconToolBar ; |
242 | navigatorToolBar = iconToolBar ; | 253 | navigatorToolBar = iconToolBar ; |
243 | } else { | 254 | } else { |
244 | #ifndef DESKTOP_VERSION | 255 | #ifndef DESKTOP_VERSION |
245 | setToolBarsMovable( false ); | 256 | setToolBarsMovable( false ); |
246 | #endif | 257 | #endif |
247 | if ( p->mToolBarHorV ) { | 258 | if ( p->mToolBarHorV ) { |
248 | if ( p->mToolBarUpV ) | 259 | if ( p->mToolBarUpV ) |
249 | tbd = Bottom; | 260 | tbd = Bottom; |
250 | else | 261 | else |
251 | tbd = Top; | 262 | tbd = Top; |
252 | } | 263 | } |
253 | else { | 264 | else { |
254 | if ( p->mToolBarUpV ) | 265 | if ( p->mToolBarUpV ) |
255 | tbd = Right; | 266 | tbd = Right; |
256 | else | 267 | else |
257 | tbd = Left; | 268 | tbd = Left; |
258 | } | 269 | } |
259 | viewToolBar = new QPEToolBar( this ); | 270 | viewToolBar = new QPEToolBar( this ); |
260 | addToolBar (viewToolBar , tbd ); | 271 | addToolBar (viewToolBar , tbd ); |
261 | if ( p->mToolBarHorN ) { | 272 | if ( p->mToolBarHorN ) { |
262 | if ( p->mToolBarUpN ) | 273 | if ( p->mToolBarUpN ) |
263 | tbd = Bottom; | 274 | tbd = Bottom; |
264 | else | 275 | else |
265 | tbd = Top; | 276 | tbd = Top; |
266 | } | 277 | } |
267 | else { | 278 | else { |
268 | if ( p->mToolBarUpN ) | 279 | if ( p->mToolBarUpN ) |
269 | tbd = Right; | 280 | tbd = Right; |
270 | else | 281 | else |
271 | tbd = Left; | 282 | tbd = Left; |
272 | } | 283 | } |
273 | navigatorToolBar = new QPEToolBar( this ); | 284 | navigatorToolBar = new QPEToolBar( this ); |
274 | addToolBar (navigatorToolBar , tbd ); | 285 | addToolBar (navigatorToolBar , tbd ); |
275 | } | 286 | } |
276 | 287 | ||
277 | 288 | ||
278 | 289 | ||
279 | mCalendarModifiedFlag = false; | 290 | mCalendarModifiedFlag = false; |
280 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 291 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
281 | splash->setAlignment ( AlignCenter ); | 292 | splash->setAlignment ( AlignCenter ); |
282 | setCentralWidget( splash ); | 293 | setCentralWidget( splash ); |
283 | #ifndef DESKTOP_VERSION | 294 | #ifndef DESKTOP_VERSION |
284 | showMaximized(); | 295 | showMaximized(); |
285 | #endif | 296 | #endif |
286 | 297 | ||
287 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 298 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
288 | setDefaultPreferences(); | 299 | setDefaultPreferences(); |
289 | mCalendar = new CalendarLocal(); | 300 | mCalendar = new CalendarLocal(); |
290 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 301 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
291 | mView->hide(); | 302 | mView->hide(); |
292 | //mView->resize(splash->size() ); | 303 | //mView->resize(splash->size() ); |
293 | initActions(); | 304 | initActions(); |
294 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 305 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
295 | mSyncManager->setBlockSave(false); | 306 | mSyncManager->setBlockSave(false); |
296 | mView->setSyncManager(mSyncManager); | 307 | mView->setSyncManager(mSyncManager); |
297 | #ifndef DESKTOP_VERSION | 308 | #ifndef DESKTOP_VERSION |
298 | iconToolBar->show(); | 309 | iconToolBar->show(); |
299 | qApp->processEvents(); | 310 | qApp->processEvents(); |
300 | #endif | 311 | #endif |
301 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 312 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
302 | int vh = height() ; | 313 | int vh = height() ; |
303 | int vw = width(); | 314 | int vw = width(); |
304 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 315 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
305 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 316 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
306 | vh -= iconToolBar->height(); | 317 | vh -= iconToolBar->height(); |
307 | } else { | 318 | } else { |
308 | vw -= iconToolBar->height(); | 319 | vw -= iconToolBar->height(); |
309 | } | 320 | } |
310 | //mView->setMaximumSize( splash->size() ); | 321 | //mView->setMaximumSize( splash->size() ); |
311 | //mView->resize( splash->size() ); | 322 | //mView->resize( splash->size() ); |
312 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 323 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
313 | mView->readSettings(); | 324 | mView->readSettings(); |
314 | bool newFile = false; | 325 | bool newFile = false; |
315 | if( !QFile::exists( defaultFileName() ) ) { | 326 | if( !QFile::exists( defaultFileName() ) ) { |
316 | QFileInfo finfo ( defaultFileName() ); | 327 | QFileInfo finfo ( defaultFileName() ); |
317 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 328 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
318 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 329 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
319 | finfo.setFile( oldFile ); | 330 | finfo.setFile( oldFile ); |
320 | if (finfo.exists() ) { | 331 | if (finfo.exists() ) { |
321 | KMessageBox::information( this, message); | 332 | KMessageBox::information( this, message); |
322 | mView->openCalendar( oldFile ); | 333 | mView->openCalendar( oldFile ); |
323 | qApp->processEvents(); | 334 | qApp->processEvents(); |
324 | } else { | 335 | } else { |
325 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 336 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
326 | finfo.setFile( oldFile ); | 337 | finfo.setFile( oldFile ); |
327 | if (finfo.exists() ) { | 338 | if (finfo.exists() ) { |
328 | KMessageBox::information( this, message); | 339 | KMessageBox::information( this, message); |
329 | mView->openCalendar( oldFile ); | 340 | mView->openCalendar( oldFile ); |
330 | qApp->processEvents(); | 341 | qApp->processEvents(); |
331 | } | 342 | } |
332 | } | 343 | } |
333 | mView->saveCalendar( defaultFileName() ); | 344 | mView->saveCalendar( defaultFileName() ); |
334 | newFile = true; | 345 | newFile = true; |
335 | } | 346 | } |
336 | 347 | ||
337 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 348 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
338 | mView->loadCalendars(); | 349 | mView->loadCalendars(); |
339 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 350 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
340 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 351 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
341 | 352 | ||
342 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 353 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
343 | KOPrefs::instance()->setAllDefaults(); | 354 | KOPrefs::instance()->setAllDefaults(); |
344 | } | 355 | } |
345 | processIncidenceSelection( 0 ); | 356 | processIncidenceSelection( 0 ); |
346 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 357 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
347 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 358 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
348 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 359 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
349 | SLOT( slotModifiedChanged( bool ) ) ); | 360 | SLOT( slotModifiedChanged( bool ) ) ); |
350 | 361 | ||
351 | 362 | ||
352 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 363 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
353 | SLOT( disableBR(bool) ) ); | 364 | SLOT( disableBR(bool) ) ); |
354 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 365 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index adab95d..41d5807 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,173 +1,173 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | #include <qmenubar.h> | 8 | #include <qmenubar.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <qregexp.h> | 10 | #include <qregexp.h> |
11 | 11 | ||
12 | #include <libkcal/incidence.h> | 12 | #include <libkcal/incidence.h> |
13 | #include <ksyncmanager.h> | 13 | #include <ksyncmanager.h> |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | #include <qcopchannel_qws.h> | 15 | #include <qcopchannel_qws.h> |
16 | #endif | 16 | #endif |
17 | class QAction; | 17 | class QAction; |
18 | class CalendarView; | 18 | class CalendarView; |
19 | class KSyncProfile; | 19 | class 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 |
25 | class QPEToolBar; | 25 | class QPEToolBar; |
26 | class QPEMenuBar; | 26 | class QPEMenuBar; |
27 | 27 | ||
28 | 28 | ||
29 | namespace KCal { | 29 | namespace KCal { |
30 | class CalendarLocal; | 30 | class CalendarLocal; |
31 | } | 31 | } |
32 | 32 | ||
33 | using namespace KCal; | 33 | using namespace KCal; |
34 | 34 | ||
35 | class MainWindow : public QMainWindow | 35 | class MainWindow : public QMainWindow |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | MainWindow( QWidget *parent = 0, const char *name = 0 ); | 39 | MainWindow( QWidget *parent = 0, const char *name = 0 ); |
40 | ~MainWindow(); | 40 | ~MainWindow(); |
41 | bool beamReceiveEnabled(); | 41 | bool beamReceiveEnabled(); |
42 | static QString defaultFileName(); | 42 | static QString defaultFileName(); |
43 | static QString syncFileName(); | 43 | static QString syncFileName(); |
44 | static QString resourcePath(); | 44 | static QString resourcePath(); |
45 | public slots: | 45 | public slots: |
46 | void setUsesBigPixmaps ( bool ); | 46 | void setUsesBigPixmaps ( bool ); |
47 | void setCaption ( const QString & ); | 47 | void setCaption ( const QString & ); |
48 | void updateWeekNum(const KCal::DateList &); | 48 | void updateWeekNum(const KCal::DateList &); |
49 | void updateWeek(QDate); | 49 | void updateWeek(QDate); |
50 | void updateFilterToolbar(); | 50 | void updateFilterToolbar(); |
51 | virtual void showMaximized (); | 51 | virtual void showMaximized (); |
52 | void configureAgenda( int ); | 52 | void configureAgenda( int ); |
53 | void recieve( const QCString& msg, const QByteArray& data ); | 53 | void recieve( const QCString& msg, const QByteArray& data ); |
54 | protected slots: | 54 | protected slots: |
55 | void calHint(); | 55 | void calHint(); |
56 | void startMultiSync(); | 56 | void startMultiSync(); |
57 | void setCaptionToDates(); | 57 | void setCaptionToDates(); |
58 | void weekAction(); | 58 | void weekAction(); |
59 | void about(); | 59 | void about(); |
60 | void licence(); | 60 | void licence(); |
61 | void faq(); | 61 | void faq(); |
62 | void usertrans(); | 62 | void usertrans(); |
63 | void features(); | 63 | void features(); |
64 | void synchowto(); | 64 | void synchowto(); |
65 | void storagehowto(); | 65 | void storagehowto(); |
66 | void timetrackinghowto(); | 66 | void timetrackinghowto(); |
67 | void kdesynchowto(); | 67 | void kdesynchowto(); |
68 | void multisynchowto(); | 68 | void multisynchowto(); |
69 | void whatsNew(); | 69 | void whatsNew(); |
70 | void keyBindings(); | 70 | void keyBindings(); |
71 | void aboutAutoSaving();; | 71 | void aboutAutoSaving();; |
72 | void aboutKnownBugs(); | 72 | void aboutKnownBugs(); |
73 | 73 | ||
74 | void processIncidenceSelection( Incidence * ); | 74 | void processIncidenceSelection( Incidence * ); |
75 | 75 | ||
76 | void importQtopia(); | 76 | void importQtopia(); |
77 | void importBday(); | 77 | void importBday(); |
78 | void importOL(); | 78 | void importOL(); |
79 | void importIcal(); | 79 | void importIcal(); |
80 | void importFile( QString, bool ); | 80 | void importFile( QString, bool ); |
81 | void quickImportIcal(); | 81 | void quickImportIcal(); |
82 | 82 | ||
83 | void slotModifiedChanged( bool ); | 83 | void slotModifiedChanged( bool ); |
84 | 84 | ||
85 | void save(); | 85 | void save(); |
86 | void backupAllFiles(); | 86 | void backupAllFiles(); |
87 | void saveStopTimer(); | 87 | void saveStopTimer(); |
88 | void configureToolBar( int ); | 88 | void configureToolBar( int ); |
89 | void printSel(); | 89 | void printSel(); |
90 | void printCal(); | 90 | void printCal(); |
91 | void printListView(); | 91 | void printListView(); |
92 | void saveCalendar(); | 92 | void saveCalendar(); |
93 | void loadCalendar(); | 93 | void loadCalendar(); |
94 | void exportVCalendar(); | 94 | void exportVCalendar(); |
95 | void fillFilterMenu(); | 95 | void fillFilterMenu(); |
96 | void fillFilterMenuTB(); | 96 | void fillFilterMenuTB(); |
97 | void selectFilter( int ); | 97 | void selectFilter( int ); |
98 | void fillFilterMenuPopup(); | 98 | void fillFilterMenuPopup(); |
99 | void selectFilterPopup( int ); | 99 | void selectFilterPopup( int ); |
100 | void exportToPhone( int ); | 100 | void exportToPhone( int ); |
101 | void toggleBeamReceive(); | 101 | void toggleBeamReceive(); |
102 | void disableBR(bool); | 102 | void disableBR(bool); |
103 | signals: | 103 | signals: |
104 | void selectWeek ( int ); | 104 | void selectWeek ( int ); |
105 | private slots: | 105 | private slots: |
106 | void showConfigureAgenda(); | 106 | void showConfigureAgenda(); |
107 | void getFile( bool ); | 107 | void getFile( bool ); |
108 | void syncFileRequest(); | 108 | void syncFileRequest(); |
109 | 109 | ||
110 | protected: | 110 | protected: |
111 | void hideEvent ( QHideEvent * ); | 111 | void hideEvent ( QHideEvent * ); |
112 | QString sentSyncFile(); | 112 | QString sentSyncFile(); |
113 | void displayText( QString, QString); | 113 | void displayText( QString, QString); |
114 | void enableIncidenceActions( bool ); | 114 | void enableIncidenceActions( bool ); |
115 | 115 | ||
116 | private: | 116 | private: |
117 | bool mBRdisabled; | 117 | bool mBRdisabled; |
118 | #ifndef DESKTOP_VERSION | 118 | #ifndef DESKTOP_VERSION |
119 | QCopChannel* infrared; | 119 | QCopChannel* infrared; |
120 | #endif | 120 | #endif |
121 | QAction* brAction; | 121 | QAction* brAction; |
122 | KSyncManager* mSyncManager; | 122 | KSyncManager* mSyncManager; |
123 | bool mClosed; | 123 | bool mClosed; |
124 | void saveOnClose(); | 124 | void saveOnClose(); |
125 | bool mFlagKeyPressed; | 125 | bool mFlagKeyPressed; |
126 | bool mBlockAtStartup; | 126 | bool mBlockAtStartup; |
127 | QPEToolBar *iconToolBar; | 127 | QPEToolBar *iconToolBar; |
128 | QPEToolBar *viewToolBar; | 128 | QPEToolBar *viewToolBar; |
129 | QPEToolBar *navigatorToolBar; | 129 | QPEToolBar *navigatorToolBar; |
130 | QPEToolBar *filterToolBar; | 130 | QPEToolBar *filterToolBar; |
131 | QMenuBar *filterMenubar; | 131 | QMenuBar *filterMenubar; |
132 | QPopupMenu * filterPopupMenu; | 132 | QPopupMenu * filterPopupMenu; |
133 | QPopupMenu * mCurrentItemMenu; | 133 | QPopupMenu * mCurrentItemMenu; |
134 | void initActions(); | 134 | void initActions(); |
135 | void setDefaultPreferences(); | 135 | void setDefaultPreferences(); |
136 | void resizeEvent( QResizeEvent* e); | 136 | void resizeEvent( QResizeEvent* e); |
137 | void keyPressEvent ( QKeyEvent * ) ; | 137 | void keyPressEvent ( QKeyEvent * ) ; |
138 | void keyReleaseEvent ( QKeyEvent * ) ; | 138 | void keyReleaseEvent ( QKeyEvent * ) ; |
139 | QPopupMenu *configureToolBarMenu; | 139 | QPopupMenu *configureToolBarMenu; |
140 | QPopupMenu *selectFilterMenu; | 140 | QPopupMenu *selectFilterMenu; |
141 | QPopupMenu *selectFilterMenuTB; | 141 | QPopupMenu *selectFilterMenuTB; |
142 | QPopupMenu *configureAgendaMenu, *syncMenu; | 142 | QPopupMenu *configureAgendaMenu, *syncMenu; |
143 | CalendarLocal *mCalendar; | 143 | CalendarLocal *mCalendar; |
144 | CalendarView *mView; | 144 | CalendarView *mView; |
145 | QAction *mNewSubTodoAction; | 145 | QAction *mNewSubTodoAction; |
146 | QAction *mWeekAction; | 146 | QAction *mWeekAction; |
147 | QFont mWeekFont; | 147 | QFont mWeekFont; |
148 | QPixmap mWeekPixmap; | 148 | QPixmap mWeekPixmap; |
149 | QColor mWeekBgColor; | 149 | QColor mWeekBgColor; |
150 | 150 | ||
151 | QAction *mShowAction; | 151 | QAction *mShowAction; |
152 | QAction *mEditAction; | 152 | QAction *mEditAction; |
153 | QAction *mDeleteAction; | 153 | QAction *mDeleteAction; |
154 | QAction *mCloneAction; | 154 | QAction *mCloneAction; |
155 | QAction *mMoveAction; | 155 | QAction *mMoveAction; |
156 | QAction *mBeamAction; | 156 | QAction *mBeamAction; |
157 | QAction *mCancelAction; | 157 | QAction *mCancelAction; |
158 | 158 | ||
159 | QAction *mToggleNav; | 159 | QAction *mToggleNav; |
160 | QAction *mToggleFilter; | 160 | QAction *mToggleFilter; |
161 | QAction *mToggleAllday; | 161 | QAction *mToggleAllday; |
162 | QAction *actionFilterMenuTB; | 162 | QAction *actionFilterMenuTB; |
163 | 163 | ||
164 | void closeEvent( QCloseEvent* ce ); | 164 | void closeEvent( QCloseEvent* ce ); |
165 | QTimer mSaveTimer; | 165 | QTimer mSaveTimer; |
166 | //bool mBlockSaveFlag; | 166 | //bool mBlockSaveFlag; |
167 | bool mCalendarModifiedFlag; | 167 | bool mCalendarModifiedFlag; |
168 | QPixmap loadPixmap( QString ); | 168 | QPixmap loadPixmap( QString ); |
169 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80; | 169 | QPixmap listviewPix, listviewPix0, listviewPix20, listviewPix40, listviewPix60, listviewPix80, journalPix; |
170 | }; | 170 | }; |
171 | 171 | ||
172 | 172 | ||
173 | #endif | 173 | #endif |