author | zautrix <zautrix> | 2007-06-05 13:21:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2007-06-05 13:21:33 (UTC) |
commit | d5c53970b9e12bfe774d1fecd603080aded24e09 (patch) (unidiff) | |
tree | fca3c555b3e37302ebe1ee1840fa3e27502dcc50 | |
parent | a388f4f019ccf2b7c138a6814b44b9e8f2a5f570 (diff) | |
download | kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.zip kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.tar.gz kdepimpi-d5c53970b9e12bfe774d1fecd603080aded24e09.tar.bz2 |
print fix
-rw-r--r-- | korganizer/kolistview.cpp | 22 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index b378330..192f8c0 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1,1438 +1,1458 @@ | |||
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 | extern QPixmap* sgListViewJournalPix; |
72 | 72 | ||
73 | class KOListViewWhatsThis :public QWhatsThis | 73 | class KOListViewWhatsThis :public QWhatsThis |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
77 | 77 | ||
78 | protected: | 78 | protected: |
79 | virtual QString text( const QPoint& p) | 79 | virtual QString text( const QPoint& p) |
80 | { | 80 | { |
81 | return _view->getWhatsThisText(p) ; | 81 | return _view->getWhatsThisText(p) ; |
82 | } | 82 | } |
83 | private: | 83 | private: |
84 | QWidget* _wid; | 84 | QWidget* _wid; |
85 | KOListView * _view; | 85 | KOListView * _view; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
90 | { | 90 | { |
91 | mItem = item; | 91 | mItem = item; |
92 | mDate = date; | 92 | mDate = date; |
93 | } | 93 | } |
94 | 94 | ||
95 | ListItemVisitor::~ListItemVisitor() | 95 | ListItemVisitor::~ListItemVisitor() |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
99 | bool ListItemVisitor::visit(Event *e) | 99 | bool ListItemVisitor::visit(Event *e) |
100 | { | 100 | { |
101 | bool ok = false; | 101 | bool ok = false; |
102 | QString start, end; | 102 | QString start, end; |
103 | QDate ds, de; | 103 | QDate ds, de; |
104 | if ( e->doesRecur() ) { | 104 | if ( e->doesRecur() ) { |
105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
106 | if ( ok ) { | 106 | if ( ok ) { |
107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
108 | start = KGlobal::locale()->formatDate(ds,true); | 108 | start = KGlobal::locale()->formatDate(ds,true); |
109 | de = ds.addDays( days); | 109 | de = ds.addDays( days); |
110 | end = KGlobal::locale()->formatDate(de,true); | 110 | end = KGlobal::locale()->formatDate(de,true); |
111 | } | 111 | } |
112 | 112 | ||
113 | } | 113 | } |
114 | if ( ! ok ) { | 114 | if ( ! ok ) { |
115 | start =e->dtStartDateStr(); | 115 | start =e->dtStartDateStr(); |
116 | end = e->dtEndDateStr(); | 116 | end = e->dtEndDateStr(); |
117 | ds = e->dtStart().date(); | 117 | ds = e->dtStart().date(); |
118 | de = e->dtEnd().date(); | 118 | de = e->dtEnd().date(); |
119 | } | 119 | } |
120 | mItem->setText(0,e->summary()); | 120 | mItem->setText(0,e->summary()); |
121 | mItem->setText(1,start); | 121 | mItem->setText(1,start); |
122 | if ( e->doesFloat() ) | 122 | if ( e->doesFloat() ) |
123 | mItem->setText(2,"---"); | 123 | mItem->setText(2,"---"); |
124 | else | 124 | else |
125 | mItem->setText(2,e->dtStartTimeStr()); | 125 | mItem->setText(2,e->dtStartTimeStr()); |
126 | mItem->setText(3,end); | 126 | mItem->setText(3,end); |
127 | if ( e->doesFloat() ) | 127 | if ( e->doesFloat() ) |
128 | mItem->setText(4,"---"); | 128 | mItem->setText(4,"---"); |
129 | else | 129 | else |
130 | mItem->setText(4,e->dtEndTimeStr()); | 130 | mItem->setText(4,e->dtEndTimeStr()); |
131 | mItem->setText(5, e->durationText()); | 131 | mItem->setText(5, e->durationText()); |
132 | if ( e->isAlarmEnabled() ) { | 132 | if ( e->isAlarmEnabled() ) { |
133 | mItem->setText(6,e->alarms().first()->offsetText() ); | 133 | mItem->setText(6,e->alarms().first()->offsetText() ); |
134 | } else { | 134 | } else { |
135 | mItem->setText(6, i18n("No")); | 135 | mItem->setText(6, i18n("No")); |
136 | } | 136 | } |
137 | mItem->setText(7, e->recurrenceText()); | 137 | mItem->setText(7, e->recurrenceText()); |
138 | if( ! e->doesRecur() ) | 138 | if( ! e->doesRecur() ) |
139 | mItem->setSortKey( 7, "-" ); | 139 | mItem->setSortKey( 7, "-" ); |
140 | mItem->setText(8, e->cancelled() ? i18n("Yes") : i18n("No")); | 140 | mItem->setText(8, e->cancelled() ? i18n("Yes") : i18n("No")); |
141 | mItem->setText(9,e->categoriesStr()); | 141 | mItem->setText(9,e->categoriesStr()); |
142 | mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); | 142 | mItem->setText(10, KOPrefs::instance()->calName( e->calID() )); |
143 | mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); | 143 | mItem->setText(11, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); |
144 | mItem->setSortKey(11,e->lastModifiedSortKey()); | 144 | mItem->setSortKey(11,e->lastModifiedSortKey()); |
145 | 145 | ||
146 | QString key; | 146 | QString key; |
147 | QTime t; | 147 | QTime t; |
148 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 148 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
149 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 149 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
150 | mItem->setSortKey(1,key); | 150 | mItem->setSortKey(1,key); |
151 | 151 | ||
152 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 152 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
153 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 153 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
154 | mItem->setSortKey(3,key); | 154 | mItem->setSortKey(3,key); |
155 | return true; | 155 | return true; |
156 | } | 156 | } |
157 | 157 | ||
158 | bool ListItemVisitor::visit(Todo *t) | 158 | bool ListItemVisitor::visit(Todo *t) |
159 | { | 159 | { |
160 | mItem->setText(0,t->summary()); | 160 | mItem->setText(0,t->summary()); |
161 | if ( t->isCompleted() ) { | 161 | if ( t->isCompleted() ) { |
162 | mItem->setSortKey(0,"99"+ t->summary().left(10)); | 162 | mItem->setSortKey(0,"99"+ t->summary().left(10)); |
163 | } else | 163 | } else |
164 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); | 164 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); |
165 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); | 165 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); |
166 | if (t->hasStartDate()) { | 166 | if (t->hasStartDate()) { |
167 | mItem->setText(1,t->dtStartDateStr()); | 167 | mItem->setText(1,t->dtStartDateStr()); |
168 | if (t->doesFloat()) { | 168 | if (t->doesFloat()) { |
169 | mItem->setText(2,"---"); | 169 | mItem->setText(2,"---"); |
170 | } else { | 170 | } else { |
171 | mItem->setText(2,t->dtStartTimeStr()); | 171 | mItem->setText(2,t->dtStartTimeStr()); |
172 | } | 172 | } |
173 | } else { | 173 | } else { |
174 | mItem->setText(1,"---"); | 174 | mItem->setText(1,"---"); |
175 | mItem->setText(2,"---"); | 175 | mItem->setText(2,"---"); |
176 | } | 176 | } |
177 | if ( t->isAlarmEnabled() ) { | 177 | if ( t->isAlarmEnabled() ) { |
178 | mItem->setText(6,t->alarms().first()->offsetText() ); | 178 | mItem->setText(6,t->alarms().first()->offsetText() ); |
179 | } else { | 179 | } else { |
180 | mItem->setText(6, i18n("No")); | 180 | mItem->setText(6, i18n("No")); |
181 | } | 181 | } |
182 | mItem->setText(7, t->recurrenceText()); | 182 | mItem->setText(7, t->recurrenceText()); |
183 | if( ! t->doesRecur() ) | 183 | if( ! t->doesRecur() ) |
184 | mItem->setSortKey( 7, "-" ); | 184 | mItem->setSortKey( 7, "-" ); |
185 | if (t->hasDueDate()) { | 185 | if (t->hasDueDate()) { |
186 | mItem->setText(3,t->dtDueDateStr()); | 186 | mItem->setText(3,t->dtDueDateStr()); |
187 | if (t->doesFloat()) { | 187 | if (t->doesFloat()) { |
188 | mItem->setText(4,"---"); | 188 | mItem->setText(4,"---"); |
189 | } else { | 189 | } else { |
190 | mItem->setText(4,t->dtDueTimeStr()); | 190 | mItem->setText(4,t->dtDueTimeStr()); |
191 | } | 191 | } |
192 | } else { | 192 | } else { |
193 | mItem->setText(3,"---"); | 193 | mItem->setText(3,"---"); |
194 | mItem->setText(4,"---"); | 194 | mItem->setText(4,"---"); |
195 | } | 195 | } |
196 | mItem->setText(5, t->durationText()); | 196 | mItem->setText(5, t->durationText()); |
197 | mItem->setText(8, t->cancelled() ? i18n("Yes") : i18n("No")); | 197 | mItem->setText(8, t->cancelled() ? i18n("Yes") : i18n("No")); |
198 | mItem->setText(9,t->categoriesStr()); | 198 | mItem->setText(9,t->categoriesStr()); |
199 | mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); | 199 | mItem->setText(10, KOPrefs::instance()->calName( t->calID() )); |
200 | mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | 200 | mItem->setText(11, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); |
201 | mItem->setSortKey(11,t->lastModifiedSortKey()); | 201 | mItem->setSortKey(11,t->lastModifiedSortKey()); |
202 | QString key; | 202 | QString key; |
203 | QDate d; | 203 | QDate d; |
204 | QTime tm; | 204 | QTime tm; |
205 | if (t->hasDueDate()) { | 205 | if (t->hasDueDate()) { |
206 | d = t->dtDue().date(); | 206 | d = t->dtDue().date(); |
207 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 207 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
208 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 208 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
209 | mItem->setSortKey(3,key); | 209 | mItem->setSortKey(3,key); |
210 | } | 210 | } |
211 | if ( t->hasStartDate() ) { | 211 | if ( t->hasStartDate() ) { |
212 | d = t->dtStart().date(); | 212 | d = t->dtStart().date(); |
213 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 213 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
214 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 214 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
215 | mItem->setSortKey(1,key); | 215 | mItem->setSortKey(1,key); |
216 | } | 216 | } |
217 | return true; | 217 | return true; |
218 | } | 218 | } |
219 | 219 | ||
220 | bool ListItemVisitor::visit(Journal * j) | 220 | bool ListItemVisitor::visit(Journal * j) |
221 | { | 221 | { |
222 | 222 | ||
223 | QString des; | 223 | QString des; |
224 | mItem->setPixmap( 0, *sgListViewJournalPix); | 224 | mItem->setPixmap( 0, *sgListViewJournalPix); |
225 | if ( !j->summary().isEmpty() ) { | 225 | if ( !j->summary().isEmpty() ) { |
226 | des = j->summary(); | 226 | des = j->summary(); |
227 | } else { | 227 | } else { |
228 | des = j->description().left(30); | 228 | des = j->description().left(30); |
229 | des = des.simplifyWhiteSpace (); | 229 | des = des.simplifyWhiteSpace (); |
230 | des.replace (QRegExp ("\\n"),"" ); | 230 | des.replace (QRegExp ("\\n"),"" ); |
231 | des.replace (QRegExp ("\\r"),"" ); | 231 | des.replace (QRegExp ("\\r"),"" ); |
232 | } | 232 | } |
233 | mItem->setText(0,des.left(25)); | 233 | mItem->setText(0,des.left(25)); |
234 | mItem->setSortKey(0,"0"+ des.left(25)); | 234 | mItem->setSortKey(0,"0"+ des.left(25)); |
235 | mItem->setText(1,j->dtStartDateStr()); | 235 | mItem->setText(1,j->dtStartDateStr()); |
236 | mItem->setText(2,"---"); | 236 | mItem->setText(2,"---"); |
237 | mItem->setText(3,"---"); | 237 | mItem->setText(3,"---"); |
238 | mItem->setText(4,"---"); | 238 | mItem->setText(4,"---"); |
239 | mItem->setText(5,"---"); | 239 | mItem->setText(5,"---"); |
240 | mItem->setText(6,"---"); | 240 | mItem->setText(6,"---"); |
241 | mItem->setText(7,"---"); | 241 | mItem->setText(7,"---"); |
242 | mItem->setText(8,"---"); | 242 | mItem->setText(8,"---"); |
243 | mItem->setText(9,j->categoriesStr()); | 243 | mItem->setText(9,j->categoriesStr()); |
244 | mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); | 244 | mItem->setText(10, KOPrefs::instance()->calName( j->calID() )); |
245 | mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); | 245 | mItem->setText(11, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); |
246 | mItem->setSortKey(11,j->lastModifiedSortKey()); | 246 | mItem->setSortKey(11,j->lastModifiedSortKey()); |
247 | 247 | ||
248 | QString key; | 248 | QString key; |
249 | QDate d; | 249 | QDate d; |
250 | d = j->dtStart().date(); | 250 | d = j->dtStart().date(); |
251 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 251 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
252 | mItem->setSortKey(1,key); | 252 | mItem->setSortKey(1,key); |
253 | return true; | 253 | return true; |
254 | } | 254 | } |
255 | 255 | ||
256 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 256 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
257 | const char *name) | 257 | const char *name) |
258 | : KOEventView(calendar, parent, name) | 258 | : KOEventView(calendar, parent, name) |
259 | { | 259 | { |
260 | 260 | ||
261 | mActiveItem = 0; | 261 | mActiveItem = 0; |
262 | mForceShowCompletedTodos = false; | 262 | mForceShowCompletedTodos = false; |
263 | mListView = new KOListViewListView(this); | 263 | mListView = new KOListViewListView(this); |
264 | mListView->addColumn(i18n("Summary")); | 264 | mListView->addColumn(i18n("Summary")); |
265 | mListView->addColumn(i18n("Start Date")); | 265 | mListView->addColumn(i18n("Start Date")); |
266 | mListView->addColumn(i18n("Start Time")); | 266 | mListView->addColumn(i18n("Start Time")); |
267 | mListView->addColumn(i18n("End/Due Date")); | 267 | mListView->addColumn(i18n("End/Due Date")); |
268 | mListView->addColumn(i18n("End/Due Time")); | 268 | mListView->addColumn(i18n("End/Due Time")); |
269 | mListView->addColumn(i18n("Duration")); | 269 | mListView->addColumn(i18n("Duration")); |
270 | mListView->addColumn(i18n("Alarm")); // alarm set? | 270 | mListView->addColumn(i18n("Alarm")); // alarm set? |
271 | mListView->addColumn(i18n("Recurs")); // recurs? | 271 | mListView->addColumn(i18n("Recurs")); // recurs? |
272 | mListView->addColumn(i18n("Cancelled")); | 272 | mListView->addColumn(i18n("Cancelled")); |
273 | mListView->addColumn(i18n("Categories")); | 273 | mListView->addColumn(i18n("Categories")); |
274 | mListView->addColumn(i18n("Calendar")); | 274 | mListView->addColumn(i18n("Calendar")); |
275 | mListView->addColumn(i18n("Last Modified")); | 275 | mListView->addColumn(i18n("Last Modified")); |
276 | 276 | ||
277 | mListView->setColumnAlignment(0,AlignLeft); | 277 | mListView->setColumnAlignment(0,AlignLeft); |
278 | mListView->setColumnAlignment(1,AlignLeft); | 278 | mListView->setColumnAlignment(1,AlignLeft); |
279 | mListView->setColumnAlignment(2,AlignHCenter); | 279 | mListView->setColumnAlignment(2,AlignHCenter); |
280 | mListView->setColumnAlignment(3,AlignLeft); | 280 | mListView->setColumnAlignment(3,AlignLeft); |
281 | mListView->setColumnAlignment(4,AlignHCenter); | 281 | mListView->setColumnAlignment(4,AlignHCenter); |
282 | mListView->setColumnAlignment(5,AlignLeft); | 282 | mListView->setColumnAlignment(5,AlignLeft); |
283 | mListView->setColumnAlignment(6,AlignLeft); | 283 | mListView->setColumnAlignment(6,AlignLeft); |
284 | mListView->setColumnAlignment(7,AlignLeft); | 284 | mListView->setColumnAlignment(7,AlignLeft); |
285 | mListView->setColumnAlignment(8,AlignLeft); | 285 | mListView->setColumnAlignment(8,AlignLeft); |
286 | mListView->setColumnAlignment(9,AlignLeft); | 286 | mListView->setColumnAlignment(9,AlignLeft); |
287 | mListView->setColumnAlignment(10,AlignLeft); | 287 | mListView->setColumnAlignment(10,AlignLeft); |
288 | mListView->setColumnAlignment(11,AlignLeft); | 288 | mListView->setColumnAlignment(11,AlignLeft); |
289 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 289 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
290 | 290 | ||
291 | int iii = 0; | 291 | int iii = 0; |
292 | for ( iii = 0; iii< 12 ; ++iii ) | 292 | for ( iii = 0; iii< 12 ; ++iii ) |
293 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 293 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
294 | 294 | ||
295 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 295 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
296 | layoutTop->addWidget(mListView); | 296 | layoutTop->addWidget(mListView); |
297 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 297 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
298 | mPopupMenu = eventPopup(); | 298 | mPopupMenu = eventPopup(); |
299 | QPopupMenu* selPopup = new QPopupMenu ( this ); | 299 | QPopupMenu* selPopup = new QPopupMenu ( this ); |
300 | mPopupMenu->insertSeparator(); | 300 | mPopupMenu->insertSeparator(); |
301 | 301 | ||
302 | selPopup->insertItem(i18n("All"),this, | 302 | selPopup->insertItem(i18n("All"),this, |
303 | SLOT(allSelection())); | 303 | SLOT(allSelection())); |
304 | selPopup->insertItem(i18n("None"),this, | 304 | selPopup->insertItem(i18n("None"),this, |
305 | SLOT(clearSelection())); | 305 | SLOT(clearSelection())); |
306 | selPopup->insertItem(i18n("Delete selected..."),this, | 306 | selPopup->insertItem(i18n("Delete selected..."),this, |
307 | SLOT(deleteAll())); | 307 | SLOT(deleteAll())); |
308 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); | 308 | mPopupMenu->insertItem(i18n("Selection"), selPopup ); |
309 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 309 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
310 | i18n("Hide all selected"),this, | 310 | i18n("Hide all selected"),this, |
311 | SLOT(hideAll()),true); | 311 | SLOT(hideAll()),true); |
312 | 312 | ||
313 | selPopup->insertSeparator(); | 313 | selPopup->insertSeparator(); |
314 | QPopupMenu * exportPO = new QPopupMenu ( this ); | 314 | QPopupMenu * exportPO = new QPopupMenu ( this ); |
315 | selPopup->insertItem( i18n("Export"), exportPO ); | 315 | selPopup->insertItem( i18n("Export"), exportPO ); |
316 | #ifdef DESKTOP_VERSION | 316 | #ifdef DESKTOP_VERSION |
317 | mPopupMenu->insertSeparator(); | 317 | mPopupMenu->insertSeparator(); |
318 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 318 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
319 | i18n("Print complete list..."),this, | 319 | i18n("Print complete list..."),this, |
320 | SLOT(printList()),true); | 320 | SLOT(printList()),true); |
321 | #endif | 321 | #endif |
322 | mCalPopup = new QPopupMenu ( this ); | 322 | mCalPopup = new QPopupMenu ( this ); |
323 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); | 323 | selPopup->insertItem( i18n("Set Calendar"), mCalPopup ); |
324 | 324 | ||
325 | selPopup->insertItem(i18n("Set categories")+"...",this, | 325 | selPopup->insertItem(i18n("Set categories")+"...",this, |
326 | SLOT(setCat()) ); | 326 | SLOT(setCat()) ); |
327 | selPopup->insertItem( i18n("Set alarm..."),this, | 327 | selPopup->insertItem( i18n("Set alarm..."),this, |
328 | SLOT(setAlarm())); | 328 | SLOT(setAlarm())); |
329 | #if 0 | 329 | #if 0 |
330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 330 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
331 | i18n("Set categories")+"...",this, | 331 | i18n("Set categories")+"...",this, |
332 | SLOT(setCat()),true); | 332 | SLOT(setCat()),true); |
333 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 333 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
334 | i18n("Set alarm..."),this, | 334 | i18n("Set alarm..."),this, |
335 | SLOT(setAlarm()),true); | 335 | SLOT(setAlarm()),true); |
336 | #endif | 336 | #endif |
337 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 337 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
338 | SLOT( populateCalPopup() )); | 338 | SLOT( populateCalPopup() )); |
339 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 339 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
340 | SLOT( setCalendar( int ) )); | 340 | SLOT( setCalendar( int ) )); |
341 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, | 341 | QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this, |
342 | SLOT( catChanged( Incidence * ) )); | 342 | SLOT( catChanged( Incidence * ) )); |
343 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, | 343 | exportPO->insertItem( i18n("As iCal (ics) file..."),this, |
344 | SLOT(saveToFile())); | 344 | SLOT(saveToFile())); |
345 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, | 345 | exportPO->insertItem( i18n("As vCal (vcs) file..."),this, |
346 | SLOT(saveToFileVCS())); | 346 | SLOT(saveToFileVCS())); |
347 | exportPO->insertItem( i18n("Journal/Details..."),this, | 347 | exportPO->insertItem( i18n("Journal/Details..."),this, |
348 | SLOT(saveDescriptionToFile())); | 348 | SLOT(saveDescriptionToFile())); |
349 | // mPopupMenu->insertSeparator(); | 349 | // mPopupMenu->insertSeparator(); |
350 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 350 | // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
351 | // i18n("Add Categ. to selected..."),this, | 351 | // i18n("Add Categ. to selected..."),this, |
352 | // SLOT(addCat()),true); | 352 | // SLOT(addCat()),true); |
353 | //mPopupMenu->insertSeparator(); | 353 | //mPopupMenu->insertSeparator(); |
354 | #ifndef DESKTOP_VERSION | 354 | #ifndef DESKTOP_VERSION |
355 | selPopup->insertSeparator(); | 355 | selPopup->insertSeparator(); |
356 | selPopup->insertItem( i18n("Beam via IR..."),this, | 356 | selPopup->insertItem( i18n("Beam via IR..."),this, |
357 | SLOT(beamSelected())); | 357 | SLOT(beamSelected())); |
358 | #if 0 | 358 | #if 0 |
359 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 359 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
360 | i18n("Beam via IR"),this, | 360 | i18n("Beam via IR"),this, |
361 | SLOT(beamSelected()),true); | 361 | SLOT(beamSelected()),true); |
362 | #endif | 362 | #endif |
363 | #endif | 363 | #endif |
364 | /* | 364 | /* |
365 | mPopupMenu = new QPopupMenu; | 365 | mPopupMenu = new QPopupMenu; |
366 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 366 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
367 | SLOT (editEvent())); | 367 | SLOT (editEvent())); |
368 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 368 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
369 | SLOT (deleteEvent())); | 369 | SLOT (deleteEvent())); |
370 | mPopupMenu->insertSeparator(); | 370 | mPopupMenu->insertSeparator(); |
371 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 371 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
372 | SLOT(showDates())); | 372 | SLOT(showDates())); |
373 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 373 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
374 | SLOT(hideDates())); | 374 | SLOT(hideDates())); |
375 | */ | 375 | */ |
376 | QObject::connect(mListView,SIGNAL( newEvent()), | 376 | QObject::connect(mListView,SIGNAL( newEvent()), |
377 | this,SIGNAL(signalNewEvent())); | 377 | this,SIGNAL(signalNewEvent())); |
378 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 378 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
379 | this,SLOT(defaultItemAction(QListViewItem *))); | 379 | this,SLOT(defaultItemAction(QListViewItem *))); |
380 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, | 380 | QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, |
381 | const QPoint &, int )), | 381 | const QPoint &, int )), |
382 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 382 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
383 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 383 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
384 | SLOT(processSelectionChange(QListViewItem *))); | 384 | SLOT(processSelectionChange(QListViewItem *))); |
385 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 385 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
386 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 386 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
387 | 387 | ||
388 | readSettings(KOGlobals::config(),"KOListView Layout"); | 388 | readSettings(KOGlobals::config(),"KOListView Layout"); |
389 | } | 389 | } |
390 | 390 | ||
391 | KOListView::~KOListView() | 391 | KOListView::~KOListView() |
392 | { | 392 | { |
393 | delete mPopupMenu; | 393 | delete mPopupMenu; |
394 | #if QT_VERSION >= 0x030000 | 394 | #if QT_VERSION >= 0x030000 |
395 | 395 | ||
396 | #else | 396 | #else |
397 | delete mKOListViewWhatsThis; | 397 | delete mKOListViewWhatsThis; |
398 | #endif | 398 | #endif |
399 | } | 399 | } |
400 | 400 | ||
401 | void KOListView::catChanged( Incidence* inc) | 401 | void KOListView::catChanged( Incidence* inc) |
402 | { | 402 | { |
403 | KOListViewItem* item = getItemForEvent(inc); | 403 | KOListViewItem* item = getItemForEvent(inc); |
404 | if (item) { | 404 | if (item) { |
405 | ListItemVisitor v(item, mStartDate ); | 405 | ListItemVisitor v(item, mStartDate ); |
406 | inc->accept(v); | 406 | inc->accept(v); |
407 | } | 407 | } |
408 | } | 408 | } |
409 | QString KOListView::getWhatsThisText(QPoint p) | 409 | QString KOListView::getWhatsThisText(QPoint p) |
410 | { | 410 | { |
411 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 411 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
412 | if ( item ) | 412 | if ( item ) |
413 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), | 413 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
414 | KOPrefs::instance()->mWTshowDetails, | 414 | KOPrefs::instance()->mWTshowDetails, |
415 | KOPrefs::instance()->mWTshowCreated, | 415 | KOPrefs::instance()->mWTshowCreated, |
416 | KOPrefs::instance()->mWTshowChanged); | 416 | KOPrefs::instance()->mWTshowChanged); |
417 | return i18n("That is the list view" ); | 417 | return i18n("That is the list view" ); |
418 | 418 | ||
419 | } | 419 | } |
420 | 420 | ||
421 | void KOListView::setCalendar( int c ) | 421 | void KOListView::setCalendar( int c ) |
422 | { | 422 | { |
423 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 423 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
424 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), | 424 | i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), |
425 | i18n("Continue"), i18n("Cancel"), 0, | 425 | i18n("Continue"), i18n("Cancel"), 0, |
426 | 0, 1 ); | 426 | 0, 1 ); |
427 | if ( result != 0 ) { | 427 | if ( result != 0 ) { |
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | 430 | ||
431 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 431 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
432 | int icount = delSel.count(); | 432 | int icount = delSel.count(); |
433 | if ( icount ) { | 433 | if ( icount ) { |
434 | Incidence *incidence = delSel.first(); | 434 | Incidence *incidence = delSel.first(); |
435 | while ( incidence ) { | 435 | while ( incidence ) { |
436 | incidence->setCalID( c ); | 436 | incidence->setCalID( c ); |
437 | KOListViewItem * item = getItemForEvent( incidence ); | 437 | KOListViewItem * item = getItemForEvent( incidence ); |
438 | if ( item ) { | 438 | if ( item ) { |
439 | ListItemVisitor v(item, mStartDate ); | 439 | ListItemVisitor v(item, mStartDate ); |
440 | incidence->accept(v); | 440 | incidence->accept(v); |
441 | } | 441 | } |
442 | incidence = delSel.next(); | 442 | incidence = delSel.next(); |
443 | } | 443 | } |
444 | } | 444 | } |
445 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 445 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
446 | KopiCalendarFile * cal = calendars.first(); | 446 | KopiCalendarFile * cal = calendars.first(); |
447 | while ( cal ) { | 447 | while ( cal ) { |
448 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); | 448 | mCalendar->setCalendarEnabled( cal->mCalNumber,cal->isEnabled ); |
449 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); | 449 | mCalendar->setAlarmEnabled( cal->mCalNumber, cal->isAlarmEnabled ); |
450 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); | 450 | mCalendar->setReadOnly( cal->mCalNumber, cal->isReadOnly ); |
451 | if ( cal->isStandard ) | 451 | if ( cal->isStandard ) |
452 | mCalendar->setDefaultCalendar( cal->mCalNumber ); | 452 | mCalendar->setDefaultCalendar( cal->mCalNumber ); |
453 | cal = calendars.next(); | 453 | cal = calendars.next(); |
454 | } | 454 | } |
455 | mCalendar->setSyncEventsReadOnly(); | 455 | mCalendar->setSyncEventsReadOnly(); |
456 | mCalendar->reInitAlarmSettings(); | 456 | mCalendar->reInitAlarmSettings(); |
457 | 457 | ||
458 | } | 458 | } |
459 | void KOListView::populateCalPopup() | 459 | void KOListView::populateCalPopup() |
460 | { | 460 | { |
461 | mCalPopup->clear(); | 461 | mCalPopup->clear(); |
462 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 462 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
463 | while ( kkf ) { | 463 | while ( kkf ) { |
464 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); | 464 | int index = mCalPopup->insertItem( kkf->mName+"...", kkf->mCalNumber); |
465 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 465 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
466 | mCalPopup->setItemEnabled( index, false ); | 466 | mCalPopup->setItemEnabled( index, false ); |
467 | kkf = KOPrefs::instance()->mCalendars.next(); | 467 | kkf = KOPrefs::instance()->mCalendars.next(); |
468 | } | 468 | } |
469 | } | 469 | } |
470 | void KOListView::updateList() | 470 | void KOListView::updateList() |
471 | { | 471 | { |
472 | // qDebug(" KOListView::updateList() "); | 472 | // qDebug(" KOListView::updateList() "); |
473 | 473 | ||
474 | } | 474 | } |
475 | 475 | ||
476 | void KOListView::clearList() | 476 | void KOListView::clearList() |
477 | { | 477 | { |
478 | clear (); | 478 | clear (); |
479 | } | 479 | } |
480 | 480 | ||
481 | void KOListView::setCat() | 481 | void KOListView::setCat() |
482 | { | 482 | { |
483 | 483 | ||
484 | bool set = true; | 484 | bool set = true; |
485 | int result = KMessageBox::warningYesNoCancel(this, | 485 | int result = KMessageBox::warningYesNoCancel(this, |
486 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), | 486 | i18n("Do you want to <b>add</b> categories to the selected items or <b>reset</b> the list (i.e. remove current categories)?"), |
487 | i18n("Set categories"), | 487 | i18n("Set categories"), |
488 | i18n("Add"), | 488 | i18n("Add"), |
489 | i18n("Reset")); | 489 | i18n("Reset")); |
490 | if (result == KMessageBox::Cancel) return; | 490 | if (result == KMessageBox::Cancel) return; |
491 | if (result == KMessageBox::Yes) set = false; | 491 | if (result == KMessageBox::Yes) set = false; |
492 | setCategories( set ); | 492 | setCategories( set ); |
493 | } | 493 | } |
494 | 494 | ||
495 | void KOListView::setAlarm() | 495 | void KOListView::setAlarm() |
496 | { | 496 | { |
497 | KOAlarmPrefs kap( this); | 497 | KOAlarmPrefs kap( this); |
498 | if ( !kap.exec() ) | 498 | if ( !kap.exec() ) |
499 | return; | 499 | return; |
500 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos | 500 | QPtrList<Incidence> delSel = getSelectedIncidences( true, true, false, true ); // no journals, only due todos |
501 | Incidence* inc = delSel.first(); | 501 | Incidence* inc = delSel.first(); |
502 | int count = 0; | 502 | int count = 0; |
503 | while ( inc ) { | 503 | while ( inc ) { |
504 | ++count; | 504 | ++count; |
505 | if (kap.mAlarmButton->isChecked()) { | 505 | if (kap.mAlarmButton->isChecked()) { |
506 | if (inc->alarms().count() == 0) | 506 | if (inc->alarms().count() == 0) |
507 | inc->newAlarm(); | 507 | inc->newAlarm(); |
508 | Alarm *alarm = inc->alarms().first(); | 508 | Alarm *alarm = inc->alarms().first(); |
509 | alarm->setEnabled(true); | 509 | alarm->setEnabled(true); |
510 | int j = kap.mAlarmTimeEdit->value()* -60; | 510 | int j = kap.mAlarmTimeEdit->value()* -60; |
511 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 511 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
512 | j = j * 60; | 512 | j = j * 60; |
513 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 513 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
514 | j = j * (60 * 24); | 514 | j = j * (60 * 24); |
515 | alarm->setStartOffset( j ); | 515 | alarm->setStartOffset( j ); |
516 | 516 | ||
517 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 517 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
518 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 518 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
519 | } | 519 | } |
520 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 520 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
521 | alarm->setAudioAlarm(kap.mAlarmSound); | 521 | alarm->setAudioAlarm(kap.mAlarmSound); |
522 | else | 522 | else |
523 | alarm->setType(Alarm::Invalid); | 523 | alarm->setType(Alarm::Invalid); |
524 | } else { | 524 | } else { |
525 | QPtrList<Alarm> alarms = inc->alarms(); | 525 | QPtrList<Alarm> alarms = inc->alarms(); |
526 | Alarm *alarm; | 526 | Alarm *alarm; |
527 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 527 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
528 | alarm->setEnabled(false); | 528 | alarm->setEnabled(false); |
529 | alarm->setType(Alarm::Invalid); | 529 | alarm->setType(Alarm::Invalid); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | KOListViewItem* item = getItemForEvent(inc); | 532 | KOListViewItem* item = getItemForEvent(inc); |
533 | if (item) { | 533 | if (item) { |
534 | ListItemVisitor v(item, mStartDate ); | 534 | ListItemVisitor v(item, mStartDate ); |
535 | inc->accept(v); | 535 | inc->accept(v); |
536 | } | 536 | } |
537 | inc = delSel.next(); | 537 | inc = delSel.next(); |
538 | } | 538 | } |
539 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); | 539 | topLevelWidget()->setCaption( i18n("Changed alarm for %1 items").arg( count ) ); |
540 | qDebug("KO: Set alarm for %d items", count); | 540 | qDebug("KO: Set alarm for %d items", count); |
541 | calendar()->reInitAlarmSettings(); | 541 | calendar()->reInitAlarmSettings(); |
542 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 542 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
543 | } | 543 | } |
544 | void KOListView::setCategories( bool removeOld ) | 544 | void KOListView::setCategories( bool removeOld ) |
545 | { | 545 | { |
546 | 546 | ||
547 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 547 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
548 | csd->setColorEnabled(); | 548 | csd->setColorEnabled(); |
549 | if (! csd->exec()) { | 549 | if (! csd->exec()) { |
550 | delete csd; | 550 | delete csd; |
551 | return; | 551 | return; |
552 | } | 552 | } |
553 | QStringList catList = csd->selectedCategories(); | 553 | QStringList catList = csd->selectedCategories(); |
554 | delete csd; | 554 | delete csd; |
555 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 555 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
556 | Incidence* inc = delSel.first(); | 556 | Incidence* inc = delSel.first(); |
557 | while ( inc ) { | 557 | while ( inc ) { |
558 | if ( removeOld ) { | 558 | if ( removeOld ) { |
559 | inc->setCategories( catList, false ); | 559 | inc->setCategories( catList, false ); |
560 | } else { | 560 | } else { |
561 | inc->addCategories( catList, false ); | 561 | inc->addCategories( catList, false ); |
562 | } | 562 | } |
563 | KOListViewItem* item = getItemForEvent(inc); | 563 | KOListViewItem* item = getItemForEvent(inc); |
564 | if (item) { | 564 | if (item) { |
565 | ListItemVisitor v(item, mStartDate ); | 565 | ListItemVisitor v(item, mStartDate ); |
566 | inc->accept(v); | 566 | inc->accept(v); |
567 | } | 567 | } |
568 | inc = delSel.next(); | 568 | inc = delSel.next(); |
569 | } | 569 | } |
570 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 570 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
571 | } | 571 | } |
572 | 572 | ||
573 | void KOListView::beamSelected() | 573 | void KOListView::beamSelected() |
574 | { | 574 | { |
575 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 575 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
576 | if ( delSel.count() ) | 576 | if ( delSel.count() ) |
577 | emit beamIncidenceList( delSel ); | 577 | emit beamIncidenceList( delSel ); |
578 | } | 578 | } |
579 | 579 | ||
580 | void KOListView::saveDescriptionToFile() | 580 | void KOListView::saveDescriptionToFile() |
581 | { | 581 | { |
582 | 582 | ||
583 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), | 583 | int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), |
584 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), | 584 | i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), |
585 | i18n("Continue"), i18n("Cancel"), 0, | 585 | i18n("Continue"), i18n("Cancel"), 0, |
586 | 0, 1 ); | 586 | 0, 1 ); |
587 | if ( result != 0 ) { | 587 | if ( result != 0 ) { |
588 | return; | 588 | return; |
589 | } | 589 | } |
590 | QPtrList<Incidence> delSel = getSelectedIncidences() ; | 590 | QPtrList<Incidence> delSel = getSelectedIncidences() ; |
591 | int icount = delSel.count(); | 591 | int icount = delSel.count(); |
592 | if ( icount ) { | 592 | if ( icount ) { |
593 | QString fn = KOPrefs::instance()->mLastSaveFile; | 593 | QString fn = KOPrefs::instance()->mLastSaveFile; |
594 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 594 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
595 | 595 | ||
596 | if ( fn == "" ) | 596 | if ( fn == "" ) |
597 | return; | 597 | return; |
598 | QFileInfo info; | 598 | QFileInfo info; |
599 | info.setFile( fn ); | 599 | info.setFile( fn ); |
600 | QString mes; | 600 | QString mes; |
601 | bool createbup = true; | 601 | bool createbup = true; |
602 | if ( info. exists() ) { | 602 | if ( info. exists() ) { |
603 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 603 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
604 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 604 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
605 | i18n("Overwrite!"), i18n("Cancel"), 0, | 605 | i18n("Overwrite!"), i18n("Cancel"), 0, |
606 | 0, 1 ); | 606 | 0, 1 ); |
607 | if ( result != 0 ) { | 607 | if ( result != 0 ) { |
608 | createbup = false; | 608 | createbup = false; |
609 | } | 609 | } |
610 | } | 610 | } |
611 | if ( createbup ) { | 611 | if ( createbup ) { |
612 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + | 612 | QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + |
613 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); | 613 | KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); |
614 | Incidence *incidence = delSel.first(); | 614 | Incidence *incidence = delSel.first(); |
615 | icount = 0; | 615 | icount = 0; |
616 | while ( incidence ) { | 616 | while ( incidence ) { |
617 | if ( incidence->typeID() == journalID ) { | 617 | if ( incidence->typeID() == journalID ) { |
618 | text += "\n************************************\n"; | 618 | text += "\n************************************\n"; |
619 | if ( !incidence->summary().isEmpty() ) | 619 | if ( !incidence->summary().isEmpty() ) |
620 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); | 620 | text += i18n("Journal: %1 from ").arg( incidence->summary() ) +incidence->dtStartDateStr( false ); |
621 | else | 621 | else |
622 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); | 622 | text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); |
623 | if ( !incidence->location().isEmpty() ) | 623 | if ( !incidence->location().isEmpty() ) |
624 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 624 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
625 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 625 | text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
626 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); | 626 | text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); |
627 | ++icount; | 627 | ++icount; |
628 | 628 | ||
629 | } else { | 629 | } else { |
630 | if ( !incidence->description().isEmpty() ) { | 630 | if ( !incidence->description().isEmpty() ) { |
631 | text += "\n************************************\n"; | 631 | text += "\n************************************\n"; |
632 | if ( incidence->typeID() == todoID ) | 632 | if ( incidence->typeID() == todoID ) |
633 | text += i18n("To-Do: "); | 633 | text += i18n("To-Do: "); |
634 | text += incidence->summary(); | 634 | text += incidence->summary(); |
635 | if ( !incidence->location().isEmpty() ) | 635 | if ( !incidence->location().isEmpty() ) |
636 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; | 636 | text +="\n(" + i18n("Location: ") + incidence->location()+ ")"; |
637 | if ( incidence->hasStartDate() ) | 637 | if ( incidence->hasStartDate() ) |
638 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); | 638 | text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); |
639 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); | 639 | text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); |
640 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); | 640 | text += "\n" + i18n("Description: ") + "\n" + incidence->description(); |
641 | ++icount; | 641 | ++icount; |
642 | 642 | ||
643 | } | 643 | } |
644 | } | 644 | } |
645 | incidence = delSel.next(); | 645 | incidence = delSel.next(); |
646 | } | 646 | } |
647 | QFile file( fn ); | 647 | QFile file( fn ); |
648 | if (!file.open( IO_WriteOnly ) ) { | 648 | if (!file.open( IO_WriteOnly ) ) { |
649 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); | 649 | topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); |
650 | return; | 650 | return; |
651 | } | 651 | } |
652 | QTextStream ts( &file ); | 652 | QTextStream ts( &file ); |
653 | ts << text; | 653 | ts << text; |
654 | file.close(); | 654 | file.close(); |
655 | //qDebug("%s ", text.latin1()); | 655 | //qDebug("%s ", text.latin1()); |
656 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); | 656 | mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); |
657 | KOPrefs::instance()->mLastSaveFile = fn; | 657 | KOPrefs::instance()->mLastSaveFile = fn; |
658 | topLevelWidget()->setCaption(mes); | 658 | topLevelWidget()->setCaption(mes); |
659 | } | 659 | } |
660 | } | 660 | } |
661 | } | 661 | } |
662 | void KOListView::saveToFileVCS() | 662 | void KOListView::saveToFileVCS() |
663 | { | 663 | { |
664 | writeToFile( false ); | 664 | writeToFile( false ); |
665 | } | 665 | } |
666 | void KOListView::saveToFile() | 666 | void KOListView::saveToFile() |
667 | { | 667 | { |
668 | writeToFile( true ); | 668 | writeToFile( true ); |
669 | } | 669 | } |
670 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) | 670 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents, bool includeTodos, bool includeJournals, bool onlyDueTodos ) |
671 | { | 671 | { |
672 | QPtrList<Incidence> delSel ; | 672 | QPtrList<Incidence> delSel ; |
673 | bool addSubTodos = false; | 673 | bool addSubTodos = false; |
674 | bool askSubTodos = true; | 674 | bool askSubTodos = true; |
675 | QListViewItem *item = mListView->firstChild (); | 675 | QListViewItem *item = mListView->firstChild (); |
676 | while ( item ) { | 676 | while ( item ) { |
677 | if ( item->isSelected() ) { | 677 | if ( item->isSelected() ) { |
678 | Incidence* inc = ((KOListViewItem *)item)->data(); | 678 | Incidence* inc = ((KOListViewItem *)item)->data(); |
679 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { | 679 | if ( ( addSubTodos && delSel.findRef( inc ) == -1) || !addSubTodos ) { |
680 | if ( (inc->typeID() == todoID && includeTodos) || | 680 | if ( (inc->typeID() == todoID && includeTodos) || |
681 | (inc->typeID() == eventID && includeEvents) || | 681 | (inc->typeID() == eventID && includeEvents) || |
682 | (inc->typeID() == journalID && includeJournals) ) { | 682 | (inc->typeID() == journalID && includeJournals) ) { |
683 | if ( inc->typeID() == todoID && onlyDueTodos ) { | 683 | if ( inc->typeID() == todoID && onlyDueTodos ) { |
684 | if ( ((Todo*)inc)->hasDueDate() ) | 684 | if ( ((Todo*)inc)->hasDueDate() ) |
685 | delSel.append( inc ); | 685 | delSel.append( inc ); |
686 | } else | 686 | } else |
687 | delSel.append( inc ); | 687 | delSel.append( inc ); |
688 | 688 | ||
689 | } | 689 | } |
690 | } | 690 | } |
691 | if ( inc->typeID() == todoID ) { | 691 | if ( inc->typeID() == todoID ) { |
692 | Todo * todo = (Todo*) inc; | 692 | Todo * todo = (Todo*) inc; |
693 | if ( todo->relations().count() ) { | 693 | if ( todo->relations().count() ) { |
694 | if ( askSubTodos ) { | 694 | if ( askSubTodos ) { |
695 | int result = KMessageBox::warningYesNoCancel(this, | 695 | int result = KMessageBox::warningYesNoCancel(this, |
696 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), | 696 | i18n("One (or more) selected\ntodo has subtodos!\nDo you want to select\nall subtodos of all\nselected todos as well?"), |
697 | i18n("Todo has subtodos"), | 697 | i18n("Todo has subtodos"), |
698 | i18n("Yes"), | 698 | i18n("Yes"), |
699 | i18n("No")); | 699 | i18n("No")); |
700 | if ( result == KMessageBox::Cancel ) { | 700 | if ( result == KMessageBox::Cancel ) { |
701 | delSel.clear(); | 701 | delSel.clear(); |
702 | return delSel; | 702 | return delSel; |
703 | } | 703 | } |
704 | if (result == KMessageBox::Yes) | 704 | if (result == KMessageBox::Yes) |
705 | addSubTodos = true; | 705 | addSubTodos = true; |
706 | askSubTodos = false; | 706 | askSubTodos = false; |
707 | } | 707 | } |
708 | if ( addSubTodos ) { | 708 | if ( addSubTodos ) { |
709 | QPtrList<Incidence> tempSel ; | 709 | QPtrList<Incidence> tempSel ; |
710 | inc->addRelationsToList( &tempSel ); | 710 | inc->addRelationsToList( &tempSel ); |
711 | Incidence* tempinc = tempSel.first(); | 711 | Incidence* tempinc = tempSel.first(); |
712 | while ( tempinc ) { | 712 | while ( tempinc ) { |
713 | if ( delSel.findRef( tempinc ) == -1 ) { | 713 | if ( delSel.findRef( tempinc ) == -1 ) { |
714 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { | 714 | if ( tempinc->typeID() == todoID && onlyDueTodos ) { |
715 | if ( ((Todo*)tempinc)->hasDueDate() ) | 715 | if ( ((Todo*)tempinc)->hasDueDate() ) |
716 | delSel.append( tempinc ); | 716 | delSel.append( tempinc ); |
717 | } else | 717 | } else |
718 | delSel.append( tempinc ); | 718 | delSel.append( tempinc ); |
719 | } | 719 | } |
720 | tempinc = tempSel.next(); | 720 | tempinc = tempSel.next(); |
721 | } | 721 | } |
722 | } | 722 | } |
723 | } | 723 | } |
724 | } | 724 | } |
725 | } | 725 | } |
726 | item = item->nextSibling(); | 726 | item = item->nextSibling(); |
727 | } | 727 | } |
728 | return delSel; | 728 | return delSel; |
729 | } | 729 | } |
730 | 730 | ||
731 | void KOListView::writeToFile( bool iCal ) | 731 | void KOListView::writeToFile( bool iCal ) |
732 | { | 732 | { |
733 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; | 733 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed; |
734 | if ( !iCal ) { | 734 | if ( !iCal ) { |
735 | bool journal = false; | 735 | bool journal = false; |
736 | Incidence *incidence = delSel.first(); | 736 | Incidence *incidence = delSel.first(); |
737 | while ( incidence ) { | 737 | while ( incidence ) { |
738 | if ( incidence->typeID() == journalID ) { | 738 | if ( incidence->typeID() == journalID ) { |
739 | journal = true; | 739 | journal = true; |
740 | break; | 740 | break; |
741 | } | 741 | } |
742 | incidence = delSel.next(); | 742 | incidence = delSel.next(); |
743 | } | 743 | } |
744 | if ( journal ) { | 744 | if ( journal ) { |
745 | int result = KMessageBox::warningContinueCancel(this, | 745 | int result = KMessageBox::warningContinueCancel(this, |
746 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 746 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
747 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 747 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
748 | true); | 748 | true); |
749 | if (result != KMessageBox::Continue) return; | 749 | if (result != KMessageBox::Continue) return; |
750 | } | 750 | } |
751 | } | 751 | } |
752 | if ( delSel.count() ) { | 752 | if ( delSel.count() ) { |
753 | QString fn = KOPrefs::instance()->mLastSaveFile; | 753 | QString fn = KOPrefs::instance()->mLastSaveFile; |
754 | QString extension; | 754 | QString extension; |
755 | if ( iCal ) { | 755 | if ( iCal ) { |
756 | if ( fn.right( 4 ).lower() == ".vcs" ) { | 756 | if ( fn.right( 4 ).lower() == ".vcs" ) { |
757 | fn = fn.left( fn.length() -3) + "ics"; | 757 | fn = fn.left( fn.length() -3) + "ics"; |
758 | } | 758 | } |
759 | } else { | 759 | } else { |
760 | if ( fn.right( 4 ).lower() == ".ics" ) { | 760 | if ( fn.right( 4 ).lower() == ".ics" ) { |
761 | fn = fn.left( fn.length() -3) + "vcs"; | 761 | fn = fn.left( fn.length() -3) + "vcs"; |
762 | } | 762 | } |
763 | } | 763 | } |
764 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); | 764 | fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); |
765 | 765 | ||
766 | if ( fn == "" ) | 766 | if ( fn == "" ) |
767 | return; | 767 | return; |
768 | QFileInfo info; | 768 | QFileInfo info; |
769 | info.setFile( fn ); | 769 | info.setFile( fn ); |
770 | QString mes; | 770 | QString mes; |
771 | bool createbup = true; | 771 | bool createbup = true; |
772 | if ( info. exists() ) { | 772 | if ( info. exists() ) { |
773 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 773 | mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
774 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 774 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
775 | i18n("Overwrite!"), i18n("Cancel"), 0, | 775 | i18n("Overwrite!"), i18n("Cancel"), 0, |
776 | 0, 1 ); | 776 | 0, 1 ); |
777 | if ( result != 0 ) { | 777 | if ( result != 0 ) { |
778 | createbup = false; | 778 | createbup = false; |
779 | } | 779 | } |
780 | } | 780 | } |
781 | if ( createbup ) { | 781 | if ( createbup ) { |
782 | CalendarLocal cal; | 782 | CalendarLocal cal; |
783 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 783 | cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
784 | Incidence *incidence = delSel.first(); | 784 | Incidence *incidence = delSel.first(); |
785 | while ( incidence ) { | 785 | while ( incidence ) { |
786 | cal.addIncidence( incidence->clone() ); | 786 | cal.addIncidence( incidence->clone() ); |
787 | incidence = delSel.next(); | 787 | incidence = delSel.next(); |
788 | } | 788 | } |
789 | if ( iCal ) { | 789 | if ( iCal ) { |
790 | ICalFormat format; | 790 | ICalFormat format; |
791 | format.save( &cal, fn ); | 791 | format.save( &cal, fn ); |
792 | } else { | 792 | } else { |
793 | 793 | ||
794 | VCalFormat format; | 794 | VCalFormat format; |
795 | format.save( &cal, fn ); | 795 | format.save( &cal, fn ); |
796 | } | 796 | } |
797 | mes = i18n("KO/Pi:Saved %1").arg(fn ); | 797 | mes = i18n("KO/Pi:Saved %1").arg(fn ); |
798 | KOPrefs::instance()->mLastSaveFile = fn; | 798 | KOPrefs::instance()->mLastSaveFile = fn; |
799 | topLevelWidget()->setCaption(mes); | 799 | topLevelWidget()->setCaption(mes); |
800 | } | 800 | } |
801 | } | 801 | } |
802 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); | 802 | QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); |
803 | } | 803 | } |
804 | void KOListView::hideAll() | 804 | void KOListView::hideAll() |
805 | { | 805 | { |
806 | QPtrList<QListViewItem> delSel ; | 806 | QPtrList<QListViewItem> delSel ; |
807 | QListViewItem *item = mListView->firstChild (); | 807 | QListViewItem *item = mListView->firstChild (); |
808 | while ( item ) { | 808 | while ( item ) { |
809 | if ( item->isSelected() ) { | 809 | if ( item->isSelected() ) { |
810 | delSel.append(item); | 810 | delSel.append(item); |
811 | } | 811 | } |
812 | item = item->nextSibling(); | 812 | item = item->nextSibling(); |
813 | } | 813 | } |
814 | item = delSel.first() ; | 814 | item = delSel.first() ; |
815 | while ( item ) { | 815 | while ( item ) { |
816 | QListViewItem * del = item; | 816 | QListViewItem * del = item; |
817 | item = delSel.next(); | 817 | item = delSel.next(); |
818 | delete del; | 818 | delete del; |
819 | } | 819 | } |
820 | } | 820 | } |
821 | void KOListView::printList() | 821 | void KOListView::printList() |
822 | { | 822 | { |
823 | mListView->printList(); | 823 | mListView->printList(); |
824 | } | 824 | } |
825 | void KOListView::deleteAll() | 825 | void KOListView::deleteAll() |
826 | { | 826 | { |
827 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; | 827 | QPtrList<Incidence> delSel = getSelectedIncidences(); // all inc allowed;; |
828 | if ( delSel.count() ) { | 828 | if ( delSel.count() ) { |
829 | int icount = delSel.count(); | 829 | int icount = delSel.count(); |
830 | Incidence *incidence = delSel.first(); | 830 | Incidence *incidence = delSel.first(); |
831 | Incidence *toDelete; | 831 | Incidence *toDelete; |
832 | KOPrefs *p = KOPrefs::instance(); | 832 | KOPrefs *p = KOPrefs::instance(); |
833 | bool confirm = p->mConfirm; | 833 | bool confirm = p->mConfirm; |
834 | QString mess; | 834 | QString mess; |
835 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); | 835 | mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); |
836 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { | 836 | if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { |
837 | p->mConfirm = false; | 837 | p->mConfirm = false; |
838 | int delCounter = 0; | 838 | int delCounter = 0; |
839 | QDialog dia ( this, "p-dialog", true ); | 839 | QDialog dia ( this, "p-dialog", true ); |
840 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); | 840 | QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); |
841 | QVBoxLayout lay( &dia ); | 841 | QVBoxLayout lay( &dia ); |
842 | lay.setMargin(7); | 842 | lay.setMargin(7); |
843 | lay.setSpacing(7); | 843 | lay.setSpacing(7); |
844 | lay.addWidget( &lab); | 844 | lay.addWidget( &lab); |
845 | QProgressBar bar( icount, &dia ); | 845 | QProgressBar bar( icount, &dia ); |
846 | lay.addWidget( &bar); | 846 | lay.addWidget( &bar); |
847 | int w = 220; | 847 | int w = 220; |
848 | int h = 50; | 848 | int h = 50; |
849 | int dw = QApplication::desktop()->width(); | 849 | int dw = QApplication::desktop()->width(); |
850 | int dh = QApplication::desktop()->height(); | 850 | int dh = QApplication::desktop()->height(); |
851 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 851 | dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
852 | //dia.resize( 240,50 ); | 852 | //dia.resize( 240,50 ); |
853 | dia.show(); | 853 | dia.show(); |
854 | KOPrefs::instance()->mGlobalUpdateDisabled = true; | 854 | KOPrefs::instance()->mGlobalUpdateDisabled = true; |
855 | while ( incidence ) { | 855 | while ( incidence ) { |
856 | bar.setProgress( delCounter ); | 856 | bar.setProgress( delCounter ); |
857 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); | 857 | mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); |
858 | dia.setCaption( mess ); | 858 | dia.setCaption( mess ); |
859 | qApp->processEvents(); | 859 | qApp->processEvents(); |
860 | toDelete = (incidence); | 860 | toDelete = (incidence); |
861 | incidence = delSel.next(); | 861 | incidence = delSel.next(); |
862 | emit deleteIncidenceSignal(toDelete ); | 862 | emit deleteIncidenceSignal(toDelete ); |
863 | if ( dia.result() != 0 ) | 863 | if ( dia.result() != 0 ) |
864 | break; | 864 | break; |
865 | 865 | ||
866 | } | 866 | } |
867 | KOPrefs::instance()->mGlobalUpdateDisabled = false; | 867 | KOPrefs::instance()->mGlobalUpdateDisabled = false; |
868 | emit deleteIncidenceSignal( 0 ); | 868 | emit deleteIncidenceSignal( 0 ); |
869 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); | 869 | mess = mess.sprintf( i18n("%d items remaining in list."), count() ); |
870 | topLevelWidget ()->setCaption( mess ); | 870 | topLevelWidget ()->setCaption( mess ); |
871 | p->mConfirm = confirm; | 871 | p->mConfirm = confirm; |
872 | } | 872 | } |
873 | } | 873 | } |
874 | 874 | ||
875 | 875 | ||
876 | } | 876 | } |
877 | int KOListView::maxDatesHint() | 877 | int KOListView::maxDatesHint() |
878 | { | 878 | { |
879 | return 0; | 879 | return 0; |
880 | } | 880 | } |
881 | 881 | ||
882 | int KOListView::currentDateCount() | 882 | int KOListView::currentDateCount() |
883 | { | 883 | { |
884 | return 0; | 884 | return 0; |
885 | } | 885 | } |
886 | 886 | ||
887 | QPtrList<Incidence> KOListView::selectedIncidences() | 887 | QPtrList<Incidence> KOListView::selectedIncidences() |
888 | { | 888 | { |
889 | QPtrList<Incidence> eventList; | 889 | QPtrList<Incidence> eventList; |
890 | QListViewItem *item = mListView->firstChild (); | 890 | QListViewItem *item = mListView->firstChild (); |
891 | while ( item ) { | 891 | while ( item ) { |
892 | if ( item->isSelected() ) { | 892 | if ( item->isSelected() ) { |
893 | eventList.append(((KOListViewItem *)item)->data()); | 893 | eventList.append(((KOListViewItem *)item)->data()); |
894 | } | 894 | } |
895 | 895 | ||
896 | item = item->nextSibling(); | 896 | item = item->nextSibling(); |
897 | } | 897 | } |
898 | 898 | ||
899 | // // QListViewItem *item = mListView->selectedItem(); | 899 | // // QListViewItem *item = mListView->selectedItem(); |
900 | //if (item) eventList.append(((KOListViewItem *)item)->data()); | 900 | //if (item) eventList.append(((KOListViewItem *)item)->data()); |
901 | 901 | ||
902 | return eventList; | 902 | return eventList; |
903 | } | 903 | } |
904 | 904 | ||
905 | DateList KOListView::selectedDates() | 905 | DateList KOListView::selectedDates() |
906 | { | 906 | { |
907 | DateList eventList; | 907 | DateList eventList; |
908 | return eventList; | 908 | return eventList; |
909 | } | 909 | } |
910 | 910 | ||
911 | void KOListView::showDates(bool show) | 911 | void KOListView::showDates(bool show) |
912 | { | 912 | { |
913 | // Shouldn't we set it to a value greater 0? When showDates is called with | 913 | // Shouldn't we set it to a value greater 0? When showDates is called with |
914 | // show == true at first, then the columnwidths are set to zero. | 914 | // show == true at first, then the columnwidths are set to zero. |
915 | static int oldColWidth1 = 0; | 915 | static int oldColWidth1 = 0; |
916 | static int oldColWidth3 = 0; | 916 | static int oldColWidth3 = 0; |
917 | 917 | ||
918 | if (!show) { | 918 | if (!show) { |
919 | oldColWidth1 = mListView->columnWidth(1); | 919 | oldColWidth1 = mListView->columnWidth(1); |
920 | oldColWidth3 = mListView->columnWidth(3); | 920 | oldColWidth3 = mListView->columnWidth(3); |
921 | mListView->setColumnWidth(1, 0); | 921 | mListView->setColumnWidth(1, 0); |
922 | mListView->setColumnWidth(3, 0); | 922 | mListView->setColumnWidth(3, 0); |
923 | } else { | 923 | } else { |
924 | mListView->setColumnWidth(1, oldColWidth1); | 924 | mListView->setColumnWidth(1, oldColWidth1); |
925 | mListView->setColumnWidth(3, oldColWidth3); | 925 | mListView->setColumnWidth(3, oldColWidth3); |
926 | } | 926 | } |
927 | mListView->repaint(); | 927 | mListView->repaint(); |
928 | } | 928 | } |
929 | 929 | ||
930 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 930 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
931 | const QDate &td) | 931 | const QDate &td) |
932 | { | 932 | { |
933 | #ifndef KORG_NOPRINTER | 933 | #ifndef KORG_NOPRINTER |
934 | calPrinter->preview(CalPrinter::Day, fd, td); | 934 | calPrinter->preview(CalPrinter::Day, fd, td); |
935 | #endif | 935 | #endif |
936 | } | 936 | } |
937 | 937 | ||
938 | void KOListView::showDates() | 938 | void KOListView::showDates() |
939 | { | 939 | { |
940 | showDates(true); | 940 | showDates(true); |
941 | } | 941 | } |
942 | 942 | ||
943 | void KOListView::hideDates() | 943 | void KOListView::hideDates() |
944 | { | 944 | { |
945 | showDates(false); | 945 | showDates(false); |
946 | } | 946 | } |
947 | 947 | ||
948 | void KOListView::resetFocus() | 948 | void KOListView::resetFocus() |
949 | { | 949 | { |
950 | topLevelWidget()->setActiveWindow(); | 950 | topLevelWidget()->setActiveWindow(); |
951 | topLevelWidget()->raise(); | 951 | topLevelWidget()->raise(); |
952 | mListView->setFocus(); | 952 | mListView->setFocus(); |
953 | } | 953 | } |
954 | void KOListView::updateView() | 954 | void KOListView::updateView() |
955 | { | 955 | { |
956 | mListView->setFocus(); | 956 | mListView->setFocus(); |
957 | if ( mListView->firstChild () ) { | 957 | if ( mListView->firstChild () ) { |
958 | mListView->setCurrentItem( mListView->firstChild () ); | 958 | mListView->setCurrentItem( mListView->firstChild () ); |
959 | } | 959 | } |
960 | processSelectionChange( mListView->firstChild () ); | 960 | processSelectionChange( mListView->firstChild () ); |
961 | } | 961 | } |
962 | void KOListView::updateConfig() | 962 | void KOListView::updateConfig() |
963 | { | 963 | { |
964 | 964 | ||
965 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 965 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
966 | updateView(); | 966 | updateView(); |
967 | 967 | ||
968 | } | 968 | } |
969 | void KOListView::setStartDate(const QDate &start) | 969 | void KOListView::setStartDate(const QDate &start) |
970 | { | 970 | { |
971 | mStartDate = start; | 971 | mStartDate = start; |
972 | } | 972 | } |
973 | 973 | ||
974 | void KOListView::showDates(const QDate &start, const QDate &end) | 974 | void KOListView::showDates(const QDate &start, const QDate &end) |
975 | { | 975 | { |
976 | clear(); | 976 | clear(); |
977 | mStartDate = start; | 977 | mStartDate = start; |
978 | QDate date = start; | 978 | QDate date = start; |
979 | while( date <= end ) { | 979 | while( date <= end ) { |
980 | addEvents(calendar()->events(date)); | 980 | addEvents(calendar()->events(date)); |
981 | addTodos(calendar()->todos(date)); | 981 | addTodos(calendar()->todos(date)); |
982 | addJournals( calendar()->journals4Date(date) ); | 982 | addJournals( calendar()->journals4Date(date) ); |
983 | date = date.addDays( 1 ); | 983 | date = date.addDays( 1 ); |
984 | } | 984 | } |
985 | //emit incidenceSelected( 0 ); | 985 | //emit incidenceSelected( 0 ); |
986 | updateView(); | 986 | updateView(); |
987 | 987 | ||
988 | } | 988 | } |
989 | 989 | ||
990 | void KOListView::addEvents(QPtrList<Event> eventList) | 990 | void KOListView::addEvents(QPtrList<Event> eventList) |
991 | { | 991 | { |
992 | 992 | ||
993 | Event *ev; | 993 | Event *ev; |
994 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 994 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
995 | addIncidence(ev); | 995 | addIncidence(ev); |
996 | } | 996 | } |
997 | if ( !mListView->currentItem() ){ | 997 | if ( !mListView->currentItem() ){ |
998 | updateView(); | 998 | updateView(); |
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | void KOListView::addTodos(QPtrList<Todo> eventList) | 1002 | void KOListView::addTodos(QPtrList<Todo> eventList) |
1003 | { | 1003 | { |
1004 | Todo *ev; | 1004 | Todo *ev; |
1005 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1005 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1006 | addIncidence(ev); | 1006 | addIncidence(ev); |
1007 | } | 1007 | } |
1008 | if ( !mListView->currentItem() ){ | 1008 | if ( !mListView->currentItem() ){ |
1009 | updateView(); | 1009 | updateView(); |
1010 | } | 1010 | } |
1011 | } | 1011 | } |
1012 | void KOListView::addJournals(QPtrList<Journal> eventList) | 1012 | void KOListView::addJournals(QPtrList<Journal> eventList) |
1013 | { | 1013 | { |
1014 | Journal *ev; | 1014 | Journal *ev; |
1015 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1015 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1016 | addIncidence(ev); | 1016 | addIncidence(ev); |
1017 | } | 1017 | } |
1018 | if ( !mListView->currentItem() ){ | 1018 | if ( !mListView->currentItem() ){ |
1019 | updateView(); | 1019 | updateView(); |
1020 | } | 1020 | } |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void KOListView::showCompletedTodos() | 1023 | void KOListView::showCompletedTodos() |
1024 | { | 1024 | { |
1025 | mForceShowCompletedTodos = true; | 1025 | mForceShowCompletedTodos = true; |
1026 | } | 1026 | } |
1027 | void KOListView::addIncidence(Incidence *incidence) | 1027 | void KOListView::addIncidence(Incidence *incidence) |
1028 | { | 1028 | { |
1029 | if ( mUidDict.find( incidence->uid() ) ) return; | 1029 | if ( mUidDict.find( incidence->uid() ) ) return; |
1030 | 1030 | ||
1031 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 1031 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
1032 | if ( incidence->typeID() == todoID ) { | 1032 | if ( incidence->typeID() == todoID ) { |
1033 | if ( ! mForceShowCompletedTodos ) { | 1033 | if ( ! mForceShowCompletedTodos ) { |
1034 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) | 1034 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) |
1035 | return; | 1035 | return; |
1036 | } | 1036 | } |
1037 | } | 1037 | } |
1038 | mUidDict.insert( incidence->uid(), incidence ); | 1038 | mUidDict.insert( incidence->uid(), incidence ); |
1039 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 1039 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
1040 | ListItemVisitor v(item, mStartDate ); | 1040 | ListItemVisitor v(item, mStartDate ); |
1041 | if (incidence->accept(v)) { | 1041 | if (incidence->accept(v)) { |
1042 | return; | 1042 | return; |
1043 | } | 1043 | } |
1044 | else delete item; | 1044 | else delete item; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | void KOListView::showEvents(QPtrList<Event> eventList) | 1047 | void KOListView::showEvents(QPtrList<Event> eventList) |
1048 | { | 1048 | { |
1049 | clear(); | 1049 | clear(); |
1050 | 1050 | ||
1051 | addEvents(eventList); | 1051 | addEvents(eventList); |
1052 | 1052 | ||
1053 | // After new creation of list view no events are selected. | 1053 | // After new creation of list view no events are selected. |
1054 | emit incidenceSelected( 0 ); | 1054 | emit incidenceSelected( 0 ); |
1055 | } | 1055 | } |
1056 | int KOListView::count() | 1056 | int KOListView::count() |
1057 | { | 1057 | { |
1058 | return mListView->childCount(); | 1058 | return mListView->childCount(); |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | void KOListView::changeEventDisplay(Event *event, int action) | 1061 | void KOListView::changeEventDisplay(Event *event, int action) |
1062 | { | 1062 | { |
1063 | KOListViewItem *item; | 1063 | KOListViewItem *item; |
1064 | 1064 | ||
1065 | switch(action) { | 1065 | switch(action) { |
1066 | case KOGlobals::EVENTADDED: | 1066 | case KOGlobals::EVENTADDED: |
1067 | addIncidence( event ); | 1067 | addIncidence( event ); |
1068 | break; | 1068 | break; |
1069 | case KOGlobals::EVENTEDITED: | 1069 | case KOGlobals::EVENTEDITED: |
1070 | item = getItemForEvent(event); | 1070 | item = getItemForEvent(event); |
1071 | if (item) { | 1071 | if (item) { |
1072 | ListItemVisitor v(item, mStartDate ); | 1072 | ListItemVisitor v(item, mStartDate ); |
1073 | ((Incidence*)event)->accept(v); | 1073 | ((Incidence*)event)->accept(v); |
1074 | } | 1074 | } |
1075 | break; | 1075 | break; |
1076 | case KOGlobals::EVENTDELETED: | 1076 | case KOGlobals::EVENTDELETED: |
1077 | item = getItemForEvent(event); | 1077 | item = getItemForEvent(event); |
1078 | if (item) { | 1078 | if (item) { |
1079 | mUidDict.remove( event->uid() ); | 1079 | mUidDict.remove( event->uid() ); |
1080 | delete item; | 1080 | delete item; |
1081 | } | 1081 | } |
1082 | break; | 1082 | break; |
1083 | default: | 1083 | default: |
1084 | ; | 1084 | ; |
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) | 1088 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1089 | { | 1089 | { |
1090 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1090 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1091 | while (item) { | 1091 | while (item) { |
1092 | if (item->data() == event) return item; | 1092 | if (item->data() == event) return item; |
1093 | item = (KOListViewItem *)item->nextSibling(); | 1093 | item = (KOListViewItem *)item->nextSibling(); |
1094 | } | 1094 | } |
1095 | return 0; | 1095 | return 0; |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | void KOListView::defaultItemAction(QListViewItem *i) | 1098 | void KOListView::defaultItemAction(QListViewItem *i) |
1099 | { | 1099 | { |
1100 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1100 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
1101 | if ( item ) defaultAction( item->data() ); | 1101 | if ( item ) defaultAction( item->data() ); |
1102 | 1102 | ||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 1105 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
1106 | { | 1106 | { |
1107 | mActiveItem = (KOListViewItem *)item; | 1107 | mActiveItem = (KOListViewItem *)item; |
1108 | if (mActiveItem) { | 1108 | if (mActiveItem) { |
1109 | Incidence *incidence = mActiveItem->data(); | 1109 | Incidence *incidence = mActiveItem->data(); |
1110 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | 1110 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); |
1111 | mPopupMenu->showIncidencePopup(incidence); | 1111 | mPopupMenu->showIncidencePopup(incidence); |
1112 | 1112 | ||
1113 | /* | 1113 | /* |
1114 | if ( incidence && incidence->type() == "Event" ) { | 1114 | if ( incidence && incidence->type() == "Event" ) { |
1115 | Event *event = static_cast<Event *>( incidence ); | 1115 | Event *event = static_cast<Event *>( incidence ); |
1116 | mPopupMenu->showEventPopup(event); | 1116 | mPopupMenu->showEventPopup(event); |
1117 | } | 1117 | } |
1118 | */ | 1118 | */ |
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | void KOListView::readSettings(KConfig *config, QString setting) | 1122 | void KOListView::readSettings(KConfig *config, QString setting) |
1123 | { | 1123 | { |
1124 | // qDebug("KOListView::readSettings "); | 1124 | // qDebug("KOListView::readSettings "); |
1125 | mListView->restoreLayout(config,setting); | 1125 | mListView->restoreLayout(config,setting); |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | void KOListView::writeSettings(KConfig *config, QString setting) | 1128 | void KOListView::writeSettings(KConfig *config, QString setting) |
1129 | { | 1129 | { |
1130 | // qDebug("KOListView::writeSettings "); | 1130 | // qDebug("KOListView::writeSettings "); |
1131 | mListView->saveLayout(config, setting); | 1131 | mListView->saveLayout(config, setting); |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | void KOListView::processSelectionChange(QListViewItem *) | 1134 | void KOListView::processSelectionChange(QListViewItem *) |
1135 | { | 1135 | { |
1136 | 1136 | ||
1137 | KOListViewItem *item = | 1137 | KOListViewItem *item = |
1138 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 1138 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
1139 | 1139 | ||
1140 | if ( !item ) { | 1140 | if ( !item ) { |
1141 | emit incidenceSelected( 0 ); | 1141 | emit incidenceSelected( 0 ); |
1142 | } else { | 1142 | } else { |
1143 | emit incidenceSelected( item->data() ); | 1143 | emit incidenceSelected( item->data() ); |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | void KOListView::clearSelection() | 1147 | void KOListView::clearSelection() |
1148 | { | 1148 | { |
1149 | mListView->selectAll( false ); | 1149 | mListView->selectAll( false ); |
1150 | } | 1150 | } |
1151 | void KOListView::allSelection() | 1151 | void KOListView::allSelection() |
1152 | { | 1152 | { |
1153 | mListView->selectAll( true ); | 1153 | mListView->selectAll( true ); |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | void KOListView::clear() | 1156 | void KOListView::clear() |
1157 | { | 1157 | { |
1158 | mListView->clear(); | 1158 | mListView->clear(); |
1159 | mUidDict.clear(); | 1159 | mUidDict.clear(); |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | Incidence* KOListView::currentItem() | 1162 | Incidence* KOListView::currentItem() |
1163 | { | 1163 | { |
1164 | if ( mListView->currentItem() ) | 1164 | if ( mListView->currentItem() ) |
1165 | return ((KOListViewItem*) mListView->currentItem())->data(); | 1165 | return ((KOListViewItem*) mListView->currentItem())->data(); |
1166 | return 0; | 1166 | return 0; |
1167 | } | 1167 | } |
1168 | void KOListView::keyPressEvent ( QKeyEvent *e) | 1168 | void KOListView::keyPressEvent ( QKeyEvent *e) |
1169 | { | 1169 | { |
1170 | 1170 | ||
1171 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 1171 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
1172 | deleteAll(); | 1172 | deleteAll(); |
1173 | return; | 1173 | return; |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | e->ignore(); | 1176 | e->ignore(); |
1177 | } | 1177 | } |
1178 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1178 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1179 | { | 1179 | { |
1180 | 1180 | ||
1181 | switch ( e->key() ) { | 1181 | switch ( e->key() ) { |
1182 | case Qt::Key_Down: | 1182 | case Qt::Key_Down: |
1183 | if ( e->state() == ShiftButton ) { | 1183 | if ( e->state() == ShiftButton ) { |
1184 | QListViewItem* cn = currentItem(); | 1184 | QListViewItem* cn = currentItem(); |
1185 | if ( !cn ) | 1185 | if ( !cn ) |
1186 | cn = firstChild(); | 1186 | cn = firstChild(); |
1187 | if ( !cn ) | 1187 | if ( !cn ) |
1188 | return; | 1188 | return; |
1189 | while ( cn->nextSibling() ) | 1189 | while ( cn->nextSibling() ) |
1190 | cn = cn->nextSibling(); | 1190 | cn = cn->nextSibling(); |
1191 | setCurrentItem ( cn ); | 1191 | setCurrentItem ( cn ); |
1192 | ensureItemVisible ( cn ); | 1192 | ensureItemVisible ( cn ); |
1193 | 1193 | ||
1194 | e->accept(); | 1194 | e->accept(); |
1195 | return; | 1195 | return; |
1196 | } | 1196 | } |
1197 | if ( e->state() == ControlButton ) { | 1197 | if ( e->state() == ControlButton ) { |
1198 | int count = childCount (); | 1198 | int count = childCount (); |
1199 | int jump = count / 5; | 1199 | int jump = count / 5; |
1200 | QListViewItem* cn; | 1200 | QListViewItem* cn; |
1201 | cn = currentItem(); | 1201 | cn = currentItem(); |
1202 | if ( ! cn ) | 1202 | if ( ! cn ) |
1203 | return; | 1203 | return; |
1204 | if ( jump == 0 ) | 1204 | if ( jump == 0 ) |
1205 | jump = 1; | 1205 | jump = 1; |
1206 | while ( jump && cn->nextSibling() ) { | 1206 | while ( jump && cn->nextSibling() ) { |
1207 | cn = cn->nextSibling(); | 1207 | cn = cn->nextSibling(); |
1208 | --jump; | 1208 | --jump; |
1209 | } | 1209 | } |
1210 | setCurrentItem ( cn ); | 1210 | setCurrentItem ( cn ); |
1211 | ensureItemVisible ( cn ); | 1211 | ensureItemVisible ( cn ); |
1212 | 1212 | ||
1213 | } else | 1213 | } else |
1214 | QListView::keyPressEvent ( e ) ; | 1214 | QListView::keyPressEvent ( e ) ; |
1215 | e->accept(); | 1215 | e->accept(); |
1216 | break; | 1216 | break; |
1217 | 1217 | ||
1218 | case Qt::Key_Up: | 1218 | case Qt::Key_Up: |
1219 | if ( e->state() == ShiftButton ) { | 1219 | if ( e->state() == ShiftButton ) { |
1220 | QListViewItem* cn = firstChild(); | 1220 | QListViewItem* cn = firstChild(); |
1221 | if ( cn ) { | 1221 | if ( cn ) { |
1222 | setCurrentItem ( cn ); | 1222 | setCurrentItem ( cn ); |
1223 | ensureItemVisible ( cn ); | 1223 | ensureItemVisible ( cn ); |
1224 | } | 1224 | } |
1225 | e->accept(); | 1225 | e->accept(); |
1226 | return; | 1226 | return; |
1227 | } | 1227 | } |
1228 | if ( e->state() == ControlButton ) { | 1228 | if ( e->state() == ControlButton ) { |
1229 | int count = childCount (); | 1229 | int count = childCount (); |
1230 | int jump = count / 5; | 1230 | int jump = count / 5; |
1231 | QListViewItem* cn; | 1231 | QListViewItem* cn; |
1232 | cn = currentItem(); | 1232 | cn = currentItem(); |
1233 | if ( ! cn ) | 1233 | if ( ! cn ) |
1234 | return; | 1234 | return; |
1235 | if ( jump == 0 ) | 1235 | if ( jump == 0 ) |
1236 | jump = 1; | 1236 | jump = 1; |
1237 | while ( jump && cn->itemAbove ()) { | 1237 | while ( jump && cn->itemAbove ()) { |
1238 | cn = cn->itemAbove (); | 1238 | cn = cn->itemAbove (); |
1239 | --jump; | 1239 | --jump; |
1240 | } | 1240 | } |
1241 | setCurrentItem ( cn ); | 1241 | setCurrentItem ( cn ); |
1242 | ensureItemVisible ( cn ); | 1242 | ensureItemVisible ( cn ); |
1243 | } else | 1243 | } else |
1244 | QListView::keyPressEvent ( e ) ; | 1244 | QListView::keyPressEvent ( e ) ; |
1245 | e->accept(); | 1245 | e->accept(); |
1246 | break; | 1246 | break; |
1247 | case Qt::Key_I: { | 1247 | case Qt::Key_I: { |
1248 | QListViewItem* cn; | 1248 | QListViewItem* cn; |
1249 | cn = currentItem(); | 1249 | cn = currentItem(); |
1250 | if ( cn ) { | 1250 | if ( cn ) { |
1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1252 | if ( ci ){ | 1252 | if ( ci ){ |
1253 | //emit showIncidence( ci->data()); | 1253 | //emit showIncidence( ci->data()); |
1254 | cn = cn->nextSibling(); | 1254 | cn = cn->nextSibling(); |
1255 | if ( cn ) { | 1255 | if ( cn ) { |
1256 | setCurrentItem ( cn ); | 1256 | setCurrentItem ( cn ); |
1257 | ensureItemVisible ( cn ); | 1257 | ensureItemVisible ( cn ); |
1258 | } | 1258 | } |
1259 | emit showIncidence( ci->data()); | 1259 | emit showIncidence( ci->data()); |
1260 | } | 1260 | } |
1261 | } | 1261 | } |
1262 | e->accept(); | 1262 | e->accept(); |
1263 | } | 1263 | } |
1264 | break; | 1264 | break; |
1265 | case Qt::Key_Return: | 1265 | case Qt::Key_Return: |
1266 | case Qt::Key_Enter: | 1266 | case Qt::Key_Enter: |
1267 | { | 1267 | { |
1268 | QListViewItem* cn; | 1268 | QListViewItem* cn; |
1269 | cn = currentItem(); | 1269 | cn = currentItem(); |
1270 | if ( cn ) { | 1270 | if ( cn ) { |
1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1272 | if ( ci ){ | 1272 | if ( ci ){ |
1273 | if ( e->state() == ShiftButton ) | 1273 | if ( e->state() == ShiftButton ) |
1274 | ci->setSelected( false ); | 1274 | ci->setSelected( false ); |
1275 | else | 1275 | else |
1276 | ci->setSelected( true ); | 1276 | ci->setSelected( true ); |
1277 | cn = cn->nextSibling(); | 1277 | cn = cn->nextSibling(); |
1278 | if ( cn ) { | 1278 | if ( cn ) { |
1279 | setCurrentItem ( cn ); | 1279 | setCurrentItem ( cn ); |
1280 | ensureItemVisible ( cn ); | 1280 | ensureItemVisible ( cn ); |
1281 | } else { | 1281 | } else { |
1282 | emit currentChanged( ci ); | 1282 | emit currentChanged( ci ); |
1283 | } | 1283 | } |
1284 | } | 1284 | } |
1285 | } | 1285 | } |
1286 | e->accept(); | 1286 | e->accept(); |
1287 | } | 1287 | } |
1288 | break; | 1288 | break; |
1289 | default: | 1289 | default: |
1290 | e->ignore(); | 1290 | e->ignore(); |
1291 | } | 1291 | } |
1292 | } | 1292 | } |
1293 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1293 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1294 | : KListView( lv, "kolistlistview", false ) | 1294 | : KListView( lv, "kolistlistview", false ) |
1295 | { | 1295 | { |
1296 | mYMousePos = 0; | 1296 | mYMousePos = 0; |
1297 | setAllColumnsShowFocus( true ); | 1297 | setAllColumnsShowFocus( true ); |
1298 | mPopupTimer = new QTimer(this); | 1298 | mPopupTimer = new QTimer(this); |
1299 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1299 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1300 | #ifndef DESKTOP_VERSION | 1300 | #ifndef DESKTOP_VERSION |
1301 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1301 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1302 | #endif | 1302 | #endif |
1303 | setSelectionMode( QListView::Multi ); | 1303 | setSelectionMode( QListView::Multi ); |
1304 | setMultiSelection( true); | 1304 | setMultiSelection( true); |
1305 | } | 1305 | } |
1306 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | 1306 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) |
1307 | { | 1307 | { |
1308 | QListViewItem *qitem = firstChild (); | 1308 | QListViewItem *qitem = firstChild (); |
1309 | while ( qitem ) { | 1309 | while ( qitem ) { |
1310 | if ( qitem->isSelected() && item != qitem ) | 1310 | if ( qitem->isSelected() && item != qitem ) |
1311 | return true; | 1311 | return true; |
1312 | qitem = qitem->nextSibling(); | 1312 | qitem = qitem->nextSibling(); |
1313 | } | 1313 | } |
1314 | return false; | 1314 | return false; |
1315 | } | 1315 | } |
1316 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1316 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1317 | { | 1317 | { |
1318 | if (!e) return; | 1318 | if (!e) return; |
1319 | QPoint vp = contentsToViewport(e->pos()); | 1319 | QPoint vp = contentsToViewport(e->pos()); |
1320 | QListViewItem *item = itemAt(vp); | 1320 | QListViewItem *item = itemAt(vp); |
1321 | if (!item) { | 1321 | if (!item) { |
1322 | emit newEvent(); | 1322 | emit newEvent(); |
1323 | return; | 1323 | return; |
1324 | } | 1324 | } |
1325 | KListView::contentsMouseDoubleClickEvent(e); | 1325 | KListView::contentsMouseDoubleClickEvent(e); |
1326 | } | 1326 | } |
1327 | #if 0 | 1327 | #if 0 |
1328 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1328 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1329 | { | 1329 | { |
1330 | //qDebug("contentsMousePressEvent++++ "); | 1330 | //qDebug("contentsMousePressEvent++++ "); |
1331 | KListView::contentsMousePressEvent( e ); | 1331 | KListView::contentsMousePressEvent( e ); |
1332 | if ( e->button() == RightButton ) { | 1332 | if ( e->button() == RightButton ) { |
1333 | QListViewItem* ci = currentItem(); | 1333 | QListViewItem* ci = currentItem(); |
1334 | clearSelection () ; | 1334 | clearSelection () ; |
1335 | if ( ci ) | 1335 | if ( ci ) |
1336 | ci->setSelected( true ); | 1336 | ci->setSelected( true ); |
1337 | } | 1337 | } |
1338 | } | 1338 | } |
1339 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1339 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1340 | { | 1340 | { |
1341 | KListView::contentsMouseReleaseEvent(e); | 1341 | KListView::contentsMouseReleaseEvent(e); |
1342 | } | 1342 | } |
1343 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1343 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1344 | { | 1344 | { |
1345 | KListView::contentsMouseMoveEvent(e); | 1345 | KListView::contentsMouseMoveEvent(e); |
1346 | } | 1346 | } |
1347 | #endif | 1347 | #endif |
1348 | void KOListViewListView::popupMenu() | 1348 | void KOListViewListView::popupMenu() |
1349 | { | 1349 | { |
1350 | mPopupTimer->stop(); | 1350 | mPopupTimer->stop(); |
1351 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1351 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); |
1352 | QApplication::postEvent( this->viewport(), e ); | 1352 | QApplication::postEvent( this->viewport(), e ); |
1353 | 1353 | ||
1354 | } | 1354 | } |
1355 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1355 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1356 | { | 1356 | { |
1357 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); | 1357 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); |
1358 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1358 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1359 | if ( e->button() == LeftButton ) { | 1359 | if ( e->button() == LeftButton ) { |
1360 | mPopupTimer->start( 600 ); | 1360 | mPopupTimer->start( 600 ); |
1361 | mEventPos = contentsToViewport(e->pos()); | 1361 | mEventPos = contentsToViewport(e->pos()); |
1362 | mEventGlobalPos = e->globalPos(); | 1362 | mEventGlobalPos = e->globalPos(); |
1363 | } | 1363 | } |
1364 | KListView::contentsMousePressEvent( e ); | 1364 | KListView::contentsMousePressEvent( e ); |
1365 | if ( e->button() == RightButton ) { | 1365 | if ( e->button() == RightButton ) { |
1366 | QListViewItem* ci = currentItem(); | 1366 | QListViewItem* ci = currentItem(); |
1367 | //clearSelection(); | 1367 | //clearSelection(); |
1368 | if ( ci ) | 1368 | if ( ci ) |
1369 | ci->setSelected( true ); | 1369 | ci->setSelected( true ); |
1370 | } | 1370 | } |
1371 | } | 1371 | } |
1372 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1372 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1373 | { | 1373 | { |
1374 | mPopupTimer->stop(); | 1374 | mPopupTimer->stop(); |
1375 | KListView::contentsMouseReleaseEvent(e); | 1375 | KListView::contentsMouseReleaseEvent(e); |
1376 | } | 1376 | } |
1377 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1377 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1378 | { | 1378 | { |
1379 | // qDebug("contentsMouseMoveEv....... "); | 1379 | // qDebug("contentsMouseMoveEv....... "); |
1380 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1380 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1381 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1381 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1382 | if ( diff < 0 ) diff = -diff; | 1382 | if ( diff < 0 ) diff = -diff; |
1383 | if ( diff > 15 ) | 1383 | if ( diff > 15 ) |
1384 | mPopupTimer->stop(); | 1384 | mPopupTimer->stop(); |
1385 | else { | 1385 | else { |
1386 | mEventPos = contentsToViewport(e->pos()); | 1386 | mEventPos = contentsToViewport(e->pos()); |
1387 | mEventGlobalPos = e->globalPos(); | 1387 | mEventGlobalPos = e->globalPos(); |
1388 | } | 1388 | } |
1389 | KListView::contentsMouseMoveEvent(e); | 1389 | KListView::contentsMouseMoveEvent(e); |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | #define protected public | 1392 | #define protected public |
1393 | #include <qheader.h> | 1393 | #include <qheader.h> |
1394 | #undef protected | 1394 | #undef protected |
1395 | void KOListViewListView::printList() | 1395 | void KOListViewListView::printList() |
1396 | { | 1396 | { |
1397 | #ifdef DESKTOP_VERSION | 1397 | #ifdef DESKTOP_VERSION |
1398 | KOPrintPrefs pp ( this ); | 1398 | KOPrintPrefs pp ( this ); |
1399 | if (!pp.exec() ) | 1399 | if (!pp.exec() ) |
1400 | return; | 1400 | return; |
1401 | int scaleval = pp.printMode() ; | 1401 | int scaleval = pp.printMode() ; |
1402 | 1402 | ||
1403 | QPrinter printer; | 1403 | QPrinter printer; |
1404 | if (!printer.setup() ) | 1404 | if (!printer.setup() ) |
1405 | return; | 1405 | return; |
1406 | clearSelection (); | 1406 | clearSelection (); |
1407 | QPainter p; | 1407 | QPainter p; |
1408 | p.begin ( &printer ); | 1408 | p.begin ( &printer ); |
1409 | p.setFont(font()); | ||
1409 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 1410 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
1410 | float dx, dy; | 1411 | float dx, dy; |
1411 | int wid = (m.width() * 9)/10; | 1412 | int wid = (m.width() * 9)/10; |
1412 | dx = (float) wid/(float)contentsWidth (); | 1413 | dx = (float) wid/(float)contentsWidth (); |
1413 | dy = (float)(m.height()) / (float)contentsHeight (); | 1414 | dy = (float)(m.height()) / (float)contentsHeight (); |
1414 | float scale; | 1415 | float scale; |
1415 | // scale to fit the width or height of the paper | 1416 | // scale to fit the width or height of the paper |
1416 | if ( dx < dy ) | 1417 | if ( dx < dy ) |
1417 | scale = dx; | 1418 | scale = dx; |
1418 | else | 1419 | else |
1419 | scale = dy; | 1420 | scale = dy; |
1420 | 1421 | ||
1421 | p.translate( m.width()/10,m.width()/10 ); | 1422 | p.translate( m.width()/10,m.width()/10 ); |
1422 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | 1423 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { |
1423 | p.scale( scale, scale ); | 1424 | p.scale( scale, scale ); |
1424 | } | 1425 | } |
1425 | 1426 | ||
1426 | int cou = header()->count(); | 1427 | int cou = header()->count(); |
1427 | int iii; | 1428 | int iii; |
1428 | QRect rect ( 0,0,0, header()->height()); | 1429 | QRect rect ( 0,0,0, header()->height()); |
1429 | for ( iii = 0; iii < cou; ++iii ) { | 1430 | for ( iii = 0; iii < cou; ++iii ) { |
1430 | rect.setLeft ( header()->sectionPos( iii ) ); | 1431 | rect.setLeft ( header()->sectionPos( iii ) ); |
1431 | rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); | 1432 | rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); |
1432 | header()->paintSection ( & p, header()->mapToIndex (iii), rect ); | 1433 | header()->paintSection ( & p, header()->mapToIndex (iii), rect ); |
1433 | } | 1434 | } |
1434 | p.translate( 0, header()->height()); | 1435 | p.translate( 0, header()->height()); |
1435 | drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); | 1436 | //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); |
1437 | |||
1438 | const QColorGroup &cg = colorGroup(); | ||
1439 | KOListViewItem* item = (KOListViewItem* )firstChild(); | ||
1440 | int yOff = 0; | ||
1441 | while ( item ) { | ||
1442 | p.translate( 0, yOff ); | ||
1443 | p.save(); | ||
1444 | for ( iii = 0; iii < cou; ++iii ) { | ||
1445 | int align = columnAlignment( iii ); | ||
1446 | if ( align == AlignAuto ) align = AlignLeft; | ||
1447 | p.restore(); | ||
1448 | p.save(); | ||
1449 | p.translate( header()->sectionPos( iii ), 0); | ||
1450 | item->paintCell( &p, cg, iii, header()->sectionSize (iii), align ); | ||
1451 | } | ||
1452 | yOff = item->height(); | ||
1453 | item = (KOListViewItem* )(item->itemBelow()); | ||
1454 | p.restore(); | ||
1455 | } | ||
1436 | p.end(); | 1456 | p.end(); |
1437 | #endif | 1457 | #endif |
1438 | } | 1458 | } |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 764c495..292951b 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,1007 +1,1011 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KdePim/Pi. | 2 | This file is part of KdePim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qgroupbox.h> | 34 | #include <qgroupbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
38 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | 44 | ||
45 | #include <kdialog.h> | 45 | #include <kdialog.h> |
46 | #include <kprefsdialog.h> | 46 | #include <kprefsdialog.h> |
47 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobalsettings.h> | 48 | #include <kglobalsettings.h> |
49 | #include <kdateedit.h> | 49 | #include <kdateedit.h> |
50 | #include <kglobal.h> | 50 | #include <kglobal.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | 52 | ||
53 | /*US | 53 | /*US |
54 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
55 | #include <qframe.h> | 55 | #include <qframe.h> |
56 | #include <qpushbutton.h> | 56 | #include <qpushbutton.h> |
57 | #include <qcombobox.h> | 57 | #include <qcombobox.h> |
58 | #include <qlineedit.h> | 58 | #include <qlineedit.h> |
59 | #include <qlabel.h> | 59 | #include <qlabel.h> |
60 | #include <qfile.h> | 60 | #include <qfile.h> |
61 | 61 | ||
62 | #include <kconfig.h> | 62 | #include <kconfig.h> |
63 | #include <kdebug.h> | 63 | #include <kdebug.h> |
64 | #include <kdialog.h> | 64 | #include <kdialog.h> |
65 | #include <klistview.h> | 65 | #include <klistview.h> |
66 | #include <klocale.h> | 66 | #include <klocale.h> |
67 | #include <kglobal.h> | 67 | #include <kglobal.h> |
68 | #include <kmessagebox.h> | 68 | #include <kmessagebox.h> |
69 | #include <kstandarddirs.h> | 69 | #include <kstandarddirs.h> |
70 | 70 | ||
71 | #ifndef KAB_EMBEDDED | 71 | #ifndef KAB_EMBEDDED |
72 | #include <ktrader.h> | 72 | #include <ktrader.h> |
73 | #else // KAB_EMBEDDED | 73 | #else // KAB_EMBEDDED |
74 | #include <mergewidget.h> | 74 | #include <mergewidget.h> |
75 | #include <distributionlistwidget.h> | 75 | #include <distributionlistwidget.h> |
76 | #endif // KAB_EMBEDDED | 76 | #endif // KAB_EMBEDDED |
77 | 77 | ||
78 | #include "addresseewidget.h" | 78 | #include "addresseewidget.h" |
79 | #include "extensionconfigdialog.h" | 79 | #include "extensionconfigdialog.h" |
80 | #include "extensionwidget.h" | 80 | #include "extensionwidget.h" |
81 | */ | 81 | */ |
82 | 82 | ||
83 | #include "qapplication.h" | 83 | #include "qapplication.h" |
84 | 84 | ||
85 | #include "kpimglobalprefs.h" | 85 | #include "kpimglobalprefs.h" |
86 | 86 | ||
87 | #include "kdepimconfigwidget.h" | 87 | #include "kdepimconfigwidget.h" |
88 | #include <kprefs.h> | 88 | #include <kprefs.h> |
89 | #include <kmessagebox.h> | 89 | #include <kmessagebox.h> |
90 | 90 | ||
91 | 91 | ||
92 | 92 | ||
93 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 93 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
94 | : KPrefsWidget(prefs, parent, name ) | 94 | : KPrefsWidget(prefs, parent, name ) |
95 | { | 95 | { |
96 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 96 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
97 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 97 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
98 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 98 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
99 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 99 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
100 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 100 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
101 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 101 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
102 | 102 | ||
103 | 103 | ||
104 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 104 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
105 | KDialog::spacingHint() ); | 105 | KDialog::spacingHint() ); |
106 | 106 | ||
107 | tabWidget = new QTabWidget( this ); | 107 | tabWidget = new QTabWidget( this ); |
108 | topLayout->addWidget( tabWidget ); | 108 | topLayout->addWidget( tabWidget ); |
109 | 109 | ||
110 | 110 | ||
111 | setupLocaleTab(); | 111 | setupLocaleTab(); |
112 | setupLocaleDateTab(); | 112 | setupLocaleDateTab(); |
113 | setupTimeZoneTab(); | 113 | setupTimeZoneTab(); |
114 | setupExternalAppTab(); | 114 | setupExternalAppTab(); |
115 | setupStoreTab(); | 115 | setupStoreTab(); |
116 | setupBackupTab(); | 116 | setupBackupTab(); |
117 | } | 117 | } |
118 | void KDEPIMConfigWidget::showTimeZoneTab() | 118 | void KDEPIMConfigWidget::showTimeZoneTab() |
119 | { | 119 | { |
120 | tabWidget->setCurrentPage ( 3 ) ; | 120 | tabWidget->setCurrentPage ( 3 ) ; |
121 | } | 121 | } |
122 | void KDEPIMConfigWidget::setupBackupTab() | 122 | void KDEPIMConfigWidget::setupBackupTab() |
123 | { | 123 | { |
124 | QVBox *colorPage = new QVBox( this ); | 124 | QVBox *colorPage = new QVBox( this ); |
125 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); | 125 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); |
126 | QWidget* topFrame = new QWidget( colorPage ); | 126 | QWidget* topFrame = new QWidget( colorPage ); |
127 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 127 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); |
128 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), | 128 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), |
129 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); | 129 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); |
130 | topLayout->addWidget((QWidget*)sb->checkBox()); | 130 | topLayout->addWidget((QWidget*)sb->checkBox()); |
131 | QWidget* bupFrame = new QWidget( topFrame ); | 131 | QWidget* bupFrame = new QWidget( topFrame ); |
132 | topLayout->addWidget((bupFrame)); | 132 | topLayout->addWidget((bupFrame)); |
133 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); | 133 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); |
134 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); | 134 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); |
135 | sb = addWidBool(i18n("Use standard backup dir"), | 135 | sb = addWidBool(i18n("Use standard backup dir"), |
136 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); | 136 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); |
137 | bupLayout->addWidget((QWidget*)sb->checkBox()); | 137 | bupLayout->addWidget((QWidget*)sb->checkBox()); |
138 | mBackupUrl = new KURLRequester( bupFrame ); | 138 | mBackupUrl = new KURLRequester( bupFrame ); |
139 | mBackupUrl->setPathIsDir(); | 139 | mBackupUrl->setPathIsDir(); |
140 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | 140 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); |
141 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); | 141 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); |
142 | bupLayout->addWidget( mBackupUrl ); | 142 | bupLayout->addWidget( mBackupUrl ); |
143 | 143 | ||
144 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); | 144 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); |
145 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); | 145 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); |
146 | QHBox *dummy = new QHBox(bupFrame); | 146 | QHBox *dummy = new QHBox(bupFrame); |
147 | new QLabel(i18n("Number of Backups:"),dummy); | 147 | new QLabel(i18n("Number of Backups:"),dummy); |
148 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); | 148 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); |
149 | new QLabel(i18n(" "),dummy); | 149 | new QLabel(i18n(" "),dummy); |
150 | bupLayout->addWidget( dummy ); | 150 | bupLayout->addWidget( dummy ); |
151 | 151 | ||
152 | dummy = new QHBox(bupFrame); | 152 | dummy = new QHBox(bupFrame); |
153 | new QLabel(i18n("Make backup every "),dummy); | 153 | new QLabel(i18n("Make backup every "),dummy); |
154 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); | 154 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); |
155 | new QLabel(i18n(" days"),dummy); | 155 | new QLabel(i18n(" days"),dummy); |
156 | new QLabel(i18n(" "),dummy); | 156 | new QLabel(i18n(" "),dummy); |
157 | bupLayout->addWidget( dummy ); | 157 | bupLayout->addWidget( dummy ); |
158 | QString localKdeDir; | 158 | QString localKdeDir; |
159 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | 159 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); |
160 | if ( ! localKdeDir.isEmpty() ) { | 160 | if ( ! localKdeDir.isEmpty() ) { |
161 | sb->checkBox()->setEnabled( false ); | 161 | sb->checkBox()->setEnabled( false ); |
162 | sb->checkBox()->setChecked( true ); | 162 | sb->checkBox()->setChecked( true ); |
163 | mBackupUrl->setEnabled( false ); | 163 | mBackupUrl->setEnabled( false ); |
164 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; | 164 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; |
165 | } | 165 | } |
166 | 166 | ||
167 | } | 167 | } |
168 | void KDEPIMConfigWidget::setupStoreTab() | 168 | void KDEPIMConfigWidget::setupStoreTab() |
169 | { | 169 | { |
170 | QVBox *colorPage = new QVBox( this ); | 170 | QVBox *colorPage = new QVBox( this ); |
171 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); | 171 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); |
172 | QWidget* cw = new QWidget( colorPage ); | 172 | QWidget* cw = new QWidget( colorPage ); |
173 | KPrefsWidColor *holidayColor = | 173 | KPrefsWidColor *holidayColor = |
174 | addWidColor(i18n("Alternating background of list views"), | 174 | addWidColor(i18n("Alternating background of list views"), |
175 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); | 175 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); |
176 | QHBoxLayout *topLayout = new QHBoxLayout(cw); | 176 | QHBoxLayout *topLayout = new QHBoxLayout(cw); |
177 | topLayout->addWidget(holidayColor->label()); | 177 | topLayout->addWidget(holidayColor->label()); |
178 | topLayout->addWidget( (QWidget* )holidayColor->button()); | 178 | topLayout->addWidget( (QWidget* )holidayColor->button()); |
179 | 179 | ||
180 | 180 | ||
181 | QVBox *storePage = new QVBox( this ); | 181 | QVBox *storePage = new QVBox( this ); |
182 | if ( QApplication::desktop()->height() > 240 ) | 182 | if ( QApplication::desktop()->height() > 240 ) |
183 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); | 183 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); |
184 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 184 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
185 | mStoreUrl = new KURLRequester( storePage ); | 185 | mStoreUrl = new KURLRequester( storePage ); |
186 | mStoreUrl->setPathIsDir(); | 186 | mStoreUrl->setPathIsDir(); |
187 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 187 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
188 | #ifdef DESKTOP_VERSION | 188 | #ifdef DESKTOP_VERSION |
189 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 189 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
190 | QFileInfo fi ( confFile ); | 190 | QFileInfo fi ( confFile ); |
191 | if ( fi.exists() ) { | 191 | if ( fi.exists() ) { |
192 | KConfig cfg ( confFile ); | 192 | KConfig cfg ( confFile ); |
193 | cfg.setGroup("Global"); | 193 | cfg.setGroup("Global"); |
194 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | 194 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); |
195 | if ( localKdeDir != "x_x_x" ) { | 195 | if ( localKdeDir != "x_x_x" ) { |
196 | mStoreUrl->setURL( localKdeDir ); | 196 | mStoreUrl->setURL( localKdeDir ); |
197 | qDebug("Reading config from %s ", confFile.latin1()); | 197 | qDebug("Reading config from %s ", confFile.latin1()); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | #endif | 201 | #endif |
202 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 202 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
203 | QHBox *bb = new QHBox( storePage ); | 203 | QHBox *bb = new QHBox( storePage ); |
204 | QPushButton * pb; | 204 | QPushButton * pb; |
205 | if ( QApplication::desktop()->width() < 640 ) | 205 | if ( QApplication::desktop()->width() < 640 ) |
206 | pb = new QPushButton ( i18n("Save"), bb ); | 206 | pb = new QPushButton ( i18n("Save"), bb ); |
207 | else | 207 | else |
208 | pb = new QPushButton ( i18n("Save settings"), bb ); | 208 | pb = new QPushButton ( i18n("Save settings"), bb ); |
209 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 209 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
210 | pb = new QPushButton ( i18n("Save standard"), bb ); | 210 | pb = new QPushButton ( i18n("Save standard"), bb ); |
211 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 211 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
212 | #ifdef DESKTOP_VERSION | 212 | #ifdef DESKTOP_VERSION |
213 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | 213 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); |
214 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | 214 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); |
215 | #endif | 215 | #endif |
216 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 216 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
217 | mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 217 | mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
218 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 218 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
219 | 219 | ||
220 | #ifdef DESKTOP_VERSION | 220 | #ifdef DESKTOP_VERSION |
221 | if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) { | 221 | if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) { |
222 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" )); | 222 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" )); |
223 | } | 223 | } |
224 | #endif | 224 | #endif |
225 | } | 225 | } |
226 | void KDEPIMConfigWidget::setLocalStore() | 226 | void KDEPIMConfigWidget::setLocalStore() |
227 | { | 227 | { |
228 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | 228 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); |
229 | saveStoreSettings(); | 229 | saveStoreSettings(); |
230 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); | 230 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); |
231 | KMessageBox::information( this, message); | 231 | KMessageBox::information( this, message); |
232 | } | 232 | } |
233 | void KDEPIMConfigWidget::setStandardStore() | 233 | void KDEPIMConfigWidget::setStandardStore() |
234 | { | 234 | { |
235 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 235 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
236 | saveStoreSettings(); | 236 | saveStoreSettings(); |
237 | } | 237 | } |
238 | void KDEPIMConfigWidget::saveStoreSettings() | 238 | void KDEPIMConfigWidget::saveStoreSettings() |
239 | { | 239 | { |
240 | #ifdef DESKTOP_VERSION | 240 | #ifdef DESKTOP_VERSION |
241 | if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) { | 241 | if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) { |
242 | QString file = qApp->applicationDirPath ()+"/.microkdehome"; | 242 | QString file = qApp->applicationDirPath ()+"/.microkdehome"; |
243 | QFileInfo fi ( file ); | 243 | QFileInfo fi ( file ); |
244 | if ( fi.exists() ) { | 244 | if ( fi.exists() ) { |
245 | bool res = QFile::remove( file ); | 245 | bool res = QFile::remove( file ); |
246 | if ( ! res ) | 246 | if ( ! res ) |
247 | KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file )); | 247 | KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file )); |
248 | } | 248 | } |
249 | } | 249 | } |
250 | #endif | 250 | #endif |
251 | if ( !mStoreUrl->url().isEmpty() ) { | 251 | if ( !mStoreUrl->url().isEmpty() ) { |
252 | QString path = QDir::homeDirPath(); | 252 | QString path = QDir::homeDirPath(); |
253 | QString url = mStoreUrl->url(); | 253 | QString url = mStoreUrl->url(); |
254 | #ifdef DESKTOP_VERSION | 254 | #ifdef DESKTOP_VERSION |
255 | if ( url.startsWith( "LOCAL:" ) ) { | 255 | if ( url.startsWith( "LOCAL:" ) ) { |
256 | path = qApp->applicationDirPath () ; | 256 | path = qApp->applicationDirPath () ; |
257 | } | 257 | } |
258 | #endif | 258 | #endif |
259 | KConfig cfg ( path + "/.microkdehome" ); | 259 | KConfig cfg ( path + "/.microkdehome" ); |
260 | cfg.setGroup("Global"); | 260 | cfg.setGroup("Global"); |
261 | cfg.writeEntry( "MICROKDEHOME", url ); | 261 | cfg.writeEntry( "MICROKDEHOME", url ); |
262 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 262 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
263 | cfg.sync(); | 263 | cfg.sync(); |
264 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" )); | 264 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" )); |
265 | } else { | 265 | } else { |
266 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 266 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
267 | saveStoreSettings(); | 267 | saveStoreSettings(); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | void KDEPIMConfigWidget::setupExternalAppTab() | 270 | void KDEPIMConfigWidget::setupExternalAppTab() |
271 | { | 271 | { |
272 | QWidget *externalAppsPage = new QWidget( this ); | 272 | QWidget *externalAppsPage = new QWidget( this ); |
273 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 273 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
274 | KDialog::spacingHintSmall() ); | 274 | KDialog::spacingHintSmall() ); |
275 | 275 | ||
276 | mExternalApps = new QComboBox( externalAppsPage ); | 276 | mExternalApps = new QComboBox( externalAppsPage ); |
277 | 277 | ||
278 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 278 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
279 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 279 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
280 | mExternalApps->insertItem( it.data(), it.key() ); | 280 | mExternalApps->insertItem( it.data(), it.key() ); |
281 | 281 | ||
282 | layout->addWidget( mExternalApps ); | 282 | layout->addWidget( mExternalApps ); |
283 | 283 | ||
284 | connect( mExternalApps, SIGNAL( activated( int ) ), | 284 | connect( mExternalApps, SIGNAL( activated( int ) ), |
285 | this, SLOT (externalapp_changed( int ) ) ); | 285 | this, SLOT (externalapp_changed( int ) ) ); |
286 | 286 | ||
287 | 287 | ||
288 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 288 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
289 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 289 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
290 | mExternalAppGroupBox->layout()->setMargin(4); | 290 | mExternalAppGroupBox->layout()->setMargin(4); |
291 | 291 | ||
292 | mClient = new QComboBox( mExternalAppGroupBox ); | 292 | mClient = new QComboBox( mExternalAppGroupBox ); |
293 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 293 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
294 | 294 | ||
295 | connect( mClient, SIGNAL( activated( int ) ), | 295 | connect( mClient, SIGNAL( activated( int ) ), |
296 | this, SLOT (client_changed( int ) ) ); | 296 | this, SLOT (client_changed( int ) ) ); |
297 | 297 | ||
298 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 298 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
299 | boxLayout->addWidget( lab, 1, 0 ); | 299 | boxLayout->addWidget( lab, 1, 0 ); |
300 | mChannel = new QLineEdit(mExternalAppGroupBox); | 300 | mChannel = new QLineEdit(mExternalAppGroupBox); |
301 | mChannel->setReadOnly(true); | 301 | mChannel->setReadOnly(true); |
302 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 302 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
303 | 303 | ||
304 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 304 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
305 | boxLayout->addWidget( lab, 3, 0 ); | 305 | boxLayout->addWidget( lab, 3, 0 ); |
306 | mMessage = new QLineEdit(mExternalAppGroupBox); | 306 | mMessage = new QLineEdit(mExternalAppGroupBox); |
307 | mMessage->setReadOnly(true); | 307 | mMessage->setReadOnly(true); |
308 | boxLayout->addWidget( mMessage , 4, 0); | 308 | boxLayout->addWidget( mMessage , 4, 0); |
309 | 309 | ||
310 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 310 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
311 | boxLayout->addWidget( lab, 3, 1 ); | 311 | boxLayout->addWidget( lab, 3, 1 ); |
312 | mParameters = new QLineEdit(mExternalAppGroupBox); | 312 | mParameters = new QLineEdit(mExternalAppGroupBox); |
313 | mParameters->setReadOnly(true); | 313 | mParameters->setReadOnly(true); |
314 | boxLayout->addWidget( mParameters, 4, 1 ); | 314 | boxLayout->addWidget( mParameters, 4, 1 ); |
315 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 315 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
316 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 316 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
317 | 317 | ||
318 | 318 | ||
319 | if ( QApplication::desktop()->height() > 240 ) { | 319 | if ( QApplication::desktop()->height() > 240 ) { |
320 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 320 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
321 | boxLayout->addWidget( lab, 6, 0 ); | 321 | boxLayout->addWidget( lab, 6, 0 ); |
322 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 322 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
323 | mMessage2->setReadOnly(true); | 323 | mMessage2->setReadOnly(true); |
324 | boxLayout->addWidget( mMessage2 , 7, 0); | 324 | boxLayout->addWidget( mMessage2 , 7, 0); |
325 | 325 | ||
326 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 326 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
327 | boxLayout->addWidget( lab, 6, 1 ); | 327 | boxLayout->addWidget( lab, 6, 1 ); |
328 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 328 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
329 | mParameters2->setReadOnly(true); | 329 | mParameters2->setReadOnly(true); |
330 | boxLayout->addWidget( mParameters2, 7, 1 ); | 330 | boxLayout->addWidget( mParameters2, 7, 1 ); |
331 | 331 | ||
332 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 332 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
333 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 333 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
334 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 334 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
335 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 335 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
336 | } else { | 336 | } else { |
337 | mMessage2 = 0; | 337 | mMessage2 = 0; |
338 | mParameters2 = 0; | 338 | mParameters2 = 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 341 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
342 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 342 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
343 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 343 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
344 | 344 | ||
345 | 345 | ||
346 | layout->addWidget( mExternalAppGroupBox ); | 346 | layout->addWidget( mExternalAppGroupBox ); |
347 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 347 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
348 | 348 | ||
349 | } | 349 | } |
350 | 350 | ||
351 | 351 | ||
352 | void KDEPIMConfigWidget::setupLocaleDateTab() | 352 | void KDEPIMConfigWidget::setupLocaleDateTab() |
353 | { | 353 | { |
354 | QWidget *topFrame = new QWidget( this ); | 354 | QWidget *topFrame = new QWidget( this ); |
355 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 355 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); |
356 | 356 | ||
357 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 357 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
358 | topLayout->setMargin(KDialog::marginHintSmall()); | 358 | topLayout->setMargin(KDialog::marginHintSmall()); |
359 | int iii = 0; | 359 | int iii = 0; |
360 | 360 | ||
361 | 361 | ||
362 | KPrefsWidRadios *syncPrefsGroup = | 362 | KPrefsWidRadios *syncPrefsGroup = |
363 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 363 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
364 | QString format; | 364 | QString format; |
365 | if ( QApplication::desktop()->width() < 480 ) | 365 | if ( QApplication::desktop()->width() < 480 ) |
366 | format = "(%d.%m.%Y)"; | 366 | format = "(%d.%m.%Y)"; |
367 | else | 367 | else |
368 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 368 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
369 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 369 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
370 | if ( QApplication::desktop()->width() < 480 ) | 370 | if ( QApplication::desktop()->width() < 480 ) |
371 | format = "(%m.%d.%Y)"; | 371 | format = "(%m.%d.%Y)"; |
372 | else | 372 | else |
373 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 373 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
374 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 374 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
375 | if ( QApplication::desktop()->width() < 480 ) | 375 | if ( QApplication::desktop()->width() < 480 ) |
376 | format = "(%Y-%m-%d)"; | 376 | format = "(%Y-%m-%d)"; |
377 | else | 377 | else |
378 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 378 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
379 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 379 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
380 | syncPrefsGroup->addRadio(i18n("User defined")); | 380 | syncPrefsGroup->addRadio(i18n("User defined")); |
381 | if ( QApplication::desktop()->width() < 480 ) { | 381 | if ( QApplication::desktop()->width() < 480 ) { |
382 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 382 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
383 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 383 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
384 | } | 384 | } |
385 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 385 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
386 | ++iii; | 386 | ++iii; |
387 | ++iii; | 387 | ++iii; |
388 | QLabel * lab; | 388 | QLabel * lab; |
389 | mUserDateFormatLong = new QLineEdit(topFrame); | 389 | mUserDateFormatLong = new QLineEdit(topFrame); |
390 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 390 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
391 | topLayout->addWidget(lab ,iii,0); | 391 | topLayout->addWidget(lab ,iii,0); |
392 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 392 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
393 | ++iii; | 393 | ++iii; |
394 | mUserDateFormatShort = new QLineEdit(topFrame); | 394 | mUserDateFormatShort = new QLineEdit(topFrame); |
395 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 395 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
396 | topLayout->addWidget(lab ,iii,0); | 396 | topLayout->addWidget(lab ,iii,0); |
397 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 397 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
398 | ++iii; | 398 | ++iii; |
399 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 399 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
400 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 400 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
401 | ++iii; | 401 | ++iii; |
402 | //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); | 402 | //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); |
403 | if ( QApplication::desktop()->height() > 240 ) { | 403 | if ( QApplication::desktop()->height() > 240 ) { |
404 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 404 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
405 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 405 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
406 | ++iii; | 406 | ++iii; |
407 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 407 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
408 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 408 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
409 | ++iii; | 409 | ++iii; |
410 | } | 410 | } |
411 | 411 | ||
412 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 412 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
413 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 413 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
414 | 414 | ||
415 | 415 | ||
416 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 416 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
417 | } | 417 | } |
418 | 418 | ||
419 | void KDEPIMConfigWidget::setupLocaleTab() | 419 | void KDEPIMConfigWidget::setupLocaleTab() |
420 | { | 420 | { |
421 | 421 | ||
422 | QWidget *topFrame = new QWidget( this ); | 422 | QWidget *topFrame = new QWidget( this ); |
423 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 423 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
424 | 424 | ||
425 | topLayout->setSpacing(KDialog::spacingHint()); | 425 | topLayout->setSpacing(KDialog::spacingHint()); |
426 | topLayout->setMargin(KDialog::marginHint()); | 426 | topLayout->setMargin(KDialog::marginHint()); |
427 | int iii = 0; | 427 | int iii = 0; |
428 | KPrefsWidRadios *syncPrefsGroup = | 428 | KPrefsWidRadios *syncPrefsGroup = |
429 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 429 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
430 | syncPrefsGroup->addRadio(i18n("English")); | 430 | syncPrefsGroup->addRadio(i18n("English")); |
431 | syncPrefsGroup->addRadio(i18n("German")); | 431 | syncPrefsGroup->addRadio(i18n("German")); |
432 | syncPrefsGroup->addRadio(i18n("French")); | 432 | syncPrefsGroup->addRadio(i18n("French")); |
433 | syncPrefsGroup->addRadio(i18n("Italian")); | 433 | syncPrefsGroup->addRadio(i18n("Italian")); |
434 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 434 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
435 | if ( QApplication::desktop()->width() < 300 ) { | 435 | if ( QApplication::desktop()->width() < 300 ) { |
436 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 436 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
437 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 437 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
438 | } | 438 | } |
439 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 439 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
440 | ++iii; | 440 | ++iii; |
441 | 441 | ||
442 | 442 | ||
443 | tabWidget->addTab( topFrame, i18n( "Language" ) ); | 443 | tabWidget->addTab( topFrame, i18n( "Language" ) ); |
444 | topFrame = new QWidget( this ); | 444 | topFrame = new QWidget( this ); |
445 | topLayout = new QGridLayout(topFrame,4,2); | 445 | topLayout = new QGridLayout(topFrame,4,2); |
446 | 446 | ||
447 | topLayout->setSpacing(KDialog::spacingHint()); | 447 | topLayout->setSpacing(KDialog::spacingHint()); |
448 | topLayout->setMargin(KDialog::marginHint()); | 448 | topLayout->setMargin(KDialog::marginHint()); |
449 | iii = 0; | 449 | iii = 0; |
450 | syncPrefsGroup = | 450 | syncPrefsGroup = |
451 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 451 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
452 | if ( QApplication::desktop()->width() > 300 ) | 452 | if ( QApplication::desktop()->width() > 300 ) |
453 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 453 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
454 | syncPrefsGroup->addRadio(i18n("24:00")); | 454 | syncPrefsGroup->addRadio(i18n("24:00")); |
455 | syncPrefsGroup->addRadio(i18n("12:00am")); | 455 | syncPrefsGroup->addRadio(i18n("12:00am")); |
456 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 456 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
457 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 457 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
458 | ++iii; | 458 | ++iii; |
459 | 459 | ||
460 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 460 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
461 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 461 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
462 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 462 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
463 | ++iii; | 463 | ++iii; |
464 | 464 | ||
465 | 465 | ||
466 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); | 466 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | 470 | ||
471 | void KDEPIMConfigWidget::setupTimeZoneTab() | 471 | void KDEPIMConfigWidget::setupTimeZoneTab() |
472 | { | 472 | { |
473 | QWidget *topFrame; | 473 | QWidget *topFrame; |
474 | QGridLayout *topLayout ; | 474 | QGridLayout *topLayout ; |
475 | 475 | ||
476 | 476 | ||
477 | 477 | ||
478 | 478 | ||
479 | 479 | ||
480 | 480 | ||
481 | topFrame = new QWidget( this ); | 481 | topFrame = new QWidget( this ); |
482 | topLayout = new QGridLayout( topFrame, 5, 2); | 482 | topLayout = new QGridLayout( topFrame, 5, 2); |
483 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 483 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
484 | topLayout->setMargin(KDialog::marginHintSmall()); | 484 | topLayout->setMargin(KDialog::marginHintSmall()); |
485 | 485 | ||
486 | QHBox *timeZoneBox = new QHBox( topFrame ); | 486 | QHBox *timeZoneBox = new QHBox( topFrame ); |
487 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 487 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
488 | 488 | ||
489 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 489 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
490 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 490 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
491 | if ( QApplication::desktop()->width() < 300 ) { | 491 | if ( QApplication::desktop()->width() < 300 ) { |
492 | mTimeZoneCombo->setMaximumWidth(150); | 492 | mTimeZoneCombo->setMaximumWidth(150); |
493 | } | 493 | } |
494 | 494 | ||
495 | QStringList list; | 495 | QStringList list; |
496 | list = KGlobal::locale()->timeZoneList(); | 496 | list = KGlobal::locale()->timeZoneList(); |
497 | mTimeZoneCombo->insertStringList(list); | 497 | mTimeZoneCombo->insertStringList(list); |
498 | 498 | ||
499 | // find the currently set time zone and select it | 499 | // find the currently set time zone and select it |
500 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 500 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
501 | int nCurrentlySet = 11; | 501 | int nCurrentlySet = 11; |
502 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 502 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
503 | { | 503 | { |
504 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 504 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
505 | { | 505 | { |
506 | nCurrentlySet = i; | 506 | nCurrentlySet = i; |
507 | break; | 507 | break; |
508 | } | 508 | } |
509 | } | 509 | } |
510 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 510 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
511 | int iii = 1; | 511 | int iii = 1; |
512 | KPrefsWidBool *sb = | 512 | KPrefsWidBool *sb = |
513 | addWidBool(i18n("Add 30 min to selected Timezone"), | 513 | addWidBool(i18n("Add 30 min to selected Timezone"), |
514 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 514 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
515 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 515 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
516 | ++iii; | 516 | ++iii; |
517 | sb = | 517 | sb = |
518 | addWidBool(i18n("Timezone has daylight saving"), | 518 | addWidBool(i18n("Timezone has daylight saving"), |
519 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 519 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
520 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 520 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
521 | ++iii; | 521 | ++iii; |
522 | QLabel* lab; | 522 | QLabel* lab; |
523 | 523 | ||
524 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 524 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
525 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 525 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
526 | ++iii; | 526 | ++iii; |
527 | 527 | ||
528 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 528 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
529 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 529 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
530 | ++iii; | 530 | ++iii; |
531 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 531 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
532 | topLayout->addWidget(lab, iii,0); | 532 | topLayout->addWidget(lab, iii,0); |
533 | mStartDateSavingEdit = new KDateEdit(topFrame); | 533 | mStartDateSavingEdit = new KDateEdit(topFrame); |
534 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 534 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
535 | ++iii; | 535 | ++iii; |
536 | 536 | ||
537 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 537 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
538 | topLayout->addWidget(lab, iii,0); | 538 | topLayout->addWidget(lab, iii,0); |
539 | mEndDateSavingEdit = new KDateEdit(topFrame); | 539 | mEndDateSavingEdit = new KDateEdit(topFrame); |
540 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 540 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
541 | ++iii; | 541 | ++iii; |
542 | QDate current ( 2001, 1,1); | 542 | QDate current ( 2001, 1,1); |
543 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 543 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
544 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 544 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
545 | 545 | ||
546 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 546 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
547 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 547 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
548 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 548 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
549 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 549 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
550 | 550 | ||
551 | 551 | ||
552 | topFrame = new QWidget( this ); | 552 | topFrame = new QWidget( this ); |
553 | topLayout = new QGridLayout( topFrame, 3, 2); | 553 | topLayout = new QGridLayout( topFrame, 3, 2); |
554 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 554 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
555 | topLayout->setMargin(KDialog::marginHintSmall()); | 555 | topLayout->setMargin(KDialog::marginHintSmall()); |
556 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); | 556 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); |
557 | 557 | ||
558 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); | 558 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); |
559 | topLayout->addMultiCellWidget(labb,0,0,0,2); | 559 | topLayout->addMultiCellWidget(labb,0,0,0,2); |
560 | int i = 1; | 560 | int i = 1; |
561 | KPrefsWidFont *timeLabelsFont = | 561 | KPrefsWidFont *timeLabelsFont = |
562 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), | 562 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), |
563 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); | 563 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); |
564 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 564 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
565 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 565 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
566 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 566 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
567 | } | 567 | } |
568 | 568 | ||
569 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 569 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
570 | { | 570 | { |
571 | // first store the current data | 571 | // first store the current data |
572 | saveEditFieldSettings(); | 572 | saveEditFieldSettings(); |
573 | 573 | ||
574 | // set mCurrentApp | 574 | // set mCurrentApp |
575 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 575 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
576 | 576 | ||
577 | // set mCurrentClient | 577 | // set mCurrentClient |
578 | switch(mCurrentApp) | 578 | switch(mCurrentApp) |
579 | { | 579 | { |
580 | case(ExternalAppHandler::EMAIL): | 580 | case(ExternalAppHandler::EMAIL): |
581 | mCurrentClient = mEmailClient; | 581 | mCurrentClient = mEmailClient; |
582 | break; | 582 | break; |
583 | case(ExternalAppHandler::PHONE): | 583 | case(ExternalAppHandler::PHONE): |
584 | mCurrentClient = mPhoneClient; | 584 | mCurrentClient = mPhoneClient; |
585 | break; | 585 | break; |
586 | case(ExternalAppHandler::SMS): | 586 | case(ExternalAppHandler::SMS): |
587 | mCurrentClient = mSMSClient; | 587 | mCurrentClient = mSMSClient; |
588 | break; | 588 | break; |
589 | case(ExternalAppHandler::FAX): | 589 | case(ExternalAppHandler::FAX): |
590 | mCurrentClient = mFaxClient; | 590 | mCurrentClient = mFaxClient; |
591 | break; | 591 | break; |
592 | case(ExternalAppHandler::PAGER): | 592 | case(ExternalAppHandler::PAGER): |
593 | mCurrentClient = mPagerClient; | 593 | mCurrentClient = mPagerClient; |
594 | break; | 594 | break; |
595 | case(ExternalAppHandler::SIP): | 595 | case(ExternalAppHandler::SIP): |
596 | mCurrentClient = mSipClient; | 596 | mCurrentClient = mSipClient; |
597 | break; | 597 | break; |
598 | default: | 598 | default: |
599 | return; | 599 | return; |
600 | } | 600 | } |
601 | 601 | ||
602 | // and at last update the widgets | 602 | // and at last update the widgets |
603 | updateClientWidgets(); | 603 | updateClientWidgets(); |
604 | } | 604 | } |
605 | 605 | ||
606 | 606 | ||
607 | 607 | ||
608 | void KDEPIMConfigWidget::client_changed( int newClient ) | 608 | void KDEPIMConfigWidget::client_changed( int newClient ) |
609 | { | 609 | { |
610 | if (newClient == mCurrentClient) | 610 | if (newClient == mCurrentClient) |
611 | return; | 611 | return; |
612 | 612 | ||
613 | // first store the current data | 613 | // first store the current data |
614 | saveEditFieldSettings(); | 614 | saveEditFieldSettings(); |
615 | 615 | ||
616 | 616 | ||
617 | //then reset the clientvariable | 617 | //then reset the clientvariable |
618 | mCurrentClient = newClient; | 618 | mCurrentClient = newClient; |
619 | 619 | ||
620 | // and at last update the widgets | 620 | // and at last update the widgets |
621 | updateClientWidgets(); | 621 | updateClientWidgets(); |
622 | 622 | ||
623 | KPrefsWidget::modified(); | 623 | KPrefsWidget::modified(); |
624 | } | 624 | } |
625 | 625 | ||
626 | void KDEPIMConfigWidget::saveEditFieldSettings() | 626 | void KDEPIMConfigWidget::saveEditFieldSettings() |
627 | { | 627 | { |
628 | 628 | ||
629 | switch(mCurrentApp) | 629 | switch(mCurrentApp) |
630 | { | 630 | { |
631 | case(ExternalAppHandler::EMAIL): | 631 | case(ExternalAppHandler::EMAIL): |
632 | mEmailClient = mClient->currentItem(); | 632 | mEmailClient = mClient->currentItem(); |
633 | break; | 633 | break; |
634 | case(ExternalAppHandler::PHONE): | 634 | case(ExternalAppHandler::PHONE): |
635 | mPhoneClient= mClient->currentItem(); | 635 | mPhoneClient= mClient->currentItem(); |
636 | break; | 636 | break; |
637 | case(ExternalAppHandler::SMS): | 637 | case(ExternalAppHandler::SMS): |
638 | mSMSClient = mClient->currentItem(); | 638 | mSMSClient = mClient->currentItem(); |
639 | break; | 639 | break; |
640 | case(ExternalAppHandler::FAX): | 640 | case(ExternalAppHandler::FAX): |
641 | mFaxClient = mClient->currentItem(); | 641 | mFaxClient = mClient->currentItem(); |
642 | break; | 642 | break; |
643 | case(ExternalAppHandler::PAGER): | 643 | case(ExternalAppHandler::PAGER): |
644 | mPagerClient = mClient->currentItem(); | 644 | mPagerClient = mClient->currentItem(); |
645 | break; | 645 | break; |
646 | case(ExternalAppHandler::SIP): | 646 | case(ExternalAppHandler::SIP): |
647 | mSipClient = mClient->currentItem(); | 647 | mSipClient = mClient->currentItem(); |
648 | break; | 648 | break; |
649 | default: | 649 | default: |
650 | return; | 650 | return; |
651 | } | 651 | } |
652 | 652 | ||
653 | //store the current data back to the apropriate membervariables if we had set it to "other" | 653 | //store the current data back to the apropriate membervariables if we had set it to "other" |
654 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 654 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
655 | { | 655 | { |
656 | mEmailOtherChannel = mChannel->text(); | 656 | mEmailOtherChannel = mChannel->text(); |
657 | mEmailOtherMessage = mMessage->text(); | 657 | mEmailOtherMessage = mMessage->text(); |
658 | mEmailOtherMessageParameters = mParameters->text(); | 658 | mEmailOtherMessageParameters = mParameters->text(); |
659 | if ( mMessage2 ) | 659 | if ( mMessage2 ) |
660 | mEmailOtherMessage2 = mMessage2->text(); | 660 | mEmailOtherMessage2 = mMessage2->text(); |
661 | if ( mParameters2 ) | 661 | if ( mParameters2 ) |
662 | mEmailOtherMessageParameters2 = mParameters2->text(); | 662 | mEmailOtherMessageParameters2 = mParameters2->text(); |
663 | } | 663 | } |
664 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 664 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
665 | { | 665 | { |
666 | mPhoneOtherChannel = mChannel->text(); | 666 | mPhoneOtherChannel = mChannel->text(); |
667 | mPhoneOtherMessage = mMessage->text(); | 667 | mPhoneOtherMessage = mMessage->text(); |
668 | mPhoneOtherMessageParameters = mParameters->text(); | 668 | mPhoneOtherMessageParameters = mParameters->text(); |
669 | } | 669 | } |
670 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 670 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
671 | { | 671 | { |
672 | mSMSOtherChannel = mChannel->text(); | 672 | mSMSOtherChannel = mChannel->text(); |
673 | mSMSOtherMessage = mMessage->text(); | 673 | mSMSOtherMessage = mMessage->text(); |
674 | mSMSOtherMessageParameters = mParameters->text(); | 674 | mSMSOtherMessageParameters = mParameters->text(); |
675 | } | 675 | } |
676 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 676 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
677 | { | 677 | { |
678 | mFaxOtherChannel = mChannel->text(); | 678 | mFaxOtherChannel = mChannel->text(); |
679 | mFaxOtherMessage = mMessage->text(); | 679 | mFaxOtherMessage = mMessage->text(); |
680 | mFaxOtherMessageParameters = mParameters->text(); | 680 | mFaxOtherMessageParameters = mParameters->text(); |
681 | } | 681 | } |
682 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 682 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
683 | { | 683 | { |
684 | mPagerOtherChannel = mChannel->text(); | 684 | mPagerOtherChannel = mChannel->text(); |
685 | mPagerOtherMessage = mMessage->text(); | 685 | mPagerOtherMessage = mMessage->text(); |
686 | mPagerOtherMessageParameters = mParameters->text(); | 686 | mPagerOtherMessageParameters = mParameters->text(); |
687 | } | 687 | } |
688 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 688 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
689 | { | 689 | { |
690 | mSipOtherChannel = mChannel->text(); | 690 | mSipOtherChannel = mChannel->text(); |
691 | mSipOtherMessage = mMessage->text(); | 691 | mSipOtherMessage = mMessage->text(); |
692 | mSipOtherMessageParameters = mParameters->text(); | 692 | mSipOtherMessageParameters = mParameters->text(); |
693 | } | 693 | } |
694 | 694 | ||
695 | 695 | ||
696 | } | 696 | } |
697 | 697 | ||
698 | void KDEPIMConfigWidget::updateClientWidgets() | 698 | void KDEPIMConfigWidget::updateClientWidgets() |
699 | { | 699 | { |
700 | bool blocked = signalsBlocked(); | 700 | bool blocked = signalsBlocked(); |
701 | blockSignals( true ); | 701 | blockSignals( true ); |
702 | 702 | ||
703 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 703 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
704 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 704 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
705 | if (it == mExternalAppsMap.end()) | 705 | if (it == mExternalAppsMap.end()) |
706 | return; | 706 | return; |
707 | 707 | ||
708 | // update group box | 708 | // update group box |
709 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 709 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
710 | 710 | ||
711 | //update the entries in the client combobox | 711 | //update the entries in the client combobox |
712 | mClient->clear(); | 712 | mClient->clear(); |
713 | 713 | ||
714 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 714 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
715 | DefaultAppItem* dai; | 715 | DefaultAppItem* dai; |
716 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 716 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
717 | { | 717 | { |
718 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 718 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
719 | 719 | ||
720 | if (dai->_id == mCurrentClient) | 720 | if (dai->_id == mCurrentClient) |
721 | { | 721 | { |
722 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 722 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
723 | //Otherwise take the default data from externalapphandler. | 723 | //Otherwise take the default data from externalapphandler. |
724 | mChannel->setText(dai->_channel); | 724 | mChannel->setText(dai->_channel); |
725 | mMessage->setText(dai->_message); | 725 | mMessage->setText(dai->_message); |
726 | mParameters->setText(dai->_parameters); | 726 | mParameters->setText(dai->_parameters); |
727 | if ( mMessage2 ) | 727 | if ( mMessage2 ) |
728 | mMessage2->setText(dai->_message2); | 728 | mMessage2->setText(dai->_message2); |
729 | if ( mParameters2 ) | 729 | if ( mParameters2 ) |
730 | mParameters2->setText(dai->_parameters2); | 730 | mParameters2->setText(dai->_parameters2); |
731 | 731 | ||
732 | 732 | ||
733 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 733 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
734 | { | 734 | { |
735 | mChannel->setText(mEmailOtherChannel); | 735 | mChannel->setText(mEmailOtherChannel); |
736 | mMessage->setText(mEmailOtherMessage); | 736 | mMessage->setText(mEmailOtherMessage); |
737 | mParameters->setText(mEmailOtherMessageParameters); | 737 | mParameters->setText(mEmailOtherMessageParameters); |
738 | if ( mMessage2 ) | 738 | if ( mMessage2 ) |
739 | mMessage2->setText(mEmailOtherMessage2); | 739 | mMessage2->setText(mEmailOtherMessage2); |
740 | if ( mParameters2 ) | 740 | if ( mParameters2 ) |
741 | mParameters2->setText(mEmailOtherMessageParameters2); | 741 | mParameters2->setText(mEmailOtherMessageParameters2); |
742 | } | 742 | } |
743 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 743 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
744 | { | 744 | { |
745 | mChannel->setText(mPhoneOtherChannel); | 745 | mChannel->setText(mPhoneOtherChannel); |
746 | mMessage->setText(mPhoneOtherMessage); | 746 | mMessage->setText(mPhoneOtherMessage); |
747 | mParameters->setText(mPhoneOtherMessageParameters); | 747 | mParameters->setText(mPhoneOtherMessageParameters); |
748 | } | 748 | } |
749 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 749 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
750 | { | 750 | { |
751 | mChannel->setText(mSMSOtherChannel); | 751 | mChannel->setText(mSMSOtherChannel); |
752 | mMessage->setText(mSMSOtherMessage); | 752 | mMessage->setText(mSMSOtherMessage); |
753 | mParameters->setText(mSMSOtherMessageParameters); | 753 | mParameters->setText(mSMSOtherMessageParameters); |
754 | } | 754 | } |
755 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 755 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
756 | { | 756 | { |
757 | mChannel->setText(mFaxOtherChannel); | 757 | mChannel->setText(mFaxOtherChannel); |
758 | mMessage->setText(mFaxOtherMessage); | 758 | mMessage->setText(mFaxOtherMessage); |
759 | mParameters->setText(mFaxOtherMessageParameters); | 759 | mParameters->setText(mFaxOtherMessageParameters); |
760 | } | 760 | } |
761 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 761 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
762 | { | 762 | { |
763 | mChannel->setText(mPagerOtherChannel); | 763 | mChannel->setText(mPagerOtherChannel); |
764 | mMessage->setText(mPagerOtherMessage); | 764 | mMessage->setText(mPagerOtherMessage); |
765 | mParameters->setText(mPagerOtherMessageParameters); | 765 | mParameters->setText(mPagerOtherMessageParameters); |
766 | } | 766 | } |
767 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 767 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
768 | { | 768 | { |
769 | mChannel->setText(mSipOtherChannel); | 769 | mChannel->setText(mSipOtherChannel); |
770 | mMessage->setText(mSipOtherMessage); | 770 | mMessage->setText(mSipOtherMessage); |
771 | mParameters->setText(mSipOtherMessageParameters); | 771 | mParameters->setText(mSipOtherMessageParameters); |
772 | } | 772 | } |
773 | } | 773 | } |
774 | 774 | ||
775 | } | 775 | } |
776 | 776 | ||
777 | bool readonly; | 777 | bool readonly; |
778 | bool enabled; | 778 | bool enabled; |
779 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 779 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
780 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 780 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
781 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 781 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
782 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 782 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
783 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 783 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
784 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) | 784 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC))) |
785 | { | 785 | { |
786 | readonly = false; | 786 | readonly = false; |
787 | } | 787 | } |
788 | else | 788 | else |
789 | { | 789 | { |
790 | readonly = true; | 790 | readonly = true; |
791 | } | 791 | } |
792 | 792 | ||
793 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) | 793 | if ( ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::NONE_EMC)) |
794 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) | 794 | ||((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::NONE_PHC)) |
795 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) | 795 | ||((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::NONE_SMC)) |
796 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) | 796 | ||((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::NONE_FAC)) |
797 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) | 797 | ||((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::NONE_PAC)) |
798 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) | 798 | ||((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::NONE_SIC))) |
799 | { | 799 | { |
800 | enabled = false; | 800 | enabled = false; |
801 | } | 801 | } |
802 | else | 802 | else |
803 | { | 803 | { |
804 | enabled = true; | 804 | enabled = true; |
805 | } | 805 | } |
806 | 806 | ||
807 | 807 | ||
808 | mChannel->setReadOnly(readonly); | 808 | mChannel->setReadOnly(readonly); |
809 | mMessage->setReadOnly(readonly); | 809 | mMessage->setReadOnly(readonly); |
810 | mParameters->setReadOnly(readonly); | 810 | mParameters->setReadOnly(readonly); |
811 | if ( mMessage2 ) | 811 | if ( mMessage2 ) |
812 | mMessage2->setReadOnly(readonly); | 812 | mMessage2->setReadOnly(readonly); |
813 | if ( mParameters2 ) | 813 | if ( mParameters2 ) |
814 | mParameters2->setReadOnly(readonly); | 814 | mParameters2->setReadOnly(readonly); |
815 | 815 | ||
816 | mChannel->setEnabled(enabled); | 816 | mChannel->setEnabled(enabled); |
817 | mMessage->setEnabled(enabled); | 817 | mMessage->setEnabled(enabled); |
818 | mParameters->setEnabled(enabled); | 818 | mParameters->setEnabled(enabled); |
819 | if ( mMessage2 ) | 819 | if ( mMessage2 ) |
820 | mMessage2->setEnabled(enabled); | 820 | mMessage2->setEnabled(enabled); |
821 | if ( mParameters2 ) | 821 | if ( mParameters2 ) |
822 | mParameters2->setEnabled(enabled); | 822 | mParameters2->setEnabled(enabled); |
823 | 823 | ||
824 | 824 | ||
825 | 825 | ||
826 | mClient->setCurrentItem(mCurrentClient); | 826 | mClient->setCurrentItem(mCurrentClient); |
827 | 827 | ||
828 | 828 | ||
829 | // enable/disable the extra message/parameter field | 829 | // enable/disable the extra message/parameter field |
830 | if (mCurrentApp == ExternalAppHandler::EMAIL) | 830 | if (mCurrentApp == ExternalAppHandler::EMAIL) |
831 | { | 831 | { |
832 | } | 832 | } |
833 | else | 833 | else |
834 | { | 834 | { |
835 | if ( mMessage2 ) | 835 | if ( mMessage2 ) |
836 | mMessage2->setText( "" ); | 836 | mMessage2->setText( "" ); |
837 | if ( mParameters2 ) | 837 | if ( mParameters2 ) |
838 | mParameters2->setText( "" ); | 838 | mParameters2->setText( "" ); |
839 | } | 839 | } |
840 | 840 | ||
841 | if (enabled == true) { | 841 | if (enabled == true) { |
842 | if ( mMessage2 ) | 842 | if ( mMessage2 ) |
843 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 843 | mMessage2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
844 | if ( mParameters2 ) | 844 | if ( mParameters2 ) |
845 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); | 845 | mParameters2->setEnabled(mCurrentApp == ExternalAppHandler::EMAIL); |
846 | } | 846 | } |
847 | 847 | ||
848 | 848 | ||
849 | blockSignals( blocked ); | 849 | blockSignals( blocked ); |
850 | 850 | ||
851 | } | 851 | } |
852 | 852 | ||
853 | void KDEPIMConfigWidget::usrReadConfig() | 853 | void KDEPIMConfigWidget::usrReadConfig() |
854 | { | 854 | { |
855 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 855 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
856 | 856 | ||
857 | bool blocked = signalsBlocked(); | 857 | bool blocked = signalsBlocked(); |
858 | blockSignals( true ); | 858 | blockSignals( true ); |
859 | 859 | ||
860 | if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) | 860 | if (KPimGlobalPrefs::instance()->mBackupUseDefaultDir ) |
861 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | 861 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); |
862 | else { | 862 | else { |
863 | mBackupUrl->setURL(prefs->mBackupDatadir); | 863 | mBackupUrl->setURL(prefs->mBackupDatadir); |
864 | 864 | ||
865 | } | 865 | } |
866 | mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); | 866 | mBackupNumbersSpin->setValue( prefs->mBackupNumbers ); |
867 | mBackupDayCountSpin->setValue( prefs->mBackupDayCount); | 867 | mBackupDayCountSpin->setValue( prefs->mBackupDayCount); |
868 | 868 | ||
869 | QString dummy = prefs->mUserDateFormatLong; | 869 | QString dummy = prefs->mUserDateFormatLong; |
870 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | 870 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); |
871 | dummy = prefs->mUserDateFormatShort; | 871 | dummy = prefs->mUserDateFormatShort; |
872 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | 872 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); |
873 | 873 | ||
874 | QDate current ( 2001, 1,1); | 874 | QDate current ( 2001, 1,1); |
875 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); | 875 | mStartDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingStart-1)); |
876 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); | 876 | mEndDateSavingEdit->setDate(current.addDays(prefs->mDaylightsavingEnd-1)); |
877 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); | 877 | setCombo(mTimeZoneCombo,i18n(prefs->mTimeZoneId)); |
878 | 878 | ||
879 | mEmailClient = prefs->mEmailClient; | 879 | mEmailClient = prefs->mEmailClient; |
880 | mEmailOtherChannel = prefs->mEmailOtherChannel; | 880 | mEmailOtherChannel = prefs->mEmailOtherChannel; |
881 | mEmailOtherMessage = prefs->mEmailOtherMessage; | 881 | mEmailOtherMessage = prefs->mEmailOtherMessage; |
882 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; | 882 | mEmailOtherMessageParameters = prefs->mEmailOtherMessageParameters; |
883 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; | 883 | mEmailOtherMessage2 = prefs->mEmailOtherMessage2; |
884 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; | 884 | mEmailOtherMessageParameters2 = prefs->mEmailOtherMessageParameters2; |
885 | 885 | ||
886 | mPhoneClient = prefs->mPhoneClient; | 886 | mPhoneClient = prefs->mPhoneClient; |
887 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; | 887 | mPhoneOtherChannel = prefs->mPhoneOtherChannel; |
888 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; | 888 | mPhoneOtherMessage = prefs->mPhoneOtherMessage; |
889 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; | 889 | mPhoneOtherMessageParameters = prefs->mPhoneOtherMessageParameters; |
890 | 890 | ||
891 | mFaxClient = prefs->mFaxClient; | 891 | mFaxClient = prefs->mFaxClient; |
892 | mFaxOtherChannel = prefs->mFaxOtherChannel; | 892 | mFaxOtherChannel = prefs->mFaxOtherChannel; |
893 | mFaxOtherMessage = prefs->mFaxOtherMessage; | 893 | mFaxOtherMessage = prefs->mFaxOtherMessage; |
894 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; | 894 | mFaxOtherMessageParameters = prefs->mFaxOtherMessageParameters; |
895 | 895 | ||
896 | mSMSClient = prefs->mSMSClient; | 896 | mSMSClient = prefs->mSMSClient; |
897 | mSMSOtherChannel = prefs->mSMSOtherChannel; | 897 | mSMSOtherChannel = prefs->mSMSOtherChannel; |
898 | mSMSOtherMessage = prefs->mSMSOtherMessage; | 898 | mSMSOtherMessage = prefs->mSMSOtherMessage; |
899 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; | 899 | mSMSOtherMessageParameters = prefs->mSMSOtherMessageParameters; |
900 | 900 | ||
901 | mPagerClient = prefs->mPagerClient; | 901 | mPagerClient = prefs->mPagerClient; |
902 | mPagerOtherChannel = prefs->mPagerOtherChannel; | 902 | mPagerOtherChannel = prefs->mPagerOtherChannel; |
903 | mPagerOtherMessage = prefs->mPagerOtherMessage; | 903 | mPagerOtherMessage = prefs->mPagerOtherMessage; |
904 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; | 904 | mPagerOtherMessageParameters = prefs->mPagerOtherMessageParameters; |
905 | 905 | ||
906 | mSipClient = prefs->mSipClient; | 906 | mSipClient = prefs->mSipClient; |
907 | mSipOtherChannel = prefs->mSipOtherChannel; | 907 | mSipOtherChannel = prefs->mSipOtherChannel; |
908 | mSipOtherMessage = prefs->mSipOtherMessage; | 908 | mSipOtherMessage = prefs->mSipOtherMessage; |
909 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; | 909 | mSipOtherMessageParameters = prefs->mSipOtherMessageParameters; |
910 | 910 | ||
911 | mCurrentApp = ExternalAppHandler::EMAIL; | 911 | mCurrentApp = ExternalAppHandler::EMAIL; |
912 | mCurrentClient = mEmailClient; | 912 | mCurrentClient = mEmailClient; |
913 | 913 | ||
914 | updateClientWidgets(); | 914 | updateClientWidgets(); |
915 | 915 | ||
916 | blockSignals( blocked ); | 916 | blockSignals( blocked ); |
917 | 917 | ||
918 | } | 918 | } |
919 | 919 | ||
920 | void KDEPIMConfigWidget::usrWriteConfig() | 920 | void KDEPIMConfigWidget::usrWriteConfig() |
921 | { | 921 | { |
922 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); | 922 | KPimGlobalPrefs* prefs = KPimGlobalPrefs::instance(); |
923 | 923 | ||
924 | saveEditFieldSettings(); | 924 | saveEditFieldSettings(); |
925 | 925 | ||
926 | prefs->mBackupNumbers = mBackupNumbersSpin->value(); | 926 | prefs->mBackupNumbers = mBackupNumbersSpin->value(); |
927 | prefs->mBackupDayCount = mBackupDayCountSpin->value(); | 927 | prefs->mBackupDayCount = mBackupDayCountSpin->value(); |
928 | prefs->mBackupDatadir = mBackupUrl->url(); | 928 | QString bup_url = mBackupUrl->url(); |
929 | if ( bup_url.right(1) != "/" && bup_url.right(1) != "\\" ) | ||
930 | bup_url += "/"; | ||
931 | |||
932 | prefs->mBackupDatadir = bup_url; | ||
929 | 933 | ||
930 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | 934 | prefs->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); |
931 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | 935 | prefs->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); |
932 | 936 | ||
933 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); | 937 | prefs->mTimeZoneId = mTimeZoneCombo->currentText(); |
934 | QDate date; | 938 | QDate date; |
935 | date = mStartDateSavingEdit->date(); | 939 | date = mStartDateSavingEdit->date(); |
936 | int sub = 0; | 940 | int sub = 0; |
937 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 941 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
938 | sub = 1; | 942 | sub = 1; |
939 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; | 943 | prefs->mDaylightsavingStart = date.dayOfYear()-sub; |
940 | date = mEndDateSavingEdit->date(); | 944 | date = mEndDateSavingEdit->date(); |
941 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | 945 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) |
942 | sub = 1; | 946 | sub = 1; |
943 | else | 947 | else |
944 | sub = 0; | 948 | sub = 0; |
945 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; | 949 | prefs->mDaylightsavingEnd = date.dayOfYear()-sub; |
946 | 950 | ||
947 | 951 | ||
948 | prefs->mEmailClient = mEmailClient; | 952 | prefs->mEmailClient = mEmailClient; |
949 | prefs->mEmailOtherChannel = mEmailOtherChannel; | 953 | prefs->mEmailOtherChannel = mEmailOtherChannel; |
950 | prefs->mEmailOtherMessage = mEmailOtherMessage; | 954 | prefs->mEmailOtherMessage = mEmailOtherMessage; |
951 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; | 955 | prefs->mEmailOtherMessageParameters = mEmailOtherMessageParameters; |
952 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; | 956 | prefs->mEmailOtherMessage2 = mEmailOtherMessage2; |
953 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; | 957 | prefs->mEmailOtherMessageParameters2 = mEmailOtherMessageParameters2; |
954 | 958 | ||
955 | prefs->mPhoneClient = mPhoneClient; | 959 | prefs->mPhoneClient = mPhoneClient; |
956 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; | 960 | prefs->mPhoneOtherChannel = mPhoneOtherChannel; |
957 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; | 961 | prefs->mPhoneOtherMessage = mPhoneOtherMessage; |
958 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; | 962 | prefs->mPhoneOtherMessageParameters = mPhoneOtherMessageParameters; |
959 | 963 | ||
960 | prefs->mFaxClient = mFaxClient; | 964 | prefs->mFaxClient = mFaxClient; |
961 | prefs->mFaxOtherChannel = mFaxOtherChannel; | 965 | prefs->mFaxOtherChannel = mFaxOtherChannel; |
962 | prefs->mFaxOtherMessage = mFaxOtherMessage; | 966 | prefs->mFaxOtherMessage = mFaxOtherMessage; |
963 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; | 967 | prefs->mFaxOtherMessageParameters = mFaxOtherMessageParameters; |
964 | 968 | ||
965 | prefs->mSMSClient = mSMSClient; | 969 | prefs->mSMSClient = mSMSClient; |
966 | prefs->mSMSOtherChannel = mSMSOtherChannel; | 970 | prefs->mSMSOtherChannel = mSMSOtherChannel; |
967 | prefs->mSMSOtherMessage = mSMSOtherMessage; | 971 | prefs->mSMSOtherMessage = mSMSOtherMessage; |
968 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; | 972 | prefs->mSMSOtherMessageParameters = mSMSOtherMessageParameters; |
969 | 973 | ||
970 | prefs->mPagerClient = mPagerClient; | 974 | prefs->mPagerClient = mPagerClient; |
971 | prefs->mPagerOtherChannel = mPagerOtherChannel; | 975 | prefs->mPagerOtherChannel = mPagerOtherChannel; |
972 | prefs->mPagerOtherMessage = mPagerOtherMessage; | 976 | prefs->mPagerOtherMessage = mPagerOtherMessage; |
973 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; | 977 | prefs->mPagerOtherMessageParameters = mPagerOtherMessageParameters; |
974 | 978 | ||
975 | 979 | ||
976 | prefs->mSipClient = mSipClient; | 980 | prefs->mSipClient = mSipClient; |
977 | prefs->mSipOtherChannel = mSipOtherChannel; | 981 | prefs->mSipOtherChannel = mSipOtherChannel; |
978 | prefs->mSipOtherMessage = mSipOtherMessage; | 982 | prefs->mSipOtherMessage = mSipOtherMessage; |
979 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; | 983 | prefs->mSipOtherMessageParameters = mSipOtherMessageParameters; |
980 | 984 | ||
981 | //release the cache that other views can access the changed values instantanious | 985 | //release the cache that other views can access the changed values instantanious |
982 | ExternalAppHandler::instance()->loadConfig(); | 986 | ExternalAppHandler::instance()->loadConfig(); |
983 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 987 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
984 | } | 988 | } |
985 | 989 | ||
986 | 990 | ||
987 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, | 991 | void KDEPIMConfigWidget::setCombo(QComboBox *combo, const QString & text, |
988 | const QStringList *tags) | 992 | const QStringList *tags) |
989 | { | 993 | { |
990 | if (tags) { | 994 | if (tags) { |
991 | int i = tags->findIndex(text); | 995 | int i = tags->findIndex(text); |
992 | if (i > 0) combo->setCurrentItem(i); | 996 | if (i > 0) combo->setCurrentItem(i); |
993 | } else { | 997 | } else { |
994 | for(int i=0;i<combo->count();++i) { | 998 | for(int i=0;i<combo->count();++i) { |
995 | if (combo->text(i) == text) { | 999 | if (combo->text(i) == text) { |
996 | combo->setCurrentItem(i); | 1000 | combo->setCurrentItem(i); |
997 | break; | 1001 | break; |
998 | } | 1002 | } |
999 | } | 1003 | } |
1000 | } | 1004 | } |
1001 | } | 1005 | } |
1002 | 1006 | ||
1003 | 1007 | ||
1004 | void KDEPIMConfigWidget::textChanged( const QString& text ) | 1008 | void KDEPIMConfigWidget::textChanged( const QString& text ) |
1005 | { | 1009 | { |
1006 | emit changed( true ); | 1010 | emit changed( true ); |
1007 | } | 1011 | } |