-rw-r--r-- | korganizer/koagendaitem.cpp | 5 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 17 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 5 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 8 | ||||
-rw-r--r-- | korganizer/koprefs.h | 8 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 32 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 5 |
8 files changed, 79 insertions, 7 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 6a312b3..cead612 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,285 +1,288 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
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 | 19 | ||
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkcal/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | class KOAgendaItemWhatsThis :public QWhatsThis | 59 | class KOAgendaItemWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& ) | 65 | virtual QString text( const QPoint& ) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText() ; | 67 | return _view->getWhatsThisText() ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KOAgendaItemWhatsThis(this); | 80 | new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | setMouseTracking(true); | 85 | setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
87 | xPaintCoord = -1; | 87 | xPaintCoord = -1; |
88 | yPaintCoord = -1; | 88 | yPaintCoord = -1; |
89 | } | 89 | } |
90 | QString KOAgendaItem::getWhatsThisText() | 90 | QString KOAgendaItem::getWhatsThisText() |
91 | { | 91 | { |
92 | if ( mIncidence ) | 92 | if ( mIncidence ) |
93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence ); | 93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
94 | KOPrefs::instance()->mWTshowDetails, | ||
95 | KOPrefs::instance()->mWTshowCreated, | ||
96 | KOPrefs::instance()->mWTshowChanged); | ||
94 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 97 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
95 | } | 98 | } |
96 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
97 | { | 100 | { |
98 | mIncidence = incidence; | 101 | mIncidence = incidence; |
99 | mDate = qd; | 102 | mDate = qd; |
100 | mFirstMultiItem = 0; | 103 | mFirstMultiItem = 0; |
101 | mNextMultiItem = 0; | 104 | mNextMultiItem = 0; |
102 | mLastMultiItem = 0; | 105 | mLastMultiItem = 0; |
103 | computeText(); | 106 | computeText(); |
104 | 107 | ||
105 | if ( (incidence->type() == "Todo") && | 108 | if ( (incidence->type() == "Todo") && |
106 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
107 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
108 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
109 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
110 | else | 113 | else |
111 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
112 | } | 115 | } |
113 | else { | 116 | else { |
114 | QStringList categories = mIncidence->categories(); | 117 | QStringList categories = mIncidence->categories(); |
115 | QString cat = categories.first(); | 118 | QString cat = categories.first(); |
116 | if (cat.isEmpty()) { | 119 | if (cat.isEmpty()) { |
117 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
118 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
119 | else | 122 | else |
120 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 123 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
121 | } else { | 124 | } else { |
122 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
123 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
124 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 127 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
125 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 128 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
126 | } | 129 | } |
127 | } | 130 | } |
128 | 131 | ||
129 | } | 132 | } |
130 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 133 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
131 | mBackgroundColor.dark(),mBackgroundColor.light(), | 134 | mBackgroundColor.dark(),mBackgroundColor.light(), |
132 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 135 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
133 | setBackgroundColor( mBackgroundColor ); | 136 | setBackgroundColor( mBackgroundColor ); |
134 | 137 | ||
135 | setCellXY(0,0,1); | 138 | setCellXY(0,0,1); |
136 | setCellXWidth(0); | 139 | setCellXWidth(0); |
137 | setSubCell(0); | 140 | setSubCell(0); |
138 | setSubCells(1); | 141 | setSubCells(1); |
139 | setMultiItem(0,0,0); | 142 | setMultiItem(0,0,0); |
140 | startMove(); | 143 | startMove(); |
141 | mSelected = true; | 144 | mSelected = true; |
142 | select(false); | 145 | select(false); |
143 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 146 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
144 | mFontPixelSize = fontinf.height();; | 147 | mFontPixelSize = fontinf.height();; |
145 | hide(); | 148 | hide(); |
146 | xPaintCoord = -1; | 149 | xPaintCoord = -1; |
147 | yPaintCoord = -1; | 150 | yPaintCoord = -1; |
148 | } | 151 | } |
149 | 152 | ||
150 | 153 | ||
151 | KOAgendaItem::~KOAgendaItem() | 154 | KOAgendaItem::~KOAgendaItem() |
152 | { | 155 | { |
153 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 156 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
154 | 157 | ||
155 | } | 158 | } |
156 | 159 | ||
157 | void KOAgendaItem::recreateIncidence() | 160 | void KOAgendaItem::recreateIncidence() |
158 | { | 161 | { |
159 | #if 0 | 162 | #if 0 |
160 | Incidence* newInc = mIncidence->clone(); | 163 | Incidence* newInc = mIncidence->clone(); |
161 | newInc->recreate(); | 164 | newInc->recreate(); |
162 | if ( mIncidence->doesRecur() ) { | 165 | if ( mIncidence->doesRecur() ) { |
163 | mIncidence->addExDate( mDate ); | 166 | mIncidence->addExDate( mDate ); |
164 | newInc->recurrence()->unsetRecurs(); | 167 | newInc->recurrence()->unsetRecurs(); |
165 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 168 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
166 | QTime tim = mIncidence->dtStart().time(); | 169 | QTime tim = mIncidence->dtStart().time(); |
167 | newInc->setDtStart( QDateTime(mDate, tim) ); | 170 | newInc->setDtStart( QDateTime(mDate, tim) ); |
168 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 171 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
169 | } | 172 | } |
170 | #endif | 173 | #endif |
171 | mIncidence = mIncidence->recreateCloneException( mDate ); | 174 | mIncidence = mIncidence->recreateCloneException( mDate ); |
172 | } | 175 | } |
173 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 176 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
174 | { | 177 | { |
175 | int size = AGENDA_ICON_SIZE; | 178 | int size = AGENDA_ICON_SIZE; |
176 | 179 | ||
177 | int yOff = 0; | 180 | int yOff = 0; |
178 | int xOff = 0; | 181 | int xOff = 0; |
179 | int x = pos().x() +3; | 182 | int x = pos().x() +3; |
180 | int y; | 183 | int y; |
181 | if ( mAllDay ) | 184 | if ( mAllDay ) |
182 | y = pos().y()+3; | 185 | y = pos().y()+3; |
183 | else | 186 | else |
184 | y = mCellYTop * ( height() / cellHeight() ) +3; | 187 | y = mCellYTop * ( height() / cellHeight() ) +3; |
185 | if (mIncidence->cancelled()) { | 188 | if (mIncidence->cancelled()) { |
186 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 189 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
187 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 190 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
188 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 191 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
189 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 192 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
190 | if ( horLayout ) | 193 | if ( horLayout ) |
191 | ++xOff; | 194 | ++xOff; |
192 | else | 195 | else |
193 | ++yOff; | 196 | ++yOff; |
194 | } | 197 | } |
195 | if (mIncidence->isAlarmEnabled()) { | 198 | if (mIncidence->isAlarmEnabled()) { |
196 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 199 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
197 | if ( horLayout ) | 200 | if ( horLayout ) |
198 | ++xOff; | 201 | ++xOff; |
199 | else | 202 | else |
200 | ++yOff; | 203 | ++yOff; |
201 | } | 204 | } |
202 | if (mIncidence->recurrence()->doesRecur()) { | 205 | if (mIncidence->recurrence()->doesRecur()) { |
203 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 206 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
204 | if ( horLayout ) | 207 | if ( horLayout ) |
205 | ++xOff; | 208 | ++xOff; |
206 | else | 209 | else |
207 | ++yOff; | 210 | ++yOff; |
208 | } | 211 | } |
209 | if (mIncidence->description().length() > 0) { | 212 | if (mIncidence->description().length() > 0) { |
210 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 213 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
211 | if ( horLayout ) | 214 | if ( horLayout ) |
212 | ++xOff; | 215 | ++xOff; |
213 | else | 216 | else |
214 | ++yOff; | 217 | ++yOff; |
215 | } | 218 | } |
216 | if (mIncidence->isReadOnly()) { | 219 | if (mIncidence->isReadOnly()) { |
217 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 220 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
218 | if ( horLayout ) | 221 | if ( horLayout ) |
219 | ++xOff; | 222 | ++xOff; |
220 | else | 223 | else |
221 | ++yOff; | 224 | ++yOff; |
222 | } | 225 | } |
223 | 226 | ||
224 | if (mIncidence->attendeeCount()>0) { | 227 | if (mIncidence->attendeeCount()>0) { |
225 | 228 | ||
226 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 229 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
227 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 230 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
228 | if ( horLayout ) | 231 | if ( horLayout ) |
229 | ++xOff; | 232 | ++xOff; |
230 | else | 233 | else |
231 | ++yOff; | 234 | ++yOff; |
232 | } else { | 235 | } else { |
233 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 236 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
234 | if (me!=0) { | 237 | if (me!=0) { |
235 | 238 | ||
236 | 239 | ||
237 | } else { | 240 | } else { |
238 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 241 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
239 | if ( horLayout ) | 242 | if ( horLayout ) |
240 | ++xOff; | 243 | ++xOff; |
241 | else | 244 | else |
242 | ++yOff; | 245 | ++yOff; |
243 | 246 | ||
244 | } | 247 | } |
245 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 248 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
246 | if ( horLayout ) | 249 | if ( horLayout ) |
247 | ++xOff; | 250 | ++xOff; |
248 | else | 251 | else |
249 | ++yOff; | 252 | ++yOff; |
250 | 253 | ||
251 | } | 254 | } |
252 | 255 | ||
253 | } | 256 | } |
254 | return ( yOff || xOff ); | 257 | return ( yOff || xOff ); |
255 | } | 258 | } |
256 | 259 | ||
257 | 260 | ||
258 | void KOAgendaItem::select(bool selected) | 261 | void KOAgendaItem::select(bool selected) |
259 | { | 262 | { |
260 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 263 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
261 | if (mSelected == selected) return; | 264 | if (mSelected == selected) return; |
262 | mSelected = selected; | 265 | mSelected = selected; |
263 | if ( ! isVisible() ) | 266 | if ( ! isVisible() ) |
264 | return; | 267 | return; |
265 | if ( firstMultiItem() ) | 268 | if ( firstMultiItem() ) |
266 | firstMultiItem()->select( selected ); | 269 | firstMultiItem()->select( selected ); |
267 | if ( !firstMultiItem() && nextMultiItem() ) { | 270 | if ( !firstMultiItem() && nextMultiItem() ) { |
268 | KOAgendaItem * placeItem = nextMultiItem(); | 271 | KOAgendaItem * placeItem = nextMultiItem(); |
269 | while ( placeItem ) { | 272 | while ( placeItem ) { |
270 | placeItem->select( selected ); | 273 | placeItem->select( selected ); |
271 | placeItem = placeItem->nextMultiItem(); | 274 | placeItem = placeItem->nextMultiItem(); |
272 | } | 275 | } |
273 | } | 276 | } |
274 | globalFlagBlockAgendaItemUpdate = 0; | 277 | globalFlagBlockAgendaItemUpdate = 0; |
275 | paintMe( selected ); | 278 | paintMe( selected ); |
276 | globalFlagBlockAgendaItemUpdate = 1; | 279 | globalFlagBlockAgendaItemUpdate = 1; |
277 | repaint( false ); | 280 | repaint( false ); |
278 | } | 281 | } |
279 | 282 | ||
280 | 283 | ||
281 | /* | 284 | /* |
282 | The eventFilter has to filter the mouse events of the agenda item childs. The | 285 | The eventFilter has to filter the mouse events of the agenda item childs. The |
283 | events are fed into the event handling method of KOAgendaItem. This allows the | 286 | events are fed into the event handling method of KOAgendaItem. This allows the |
284 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 287 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
285 | */ | 288 | */ |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index f6c9624..d87938a 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -150,467 +150,482 @@ void KOEventViewer::setSource(const QString& n) | |||
150 | return; | 150 | return; |
151 | } else if (n.startsWith("uid:")) { | 151 | } else if (n.startsWith("uid:")) { |
152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 152 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
153 | const QByteArray noParamData; | 153 | const QByteArray noParamData; |
154 | const QByteArray paramData; | 154 | const QByteArray paramData; |
155 | QByteArray replyData; | 155 | QByteArray replyData; |
156 | QCString replyTypeStr; | 156 | QCString replyTypeStr; |
157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 157 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
158 | bool foundAbbrowser = PING_ABBROWSER; | 158 | bool foundAbbrowser = PING_ABBROWSER; |
159 | 159 | ||
160 | if (foundAbbrowser) { | 160 | if (foundAbbrowser) { |
161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 161 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
162 | //client->send("kaddressbook","KAddressBookIface", | 162 | //client->send("kaddressbook","KAddressBookIface", |
163 | QDataStream arg(paramData, IO_WriteOnly); | 163 | QDataStream arg(paramData, IO_WriteOnly); |
164 | arg << n.mid(6); | 164 | arg << n.mid(6); |
165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 165 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
166 | return; | 166 | return; |
167 | } else { | 167 | } else { |
168 | /* | 168 | /* |
169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 169 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
170 | We start it without its main interface | 170 | We start it without its main interface |
171 | */ | 171 | */ |
172 | KIconLoader* iconLoader = new KIconLoader(); | 172 | KIconLoader* iconLoader = new KIconLoader(); |
173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
174 | ActionManager::setStartedKAddressBook(true); | 174 | ActionManager::setStartedKAddressBook(true); |
175 | tmpStr = "kaddressbook --editor-only --uid "; | 175 | tmpStr = "kaddressbook --editor-only --uid "; |
176 | tmpStr += KProcess::quote(n.mid(6)); | 176 | tmpStr += KProcess::quote(n.mid(6)); |
177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
178 | return; | 178 | return; |
179 | } | 179 | } |
180 | } else { | 180 | } else { |
181 | //QTextBrowser::setSource(n); | 181 | //QTextBrowser::setSource(n); |
182 | } | 182 | } |
183 | #endif | 183 | #endif |
184 | } | 184 | } |
185 | void KOEventViewer::mailToAttendees( bool all ) | 185 | void KOEventViewer::mailToAttendees( bool all ) |
186 | { | 186 | { |
187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
188 | if (attendees.count() == 0) return; | 188 | if (attendees.count() == 0) return; |
189 | QStringList nameList; | 189 | QStringList nameList; |
190 | QStringList emailList; | 190 | QStringList emailList; |
191 | QStringList uidList; | 191 | QStringList uidList; |
192 | Attendee* a; | 192 | Attendee* a; |
193 | for(a=attendees.first();a;a=attendees.next()) { | 193 | for(a=attendees.first();a;a=attendees.next()) { |
194 | if ( !all && !a->RSVP() ) continue; | 194 | if ( !all && !a->RSVP() ) continue; |
195 | if (!a->email().isEmpty()) { | 195 | if (!a->email().isEmpty()) { |
196 | nameList.append (a->name() ); | 196 | nameList.append (a->name() ); |
197 | emailList.append (a->email() ); | 197 | emailList.append (a->email() ); |
198 | uidList.append (a->uid() ); | 198 | uidList.append (a->uid() ); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 201 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
202 | #ifndef DESKTOP_VERSION | 202 | #ifndef DESKTOP_VERSION |
203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 203 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | } | 206 | } |
207 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 207 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
208 | { | 208 | { |
209 | int number=text.contains("\n"); | 209 | int number=text.contains("\n"); |
210 | QString str = "<" + tag + ">"; | 210 | QString str = "<" + tag + ">"; |
211 | QString tmpText=text; | 211 | QString tmpText=text; |
212 | QString tmpStr=str; | 212 | QString tmpStr=str; |
213 | if(number !=-1) | 213 | if(number !=-1) |
214 | { | 214 | { |
215 | if (number > 0) { | 215 | if (number > 0) { |
216 | int pos=0; | 216 | int pos=0; |
217 | QString tmp; | 217 | QString tmp; |
218 | for(int i=0;i<=number;i++) { | 218 | for(int i=0;i<=number;i++) { |
219 | pos=tmpText.find("\n"); | 219 | pos=tmpText.find("\n"); |
220 | tmp=tmpText.left(pos); | 220 | tmp=tmpText.left(pos); |
221 | tmpText=tmpText.right(tmpText.length()-pos-1); | 221 | tmpText=tmpText.right(tmpText.length()-pos-1); |
222 | tmpStr+=tmp+"<br>"; | 222 | tmpStr+=tmp+"<br>"; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | else tmpStr += tmpText; | 225 | else tmpStr += tmpText; |
226 | tmpStr+="</" + tag + ">"; | 226 | tmpStr+="</" + tag + ">"; |
227 | mText.append(tmpStr); | 227 | mText.append(tmpStr); |
228 | } | 228 | } |
229 | else | 229 | else |
230 | { | 230 | { |
231 | str += text + "</" + tag + ">"; | 231 | str += text + "</" + tag + ">"; |
232 | mText.append(str); | 232 | mText.append(str); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | void KOEventViewer::setColorMode( int m ) | 236 | void KOEventViewer::setColorMode( int m ) |
237 | { | 237 | { |
238 | mColorMode = m; | 238 | mColorMode = m; |
239 | } | 239 | } |
240 | void KOEventViewer::appendEvent(Event *event, int mode ) | 240 | void KOEventViewer::appendEvent(Event *event, int mode ) |
241 | { | 241 | { |
242 | mMailSubject = ""; | 242 | mMailSubject = ""; |
243 | mCurrentIncidence = event; | 243 | mCurrentIncidence = event; |
244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 244 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
245 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 245 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
246 | if ( mode == 0 ) { | 246 | if ( mode == 0 ) { |
247 | addTag("h2",event->summary()); | 247 | addTag("h2",event->summary()); |
248 | } | 248 | } |
249 | else { | 249 | else { |
250 | if ( mColorMode == 1 ) { | 250 | if ( mColorMode == 1 ) { |
251 | mText +="<font color=\"#00A000\">"; | 251 | mText +="<font color=\"#00A000\">"; |
252 | } | 252 | } |
253 | if ( mColorMode == 2 ) { | 253 | if ( mColorMode == 2 ) { |
254 | mText +="<font color=\"#C00000\">"; | 254 | mText +="<font color=\"#C00000\">"; |
255 | } | 255 | } |
256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 256 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
257 | if ( mode == 1 ) { | 257 | if ( mode == 1 ) { |
258 | addTag("h2",i18n( "Local: " ) +event->summary()); | 258 | addTag("h2",i18n( "Local: " ) +event->summary()); |
259 | } else { | 259 | } else { |
260 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 260 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
261 | } | 261 | } |
262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 262 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
263 | if ( mColorMode ) | 263 | if ( mColorMode ) |
264 | mText += "</font>"; | 264 | mText += "</font>"; |
265 | } | 265 | } |
266 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 266 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
267 | if (event->cancelled ()) { | 267 | if (event->cancelled ()) { |
268 | mText +="<font color=\"#B00000\">"; | 268 | mText +="<font color=\"#B00000\">"; |
269 | addTag("i",i18n("This event has been cancelled!")); | 269 | addTag("i",i18n("This event has been cancelled!")); |
270 | mText.append("<br>"); | 270 | mText.append("<br>"); |
271 | mText += "</font>"; | 271 | mText += "</font>"; |
272 | mMailSubject += i18n("(cancelled)"); | 272 | mMailSubject += i18n("(cancelled)"); |
273 | } | 273 | } |
274 | if (!event->location().isEmpty()) { | 274 | if (!event->location().isEmpty()) { |
275 | addTag("b",i18n("Location: ")); | 275 | addTag("b",i18n("Location: ")); |
276 | mText.append(event->location()+"<br>"); | 276 | mText.append(event->location()+"<br>"); |
277 | mMailSubject += i18n(" at ") + event->location(); | 277 | mMailSubject += i18n(" at ") + event->location(); |
278 | } | 278 | } |
279 | if (event->doesFloat()) { | 279 | if (event->doesFloat()) { |
280 | if (event->isMultiDay()) { | 280 | if (event->isMultiDay()) { |
281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 281 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
282 | .arg(event->dtStartDateStr(shortDate)) | 282 | .arg(event->dtStartDateStr(shortDate)) |
283 | .arg(event->dtEndDateStr(shortDate))); | 283 | .arg(event->dtEndDateStr(shortDate))); |
284 | } else { | 284 | } else { |
285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 285 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
286 | } | 286 | } |
287 | } else { | 287 | } else { |
288 | if (event->isMultiDay()) { | 288 | if (event->isMultiDay()) { |
289 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 289 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
290 | .arg(event->dtStartStr( shortDate))); | 290 | .arg(event->dtStartStr( shortDate))); |
291 | mText.append(i18n("<p><b>To:</b> %1</p>") | 291 | mText.append(i18n("<p><b>To:</b> %1</p>") |
292 | .arg(event->dtEndStr(shortDate))); | 292 | .arg(event->dtEndStr(shortDate))); |
293 | } else { | 293 | } else { |
294 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 294 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
295 | .arg(event->dtStartDateStr( shortDate ))); | 295 | .arg(event->dtStartDateStr( shortDate ))); |
296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 296 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
297 | .arg(event->dtStartTimeStr()) | 297 | .arg(event->dtStartTimeStr()) |
298 | .arg(event->dtEndTimeStr())); | 298 | .arg(event->dtEndTimeStr())); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool ok; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDateTime next; | 308 | QDateTime next; |
309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( ok ) { | 310 | if ( ok ) { |
311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
314 | 314 | ||
315 | } else { | 315 | } else { |
316 | bool last; | 316 | bool last; |
317 | QDate nextd; | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
319 | if ( last ) { | 319 | if ( last ) { |
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | } else { | 324 | } else { |
325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
326 | 326 | ||
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | if (event->isAlarmEnabled()) { | 330 | if (event->isAlarmEnabled()) { |
331 | Alarm *alarm =event->alarms().first() ; | 331 | Alarm *alarm =event->alarms().first() ; |
332 | QDateTime t = alarm->time(); | 332 | QDateTime t = alarm->time(); |
333 | int min = t.secsTo( event->dtStart() )/60; | 333 | int min = t.secsTo( event->dtStart() )/60; |
334 | QString s =i18n("( %1 min before )").arg( min ); | 334 | QString s =i18n("( %1 min before )").arg( min ); |
335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 335 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 336 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
337 | //addTag("p",s); | 337 | //addTag("p",s); |
338 | } | 338 | } |
339 | 339 | ||
340 | addTag("b",i18n("Access: ")); | 340 | addTag("b",i18n("Access: ")); |
341 | mText.append(event->secrecyStr()+"<br>"); | 341 | mText.append(event->secrecyStr()+"<br>"); |
342 | |||
343 | |||
344 | if ( KOPrefs::instance()->mEVshowDetails ) { | ||
342 | if (!event->description().isEmpty()) { | 345 | if (!event->description().isEmpty()) { |
343 | addTag("p",i18n("<b>Details: </b>")); | 346 | addTag("p",i18n("<b>Details: </b>")); |
344 | addTag("p",event->description()); | 347 | addTag("p",event->description()); |
345 | } | 348 | } |
346 | 349 | } | |
347 | formatCategories(event); | 350 | formatCategories(event); |
348 | 351 | ||
349 | formatReadOnly(event); | 352 | formatReadOnly(event); |
350 | formatAttendees(event); | 353 | formatAttendees(event); |
351 | 354 | ||
355 | if ( KOPrefs::instance()->mEVshowCreated ) { | ||
356 | addTag("p",i18n("<b>Created: ") +" </b>"); | ||
357 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | ||
358 | |||
359 | } | ||
360 | if ( KOPrefs::instance()->mEVshowChanged ) { | ||
361 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | ||
362 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | ||
363 | |||
364 | } | ||
352 | setText(mText); | 365 | setText(mText); |
353 | //QWhatsThis::add(this,mText); | 366 | //QWhatsThis::add(this,mText); |
354 | 367 | ||
355 | } | 368 | } |
356 | 369 | ||
357 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 370 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
358 | { | 371 | { |
359 | mMailSubject = ""; | 372 | mMailSubject = ""; |
360 | mCurrentIncidence = event; | 373 | mCurrentIncidence = event; |
361 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 374 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
362 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 375 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
363 | if (mode == 0 ) | 376 | if (mode == 0 ) |
364 | addTag("h2",event->summary()); | 377 | addTag("h2",event->summary()); |
365 | else { | 378 | else { |
366 | if ( mColorMode == 1 ) { | 379 | if ( mColorMode == 1 ) { |
367 | mText +="<font color=\"#00A000\">"; | 380 | mText +="<font color=\"#00A000\">"; |
368 | } | 381 | } |
369 | if ( mColorMode == 2 ) { | 382 | if ( mColorMode == 2 ) { |
370 | mText +="<font color=\"#B00000\">"; | 383 | mText +="<font color=\"#B00000\">"; |
371 | } | 384 | } |
372 | if ( mode == 1 ) { | 385 | if ( mode == 1 ) { |
373 | addTag("h2",i18n( "Local: " ) +event->summary()); | 386 | addTag("h2",i18n( "Local: " ) +event->summary()); |
374 | } else { | 387 | } else { |
375 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 388 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
376 | } | 389 | } |
377 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 390 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
378 | if ( mColorMode ) | 391 | if ( mColorMode ) |
379 | mText += "</font>"; | 392 | mText += "</font>"; |
380 | } | 393 | } |
381 | mMailSubject += i18n( "Todo " )+ event->summary(); | 394 | mMailSubject += i18n( "Todo " )+ event->summary(); |
382 | 395 | ||
383 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 396 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
384 | mText +="<font color=\"#B00000\">"; | 397 | mText +="<font color=\"#B00000\">"; |
385 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 398 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
386 | mText += "</font>"; | 399 | mText += "</font>"; |
387 | } else { | 400 | } else { |
388 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 401 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
389 | .arg(event->percentComplete())); | 402 | .arg(event->percentComplete())); |
390 | } | 403 | } |
391 | 404 | ||
392 | if (event->cancelled ()) { | 405 | if (event->cancelled ()) { |
393 | mText +="<font color=\"#B00000\">"; | 406 | mText +="<font color=\"#B00000\">"; |
394 | addTag("i",i18n("This todo has been cancelled!")); | 407 | addTag("i",i18n("This todo has been cancelled!")); |
395 | mText.append("<br>"); | 408 | mText.append("<br>"); |
396 | mText += "</font>"; | 409 | mText += "</font>"; |
397 | mMailSubject += i18n("(cancelled)"); | 410 | mMailSubject += i18n("(cancelled)"); |
398 | } | 411 | } |
399 | 412 | ||
400 | if (!event->location().isEmpty()) { | 413 | if (!event->location().isEmpty()) { |
401 | addTag("b",i18n("Location: ")); | 414 | addTag("b",i18n("Location: ")); |
402 | mText.append(event->location()+"<br>"); | 415 | mText.append(event->location()+"<br>"); |
403 | mMailSubject += i18n(" at ") + event->location(); | 416 | mMailSubject += i18n(" at ") + event->location(); |
404 | } | 417 | } |
405 | 418 | ||
406 | if (event->recurrence()->doesRecur()) { | 419 | if (event->recurrence()->doesRecur()) { |
407 | 420 | ||
408 | QString recurText = event->recurrence()->recurrenceText(); | 421 | QString recurText = event->recurrence()->recurrenceText(); |
409 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 422 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
410 | 423 | ||
411 | } | 424 | } |
412 | if (event->hasStartDate()) { | 425 | if (event->hasStartDate()) { |
413 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 426 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
414 | } | 427 | } |
415 | if (event->hasDueDate()) { | 428 | if (event->hasDueDate()) { |
416 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 429 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
417 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 430 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
418 | } | 431 | } |
419 | addTag("b",i18n("Access: ")); | 432 | addTag("b",i18n("Access: ")); |
420 | mText.append(event->secrecyStr()+"<br>"); | 433 | mText.append(event->secrecyStr()+"<br>"); |
434 | if ( KOPrefs::instance()->mEVshowDetails ) { | ||
421 | if (!event->description().isEmpty()) { | 435 | if (!event->description().isEmpty()) { |
422 | addTag("p",i18n("<b>Details: </b>")); | 436 | addTag("p",i18n("<b>Details: </b>")); |
423 | addTag("p",event->description()); | 437 | addTag("p",event->description()); |
424 | } | 438 | } |
439 | } | ||
425 | 440 | ||
426 | formatCategories(event); | 441 | formatCategories(event); |
427 | 442 | ||
428 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 443 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
429 | .arg(QString::number(event->priority()))); | 444 | .arg(QString::number(event->priority()))); |
430 | 445 | ||
431 | formatReadOnly(event); | 446 | formatReadOnly(event); |
432 | formatAttendees(event); | 447 | formatAttendees(event); |
433 | if ( event->relatedTo() ) { | 448 | if ( event->relatedTo() ) { |
434 | addTag("b",i18n("Parent todo:<br>")); | 449 | addTag("b",i18n("Parent todo:<br>")); |
435 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 450 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
436 | } | 451 | } |
437 | QPtrList<Incidence> Relations = event->relations(); | 452 | QPtrList<Incidence> Relations = event->relations(); |
438 | Incidence *to; | 453 | Incidence *to; |
439 | if ( Relations.first() ) | 454 | if ( Relations.first() ) |
440 | addTag("b",i18n("Sub todos:<br>")); | 455 | addTag("b",i18n("Sub todos:<br>")); |
441 | for (to=Relations.first();to;to=Relations.next()) { | 456 | for (to=Relations.first();to;to=Relations.next()) { |
442 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 457 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
443 | 458 | ||
444 | } | 459 | } |
445 | setText(mText); | 460 | setText(mText); |
446 | } | 461 | } |
447 | 462 | ||
448 | void KOEventViewer::formatCategories(Incidence *event) | 463 | void KOEventViewer::formatCategories(Incidence *event) |
449 | { | 464 | { |
450 | if (!event->categoriesStr().isEmpty()) { | 465 | if (!event->categoriesStr().isEmpty()) { |
451 | if (event->categories().count() == 1) { | 466 | if (event->categories().count() == 1) { |
452 | addTag("h3",i18n("Category")); | 467 | addTag("h3",i18n("Category")); |
453 | } else { | 468 | } else { |
454 | addTag("h3",i18n("Categories")); | 469 | addTag("h3",i18n("Categories")); |
455 | } | 470 | } |
456 | addTag("p",event->categoriesStr()); | 471 | addTag("p",event->categoriesStr()); |
457 | } | 472 | } |
458 | } | 473 | } |
459 | void KOEventViewer::formatAttendees(Incidence *event) | 474 | void KOEventViewer::formatAttendees(Incidence *event) |
460 | { | 475 | { |
461 | QPtrList<Attendee> attendees = event->attendees(); | 476 | QPtrList<Attendee> attendees = event->attendees(); |
462 | if (attendees.count()) { | 477 | if (attendees.count()) { |
463 | 478 | ||
464 | 479 | ||
465 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 480 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
466 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 481 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
467 | addTag("h3",i18n("Organizer")); | 482 | addTag("h3",i18n("Organizer")); |
468 | mText.append("<ul><li>"); | 483 | mText.append("<ul><li>"); |
469 | #ifndef KORG_NOKABC | 484 | #ifndef KORG_NOKABC |
470 | 485 | ||
471 | #ifdef DESKTOP_VERSION | 486 | #ifdef DESKTOP_VERSION |
472 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 487 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
473 | KABC::Addressee::List addressList; | 488 | KABC::Addressee::List addressList; |
474 | addressList = add_book->findByEmail(event->organizer()); | 489 | addressList = add_book->findByEmail(event->organizer()); |
475 | KABC::Addressee o = addressList.first(); | 490 | KABC::Addressee o = addressList.first(); |
476 | if (!o.isEmpty() && addressList.size()<2) { | 491 | if (!o.isEmpty() && addressList.size()<2) { |
477 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 492 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
478 | mText += o.formattedName(); | 493 | mText += o.formattedName(); |
479 | mText += "</a>\n"; | 494 | mText += "</a>\n"; |
480 | } else { | 495 | } else { |
481 | mText.append(event->organizer()); | 496 | mText.append(event->organizer()); |
482 | } | 497 | } |
483 | #else //DESKTOP_VERSION | 498 | #else //DESKTOP_VERSION |
484 | mText += "<a href=\"uid:organizer\">"; | 499 | mText += "<a href=\"uid:organizer\">"; |
485 | mText += event->organizer(); | 500 | mText += event->organizer(); |
486 | mText += "</a>\n"; | 501 | mText += "</a>\n"; |
487 | #endif //DESKTOP_VERSION | 502 | #endif //DESKTOP_VERSION |
488 | 503 | ||
489 | 504 | ||
490 | #else | 505 | #else |
491 | mText.append(event->organizer()); | 506 | mText.append(event->organizer()); |
492 | #endif | 507 | #endif |
493 | 508 | ||
494 | if (iconPath) { | 509 | if (iconPath) { |
495 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 510 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
496 | mText += "<IMG src=\"" + iconPath + "\">"; | 511 | mText += "<IMG src=\"" + iconPath + "\">"; |
497 | mText += "</a>\n"; | 512 | mText += "</a>\n"; |
498 | } | 513 | } |
499 | mText.append("</li></ul>"); | 514 | mText.append("</li></ul>"); |
500 | 515 | ||
501 | addTag("h3",i18n("Attendees")); | 516 | addTag("h3",i18n("Attendees")); |
502 | Attendee *a; | 517 | Attendee *a; |
503 | mText.append("<ul>"); | 518 | mText.append("<ul>"); |
504 | int a_count = 0; | 519 | int a_count = 0; |
505 | int a_count_nr = 0; | 520 | int a_count_nr = 0; |
506 | 521 | ||
507 | for(a=attendees.first();a;a=attendees.next()) { | 522 | for(a=attendees.first();a;a=attendees.next()) { |
508 | #ifndef KORG_NOKABC | 523 | #ifndef KORG_NOKABC |
509 | #ifdef DESKTOP_VERSION | 524 | #ifdef DESKTOP_VERSION |
510 | if (a->name().isEmpty()) { | 525 | if (a->name().isEmpty()) { |
511 | addressList = add_book->findByEmail(a->email()); | 526 | addressList = add_book->findByEmail(a->email()); |
512 | KABC::Addressee o = addressList.first(); | 527 | KABC::Addressee o = addressList.first(); |
513 | if (!o.isEmpty() && addressList.size()<2) { | 528 | if (!o.isEmpty() && addressList.size()<2) { |
514 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 529 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
515 | mText += o.formattedName(); | 530 | mText += o.formattedName(); |
516 | mText += "</a>\n"; | 531 | mText += "</a>\n"; |
517 | } else { | 532 | } else { |
518 | mText += "<li>"; | 533 | mText += "<li>"; |
519 | mText.append(a->email()); | 534 | mText.append(a->email()); |
520 | mText += "\n"; | 535 | mText += "\n"; |
521 | } | 536 | } |
522 | } else { | 537 | } else { |
523 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 538 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
524 | if (!a->name().isEmpty()) mText += a->name(); | 539 | if (!a->name().isEmpty()) mText += a->name(); |
525 | else mText += a->email(); | 540 | else mText += a->email(); |
526 | mText += "</a>\n"; | 541 | mText += "</a>\n"; |
527 | } | 542 | } |
528 | #else //DESKTOP_VERSION | 543 | #else //DESKTOP_VERSION |
529 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 544 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
530 | if (!a->name().isEmpty()) mText += a->name(); | 545 | if (!a->name().isEmpty()) mText += a->name(); |
531 | else mText += a->email(); | 546 | else mText += a->email(); |
532 | mText += "</a>\n"; | 547 | mText += "</a>\n"; |
533 | #endif //DESKTOP_VERSION | 548 | #endif //DESKTOP_VERSION |
534 | #else | 549 | #else |
535 | //qDebug("nokabc "); | 550 | //qDebug("nokabc "); |
536 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 551 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
537 | if (!a->name().isEmpty()) mText += a->name(); | 552 | if (!a->name().isEmpty()) mText += a->name(); |
538 | else mText += a->email(); | 553 | else mText += a->email(); |
539 | mText += "</a>\n"; | 554 | mText += "</a>\n"; |
540 | #endif | 555 | #endif |
541 | 556 | ||
542 | 557 | ||
543 | if (!a->email().isEmpty()) { | 558 | if (!a->email().isEmpty()) { |
544 | if (iconPath) { | 559 | if (iconPath) { |
545 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 560 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
546 | if ( a->RSVP() ) { | 561 | if ( a->RSVP() ) { |
547 | ++a_count_nr; | 562 | ++a_count_nr; |
548 | mText += "<IMG src=\"" + iconPath + "\">"; | 563 | mText += "<IMG src=\"" + iconPath + "\">"; |
549 | } | 564 | } |
550 | else { | 565 | else { |
551 | ++a_count; | 566 | ++a_count; |
552 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 567 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
553 | } | 568 | } |
554 | mText += "</a>\n"; | 569 | mText += "</a>\n"; |
555 | } | 570 | } |
556 | } | 571 | } |
557 | if (a->status() != Attendee::NeedsAction ) | 572 | if (a->status() != Attendee::NeedsAction ) |
558 | mText +="[" + a->statusStr() + "] "; | 573 | mText +="[" + a->statusStr() + "] "; |
559 | if (a->role() == Attendee::Chair ) | 574 | if (a->role() == Attendee::Chair ) |
560 | mText +="(" + a->roleStr().left(1) + ".)"; | 575 | mText +="(" + a->roleStr().left(1) + ".)"; |
561 | } | 576 | } |
562 | mText.append("</li></ul>"); | 577 | mText.append("</li></ul>"); |
563 | if ( (a_count+a_count_nr) > 1 ) { | 578 | if ( (a_count+a_count_nr) > 1 ) { |
564 | mText += "<a href=\"mailto:ALL\">"; | 579 | mText += "<a href=\"mailto:ALL\">"; |
565 | mText += i18n( "Mail to all" ); | 580 | mText += i18n( "Mail to all" ); |
566 | mText += "</a> ( "; | 581 | mText += "</a> ( "; |
567 | mText += "<IMG src=\"" + iconPath + "\">"; | 582 | mText += "<IMG src=\"" + iconPath + "\">"; |
568 | mText += i18n( " and " ); | 583 | mText += i18n( " and " ); |
569 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 584 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
570 | mText += "<br>\n"; | 585 | mText += "<br>\n"; |
571 | 586 | ||
572 | 587 | ||
573 | } | 588 | } |
574 | if ( a_count_nr > 1 ) { | 589 | if ( a_count_nr > 1 ) { |
575 | mText += "<a href=\"mailto:RSVP\">"; | 590 | mText += "<a href=\"mailto:RSVP\">"; |
576 | mText += i18n( "Mail to selected" ); | 591 | mText += i18n( "Mail to selected" ); |
577 | mText += "</a> ( "; | 592 | mText += "</a> ( "; |
578 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 593 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
579 | mText += "<br>\n"; | 594 | mText += "<br>\n"; |
580 | } | 595 | } |
581 | } | 596 | } |
582 | 597 | ||
583 | } | 598 | } |
584 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 599 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
585 | { | 600 | { |
586 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 601 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
587 | if (mode == 0 ) { | 602 | if (mode == 0 ) { |
588 | addTag("h2",i18n("Journal from: ")); | 603 | addTag("h2",i18n("Journal from: ")); |
589 | } | 604 | } |
590 | else { | 605 | else { |
591 | if ( mode == 1 ) { | 606 | if ( mode == 1 ) { |
592 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 607 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
593 | } else { | 608 | } else { |
594 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 609 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
595 | } | 610 | } |
596 | } | 611 | } |
597 | topLevelWidget()->setCaption("Journal Viewer"); | 612 | topLevelWidget()->setCaption("Journal Viewer"); |
598 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 613 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
599 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 614 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
600 | if (!jour->description().isEmpty()) { | 615 | if (!jour->description().isEmpty()) { |
601 | addTag("p",jour->description()); | 616 | addTag("p",jour->description()); |
602 | } | 617 | } |
603 | setText(mText); | 618 | setText(mText); |
604 | } | 619 | } |
605 | 620 | ||
606 | void KOEventViewer::formatReadOnly(Incidence *event) | 621 | void KOEventViewer::formatReadOnly(Incidence *event) |
607 | { | 622 | { |
608 | if (event->isReadOnly()) { | 623 | if (event->isReadOnly()) { |
609 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 624 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
610 | } | 625 | } |
611 | } | 626 | } |
612 | void KOEventViewer::setSyncMode( bool b ) | 627 | void KOEventViewer::setSyncMode( bool b ) |
613 | { | 628 | { |
614 | mSyncMode = b; | 629 | mSyncMode = b; |
615 | } | 630 | } |
616 | 631 | ||
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d8e940b..1f5afc0 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -136,385 +136,388 @@ bool ListItemVisitor::visit(Event *e) | |||
136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 136 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
137 | mItem->setSortKey(3,key); | 137 | mItem->setSortKey(3,key); |
138 | 138 | ||
139 | return true; | 139 | return true; |
140 | } | 140 | } |
141 | 141 | ||
142 | bool ListItemVisitor::visit(Todo *t) | 142 | bool ListItemVisitor::visit(Todo *t) |
143 | { | 143 | { |
144 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); | 144 | mItem->setText(0,i18n("To-Do: %1").arg(t->summary())); |
145 | if (t->hasStartDate()) { | 145 | if (t->hasStartDate()) { |
146 | mItem->setText(1,t->dtStartDateStr()); | 146 | mItem->setText(1,t->dtStartDateStr()); |
147 | if (t->doesFloat()) { | 147 | if (t->doesFloat()) { |
148 | mItem->setText(2,"---"); | 148 | mItem->setText(2,"---"); |
149 | } else { | 149 | } else { |
150 | mItem->setText(2,t->dtStartTimeStr()); | 150 | mItem->setText(2,t->dtStartTimeStr()); |
151 | } | 151 | } |
152 | } else { | 152 | } else { |
153 | mItem->setText(1,"---"); | 153 | mItem->setText(1,"---"); |
154 | mItem->setText(2,"---"); | 154 | mItem->setText(2,"---"); |
155 | } | 155 | } |
156 | mItem->setText(3,"---"); | 156 | mItem->setText(3,"---"); |
157 | mItem->setText(4,"---"); | 157 | mItem->setText(4,"---"); |
158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); |
159 | mItem->setText(6, t->recurrence()->recurrenceText()); | 159 | mItem->setText(6, t->recurrence()->recurrenceText()); |
160 | if (t->hasDueDate()) { | 160 | if (t->hasDueDate()) { |
161 | mItem->setText(7,t->dtDueDateStr()); | 161 | mItem->setText(7,t->dtDueDateStr()); |
162 | if (t->doesFloat()) { | 162 | if (t->doesFloat()) { |
163 | mItem->setText(8,"---"); | 163 | mItem->setText(8,"---"); |
164 | } else { | 164 | } else { |
165 | mItem->setText(8,t->dtDueTimeStr()); | 165 | mItem->setText(8,t->dtDueTimeStr()); |
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | mItem->setText(7,"---"); | 168 | mItem->setText(7,"---"); |
169 | mItem->setText(8,"---"); | 169 | mItem->setText(8,"---"); |
170 | } | 170 | } |
171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 171 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
172 | mItem->setText(10,t->categoriesStr()); | 172 | mItem->setText(10,t->categoriesStr()); |
173 | 173 | ||
174 | QString key; | 174 | QString key; |
175 | QDate d; | 175 | QDate d; |
176 | if (t->hasDueDate()) { | 176 | if (t->hasDueDate()) { |
177 | d = t->dtDue().date(); | 177 | d = t->dtDue().date(); |
178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 178 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 179 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
180 | mItem->setSortKey(7,key); | 180 | mItem->setSortKey(7,key); |
181 | } | 181 | } |
182 | if ( t->hasStartDate() ) { | 182 | if ( t->hasStartDate() ) { |
183 | d = t->dtStart().date(); | 183 | d = t->dtStart().date(); |
184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 184 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
185 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 185 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
186 | mItem->setSortKey(1,key); | 186 | mItem->setSortKey(1,key); |
187 | } | 187 | } |
188 | return true; | 188 | return true; |
189 | } | 189 | } |
190 | 190 | ||
191 | bool ListItemVisitor::visit(Journal * j) | 191 | bool ListItemVisitor::visit(Journal * j) |
192 | { | 192 | { |
193 | QString des = j->description().left(50); | 193 | QString des = j->description().left(50); |
194 | des = des.simplifyWhiteSpace (); | 194 | des = des.simplifyWhiteSpace (); |
195 | des.replace (QRegExp ("\\n"),"" ); | 195 | des.replace (QRegExp ("\\n"),"" ); |
196 | des.replace (QRegExp ("\\r"),"" ); | 196 | des.replace (QRegExp ("\\r"),"" ); |
197 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); | 197 | mItem->setText(0,i18n("Journal")+": "+des.left(25)); |
198 | mItem->setText(1,j->dtStartDateStr()); | 198 | mItem->setText(1,j->dtStartDateStr()); |
199 | mItem->setText(2,"---"); | 199 | mItem->setText(2,"---"); |
200 | mItem->setText(3,"---"); | 200 | mItem->setText(3,"---"); |
201 | mItem->setText(4,"---"); | 201 | mItem->setText(4,"---"); |
202 | mItem->setText(5,"---"); | 202 | mItem->setText(5,"---"); |
203 | mItem->setText(6,"---"); | 203 | mItem->setText(6,"---"); |
204 | mItem->setText(7,j->dtStartDateStr()); | 204 | mItem->setText(7,j->dtStartDateStr()); |
205 | mItem->setText(8,"---"); | 205 | mItem->setText(8,"---"); |
206 | mItem->setText(9,"---"); | 206 | mItem->setText(9,"---"); |
207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 207 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
208 | 208 | ||
209 | QString key; | 209 | QString key; |
210 | QDate d = j->dtStart().date(); | 210 | QDate d = j->dtStart().date(); |
211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 211 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
212 | mItem->setSortKey(1,key); | 212 | mItem->setSortKey(1,key); |
213 | mItem->setSortKey(7,key); | 213 | mItem->setSortKey(7,key); |
214 | 214 | ||
215 | return true; | 215 | return true; |
216 | } | 216 | } |
217 | 217 | ||
218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 218 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
219 | const char *name) | 219 | const char *name) |
220 | : KOEventView(calendar, parent, name) | 220 | : KOEventView(calendar, parent, name) |
221 | { | 221 | { |
222 | mActiveItem = 0; | 222 | mActiveItem = 0; |
223 | mListView = new KOListViewListView(this); | 223 | mListView = new KOListViewListView(this); |
224 | mListView->addColumn(i18n("Summary")); | 224 | mListView->addColumn(i18n("Summary")); |
225 | mListView->addColumn(i18n("Start Date")); | 225 | mListView->addColumn(i18n("Start Date")); |
226 | mListView->addColumn(i18n("Start Time")); | 226 | mListView->addColumn(i18n("Start Time")); |
227 | mListView->addColumn(i18n("End Date")); | 227 | mListView->addColumn(i18n("End Date")); |
228 | mListView->addColumn(i18n("End Time")); | 228 | mListView->addColumn(i18n("End Time")); |
229 | mListView->addColumn(i18n("Alarm")); // alarm set? | 229 | mListView->addColumn(i18n("Alarm")); // alarm set? |
230 | mListView->addColumn(i18n("Recurs")); // recurs? | 230 | mListView->addColumn(i18n("Recurs")); // recurs? |
231 | mListView->addColumn(i18n("Due Date")); | 231 | mListView->addColumn(i18n("Due Date")); |
232 | mListView->addColumn(i18n("Due Time")); | 232 | mListView->addColumn(i18n("Due Time")); |
233 | mListView->addColumn(i18n("Cancelled")); | 233 | mListView->addColumn(i18n("Cancelled")); |
234 | mListView->addColumn(i18n("Categories")); | 234 | mListView->addColumn(i18n("Categories")); |
235 | 235 | ||
236 | mListView->setColumnAlignment(0,AlignLeft); | 236 | mListView->setColumnAlignment(0,AlignLeft); |
237 | mListView->setColumnAlignment(1,AlignLeft); | 237 | mListView->setColumnAlignment(1,AlignLeft); |
238 | mListView->setColumnAlignment(2,AlignHCenter); | 238 | mListView->setColumnAlignment(2,AlignHCenter); |
239 | mListView->setColumnAlignment(3,AlignLeft); | 239 | mListView->setColumnAlignment(3,AlignLeft); |
240 | mListView->setColumnAlignment(4,AlignHCenter); | 240 | mListView->setColumnAlignment(4,AlignHCenter); |
241 | mListView->setColumnAlignment(5,AlignLeft); | 241 | mListView->setColumnAlignment(5,AlignLeft); |
242 | mListView->setColumnAlignment(6,AlignLeft); | 242 | mListView->setColumnAlignment(6,AlignLeft); |
243 | mListView->setColumnAlignment(7,AlignLeft); | 243 | mListView->setColumnAlignment(7,AlignLeft); |
244 | mListView->setColumnAlignment(8,AlignLeft); | 244 | mListView->setColumnAlignment(8,AlignLeft); |
245 | mListView->setColumnAlignment(9,AlignLeft); | 245 | mListView->setColumnAlignment(9,AlignLeft); |
246 | mListView->setColumnAlignment(10,AlignLeft); | 246 | mListView->setColumnAlignment(10,AlignLeft); |
247 | mListView->setColumnWidthMode(10, QListView::Manual); | 247 | mListView->setColumnWidthMode(10, QListView::Manual); |
248 | new KOListViewWhatsThis(mListView->viewport(),this); | 248 | new KOListViewWhatsThis(mListView->viewport(),this); |
249 | 249 | ||
250 | int iii = 0; | 250 | int iii = 0; |
251 | for ( iii = 0; iii< 10 ; ++iii ) | 251 | for ( iii = 0; iii< 10 ; ++iii ) |
252 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 252 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
253 | 253 | ||
254 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 254 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
255 | layoutTop->addWidget(mListView); | 255 | layoutTop->addWidget(mListView); |
256 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 256 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
257 | mPopupMenu = eventPopup(); | 257 | mPopupMenu = eventPopup(); |
258 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 258 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
259 | i18n("Select all"),this, | 259 | i18n("Select all"),this, |
260 | SLOT(allSelection()),true); | 260 | SLOT(allSelection()),true); |
261 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 261 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
262 | i18n("Deselect all"),this, | 262 | i18n("Deselect all"),this, |
263 | SLOT(clearSelection()),true); | 263 | SLOT(clearSelection()),true); |
264 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 264 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
265 | i18n("Delete all selected"),this, | 265 | i18n("Delete all selected"),this, |
266 | SLOT(deleteAll()),true); | 266 | SLOT(deleteAll()),true); |
267 | mPopupMenu->insertSeparator(); | 267 | mPopupMenu->insertSeparator(); |
268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 268 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
269 | i18n("Save selected to file..."),this, | 269 | i18n("Save selected to file..."),this, |
270 | SLOT(saveToFile()),true); | 270 | SLOT(saveToFile()),true); |
271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 271 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
272 | i18n("Save Journal/Description..."),this, | 272 | i18n("Save Journal/Description..."),this, |
273 | SLOT(saveDescriptionToFile()),true); | 273 | SLOT(saveDescriptionToFile()),true); |
274 | // mPopupMenu->insertSeparator(); | 274 | // mPopupMenu->insertSeparator(); |
275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 275 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
276 | i18n("Add Categ. to selected..."),this, | 276 | i18n("Add Categ. to selected..."),this, |
277 | SLOT(addCat()),true); | 277 | SLOT(addCat()),true); |
278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 278 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
279 | i18n("Set Categ. for selected..."),this, | 279 | i18n("Set Categ. for selected..."),this, |
280 | SLOT(setCat()),true); | 280 | SLOT(setCat()),true); |
281 | //mPopupMenu->insertSeparator(); | 281 | //mPopupMenu->insertSeparator(); |
282 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 282 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
283 | i18n("Set alarm for selected..."),this, | 283 | i18n("Set alarm for selected..."),this, |
284 | SLOT(setAlarm()),true); | 284 | SLOT(setAlarm()),true); |
285 | 285 | ||
286 | 286 | ||
287 | #ifndef DESKTOP_VERSION | 287 | #ifndef DESKTOP_VERSION |
288 | mPopupMenu->insertSeparator(); | 288 | mPopupMenu->insertSeparator(); |
289 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 289 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
290 | i18n("Beam selected via IR"),this, | 290 | i18n("Beam selected via IR"),this, |
291 | SLOT(beamSelected()),true); | 291 | SLOT(beamSelected()),true); |
292 | #endif | 292 | #endif |
293 | /* | 293 | /* |
294 | mPopupMenu = new QPopupMenu; | 294 | mPopupMenu = new QPopupMenu; |
295 | mPopupMenu->insertItem(i18n("Edit Event"), this, | 295 | mPopupMenu->insertItem(i18n("Edit Event"), this, |
296 | SLOT (editEvent())); | 296 | SLOT (editEvent())); |
297 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, | 297 | mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, |
298 | SLOT (deleteEvent())); | 298 | SLOT (deleteEvent())); |
299 | mPopupMenu->insertSeparator(); | 299 | mPopupMenu->insertSeparator(); |
300 | mPopupMenu->insertItem(i18n("Show Dates"), this, | 300 | mPopupMenu->insertItem(i18n("Show Dates"), this, |
301 | SLOT(showDates())); | 301 | SLOT(showDates())); |
302 | mPopupMenu->insertItem(i18n("Hide Dates"), this, | 302 | mPopupMenu->insertItem(i18n("Hide Dates"), this, |
303 | SLOT(hideDates())); | 303 | SLOT(hideDates())); |
304 | */ | 304 | */ |
305 | QObject::connect(mListView,SIGNAL( newEvent()), | 305 | QObject::connect(mListView,SIGNAL( newEvent()), |
306 | this,SIGNAL(signalNewEvent())); | 306 | this,SIGNAL(signalNewEvent())); |
307 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), | 307 | QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), |
308 | this,SLOT(defaultItemAction(QListViewItem *))); | 308 | this,SLOT(defaultItemAction(QListViewItem *))); |
309 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, | 309 | QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, |
310 | const QPoint &, int )), | 310 | const QPoint &, int )), |
311 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); | 311 | this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); |
312 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), | 312 | QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), |
313 | SLOT(processSelectionChange(QListViewItem *))); | 313 | SLOT(processSelectionChange(QListViewItem *))); |
314 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), | 314 | QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), |
315 | SIGNAL(showIncidenceSignal(Incidence *)) ); | 315 | SIGNAL(showIncidenceSignal(Incidence *)) ); |
316 | 316 | ||
317 | readSettings(KOGlobals::config(),"KOListView Layout"); | 317 | readSettings(KOGlobals::config(),"KOListView Layout"); |
318 | } | 318 | } |
319 | 319 | ||
320 | KOListView::~KOListView() | 320 | KOListView::~KOListView() |
321 | { | 321 | { |
322 | delete mPopupMenu; | 322 | delete mPopupMenu; |
323 | } | 323 | } |
324 | QString KOListView::getWhatsThisText(QPoint p) | 324 | QString KOListView::getWhatsThisText(QPoint p) |
325 | { | 325 | { |
326 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); | 326 | KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); |
327 | if ( item ) | 327 | if ( item ) |
328 | return KIncidenceFormatter::instance()->getFormattedText( item->data() ); | 328 | return KIncidenceFormatter::instance()->getFormattedText( item->data(), |
329 | KOPrefs::instance()->mWTshowDetails, | ||
330 | KOPrefs::instance()->mWTshowCreated, | ||
331 | KOPrefs::instance()->mWTshowChanged); | ||
329 | return i18n("That is the list view" ); | 332 | return i18n("That is the list view" ); |
330 | 333 | ||
331 | } | 334 | } |
332 | 335 | ||
333 | void KOListView::updateList() | 336 | void KOListView::updateList() |
334 | { | 337 | { |
335 | // qDebug(" KOListView::updateList() "); | 338 | // qDebug(" KOListView::updateList() "); |
336 | 339 | ||
337 | } | 340 | } |
338 | 341 | ||
339 | void KOListView::addCat( ) | 342 | void KOListView::addCat( ) |
340 | { | 343 | { |
341 | setCategories( false ); | 344 | setCategories( false ); |
342 | } | 345 | } |
343 | void KOListView::setCat() | 346 | void KOListView::setCat() |
344 | { | 347 | { |
345 | setCategories( true ); | 348 | setCategories( true ); |
346 | } | 349 | } |
347 | void KOListView::setAlarm() | 350 | void KOListView::setAlarm() |
348 | { | 351 | { |
349 | KOAlarmPrefs kap( this); | 352 | KOAlarmPrefs kap( this); |
350 | if ( !kap.exec() ) | 353 | if ( !kap.exec() ) |
351 | return; | 354 | return; |
352 | 355 | ||
353 | 356 | ||
354 | QStringList itemList; | 357 | QStringList itemList; |
355 | QPtrList<KOListViewItem> sel ; | 358 | QPtrList<KOListViewItem> sel ; |
356 | QListViewItem *qitem = mListView->firstChild (); | 359 | QListViewItem *qitem = mListView->firstChild (); |
357 | while ( qitem ) { | 360 | while ( qitem ) { |
358 | if ( qitem->isSelected() ) { | 361 | if ( qitem->isSelected() ) { |
359 | Incidence* inc = ((KOListViewItem *) qitem)->data(); | 362 | Incidence* inc = ((KOListViewItem *) qitem)->data(); |
360 | if ( inc->type() != "Journal" ) { | 363 | if ( inc->type() != "Journal" ) { |
361 | if ( inc->type() == "Todo" ) { | 364 | if ( inc->type() == "Todo" ) { |
362 | if ( ((Todo*)inc)->hasDueDate() ) | 365 | if ( ((Todo*)inc)->hasDueDate() ) |
363 | sel.append(((KOListViewItem *)qitem)); | 366 | sel.append(((KOListViewItem *)qitem)); |
364 | } else | 367 | } else |
365 | sel.append(((KOListViewItem *)qitem)); | 368 | sel.append(((KOListViewItem *)qitem)); |
366 | } | 369 | } |
367 | } | 370 | } |
368 | qitem = qitem->nextSibling(); | 371 | qitem = qitem->nextSibling(); |
369 | } | 372 | } |
370 | int count = 0; | 373 | int count = 0; |
371 | KOListViewItem * item, *temp; | 374 | KOListViewItem * item, *temp; |
372 | item = sel.first(); | 375 | item = sel.first(); |
373 | Incidence* inc; | 376 | Incidence* inc; |
374 | while ( item ) { | 377 | while ( item ) { |
375 | inc = item->data(); | 378 | inc = item->data(); |
376 | ++count; | 379 | ++count; |
377 | if (kap.mAlarmButton->isChecked()) { | 380 | if (kap.mAlarmButton->isChecked()) { |
378 | if (inc->alarms().count() == 0) | 381 | if (inc->alarms().count() == 0) |
379 | inc->newAlarm(); | 382 | inc->newAlarm(); |
380 | QPtrList<Alarm> alarms = inc->alarms(); | 383 | QPtrList<Alarm> alarms = inc->alarms(); |
381 | Alarm *alarm; | 384 | Alarm *alarm; |
382 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { | 385 | for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { |
383 | alarm->setEnabled(true); | 386 | alarm->setEnabled(true); |
384 | int j = kap.mAlarmTimeEdit->value()* -60; | 387 | int j = kap.mAlarmTimeEdit->value()* -60; |
385 | if (kap.mAlarmIncrCombo->currentItem() == 1) | 388 | if (kap.mAlarmIncrCombo->currentItem() == 1) |
386 | j = j * 60; | 389 | j = j * 60; |
387 | else if (kap.mAlarmIncrCombo->currentItem() == 2) | 390 | else if (kap.mAlarmIncrCombo->currentItem() == 2) |
388 | j = j * (60 * 24); | 391 | j = j * (60 * 24); |
389 | alarm->setStartOffset( j ); | 392 | alarm->setStartOffset( j ); |
390 | 393 | ||
391 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { | 394 | if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { |
392 | alarm->setProcedureAlarm(kap.mAlarmProgram); | 395 | alarm->setProcedureAlarm(kap.mAlarmProgram); |
393 | } | 396 | } |
394 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) | 397 | else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) |
395 | alarm->setAudioAlarm(kap.mAlarmSound); | 398 | alarm->setAudioAlarm(kap.mAlarmSound); |
396 | else | 399 | else |
397 | alarm->setType(Alarm::Invalid); | 400 | alarm->setType(Alarm::Invalid); |
398 | //alarm->setAudioAlarm("default"); | 401 | //alarm->setAudioAlarm("default"); |
399 | // TODO: Deal with multiple alarms | 402 | // TODO: Deal with multiple alarms |
400 | break; // For now, stop after the first alarm | 403 | break; // For now, stop after the first alarm |
401 | } | 404 | } |
402 | } else { | 405 | } else { |
403 | Alarm* alarm = inc->alarms().first(); | 406 | Alarm* alarm = inc->alarms().first(); |
404 | if ( alarm ) { | 407 | if ( alarm ) { |
405 | alarm->setEnabled(false); | 408 | alarm->setEnabled(false); |
406 | alarm->setType(Alarm::Invalid); | 409 | alarm->setType(Alarm::Invalid); |
407 | } | 410 | } |
408 | } | 411 | } |
409 | temp = item; | 412 | temp = item; |
410 | item = sel.next(); | 413 | item = sel.next(); |
411 | mUidDict.remove( inc->uid() ); | 414 | mUidDict.remove( inc->uid() ); |
412 | delete temp;; | 415 | delete temp;; |
413 | addIncidence( inc ); | 416 | addIncidence( inc ); |
414 | } | 417 | } |
415 | topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); | 418 | topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); |
416 | qDebug("KO: Set alarm for %d items", count); | 419 | qDebug("KO: Set alarm for %d items", count); |
417 | calendar()->reInitAlarmSettings(); | 420 | calendar()->reInitAlarmSettings(); |
418 | } | 421 | } |
419 | void KOListView::setCategories( bool removeOld ) | 422 | void KOListView::setCategories( bool removeOld ) |
420 | { | 423 | { |
421 | 424 | ||
422 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); | 425 | KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); |
423 | if (! csd->exec()) { | 426 | if (! csd->exec()) { |
424 | delete csd; | 427 | delete csd; |
425 | return; | 428 | return; |
426 | } | 429 | } |
427 | QStringList catList = csd->selectedCategories(); | 430 | QStringList catList = csd->selectedCategories(); |
428 | delete csd; | 431 | delete csd; |
429 | // if ( catList.count() == 0 ) | 432 | // if ( catList.count() == 0 ) |
430 | // return; | 433 | // return; |
431 | catList.sort(); | 434 | catList.sort(); |
432 | QString categoriesStr = catList.join(","); | 435 | QString categoriesStr = catList.join(","); |
433 | int i; | 436 | int i; |
434 | QStringList itemList; | 437 | QStringList itemList; |
435 | QPtrList<KOListViewItem> sel ; | 438 | QPtrList<KOListViewItem> sel ; |
436 | QListViewItem *qitem = mListView->firstChild (); | 439 | QListViewItem *qitem = mListView->firstChild (); |
437 | while ( qitem ) { | 440 | while ( qitem ) { |
438 | if ( qitem->isSelected() ) { | 441 | if ( qitem->isSelected() ) { |
439 | sel.append(((KOListViewItem *)qitem)); | 442 | sel.append(((KOListViewItem *)qitem)); |
440 | } | 443 | } |
441 | qitem = qitem->nextSibling(); | 444 | qitem = qitem->nextSibling(); |
442 | } | 445 | } |
443 | KOListViewItem * item, *temp; | 446 | KOListViewItem * item, *temp; |
444 | item = sel.first(); | 447 | item = sel.first(); |
445 | Incidence* inc; | 448 | Incidence* inc; |
446 | while ( item ) { | 449 | while ( item ) { |
447 | inc = item->data(); | 450 | inc = item->data(); |
448 | if ( removeOld ) { | 451 | if ( removeOld ) { |
449 | inc->setCategories( categoriesStr ); | 452 | inc->setCategories( categoriesStr ); |
450 | } else { | 453 | } else { |
451 | itemList = QStringList::split (",", inc->categoriesStr() ); | 454 | itemList = QStringList::split (",", inc->categoriesStr() ); |
452 | for( i = 0; i< catList.count(); ++i ) { | 455 | for( i = 0; i< catList.count(); ++i ) { |
453 | if ( !itemList.contains (catList[i])) | 456 | if ( !itemList.contains (catList[i])) |
454 | itemList.append( catList[i] ); | 457 | itemList.append( catList[i] ); |
455 | } | 458 | } |
456 | itemList.sort(); | 459 | itemList.sort(); |
457 | inc->setCategories( itemList.join(",") ); | 460 | inc->setCategories( itemList.join(",") ); |
458 | } | 461 | } |
459 | temp = item; | 462 | temp = item; |
460 | item = sel.next(); | 463 | item = sel.next(); |
461 | mUidDict.remove( inc->uid() ); | 464 | mUidDict.remove( inc->uid() ); |
462 | delete temp;; | 465 | delete temp;; |
463 | addIncidence( inc ); | 466 | addIncidence( inc ); |
464 | } | 467 | } |
465 | } | 468 | } |
466 | 469 | ||
467 | void KOListView::beamSelected() | 470 | void KOListView::beamSelected() |
468 | { | 471 | { |
469 | int icount = 0; | 472 | int icount = 0; |
470 | QPtrList<Incidence> delSel ; | 473 | QPtrList<Incidence> delSel ; |
471 | QListViewItem *item = mListView->firstChild (); | 474 | QListViewItem *item = mListView->firstChild (); |
472 | while ( item ) { | 475 | while ( item ) { |
473 | if ( item->isSelected() ) { | 476 | if ( item->isSelected() ) { |
474 | delSel.append(((KOListViewItem *)item)->data()); | 477 | delSel.append(((KOListViewItem *)item)->data()); |
475 | ++icount; | 478 | ++icount; |
476 | } | 479 | } |
477 | 480 | ||
478 | item = item->nextSibling(); | 481 | item = item->nextSibling(); |
479 | } | 482 | } |
480 | if ( icount ) { | 483 | if ( icount ) { |
481 | emit beamIncidenceList( delSel ); | 484 | emit beamIncidenceList( delSel ); |
482 | return; | 485 | return; |
483 | QString fn ; | 486 | QString fn ; |
484 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; | 487 | fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; |
485 | QString mes; | 488 | QString mes; |
486 | bool createbup = true; | 489 | bool createbup = true; |
487 | if ( createbup ) { | 490 | if ( createbup ) { |
488 | QString description = "\n"; | 491 | QString description = "\n"; |
489 | CalendarLocal* cal = new CalendarLocal(); | 492 | CalendarLocal* cal = new CalendarLocal(); |
490 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 493 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
491 | Incidence *incidence = delSel.first(); | 494 | Incidence *incidence = delSel.first(); |
492 | while ( incidence ) { | 495 | while ( incidence ) { |
493 | Incidence *in = incidence->clone(); | 496 | Incidence *in = incidence->clone(); |
494 | description += in->summary() + "\n"; | 497 | description += in->summary() + "\n"; |
495 | cal->addIncidence( in ); | 498 | cal->addIncidence( in ); |
496 | incidence = delSel.next(); | 499 | incidence = delSel.next(); |
497 | } | 500 | } |
498 | FileStorage storage( cal, fn, new VCalFormat ); | 501 | FileStorage storage( cal, fn, new VCalFormat ); |
499 | storage.save(); | 502 | storage.save(); |
500 | delete cal; | 503 | delete cal; |
501 | mes = i18n("KO/Pi: Ready for beaming"); | 504 | mes = i18n("KO/Pi: Ready for beaming"); |
502 | topLevelWidget()->setCaption(mes); | 505 | topLevelWidget()->setCaption(mes); |
503 | 506 | ||
504 | #ifndef DESKTOP_VERSION | 507 | #ifndef DESKTOP_VERSION |
505 | Ir *ir = new Ir( this ); | 508 | Ir *ir = new Ir( this ); |
506 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 509 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
507 | ir->send( fn, description, "text/x-vCalendar" ); | 510 | ir->send( fn, description, "text/x-vCalendar" ); |
508 | #endif | 511 | #endif |
509 | } | 512 | } |
510 | } | 513 | } |
511 | } | 514 | } |
512 | void KOListView::beamDone( Ir *ir ) | 515 | void KOListView::beamDone( Ir *ir ) |
513 | { | 516 | { |
514 | #ifndef DESKTOP_VERSION | 517 | #ifndef DESKTOP_VERSION |
515 | delete ir; | 518 | delete ir; |
516 | #endif | 519 | #endif |
517 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); | 520 | topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); |
518 | } | 521 | } |
519 | 522 | ||
520 | void KOListView::saveDescriptionToFile() | 523 | void KOListView::saveDescriptionToFile() |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f9bc1ca..2fe80af 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,390 +1,392 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
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 | 19 | ||
20 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
98 | KOPrefs::instance()->mWTshowDetails, | ||
99 | KOPrefs::instance()->mWTshowCreated, | ||
100 | KOPrefs::instance()->mWTshowChanged); | ||
98 | } | 101 | } |
99 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
100 | { | 103 | { |
101 | 104 | ||
102 | switch(e->key()) { | 105 | switch(e->key()) { |
103 | case Key_Right: | 106 | case Key_Right: |
104 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
105 | { | 108 | { |
106 | e->ignore(); | 109 | e->ignore(); |
107 | return; | 110 | return; |
108 | } | 111 | } |
109 | scrollBy(10,0); | 112 | scrollBy(10,0); |
110 | break; | 113 | break; |
111 | case Key_Left: | 114 | case Key_Left: |
112 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
113 | { | 116 | { |
114 | e->ignore(); | 117 | e->ignore(); |
115 | return; | 118 | return; |
116 | } | 119 | } |
117 | scrollBy(-10,0); | 120 | scrollBy(-10,0); |
118 | break; | 121 | break; |
119 | case Key_Up: | 122 | case Key_Up: |
120 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
121 | e->ignore(); | 124 | e->ignore(); |
122 | break; | 125 | break; |
123 | } | 126 | } |
124 | setCurrentItem((currentItem()+count()-1)%count()); | 127 | setCurrentItem((currentItem()+count()-1)%count()); |
125 | if(!itemVisible(currentItem())) { | 128 | if(!itemVisible(currentItem())) { |
126 | if((unsigned int) currentItem() == (count()-1)) { | 129 | if((unsigned int) currentItem() == (count()-1)) { |
127 | setTopItem(currentItem()-numItemsVisible()+1); | 130 | setTopItem(currentItem()-numItemsVisible()+1); |
128 | } else { | 131 | } else { |
129 | setTopItem(topItem()-1); | 132 | setTopItem(topItem()-1); |
130 | } | 133 | } |
131 | } | 134 | } |
132 | break; | 135 | break; |
133 | case Key_Down: | 136 | case Key_Down: |
134 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
135 | e->ignore(); | 138 | e->ignore(); |
136 | break; | 139 | break; |
137 | } | 140 | } |
138 | setCurrentItem((currentItem()+1)%count()); | 141 | setCurrentItem((currentItem()+1)%count()); |
139 | if(!itemVisible(currentItem())) { | 142 | if(!itemVisible(currentItem())) { |
140 | if(currentItem() == 0) { | 143 | if(currentItem() == 0) { |
141 | setTopItem(0); | 144 | setTopItem(0); |
142 | } else { | 145 | } else { |
143 | setTopItem(topItem()+1); | 146 | setTopItem(topItem()+1); |
144 | } | 147 | } |
145 | } | 148 | } |
146 | break; | 149 | break; |
147 | case Key_I: | 150 | case Key_I: |
148 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
149 | e->ignore(); | 152 | e->ignore(); |
150 | break; | 153 | break; |
151 | case Key_Shift: | 154 | case Key_Shift: |
152 | emit shiftDown(); | 155 | emit shiftDown(); |
153 | break; | 156 | break; |
154 | default: | 157 | default: |
155 | e->ignore(); | 158 | e->ignore(); |
156 | break; | 159 | break; |
157 | } | 160 | } |
158 | } | 161 | } |
159 | 162 | ||
160 | void KNoScrollListBox::oneDown() | 163 | void KNoScrollListBox::oneDown() |
161 | { | 164 | { |
162 | setCurrentItem((currentItem()+1)%count()); | 165 | setCurrentItem((currentItem()+1)%count()); |
163 | if(!itemVisible(currentItem())) { | 166 | if(!itemVisible(currentItem())) { |
164 | if(currentItem() == 0) { | 167 | if(currentItem() == 0) { |
165 | setTopItem(0); | 168 | setTopItem(0); |
166 | } else { | 169 | } else { |
167 | setTopItem(topItem()+1); | 170 | setTopItem(topItem()+1); |
168 | } | 171 | } |
169 | } | 172 | } |
170 | } | 173 | } |
171 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
172 | { | 175 | { |
173 | switch(e->key()) { | 176 | switch(e->key()) { |
174 | case Key_Shift: | 177 | case Key_Shift: |
175 | emit shiftUp(); | 178 | emit shiftUp(); |
176 | break; | 179 | break; |
177 | default: | 180 | default: |
178 | break; | 181 | break; |
179 | } | 182 | } |
180 | } | 183 | } |
181 | 184 | ||
182 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
183 | { | 186 | { |
184 | QListBox::mousePressEvent(e); | 187 | QListBox::mousePressEvent(e); |
185 | 188 | ||
186 | if(e->button() == RightButton) { | 189 | if(e->button() == RightButton) { |
187 | emit rightClick(); | 190 | emit rightClick(); |
188 | } | 191 | } |
189 | } | 192 | } |
190 | 193 | ||
191 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
192 | : QListBoxItem() | 195 | : QListBoxItem() |
193 | { | 196 | { |
194 | setText( s ); | 197 | setText( s ); |
195 | 198 | ||
196 | mIncidence = incidence; | 199 | mIncidence = incidence; |
197 | mDate = qd; | 200 | mDate = qd; |
198 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | ||
199 | mRecur = false; | 201 | mRecur = false; |
200 | mAlarm = false; | 202 | mAlarm = false; |
201 | mReply = false; | 203 | mReply = false; |
202 | mInfo = false; | 204 | mInfo = false; |
203 | } | 205 | } |
204 | 206 | ||
205 | void MonthViewItem::paint(QPainter *p) | 207 | void MonthViewItem::paint(QPainter *p) |
206 | { | 208 | { |
207 | #if QT_VERSION >= 0x030000 | 209 | #if QT_VERSION >= 0x030000 |
208 | bool sel = isSelected(); | 210 | bool sel = isSelected(); |
209 | #else | 211 | #else |
210 | bool sel = selected(); | 212 | bool sel = selected(); |
211 | #endif | 213 | #endif |
212 | 214 | ||
213 | 215 | ||
214 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
215 | { | 217 | { |
216 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
217 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
218 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
219 | } | 221 | } |
220 | int x = 1; | 222 | int x = 1; |
221 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 223 | int y = 3;//(height() - mRecurPixmap.height()) /2; |
222 | int size = PIXMAP_SIZE; | 224 | int size = PIXMAP_SIZE; |
223 | if ( QApplication::desktop()->width() < 300 ) | 225 | if ( QApplication::desktop()->width() < 300 ) |
224 | size = 3; | 226 | size = 3; |
225 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 227 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
226 | if ( mInfo ) { | 228 | if ( mInfo ) { |
227 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 229 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
228 | x += size + 1; | 230 | x += size + 1; |
229 | } | 231 | } |
230 | if ( mRecur ) { | 232 | if ( mRecur ) { |
231 | p->fillRect ( x, y,size,size, Qt::blue ); | 233 | p->fillRect ( x, y,size,size, Qt::blue ); |
232 | x += size + 1; | 234 | x += size + 1; |
233 | } | 235 | } |
234 | if ( mAlarm ) { | 236 | if ( mAlarm ) { |
235 | p->fillRect ( x, y,size,size, Qt::red ); | 237 | p->fillRect ( x, y,size,size, Qt::red ); |
236 | x += size + 1; | 238 | x += size + 1; |
237 | } | 239 | } |
238 | if ( mReply ) { | 240 | if ( mReply ) { |
239 | p->fillRect ( x, y,size,size, Qt::yellow ); | 241 | p->fillRect ( x, y,size,size, Qt::yellow ); |
240 | x += size + 1; | 242 | x += size + 1; |
241 | } | 243 | } |
242 | } | 244 | } |
243 | QFontMetrics fm = p->fontMetrics(); | 245 | QFontMetrics fm = p->fontMetrics(); |
244 | int yPos; | 246 | int yPos; |
245 | int pmheight = size; | 247 | int pmheight = size; |
246 | if( pmheight < fm.height() ) | 248 | if( pmheight < fm.height() ) |
247 | yPos = fm.ascent() + fm.leading()/2; | 249 | yPos = fm.ascent() + fm.leading()/2; |
248 | else | 250 | else |
249 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 251 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
250 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 252 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
251 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 253 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
252 | p->drawText( x, yPos, text() ); | 254 | p->drawText( x, yPos, text() ); |
253 | if ( mIncidence->cancelled() ) { | 255 | if ( mIncidence->cancelled() ) { |
254 | int wid = fm.width( text() ); | 256 | int wid = fm.width( text() ); |
255 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 257 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
256 | } | 258 | } |
257 | 259 | ||
258 | } | 260 | } |
259 | 261 | ||
260 | int MonthViewItem::height(const QListBox *lb) const | 262 | int MonthViewItem::height(const QListBox *lb) const |
261 | { | 263 | { |
262 | return lb->fontMetrics().lineSpacing()+1; | 264 | return lb->fontMetrics().lineSpacing()+1; |
263 | } | 265 | } |
264 | 266 | ||
265 | int MonthViewItem::width(const QListBox *lb) const | 267 | int MonthViewItem::width(const QListBox *lb) const |
266 | { | 268 | { |
267 | int size = PIXMAP_SIZE; | 269 | int size = PIXMAP_SIZE; |
268 | if ( QApplication::desktop()->width() < 300 ) | 270 | if ( QApplication::desktop()->width() < 300 ) |
269 | size = 3; | 271 | size = 3; |
270 | int x = 1; | 272 | int x = 1; |
271 | if ( mInfo ) { | 273 | if ( mInfo ) { |
272 | x += size + 1; | 274 | x += size + 1; |
273 | } | 275 | } |
274 | if( mRecur ) { | 276 | if( mRecur ) { |
275 | x += size+1; | 277 | x += size+1; |
276 | } | 278 | } |
277 | if( mAlarm ) { | 279 | if( mAlarm ) { |
278 | x += size+1; | 280 | x += size+1; |
279 | } | 281 | } |
280 | if( mReply ) { | 282 | if( mReply ) { |
281 | x += size+1; | 283 | x += size+1; |
282 | } | 284 | } |
283 | 285 | ||
284 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 286 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
285 | } | 287 | } |
286 | 288 | ||
287 | 289 | ||
288 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 290 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
289 | : QWidget( par ), | 291 | : QWidget( par ), |
290 | mMonthView( parent ) | 292 | mMonthView( parent ) |
291 | { | 293 | { |
292 | 294 | ||
293 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 295 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
294 | 296 | ||
295 | // mLabel = new QLabel( this );QPushButton | 297 | // mLabel = new QLabel( this );QPushButton |
296 | mLabel = new QPushButton( this ); | 298 | mLabel = new QPushButton( this ); |
297 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 299 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
298 | //mLabel->setLineWidth( 1 ); | 300 | //mLabel->setLineWidth( 1 ); |
299 | //mLabel->setAlignment( AlignCenter ); | 301 | //mLabel->setAlignment( AlignCenter ); |
300 | mLabel->setFlat( true ); | 302 | mLabel->setFlat( true ); |
301 | mLabel->setFocusPolicy(NoFocus); | 303 | mLabel->setFocusPolicy(NoFocus); |
302 | mItemList = new KNoScrollListBox( this ); | 304 | mItemList = new KNoScrollListBox( this ); |
303 | mItemList->setMinimumSize( 10, 10 ); | 305 | mItemList->setMinimumSize( 10, 10 ); |
304 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 306 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
305 | mItemList->setLineWidth( 1 ); | 307 | mItemList->setLineWidth( 1 ); |
306 | topLayout->addWidget( mItemList ); | 308 | topLayout->addWidget( mItemList ); |
307 | mLabel->raise(); | 309 | mLabel->raise(); |
308 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 310 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
309 | mStandardPalette = palette(); | 311 | mStandardPalette = palette(); |
310 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 312 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
311 | 313 | ||
312 | enableScrollBars( false ); | 314 | enableScrollBars( false ); |
313 | updateConfig(); | 315 | updateConfig(); |
314 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 316 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
315 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 317 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
316 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 318 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
317 | SLOT( defaultAction( QListBoxItem * ) ) ); | 319 | SLOT( defaultAction( QListBoxItem * ) ) ); |
318 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 320 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
319 | const QPoint &) ), | 321 | const QPoint &) ), |
320 | SLOT( contextMenu( QListBoxItem * ) ) ); | 322 | SLOT( contextMenu( QListBoxItem * ) ) ); |
321 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 323 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
322 | SLOT( selection( QListBoxItem * ) ) ); | 324 | SLOT( selection( QListBoxItem * ) ) ); |
323 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
324 | SLOT( cellClicked( QListBoxItem * ) ) ); | 326 | SLOT( cellClicked( QListBoxItem * ) ) ); |
325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 327 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
326 | SLOT( selection( QListBoxItem * ) ) ); | 328 | SLOT( selection( QListBoxItem * ) ) ); |
327 | } | 329 | } |
328 | #ifdef DESKTOP_VERSION | 330 | #ifdef DESKTOP_VERSION |
329 | QToolTipGroup *MonthViewCell::toolTipGroup() | 331 | QToolTipGroup *MonthViewCell::toolTipGroup() |
330 | { | 332 | { |
331 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 333 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
332 | return mToolTipGroup; | 334 | return mToolTipGroup; |
333 | } | 335 | } |
334 | #endif | 336 | #endif |
335 | 337 | ||
336 | void MonthViewCell::setDate( const QDate &date ) | 338 | void MonthViewCell::setDate( const QDate &date ) |
337 | { | 339 | { |
338 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 340 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
339 | mDate = date; | 341 | mDate = date; |
340 | 342 | ||
341 | 343 | ||
342 | 344 | ||
343 | //resizeEvent( 0 ); | 345 | //resizeEvent( 0 ); |
344 | } | 346 | } |
345 | 347 | ||
346 | QDate MonthViewCell::date() const | 348 | QDate MonthViewCell::date() const |
347 | { | 349 | { |
348 | return mDate; | 350 | return mDate; |
349 | } | 351 | } |
350 | 352 | ||
351 | void MonthViewCell::setPrimary( bool primary ) | 353 | void MonthViewCell::setPrimary( bool primary ) |
352 | { | 354 | { |
353 | mPrimary = primary; | 355 | mPrimary = primary; |
354 | //setMyPalette(); | 356 | //setMyPalette(); |
355 | } | 357 | } |
356 | void MonthViewCell::setMyPalette() | 358 | void MonthViewCell::setMyPalette() |
357 | { | 359 | { |
358 | 360 | ||
359 | if ( mHoliday) { | 361 | if ( mHoliday) { |
360 | setPalette( mHolidayPalette ); | 362 | setPalette( mHolidayPalette ); |
361 | } else { | 363 | } else { |
362 | if ( mPrimary ) { | 364 | if ( mPrimary ) { |
363 | setPalette( mPrimaryPalette ); | 365 | setPalette( mPrimaryPalette ); |
364 | } else { | 366 | } else { |
365 | setPalette( mNonPrimaryPalette ); | 367 | setPalette( mNonPrimaryPalette ); |
366 | } | 368 | } |
367 | } | 369 | } |
368 | QPalette pal = palette(); | 370 | QPalette pal = palette(); |
369 | 371 | ||
370 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 372 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
371 | } | 373 | } |
372 | QPalette MonthViewCell::getPalette () | 374 | QPalette MonthViewCell::getPalette () |
373 | { | 375 | { |
374 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 376 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
375 | return mStandardPalette; | 377 | return mStandardPalette; |
376 | if ( mHoliday) { | 378 | if ( mHoliday) { |
377 | return mHolidayPalette ; | 379 | return mHolidayPalette ; |
378 | } else { | 380 | } else { |
379 | if ( mPrimary ) { | 381 | if ( mPrimary ) { |
380 | return mPrimaryPalette ; | 382 | return mPrimaryPalette ; |
381 | } | 383 | } |
382 | } | 384 | } |
383 | return mNonPrimaryPalette; | 385 | return mNonPrimaryPalette; |
384 | } | 386 | } |
385 | bool MonthViewCell::isPrimary() const | 387 | bool MonthViewCell::isPrimary() const |
386 | { | 388 | { |
387 | return mPrimary; | 389 | return mPrimary; |
388 | } | 390 | } |
389 | 391 | ||
390 | void MonthViewCell::setHoliday( bool holiday ) | 392 | void MonthViewCell::setHoliday( bool holiday ) |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 5efc247..a91074f 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -102,384 +102,390 @@ KOPrefs::KOPrefs() : | |||
102 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 102 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
103 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 103 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
104 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 104 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
105 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 105 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
106 | 106 | ||
107 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 107 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
108 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 108 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
109 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 109 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
110 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 110 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
111 | addItemInt("AllDay Size",&mAllDaySize,28); | 111 | addItemInt("AllDay Size",&mAllDaySize,28); |
112 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 112 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
113 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 113 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
114 | 114 | ||
115 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 115 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
116 | addItemStringList("EventSummary User",&mEventSummaryUser); | 116 | addItemStringList("EventSummary User",&mEventSummaryUser); |
117 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 117 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
118 | 118 | ||
119 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 119 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
120 | addItemBool("Enable Project View",&mEnableProjectView,false); | 120 | addItemBool("Enable Project View",&mEnableProjectView,false); |
121 | addItemBool("Auto Save",&mAutoSave,false); | 121 | addItemBool("Auto Save",&mAutoSave,false); |
122 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 122 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
123 | addItemBool("Confirm Deletes",&mConfirm,true); | 123 | addItemBool("Confirm Deletes",&mConfirm,true); |
124 | addItemString("Archive File",&mArchiveFile); | 124 | addItemString("Archive File",&mArchiveFile); |
125 | addItemString("Html Export File",&mHtmlExportFile, | 125 | addItemString("Html Export File",&mHtmlExportFile, |
126 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 126 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
127 | addItemBool("Html With Save",&mHtmlWithSave,false); | 127 | addItemBool("Html With Save",&mHtmlWithSave,false); |
128 | 128 | ||
129 | KPrefs::setCurrentGroup("Personal Settings"); | 129 | KPrefs::setCurrentGroup("Personal Settings"); |
130 | 130 | ||
131 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 131 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
132 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 132 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
133 | addItemBool("Bcc",&mBcc,false); | 133 | addItemBool("Bcc",&mBcc,false); |
134 | 134 | ||
135 | KPrefs::setCurrentGroup("Time & Date"); | 135 | KPrefs::setCurrentGroup("Time & Date"); |
136 | 136 | ||
137 | 137 | ||
138 | addItemInt("Default Start Time",&mStartTime,10); | 138 | addItemInt("Default Start Time",&mStartTime,10); |
139 | addItemInt("Default Duration",&mDefaultDuration,2); | 139 | addItemInt("Default Duration",&mDefaultDuration,2); |
140 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 140 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
141 | KPrefs::setCurrentGroup("AlarmSettings"); | 141 | KPrefs::setCurrentGroup("AlarmSettings"); |
142 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 142 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
143 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 143 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
144 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 144 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
145 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 145 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
146 | 146 | ||
147 | 147 | ||
148 | KPrefs::setCurrentGroup("Calendar"); | 148 | KPrefs::setCurrentGroup("Calendar"); |
149 | 149 | ||
150 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 150 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
151 | 151 | ||
152 | KPrefs::setCurrentGroup("Fonts"); | 152 | KPrefs::setCurrentGroup("Fonts"); |
153 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 153 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
154 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); | 154 | addItemFont("TimeBar Font",&mTimeBarFont,KGlobalSettings::generalFont() ); |
155 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); | 155 | addItemFont("MonthView Font",&mMonthViewFont,KGlobalSettings::generalFont()); |
156 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); | 156 | addItemFont("AgendaView Font",&mAgendaViewFont,KGlobalSettings::generalFont()); |
157 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); | 157 | addItemFont("MarcusBains Font",&mMarcusBainsFont,KGlobalSettings::generalFont()); |
158 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); | 158 | addItemFont("TimeLabels Font",&mTimeLabelsFont,KGlobalSettings::generalFont()); |
159 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); | 159 | addItemFont("TodoView Font",&mTodoViewFont,KGlobalSettings::generalFont()); |
160 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); | 160 | addItemFont("ListView Font",&mListViewFont,KGlobalSettings::generalFont()); |
161 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); | 161 | addItemFont("DateNavigator Font",&mDateNavigatorFont,KGlobalSettings::generalFont()); |
162 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); | 162 | addItemFont("EditBox Font",&mEditBoxFont,KGlobalSettings::generalFont()); |
163 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); | 163 | addItemFont("JournalView Font",&mJornalViewFont,KGlobalSettings::generalFont()); |
164 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); | 164 | addItemFont("WhatsNextView Font",&mWhatsNextFont,KGlobalSettings::generalFont()); |
165 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); | 165 | addItemFont("EventView Font",&mEventViewFont,KGlobalSettings::generalFont()); |
166 | 166 | ||
167 | KPrefs::setCurrentGroup("RemoteSyncing"); | 167 | KPrefs::setCurrentGroup("RemoteSyncing"); |
168 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 168 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
169 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 169 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
170 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 170 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
171 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 171 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
172 | 172 | ||
173 | #ifdef _WIN32_ | 173 | #ifdef _WIN32_ |
174 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 174 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
175 | #else | 175 | #else |
176 | QString hdp= locateLocal("data","korganizer")+"/"; | 176 | QString hdp= locateLocal("data","korganizer")+"/"; |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 179 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
180 | 180 | ||
181 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 181 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
182 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 182 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
183 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 183 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
184 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 184 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
185 | 185 | ||
186 | 186 | ||
187 | KPrefs::setCurrentGroup("Locale"); | 187 | KPrefs::setCurrentGroup("Locale"); |
188 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 188 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
189 | 189 | ||
190 | 190 | ||
191 | KPrefs::setCurrentGroup("Colors"); | 191 | KPrefs::setCurrentGroup("Colors"); |
192 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 192 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
193 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 193 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
194 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 194 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
195 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); | 195 | addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); |
196 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 196 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
197 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 197 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
198 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 198 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
199 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 199 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
200 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 200 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
201 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 201 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
202 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 202 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
203 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 203 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
204 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 204 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
205 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); | 205 | addItemBool("MonthViewWeek",&mMonthViewWeek,false); |
206 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 206 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
207 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 207 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
208 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 208 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
209 | addItemBool("UseAppColors",&mUseAppColors,false); | 209 | addItemBool("UseAppColors",&mUseAppColors,false); |
210 | 210 | ||
211 | 211 | ||
212 | 212 | ||
213 | KPrefs::setCurrentGroup("Views"); | 213 | KPrefs::setCurrentGroup("Views"); |
214 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 214 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
215 | addItemInt("Hour Size",&mHourSize,8); | 215 | addItemInt("Hour Size",&mHourSize,8); |
216 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 216 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
217 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 217 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
218 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 218 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
219 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 219 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
220 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 220 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
221 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 221 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
222 | #ifdef DESKTOP_VERION | 222 | #ifdef DESKTOP_VERION |
223 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 223 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
224 | #else | 224 | #else |
225 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 225 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
226 | #endif | 226 | #endif |
227 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 227 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
228 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 228 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
229 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 229 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
230 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 230 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
231 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 231 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
232 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 232 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
233 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 233 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
234 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 234 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
235 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 235 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
236 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 236 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
237 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 237 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
238 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 238 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
239 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 239 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
240 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 240 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
241 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 241 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
242 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 242 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
243 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 243 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
244 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 244 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
245 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 245 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
246 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 246 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
247 | #ifdef DESKTOP_VERSION | 247 | #ifdef DESKTOP_VERSION |
248 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 248 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
249 | #else | 249 | #else |
250 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 250 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
251 | #endif | 251 | #endif |
252 | addItemInt("Day Begins",&mDayBegins,7); | 252 | addItemInt("Day Begins",&mDayBegins,7); |
253 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 253 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
254 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 254 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
255 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 255 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
256 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 256 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
257 | 257 | ||
258 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 258 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
259 | addItemBool("Full View Month",&mFullViewMonth,true); | 259 | addItemBool("Full View Month",&mFullViewMonth,true); |
260 | addItemBool("Full View Todo",&mFullViewTodo,true); | 260 | addItemBool("Full View Todo",&mFullViewTodo,true); |
261 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 261 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
262 | 262 | ||
263 | addItemInt("Next X Days",&mNextXDays,3); | 263 | addItemInt("Next X Days",&mNextXDays,3); |
264 | 264 | ||
265 | KPrefs::setCurrentGroup("Printer"); | 265 | KPrefs::setCurrentGroup("Printer"); |
266 | 266 | ||
267 | KPrefs::setCurrentGroup("Layout"); | 267 | KPrefs::setCurrentGroup("Layout"); |
268 | 268 | ||
269 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 269 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
270 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 270 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
271 | 271 | ||
272 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 272 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
273 | 273 | ||
274 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 274 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
275 | 275 | ||
276 | KPrefs::setCurrentGroup("Group Scheduling"); | 276 | KPrefs::setCurrentGroup("Group Scheduling"); |
277 | 277 | ||
278 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 278 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
279 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 279 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
280 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 280 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
281 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 281 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
282 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 282 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
283 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 283 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
284 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 284 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
285 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 285 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
286 | 286 | ||
287 | KPrefs::setCurrentGroup( "Editors" ); | 287 | KPrefs::setCurrentGroup( "Editors" ); |
288 | 288 | ||
289 | addItemStringList( "EventTemplates", &mEventTemplates ); | 289 | addItemStringList( "EventTemplates", &mEventTemplates ); |
290 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 290 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
291 | 291 | ||
292 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 292 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
293 | 293 | ||
294 | 294 | KPrefs::setCurrentGroup( "ViewOptions" ); | |
295 | addItemBool("EVshowDetails",&mEVshowDetails,true); | ||
296 | addItemBool("EVshowCreated",&mEVshowCreated,true); | ||
297 | addItemBool("EVshowChanged",&mEVshowChanged,true); | ||
298 | addItemBool("WTshowDetails",&mWTshowDetails,false); | ||
299 | addItemBool("WTshowCreated",&mWTshowCreated,false); | ||
300 | addItemBool("WTshowChanged",&mWTshowChanged,false); | ||
295 | 301 | ||
296 | } | 302 | } |
297 | 303 | ||
298 | 304 | ||
299 | KOPrefs::~KOPrefs() | 305 | KOPrefs::~KOPrefs() |
300 | { | 306 | { |
301 | if (mInstance == this) | 307 | if (mInstance == this) |
302 | mInstance = insd.setObject(0); | 308 | mInstance = insd.setObject(0); |
303 | 309 | ||
304 | //qDebug("KOPrefs::~KOPrefs() "); | 310 | //qDebug("KOPrefs::~KOPrefs() "); |
305 | } | 311 | } |
306 | 312 | ||
307 | 313 | ||
308 | KOPrefs *KOPrefs::instance() | 314 | KOPrefs *KOPrefs::instance() |
309 | { | 315 | { |
310 | if (!mInstance) { | 316 | if (!mInstance) { |
311 | mInstance = insd.setObject(new KOPrefs()); | 317 | mInstance = insd.setObject(new KOPrefs()); |
312 | mInstance->readConfig(); | 318 | mInstance->readConfig(); |
313 | } | 319 | } |
314 | 320 | ||
315 | return mInstance; | 321 | return mInstance; |
316 | } | 322 | } |
317 | 323 | ||
318 | void KOPrefs::usrSetDefaults() | 324 | void KOPrefs::usrSetDefaults() |
319 | { | 325 | { |
320 | 326 | ||
321 | } | 327 | } |
322 | 328 | ||
323 | void KOPrefs::fillMailDefaults() | 329 | void KOPrefs::fillMailDefaults() |
324 | { | 330 | { |
325 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 331 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
326 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 332 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
327 | } | 333 | } |
328 | 334 | ||
329 | void KOPrefs::setTimeZoneIdDefault() | 335 | void KOPrefs::setTimeZoneIdDefault() |
330 | { | 336 | { |
331 | ; | 337 | ; |
332 | } | 338 | } |
333 | 339 | ||
334 | void KOPrefs::setAllDefaults() | 340 | void KOPrefs::setAllDefaults() |
335 | { | 341 | { |
336 | setCategoryDefaults(); | 342 | setCategoryDefaults(); |
337 | mEventSummaryUser = getDefaultList() ; | 343 | mEventSummaryUser = getDefaultList() ; |
338 | mTodoSummaryUser = getDefaultList() ; | 344 | mTodoSummaryUser = getDefaultList() ; |
339 | mLocationDefaults = getLocationDefaultList(); | 345 | mLocationDefaults = getLocationDefaultList(); |
340 | } | 346 | } |
341 | 347 | ||
342 | void KOPrefs::setCategoryDefaults() | 348 | void KOPrefs::setCategoryDefaults() |
343 | { | 349 | { |
344 | mCustomCategories.clear(); | 350 | mCustomCategories.clear(); |
345 | mCustomCategories = getDefaultList(); | 351 | mCustomCategories = getDefaultList(); |
346 | 352 | ||
347 | QStringList::Iterator it; | 353 | QStringList::Iterator it; |
348 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 354 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
349 | setCategoryColor(*it,mDefaultCategoryColor); | 355 | setCategoryColor(*it,mDefaultCategoryColor); |
350 | } | 356 | } |
351 | } | 357 | } |
352 | QStringList KOPrefs::getLocationDefaultList() | 358 | QStringList KOPrefs::getLocationDefaultList() |
353 | { | 359 | { |
354 | QStringList retval ; | 360 | QStringList retval ; |
355 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 361 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
356 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 362 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
357 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 363 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
358 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 364 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
359 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 365 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
360 | 366 | ||
361 | retval.sort(); | 367 | retval.sort(); |
362 | return retval; | 368 | return retval; |
363 | } | 369 | } |
364 | QStringList KOPrefs::getDefaultList() | 370 | QStringList KOPrefs::getDefaultList() |
365 | { | 371 | { |
366 | QStringList retval ; | 372 | QStringList retval ; |
367 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 373 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
368 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 374 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
369 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 375 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
370 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 376 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
371 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 377 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
372 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 378 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
373 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 379 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
374 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 380 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
375 | retval.sort(); | 381 | retval.sort(); |
376 | //qDebug("cat %s ", retval.join("-").latin1()); | 382 | //qDebug("cat %s ", retval.join("-").latin1()); |
377 | return retval; | 383 | return retval; |
378 | } | 384 | } |
379 | 385 | ||
380 | void KOPrefs::usrReadConfig() | 386 | void KOPrefs::usrReadConfig() |
381 | { | 387 | { |
382 | config()->setGroup("General"); | 388 | config()->setGroup("General"); |
383 | 389 | ||
384 | //qDebug("KOPrefs::usrReadConfig() "); | 390 | //qDebug("KOPrefs::usrReadConfig() "); |
385 | mCustomCategories = config()->readListEntry("Custom Categories"); | 391 | mCustomCategories = config()->readListEntry("Custom Categories"); |
386 | mOldLoadedLanguage = mOldLanguage ; | 392 | mOldLoadedLanguage = mOldLanguage ; |
387 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 393 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
388 | if (mLocationDefaults.isEmpty()) { | 394 | if (mLocationDefaults.isEmpty()) { |
389 | mLocationDefaults = getLocationDefaultList(); | 395 | mLocationDefaults = getLocationDefaultList(); |
390 | } | 396 | } |
391 | 397 | ||
392 | if (mEventSummaryUser.isEmpty()) { | 398 | if (mEventSummaryUser.isEmpty()) { |
393 | mEventSummaryUser = getDefaultList() ; | 399 | mEventSummaryUser = getDefaultList() ; |
394 | } | 400 | } |
395 | if (mTodoSummaryUser.isEmpty()) { | 401 | if (mTodoSummaryUser.isEmpty()) { |
396 | mTodoSummaryUser = getDefaultList() ; | 402 | mTodoSummaryUser = getDefaultList() ; |
397 | } | 403 | } |
398 | 404 | ||
399 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 405 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
400 | 406 | ||
401 | config()->setGroup("Personal Settings"); | 407 | config()->setGroup("Personal Settings"); |
402 | mName = config()->readEntry("user_name",""); | 408 | mName = config()->readEntry("user_name",""); |
403 | mEmail = config()->readEntry("user_email",""); | 409 | mEmail = config()->readEntry("user_email",""); |
404 | fillMailDefaults(); | 410 | fillMailDefaults(); |
405 | 411 | ||
406 | config()->setGroup("Category Colors"); | 412 | config()->setGroup("Category Colors"); |
407 | QStringList::Iterator it; | 413 | QStringList::Iterator it; |
408 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 414 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
409 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 415 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
410 | 416 | ||
411 | } | 417 | } |
412 | 418 | ||
413 | KPimPrefs::usrReadConfig(); | 419 | KPimPrefs::usrReadConfig(); |
414 | } | 420 | } |
415 | 421 | ||
416 | 422 | ||
417 | void KOPrefs::usrWriteConfig() | 423 | void KOPrefs::usrWriteConfig() |
418 | { | 424 | { |
419 | config()->setGroup("General"); | 425 | config()->setGroup("General"); |
420 | config()->writeEntry("Custom Categories",mCustomCategories); | 426 | config()->writeEntry("Custom Categories",mCustomCategories); |
421 | 427 | ||
422 | config()->setGroup("Personal Settings"); | 428 | config()->setGroup("Personal Settings"); |
423 | config()->writeEntry("user_name",mName); | 429 | config()->writeEntry("user_name",mName); |
424 | config()->writeEntry("user_email",mEmail); | 430 | config()->writeEntry("user_email",mEmail); |
425 | 431 | ||
426 | config()->setGroup("Category Colors"); | 432 | config()->setGroup("Category Colors"); |
427 | QDictIterator<QColor> it(mCategoryColors); | 433 | QDictIterator<QColor> it(mCategoryColors); |
428 | while (it.current()) { | 434 | while (it.current()) { |
429 | config()->writeEntry(it.currentKey(),*(it.current())); | 435 | config()->writeEntry(it.currentKey(),*(it.current())); |
430 | ++it; | 436 | ++it; |
431 | } | 437 | } |
432 | 438 | ||
433 | 439 | ||
434 | KPimPrefs::usrWriteConfig(); | 440 | KPimPrefs::usrWriteConfig(); |
435 | } | 441 | } |
436 | 442 | ||
437 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 443 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
438 | { | 444 | { |
439 | mCategoryColors.replace(cat,new QColor(color)); | 445 | mCategoryColors.replace(cat,new QColor(color)); |
440 | } | 446 | } |
441 | 447 | ||
442 | QColor *KOPrefs::categoryColor(QString cat) | 448 | QColor *KOPrefs::categoryColor(QString cat) |
443 | { | 449 | { |
444 | QColor *color = 0; | 450 | QColor *color = 0; |
445 | 451 | ||
446 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | 452 | if (!cat.isEmpty()) color = mCategoryColors[cat]; |
447 | 453 | ||
448 | if (color) return color; | 454 | if (color) return color; |
449 | else return &mDefaultCategoryColor; | 455 | else return &mDefaultCategoryColor; |
450 | } | 456 | } |
451 | 457 | ||
452 | void KOPrefs::setFullName(const QString &name) | 458 | void KOPrefs::setFullName(const QString &name) |
453 | { | 459 | { |
454 | mName = name; | 460 | mName = name; |
455 | } | 461 | } |
456 | 462 | ||
457 | void KOPrefs::setEmail(const QString &email) | 463 | void KOPrefs::setEmail(const QString &email) |
458 | { | 464 | { |
459 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | 465 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); |
460 | mEmail = email; | 466 | mEmail = email; |
461 | } | 467 | } |
462 | 468 | ||
463 | QString KOPrefs::fullName() | 469 | QString KOPrefs::fullName() |
464 | { | 470 | { |
465 | if (mEmailControlCenter) { | 471 | if (mEmailControlCenter) { |
466 | KEMailSettings settings; | 472 | KEMailSettings settings; |
467 | return settings.getSetting(KEMailSettings::RealName); | 473 | return settings.getSetting(KEMailSettings::RealName); |
468 | } else { | 474 | } else { |
469 | return mName; | 475 | return mName; |
470 | } | 476 | } |
471 | } | 477 | } |
472 | 478 | ||
473 | QString KOPrefs::email() | 479 | QString KOPrefs::email() |
474 | { | 480 | { |
475 | if (mEmailControlCenter) { | 481 | if (mEmailControlCenter) { |
476 | KEMailSettings settings; | 482 | KEMailSettings settings; |
477 | return settings.getSetting(KEMailSettings::EmailAddress); | 483 | return settings.getSetting(KEMailSettings::EmailAddress); |
478 | } else { | 484 | } else { |
479 | return mEmail; | 485 | return mEmail; |
480 | } | 486 | } |
481 | } | 487 | } |
482 | KConfig* KOPrefs::getConfig() | 488 | KConfig* KOPrefs::getConfig() |
483 | { | 489 | { |
484 | return config(); | 490 | return config(); |
485 | } | 491 | } |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index e300067..e4e3dd7 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -80,205 +80,213 @@ class KOPrefs : public KPimPrefs | |||
80 | QString fullName(); | 80 | QString fullName(); |
81 | void setEmail(const QString &); | 81 | void setEmail(const QString &); |
82 | QString email(); | 82 | QString email(); |
83 | 83 | ||
84 | QString mAdditional; | 84 | QString mAdditional; |
85 | 85 | ||
86 | bool mEmailControlCenter; | 86 | bool mEmailControlCenter; |
87 | 87 | ||
88 | bool mBcc; | 88 | bool mBcc; |
89 | bool mAutoSave; | 89 | bool mAutoSave; |
90 | int mAutoSaveInterval; | 90 | int mAutoSaveInterval; |
91 | bool mConfirm; | 91 | bool mConfirm; |
92 | 92 | ||
93 | bool mEnableGroupScheduling; | 93 | bool mEnableGroupScheduling; |
94 | bool mEnableProjectView; | 94 | bool mEnableProjectView; |
95 | 95 | ||
96 | int mDefaultFormat; | 96 | int mDefaultFormat; |
97 | int mMailClient; | 97 | int mMailClient; |
98 | 98 | ||
99 | int mStartTime; | 99 | int mStartTime; |
100 | int mDefaultDuration; | 100 | int mDefaultDuration; |
101 | int mAlarmTime; | 101 | int mAlarmTime; |
102 | 102 | ||
103 | int mWorkingHoursStart; | 103 | int mWorkingHoursStart; |
104 | int mWorkingHoursEnd; | 104 | int mWorkingHoursEnd; |
105 | bool mExcludeHolidays; | 105 | bool mExcludeHolidays; |
106 | bool mExcludeSaturdays; | 106 | bool mExcludeSaturdays; |
107 | bool mMarcusBainsShowSeconds; | 107 | bool mMarcusBainsShowSeconds; |
108 | 108 | ||
109 | QFont mTimeBarFont; | 109 | QFont mTimeBarFont; |
110 | QFont mMonthViewFont; | 110 | QFont mMonthViewFont; |
111 | QFont mAgendaViewFont; | 111 | QFont mAgendaViewFont; |
112 | QFont mMarcusBainsFont; | 112 | QFont mMarcusBainsFont; |
113 | QFont mTimeLabelsFont; | 113 | QFont mTimeLabelsFont; |
114 | QFont mTodoViewFont; | 114 | QFont mTodoViewFont; |
115 | QFont mListViewFont; | 115 | QFont mListViewFont; |
116 | QFont mDateNavigatorFont; | 116 | QFont mDateNavigatorFont; |
117 | QFont mEditBoxFont; | 117 | QFont mEditBoxFont; |
118 | QFont mJornalViewFont; | 118 | QFont mJornalViewFont; |
119 | QFont mWhatsNextFont; | 119 | QFont mWhatsNextFont; |
120 | QFont mEventViewFont; | 120 | QFont mEventViewFont; |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | QColor mHolidayColor; | 125 | QColor mHolidayColor; |
126 | QColor mHighlightColor; | 126 | QColor mHighlightColor; |
127 | QColor mEventColor; | 127 | QColor mEventColor; |
128 | QColor mTodoDoneColor; | 128 | QColor mTodoDoneColor; |
129 | QColor mAgendaBgColor; | 129 | QColor mAgendaBgColor; |
130 | QColor mWorkingHoursColor; | 130 | QColor mWorkingHoursColor; |
131 | QColor mTodoDueTodayColor; | 131 | QColor mTodoDueTodayColor; |
132 | QColor mTodoOverdueColor; | 132 | QColor mTodoOverdueColor; |
133 | QColor mMonthViewEvenColor; | 133 | QColor mMonthViewEvenColor; |
134 | QColor mMonthViewOddColor; | 134 | QColor mMonthViewOddColor; |
135 | QColor mMonthViewHolidayColor; | 135 | QColor mMonthViewHolidayColor; |
136 | bool mMonthViewUsesDayColors; | 136 | bool mMonthViewUsesDayColors; |
137 | bool mMonthViewSatSunTog; | 137 | bool mMonthViewSatSunTog; |
138 | bool mMonthViewWeek; | 138 | bool mMonthViewWeek; |
139 | QColor mAppColor1; | 139 | QColor mAppColor1; |
140 | QColor mAppColor2; | 140 | QColor mAppColor2; |
141 | bool mUseAppColors; | 141 | bool mUseAppColors; |
142 | 142 | ||
143 | int mDayBegins; | 143 | int mDayBegins; |
144 | int mHourSize; | 144 | int mHourSize; |
145 | int mAllDaySize; | 145 | int mAllDaySize; |
146 | bool mShowFullMenu; | 146 | bool mShowFullMenu; |
147 | bool mDailyRecur; | 147 | bool mDailyRecur; |
148 | bool mWeeklyRecur; | 148 | bool mWeeklyRecur; |
149 | bool mMonthDailyRecur; | 149 | bool mMonthDailyRecur; |
150 | bool mMonthWeeklyRecur; | 150 | bool mMonthWeeklyRecur; |
151 | bool mMonthShowIcons; | 151 | bool mMonthShowIcons; |
152 | bool mMonthShowShort; | 152 | bool mMonthShowShort; |
153 | bool mEnableToolTips; | 153 | bool mEnableToolTips; |
154 | bool mEnableMonthScroll; | 154 | bool mEnableMonthScroll; |
155 | bool mFullViewMonth; | 155 | bool mFullViewMonth; |
156 | bool mMonthViewUsesCategoryColor; | 156 | bool mMonthViewUsesCategoryColor; |
157 | bool mFullViewTodo; | 157 | bool mFullViewTodo; |
158 | bool mShowCompletedTodo; | 158 | bool mShowCompletedTodo; |
159 | bool mMarcusBainsEnabled; | 159 | bool mMarcusBainsEnabled; |
160 | int mNextXDays; | 160 | int mNextXDays; |
161 | int mWhatsNextDays; | 161 | int mWhatsNextDays; |
162 | int mWhatsNextPrios; | 162 | int mWhatsNextPrios; |
163 | bool mEnableQuickTodo; | 163 | bool mEnableQuickTodo; |
164 | 164 | ||
165 | bool mCompactDialogs; | 165 | bool mCompactDialogs; |
166 | bool mVerticalScreen; | 166 | bool mVerticalScreen; |
167 | 167 | ||
168 | bool mShowIconNewTodo; | 168 | bool mShowIconNewTodo; |
169 | bool mShowIconNewEvent; | 169 | bool mShowIconNewEvent; |
170 | bool mShowIconSearch; | 170 | bool mShowIconSearch; |
171 | bool mShowIconList; | 171 | bool mShowIconList; |
172 | bool mShowIconDay1; | 172 | bool mShowIconDay1; |
173 | bool mShowIconDay5; | 173 | bool mShowIconDay5; |
174 | bool mShowIconDay6; | 174 | bool mShowIconDay6; |
175 | bool mShowIconDay7; | 175 | bool mShowIconDay7; |
176 | bool mShowIconMonth; | 176 | bool mShowIconMonth; |
177 | bool mShowIconTodoview; | 177 | bool mShowIconTodoview; |
178 | bool mShowIconBackFast; | 178 | bool mShowIconBackFast; |
179 | bool mShowIconBack; | 179 | bool mShowIconBack; |
180 | bool mShowIconToday; | 180 | bool mShowIconToday; |
181 | bool mShowIconForward; | 181 | bool mShowIconForward; |
182 | bool mShowIconForwardFast; | 182 | bool mShowIconForwardFast; |
183 | bool mShowIconWhatsThis; | 183 | bool mShowIconWhatsThis; |
184 | bool mShowIconNextDays; | 184 | bool mShowIconNextDays; |
185 | bool mShowIconNext; | 185 | bool mShowIconNext; |
186 | bool mShowIconJournal; | 186 | bool mShowIconJournal; |
187 | 187 | ||
188 | bool mShowIconStretch; | 188 | bool mShowIconStretch; |
189 | 189 | ||
190 | bool mToolBarHor; | 190 | bool mToolBarHor; |
191 | bool mToolBarUp; | 191 | bool mToolBarUp; |
192 | bool mToolBarMiniIcons; | 192 | bool mToolBarMiniIcons; |
193 | 193 | ||
194 | bool mAskForQuit; | 194 | bool mAskForQuit; |
195 | bool mUsePassWd; | 195 | bool mUsePassWd; |
196 | bool mShowSyncEvents; | 196 | bool mShowSyncEvents; |
197 | bool mShowTodoInAgenda; | 197 | bool mShowTodoInAgenda; |
198 | bool mShowTimeInAgenda; | 198 | bool mShowTimeInAgenda; |
199 | bool mHideNonStartedTodos; | 199 | bool mHideNonStartedTodos; |
200 | 200 | ||
201 | int mLastSyncTime; | 201 | int mLastSyncTime; |
202 | void setCategoryColor(QString cat,const QColor & color); | 202 | void setCategoryColor(QString cat,const QColor & color); |
203 | QColor *categoryColor(QString cat); | 203 | QColor *categoryColor(QString cat); |
204 | 204 | ||
205 | QString mArchiveFile; | 205 | QString mArchiveFile; |
206 | QString mHtmlExportFile; | 206 | QString mHtmlExportFile; |
207 | bool mHtmlWithSave; | 207 | bool mHtmlWithSave; |
208 | 208 | ||
209 | QStringList mSelectedPlugins; | 209 | QStringList mSelectedPlugins; |
210 | 210 | ||
211 | QString mLastImportFile; | 211 | QString mLastImportFile; |
212 | QString mLastVcalFile; | 212 | QString mLastVcalFile; |
213 | QString mLastSaveFile; | 213 | QString mLastSaveFile; |
214 | QString mLastLoadFile; | 214 | QString mLastLoadFile; |
215 | 215 | ||
216 | 216 | ||
217 | QString mDefaultAlarmFile; | 217 | QString mDefaultAlarmFile; |
218 | int mIMIPScheduler; | 218 | int mIMIPScheduler; |
219 | int mIMIPSend; | 219 | int mIMIPSend; |
220 | QStringList mAdditionalMails; | 220 | QStringList mAdditionalMails; |
221 | int mIMIPAutoRefresh; | 221 | int mIMIPAutoRefresh; |
222 | int mIMIPAutoInsertReply; | 222 | int mIMIPAutoInsertReply; |
223 | int mIMIPAutoInsertRequest; | 223 | int mIMIPAutoInsertRequest; |
224 | int mIMIPAutoFreeBusy; | 224 | int mIMIPAutoFreeBusy; |
225 | int mIMIPAutoFreeBusyReply; | 225 | int mIMIPAutoFreeBusyReply; |
226 | 226 | ||
227 | QStringList mTodoTemplates; | 227 | QStringList mTodoTemplates; |
228 | QStringList mEventTemplates; | 228 | QStringList mEventTemplates; |
229 | 229 | ||
230 | int mDestination; | 230 | int mDestination; |
231 | 231 | ||
232 | 232 | ||
233 | bool mEditOnDoubleClick; | 233 | bool mEditOnDoubleClick; |
234 | bool mViewChangeHoldFullscreen; | 234 | bool mViewChangeHoldFullscreen; |
235 | bool mViewChangeHoldNonFullscreen; | 235 | bool mViewChangeHoldNonFullscreen; |
236 | bool mCenterOnCurrentTime; | 236 | bool mCenterOnCurrentTime; |
237 | bool mSetTimeToDayStartAt; | 237 | bool mSetTimeToDayStartAt; |
238 | bool mHighlightCurrentDay; | 238 | bool mHighlightCurrentDay; |
239 | bool mUseHighlightLightColor; | 239 | bool mUseHighlightLightColor; |
240 | bool mListViewMonthTimespan; | 240 | bool mListViewMonthTimespan; |
241 | bool mWNViewShowsParents; | 241 | bool mWNViewShowsParents; |
242 | bool mWNViewShowsPast; | 242 | bool mWNViewShowsPast; |
243 | bool mWNViewShowLocation; | 243 | bool mWNViewShowLocation; |
244 | bool mTodoViewShowsPercentage; | 244 | bool mTodoViewShowsPercentage; |
245 | bool mTodoViewUsesCatColors; | 245 | bool mTodoViewUsesCatColors; |
246 | bool mMonthViewUsesBigFont; | 246 | bool mMonthViewUsesBigFont; |
247 | bool mTodoViewUsesSmallFont; | 247 | bool mTodoViewUsesSmallFont; |
248 | bool mTodoViewUsesForegroundColor; | 248 | bool mTodoViewUsesForegroundColor; |
249 | bool mMonthViewUsesForegroundColor; | 249 | bool mMonthViewUsesForegroundColor; |
250 | 250 | ||
251 | bool mHightlightDateTimeEdit; | 251 | bool mHightlightDateTimeEdit; |
252 | bool mShortDateInViewer; | 252 | bool mShortDateInViewer; |
253 | 253 | ||
254 | bool mShowDateNavigator; | 254 | bool mShowDateNavigator; |
255 | 255 | ||
256 | QStringList mLocationDefaults; | 256 | QStringList mLocationDefaults; |
257 | QStringList mEventSummaryUser; | 257 | QStringList mEventSummaryUser; |
258 | QStringList mTodoSummaryUser; | 258 | QStringList mTodoSummaryUser; |
259 | 259 | ||
260 | bool mUseInternalAlarmNotification; | 260 | bool mUseInternalAlarmNotification; |
261 | int mAlarmPlayBeeps; | 261 | int mAlarmPlayBeeps; |
262 | int mAlarmSuspendTime; | 262 | int mAlarmSuspendTime; |
263 | int mAlarmSuspendCount; | 263 | int mAlarmSuspendCount; |
264 | int mAlarmBeepInterval; | 264 | int mAlarmBeepInterval; |
265 | int mOldLanguage; | 265 | int mOldLanguage; |
266 | int mOldLoadedLanguage; | 266 | int mOldLoadedLanguage; |
267 | 267 | ||
268 | 268 | ||
269 | QString mActiveSyncPort; | 269 | QString mActiveSyncPort; |
270 | QString mActiveSyncIP; | 270 | QString mActiveSyncIP; |
271 | 271 | ||
272 | // settings for eventviewer | ||
273 | bool mEVshowDetails; | ||
274 | bool mEVshowCreated; | ||
275 | bool mEVshowChanged; | ||
276 | bool mWTshowDetails; | ||
277 | bool mWTshowCreated; | ||
278 | bool mWTshowChanged; | ||
279 | |||
272 | private: | 280 | private: |
273 | QDict<QColor> mCategoryColors; | 281 | QDict<QColor> mCategoryColors; |
274 | QColor mDefaultCategoryColor; | 282 | QColor mDefaultCategoryColor; |
275 | 283 | ||
276 | QFont mDefaultTimeBarFont; | 284 | QFont mDefaultTimeBarFont; |
277 | QFont mDefaultViewFont; | 285 | QFont mDefaultViewFont; |
278 | QFont mDefaultMonthViewFont; | 286 | QFont mDefaultMonthViewFont; |
279 | 287 | ||
280 | QString mName; | 288 | QString mName; |
281 | QString mEmail; | 289 | QString mEmail; |
282 | }; | 290 | }; |
283 | 291 | ||
284 | #endif | 292 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 452d019..443508d 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -715,384 +715,416 @@ void KOPrefsDialog::setupViewsTab() | |||
715 | topLayout->setMargin(marginHint()); | 715 | topLayout->setMargin(marginHint()); |
716 | ii = 0; | 716 | ii = 0; |
717 | QLabel *lab; | 717 | QLabel *lab; |
718 | QHBox *habo = new QHBox( topFrame ); | 718 | QHBox *habo = new QHBox( topFrame ); |
719 | if ( QApplication::desktop()->width() <= 480 ) { | 719 | if ( QApplication::desktop()->width() <= 480 ) { |
720 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 720 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
721 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 721 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
722 | ii++; | 722 | ii++; |
723 | } else { | 723 | } else { |
724 | new QLabel ( i18n("Show events that recur "), habo ); | 724 | new QLabel ( i18n("Show events that recur "), habo ); |
725 | } | 725 | } |
726 | dailyRecur = | 726 | dailyRecur = |
727 | addWidBool(i18n("daily"), | 727 | addWidBool(i18n("daily"), |
728 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 728 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
729 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 729 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
730 | 730 | ||
731 | weeklyRecur = | 731 | weeklyRecur = |
732 | addWidBool(i18n("weekly"), | 732 | addWidBool(i18n("weekly"), |
733 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 733 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
734 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 734 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
735 | ii++; | 735 | ii++; |
736 | 736 | ||
737 | 737 | ||
738 | habo = new QHBox( topFrame ); | 738 | habo = new QHBox( topFrame ); |
739 | if ( QApplication::desktop()->width() <= 480 ) { | 739 | if ( QApplication::desktop()->width() <= 480 ) { |
740 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 740 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
741 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 741 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
742 | ii++; | 742 | ii++; |
743 | 743 | ||
744 | } else { | 744 | } else { |
745 | new QLabel ( i18n("Show in every cell "), habo ); | 745 | new QLabel ( i18n("Show in every cell "), habo ); |
746 | } | 746 | } |
747 | weeklyRecur = | 747 | weeklyRecur = |
748 | addWidBool(i18n("short month"), | 748 | addWidBool(i18n("short month"), |
749 | &(KOPrefs::instance()->mMonthShowShort),habo); | 749 | &(KOPrefs::instance()->mMonthShowShort),habo); |
750 | weeklyRecur = | 750 | weeklyRecur = |
751 | addWidBool(i18n("icons"), | 751 | addWidBool(i18n("icons"), |
752 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 752 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
753 | 753 | ||
754 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 754 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
755 | ii++; | 755 | ii++; |
756 | #ifdef DESKTOP_VERSION | 756 | #ifdef DESKTOP_VERSION |
757 | KPrefsDialogWidBool *enableMonthScroll = | 757 | KPrefsDialogWidBool *enableMonthScroll = |
758 | addWidBool(i18n("Enable scrollbars in month view cells"), | 758 | addWidBool(i18n("Enable scrollbars in month view cells"), |
759 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 759 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
760 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 760 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
761 | #endif | 761 | #endif |
762 | dummy = | 762 | dummy = |
763 | addWidBool(i18n("Week view mode uses bigger font"), | 763 | addWidBool(i18n("Week view mode uses bigger font"), |
764 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 764 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
765 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 765 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
766 | dummy = | 766 | dummy = |
767 | addWidBool(i18n("Show Sat/Sun together"), | 767 | addWidBool(i18n("Show Sat/Sun together"), |
768 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 768 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
769 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 769 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
770 | 770 | ||
771 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 771 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
772 | addWidBool(i18n("Month view uses category colors"), | 772 | addWidBool(i18n("Month view uses category colors"), |
773 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 773 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
774 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 774 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
775 | 775 | ||
776 | dummy = | 776 | dummy = |
777 | addWidBool(i18n("Categorie colors are applied to text"), | 777 | addWidBool(i18n("Categorie colors are applied to text"), |
778 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 778 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
779 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 779 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
780 | coloredCategoriesInMonthView = | 780 | coloredCategoriesInMonthView = |
781 | addWidBool(i18n("Month view uses day colors"), | 781 | addWidBool(i18n("Month view uses day colors"), |
782 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 782 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
783 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 783 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
784 | 784 | ||
785 | KPrefsDialogWidColor *holidayColor = | 785 | KPrefsDialogWidColor *holidayColor = |
786 | addWidColor(i18n("Day color odd months"), | 786 | addWidColor(i18n("Day color odd months"), |
787 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 787 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
788 | topLayout->addWidget(holidayColor->label(),ii,0); | 788 | topLayout->addWidget(holidayColor->label(),ii,0); |
789 | topLayout->addWidget(holidayColor->button(),ii++,1); | 789 | topLayout->addWidget(holidayColor->button(),ii++,1); |
790 | 790 | ||
791 | holidayColor = | 791 | holidayColor = |
792 | addWidColor(i18n("Day color even months"), | 792 | addWidColor(i18n("Day color even months"), |
793 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 793 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
794 | topLayout->addWidget(holidayColor->label(),ii,0); | 794 | topLayout->addWidget(holidayColor->label(),ii,0); |
795 | topLayout->addWidget(holidayColor->button(),ii++,1); | 795 | topLayout->addWidget(holidayColor->button(),ii++,1); |
796 | 796 | ||
797 | 797 | ||
798 | holidayColor = | 798 | holidayColor = |
799 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 799 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
800 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 800 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
801 | topLayout->addWidget(holidayColor->label(),ii,0); | 801 | topLayout->addWidget(holidayColor->label(),ii,0); |
802 | topLayout->addWidget(holidayColor->button(),ii++,1); | 802 | topLayout->addWidget(holidayColor->button(),ii++,1); |
803 | // *********************** What'sNext View | 803 | // *********************** What'sNext View |
804 | topFrame = addPage(i18n("What's Next View"),0,0); | 804 | topFrame = addPage(i18n("What's Next View"),0,0); |
805 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 805 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
806 | 806 | ||
807 | topLayout = new QGridLayout(topFrame,4,1); | 807 | topLayout = new QGridLayout(topFrame,4,1); |
808 | topLayout->setSpacing(spacingHint()); | 808 | topLayout->setSpacing(spacingHint()); |
809 | topLayout->setMargin(marginHint()); | 809 | topLayout->setMargin(marginHint()); |
810 | ii = 0; | 810 | ii = 0; |
811 | KPrefsDialogWidBool *passwdk = | 811 | KPrefsDialogWidBool *passwdk = |
812 | 812 | ||
813 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), | 813 | addWidBool(i18n("Show events, that are done in \nWhat's Next view"), |
814 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 814 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
815 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 815 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
816 | passwdk = | 816 | passwdk = |
817 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | 817 | addWidBool(i18n("Show parent To-Do's in What's Next view"), |
818 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 818 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
819 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 819 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
820 | 820 | ||
821 | passwdk = | 821 | passwdk = |
822 | addWidBool(i18n("Show location in What's Next view"), | 822 | addWidBool(i18n("Show location in What's Next view"), |
823 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 823 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
824 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 824 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
825 | 825 | ||
826 | passwdk = | 826 | passwdk = |
827 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), | 827 | addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), |
828 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 828 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
829 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 829 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
830 | passwdk = | 830 | passwdk = |
831 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), | 831 | addWidBool(i18n("Use short date in \nWhat's Next/Event view"), |
832 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 832 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
833 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 833 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
834 | 834 | ||
835 | 835 | ||
836 | 836 | ||
837 | 837 | ||
838 | // *********************** Todo View | 838 | // *********************** Todo View |
839 | 839 | ||
840 | topFrame = addPage(i18n("Todo View"),0,0); | 840 | topFrame = addPage(i18n("Todo View"),0,0); |
841 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 841 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
842 | 842 | ||
843 | topLayout = new QGridLayout(topFrame,4,1); | 843 | topLayout = new QGridLayout(topFrame,4,1); |
844 | topLayout->setSpacing(spacingHint()); | 844 | topLayout->setSpacing(spacingHint()); |
845 | topLayout->setMargin(marginHint()); | 845 | topLayout->setMargin(marginHint()); |
846 | ii = 0; | 846 | ii = 0; |
847 | dummy = | 847 | dummy = |
848 | addWidBool(i18n("Hide not running Todos in To-do view"), | 848 | addWidBool(i18n("Hide not running Todos in To-do view"), |
849 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 849 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
850 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 850 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
851 | 851 | ||
852 | 852 | ||
853 | KPrefsDialogWidBool *showCompletedTodo = | 853 | KPrefsDialogWidBool *showCompletedTodo = |
854 | addWidBool(i18n("To-do view shows completed Todos"), | 854 | addWidBool(i18n("To-do view shows completed Todos"), |
855 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 855 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
856 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 856 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
857 | dummy = | 857 | dummy = |
858 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 858 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
859 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 859 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
860 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 860 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
861 | 861 | ||
862 | dummy = | 862 | dummy = |
863 | addWidBool(i18n("Small To-do view uses smaller font"), | 863 | addWidBool(i18n("Small To-do view uses smaller font"), |
864 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 864 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
865 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 865 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
866 | 866 | ||
867 | 867 | ||
868 | 868 | ||
869 | dummy = | 869 | dummy = |
870 | addWidBool(i18n("Todo view uses category colors"), | 870 | addWidBool(i18n("Todo view uses category colors"), |
871 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 871 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
872 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 872 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
873 | 873 | ||
874 | 874 | ||
875 | QWidget* wid = new QWidget( topFrame ); | 875 | QWidget* wid = new QWidget( topFrame ); |
876 | // Todo due today color | 876 | // Todo due today color |
877 | KPrefsDialogWidColor *todoDueTodayColor = | 877 | KPrefsDialogWidColor *todoDueTodayColor = |
878 | addWidColor(i18n("Todo due today color:"), | 878 | addWidColor(i18n("Todo due today color:"), |
879 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 879 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
880 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 880 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
881 | widLayout->addWidget( todoDueTodayColor->label() ); | 881 | widLayout->addWidget( todoDueTodayColor->label() ); |
882 | widLayout->addWidget( todoDueTodayColor->button() ); | 882 | widLayout->addWidget( todoDueTodayColor->button() ); |
883 | topLayout->addWidget(wid,ii++,0); | 883 | topLayout->addWidget(wid,ii++,0); |
884 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 884 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
885 | 885 | ||
886 | // Todo overdue color | 886 | // Todo overdue color |
887 | wid = new QWidget( topFrame ); | 887 | wid = new QWidget( topFrame ); |
888 | widLayout = new QHBoxLayout(wid); | 888 | widLayout = new QHBoxLayout(wid); |
889 | KPrefsDialogWidColor *todoOverdueColor = | 889 | KPrefsDialogWidColor *todoOverdueColor = |
890 | addWidColor(i18n("Todo overdue color:"), | 890 | addWidColor(i18n("Todo overdue color:"), |
891 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 891 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
892 | widLayout->addWidget(todoOverdueColor->label()); | 892 | widLayout->addWidget(todoOverdueColor->label()); |
893 | widLayout->addWidget(todoOverdueColor->button()); | 893 | widLayout->addWidget(todoOverdueColor->button()); |
894 | topLayout->addWidget(wid,ii++,0); | 894 | topLayout->addWidget(wid,ii++,0); |
895 | 895 | ||
896 | dummy = | 896 | dummy = |
897 | addWidBool(i18n("Colors are applied to text"), | 897 | addWidBool(i18n("Colors are applied to text"), |
898 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 898 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
899 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 899 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
900 | 900 | ||
901 | dummy = | 901 | dummy = |
902 | addWidBool(i18n("Allday Agenda view shows todos"), | 902 | addWidBool(i18n("Allday Agenda view shows todos"), |
903 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 903 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
904 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 904 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
905 | 905 | ||
906 | 906 | ||
907 | topFrame = addPage(i18n("View Options"),0,0); | ||
908 | |||
909 | topLayout = new QGridLayout(topFrame,4,1); | ||
910 | topLayout->setSpacing(spacingHint()); | ||
911 | topLayout->setMargin(marginHint()); | ||
912 | ii = 0; | ||
913 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | ||
914 | topLayout->addWidget(lab ,ii++,0); | ||
915 | |||
916 | dummy = addWidBool(i18n("Details"), | ||
917 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | ||
918 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
919 | dummy = addWidBool(i18n("Created time"), | ||
920 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | ||
921 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
922 | dummy = addWidBool(i18n("Last modified time"), | ||
923 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | ||
924 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
925 | |||
926 | |||
927 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | ||
928 | topLayout->addWidget(lab ,ii++,0); | ||
929 | |||
930 | dummy = addWidBool(i18n("Details"), | ||
931 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | ||
932 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
933 | dummy = addWidBool(i18n("Created time"), | ||
934 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | ||
935 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
936 | dummy = addWidBool(i18n("Last modified time"), | ||
937 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | ||
938 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
907 | 939 | ||
908 | 940 | ||
909 | topFrame = addPage(i18n("Alarm"),0,0); | 941 | topFrame = addPage(i18n("Alarm"),0,0); |
910 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 942 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
911 | 943 | ||
912 | topLayout = new QGridLayout(topFrame,2,1); | 944 | topLayout = new QGridLayout(topFrame,2,1); |
913 | topLayout->setSpacing(spacingHint()); | 945 | topLayout->setSpacing(spacingHint()); |
914 | topLayout->setMargin(marginHint()); | 946 | topLayout->setMargin(marginHint()); |
915 | int iii = 0; | 947 | int iii = 0; |
916 | 948 | ||
917 | dummy = | 949 | dummy = |
918 | addWidBool(i18n("Use internal alarm notification"), | 950 | addWidBool(i18n("Use internal alarm notification"), |
919 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 951 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
920 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 952 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
921 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 953 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
922 | 954 | ||
923 | topLayout->addWidget(lab ,iii++,0); | 955 | topLayout->addWidget(lab ,iii++,0); |
924 | #ifndef DESKTOP_VERSION | 956 | #ifndef DESKTOP_VERSION |
925 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 957 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
926 | #else | 958 | #else |
927 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 959 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
928 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 960 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
929 | #endif | 961 | #endif |
930 | 962 | ||
931 | QHBox* dummyBox = new QHBox(topFrame); | 963 | QHBox* dummyBox = new QHBox(topFrame); |
932 | new QLabel(i18n("Play beeps count:"),dummyBox); | 964 | new QLabel(i18n("Play beeps count:"),dummyBox); |
933 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 965 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
934 | topLayout->addWidget(dummyBox,iii++,0); | 966 | topLayout->addWidget(dummyBox,iii++,0); |
935 | 967 | ||
936 | dummyBox = new QHBox(topFrame); | 968 | dummyBox = new QHBox(topFrame); |
937 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 969 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
938 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 970 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
939 | topLayout->addWidget(dummyBox,iii++,0); | 971 | topLayout->addWidget(dummyBox,iii++,0); |
940 | 972 | ||
941 | dummyBox = new QHBox(topFrame); | 973 | dummyBox = new QHBox(topFrame); |
942 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 974 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
943 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 975 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
944 | topLayout->addWidget(dummyBox,iii++,0); | 976 | topLayout->addWidget(dummyBox,iii++,0); |
945 | 977 | ||
946 | dummyBox = new QHBox(topFrame); | 978 | dummyBox = new QHBox(topFrame); |
947 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 979 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
948 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 980 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
949 | topLayout->addWidget(dummyBox,iii++,0); | 981 | topLayout->addWidget(dummyBox,iii++,0); |
950 | 982 | ||
951 | 983 | ||
952 | 984 | ||
953 | 985 | ||
954 | 986 | ||
955 | 987 | ||
956 | 988 | ||
957 | QHBox* hbo = new QHBox ( topFrame ); | 989 | QHBox* hbo = new QHBox ( topFrame ); |
958 | mDefaultAlarmFile = new QLineEdit(hbo); | 990 | mDefaultAlarmFile = new QLineEdit(hbo); |
959 | QPushButton * loadTemplate = new QPushButton(hbo); | 991 | QPushButton * loadTemplate = new QPushButton(hbo); |
960 | QPixmap icon; | 992 | QPixmap icon; |
961 | if ( QApplication::desktop()->width() < 321 ) | 993 | if ( QApplication::desktop()->width() < 321 ) |
962 | icon = SmallIcon("fileimport16"); | 994 | icon = SmallIcon("fileimport16"); |
963 | else | 995 | else |
964 | icon = SmallIcon("fileimport"); | 996 | icon = SmallIcon("fileimport"); |
965 | loadTemplate->setIconSet (icon ) ; | 997 | loadTemplate->setIconSet (icon ) ; |
966 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 998 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
967 | int size = loadTemplate->sizeHint().height(); | 999 | int size = loadTemplate->sizeHint().height(); |
968 | loadTemplate->setFixedSize( size, size ); | 1000 | loadTemplate->setFixedSize( size, size ); |
969 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1001 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
970 | // topLayout->addWidget(lab ,iii++,0); | 1002 | // topLayout->addWidget(lab ,iii++,0); |
971 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1003 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
972 | topLayout->addWidget(lab ,iii++,0); | 1004 | topLayout->addWidget(lab ,iii++,0); |
973 | topLayout->addWidget(hbo,iii++,0); | 1005 | topLayout->addWidget(hbo,iii++,0); |
974 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 1006 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
975 | 1007 | ||
976 | // topLayout->addWidget(lab ,iii++,0); | 1008 | // topLayout->addWidget(lab ,iii++,0); |
977 | // #ifndef DESKTOP_VERSION | 1009 | // #ifndef DESKTOP_VERSION |
978 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1010 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
979 | // #else | 1011 | // #else |
980 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1012 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
981 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1013 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
982 | // #endif | 1014 | // #endif |
983 | 1015 | ||
984 | 1016 | ||
985 | } | 1017 | } |
986 | 1018 | ||
987 | void KOPrefsDialog::selectSoundFile() | 1019 | void KOPrefsDialog::selectSoundFile() |
988 | { | 1020 | { |
989 | QString fileName = mDefaultAlarmFile->text(); | 1021 | QString fileName = mDefaultAlarmFile->text(); |
990 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1022 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
991 | if ( fileName.length() > 0 ) | 1023 | if ( fileName.length() > 0 ) |
992 | mDefaultAlarmFile->setText( fileName ); | 1024 | mDefaultAlarmFile->setText( fileName ); |
993 | } | 1025 | } |
994 | void KOPrefsDialog::setupFontsTab() | 1026 | void KOPrefsDialog::setupFontsTab() |
995 | { | 1027 | { |
996 | 1028 | ||
997 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1029 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
998 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1030 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
999 | 1031 | ||
1000 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1032 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1001 | topLayout->setSpacing(1); | 1033 | topLayout->setSpacing(1); |
1002 | topLayout->setMargin(3); | 1034 | topLayout->setMargin(3); |
1003 | KPrefsDialogWidFont * tVFont; | 1035 | KPrefsDialogWidFont * tVFont; |
1004 | int i = 0; | 1036 | int i = 0; |
1005 | KPrefsDialogWidFont *timeLabelsFont = | 1037 | KPrefsDialogWidFont *timeLabelsFont = |
1006 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1038 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1007 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1039 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1008 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1040 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1009 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1041 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1010 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1042 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1011 | ++i; | 1043 | ++i; |
1012 | 1044 | ||
1013 | 1045 | ||
1014 | timeLabelsFont = | 1046 | timeLabelsFont = |
1015 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1047 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1016 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1048 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1017 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1049 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1018 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1050 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1019 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1051 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1020 | ++i; | 1052 | ++i; |
1021 | 1053 | ||
1022 | KPrefsDialogWidFont *timeBarFont = | 1054 | KPrefsDialogWidFont *timeBarFont = |
1023 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1055 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1024 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1056 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1025 | topLayout->addWidget(timeBarFont->label(),i,0); | 1057 | topLayout->addWidget(timeBarFont->label(),i,0); |
1026 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1058 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1027 | topLayout->addWidget(timeBarFont->button(),i,2); | 1059 | topLayout->addWidget(timeBarFont->button(),i,2); |
1028 | ++i; | 1060 | ++i; |
1029 | 1061 | ||
1030 | 1062 | ||
1031 | KPrefsDialogWidFont *marcusBainsFont = | 1063 | KPrefsDialogWidFont *marcusBainsFont = |
1032 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1064 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1033 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1065 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1034 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1066 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1035 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1067 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1036 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1068 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1037 | ++i; | 1069 | ++i; |
1038 | 1070 | ||
1039 | tVFont = | 1071 | tVFont = |
1040 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1072 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1041 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1073 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1042 | topLayout->addWidget(tVFont->label(),i,0); | 1074 | topLayout->addWidget(tVFont->label(),i,0); |
1043 | topLayout->addWidget(tVFont->preview(),i,1); | 1075 | topLayout->addWidget(tVFont->preview(),i,1); |
1044 | topLayout->addWidget(tVFont->button(),i,2); | 1076 | topLayout->addWidget(tVFont->button(),i,2); |
1045 | ++i; | 1077 | ++i; |
1046 | 1078 | ||
1047 | 1079 | ||
1048 | 1080 | ||
1049 | tVFont = | 1081 | tVFont = |
1050 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1082 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1051 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1083 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1052 | topLayout->addWidget(tVFont->label(),i,0); | 1084 | topLayout->addWidget(tVFont->label(),i,0); |
1053 | topLayout->addWidget(tVFont->preview(),i,1); | 1085 | topLayout->addWidget(tVFont->preview(),i,1); |
1054 | topLayout->addWidget(tVFont->button(),i,2); | 1086 | topLayout->addWidget(tVFont->button(),i,2); |
1055 | ++i; | 1087 | ++i; |
1056 | 1088 | ||
1057 | 1089 | ||
1058 | 1090 | ||
1059 | topLayout->setColStretch(1,1); | 1091 | topLayout->setColStretch(1,1); |
1060 | topLayout->setRowStretch(4,1); | 1092 | topLayout->setRowStretch(4,1); |
1061 | 1093 | ||
1062 | 1094 | ||
1063 | i = 0; | 1095 | i = 0; |
1064 | topFrame = addPage(i18n("View Fonts"),0, | 1096 | topFrame = addPage(i18n("View Fonts"),0, |
1065 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1097 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1066 | 1098 | ||
1067 | topLayout = new QGridLayout(topFrame,7,3); | 1099 | topLayout = new QGridLayout(topFrame,7,3); |
1068 | topLayout->setSpacing(1); | 1100 | topLayout->setSpacing(1); |
1069 | topLayout->setMargin(3); | 1101 | topLayout->setMargin(3); |
1070 | 1102 | ||
1071 | tVFont = | 1103 | tVFont = |
1072 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1104 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1073 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1105 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1074 | topLayout->addWidget(tVFont->label(),i,0); | 1106 | topLayout->addWidget(tVFont->label(),i,0); |
1075 | topLayout->addWidget(tVFont->preview(),i,1); | 1107 | topLayout->addWidget(tVFont->preview(),i,1); |
1076 | topLayout->addWidget(tVFont->button(),i,2); | 1108 | topLayout->addWidget(tVFont->button(),i,2); |
1077 | ++i; | 1109 | ++i; |
1078 | KPrefsDialogWidFont *agendaViewFont = | 1110 | KPrefsDialogWidFont *agendaViewFont = |
1079 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1111 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1080 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1112 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1081 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1113 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1082 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1114 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1083 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1115 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1084 | ++i; | 1116 | ++i; |
1085 | 1117 | ||
1086 | 1118 | ||
1087 | KPrefsDialogWidFont *monthViewFont = | 1119 | KPrefsDialogWidFont *monthViewFont = |
1088 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1120 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1089 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1121 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1090 | topLayout->addWidget(monthViewFont->label(),i,0); | 1122 | topLayout->addWidget(monthViewFont->label(),i,0); |
1091 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1123 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1092 | topLayout->addWidget(monthViewFont->button(),i,2); | 1124 | topLayout->addWidget(monthViewFont->button(),i,2); |
1093 | ++i; | 1125 | ++i; |
1094 | 1126 | ||
1095 | 1127 | ||
1096 | KPrefsDialogWidFont *lVFont = | 1128 | KPrefsDialogWidFont *lVFont = |
1097 | addWidFont(i18n("Event"),i18n("List View:"), | 1129 | addWidFont(i18n("Event"),i18n("List View:"), |
1098 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1130 | &(KOPrefs::instance()->mListViewFont),topFrame); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3011458..3483e95 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -367,385 +367,388 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
367 | 367 | ||
368 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 368 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
369 | 369 | ||
370 | mTodoListView = new KOTodoListView(calendar,this, name ); | 370 | mTodoListView = new KOTodoListView(calendar,this, name ); |
371 | topLayout->addWidget(mTodoListView); | 371 | topLayout->addWidget(mTodoListView); |
372 | //mTodoListView->header()->setMaximumHeight(30); | 372 | //mTodoListView->header()->setMaximumHeight(30); |
373 | mTodoListView->setRootIsDecorated(true); | 373 | mTodoListView->setRootIsDecorated(true); |
374 | mTodoListView->setAllColumnsShowFocus(true); | 374 | mTodoListView->setAllColumnsShowFocus(true); |
375 | 375 | ||
376 | mTodoListView->setShowSortIndicator(true); | 376 | mTodoListView->setShowSortIndicator(true); |
377 | 377 | ||
378 | mTodoListView->addColumn(i18n("Todo")); | 378 | mTodoListView->addColumn(i18n("Todo")); |
379 | mTodoListView->addColumn(i18n("Prio")); | 379 | mTodoListView->addColumn(i18n("Prio")); |
380 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 380 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
381 | mTodoListView->addColumn(i18n("Complete")); | 381 | mTodoListView->addColumn(i18n("Complete")); |
382 | mTodoListView->setColumnAlignment(2,AlignCenter); | 382 | mTodoListView->setColumnAlignment(2,AlignCenter); |
383 | 383 | ||
384 | mTodoListView->addColumn(i18n("Due Date")); | 384 | mTodoListView->addColumn(i18n("Due Date")); |
385 | mTodoListView->setColumnAlignment(3,AlignLeft); | 385 | mTodoListView->setColumnAlignment(3,AlignLeft); |
386 | mTodoListView->addColumn(i18n("Due Time")); | 386 | mTodoListView->addColumn(i18n("Due Time")); |
387 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 387 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
388 | 388 | ||
389 | mTodoListView->addColumn(i18n("Start Date")); | 389 | mTodoListView->addColumn(i18n("Start Date")); |
390 | mTodoListView->setColumnAlignment(5,AlignLeft); | 390 | mTodoListView->setColumnAlignment(5,AlignLeft); |
391 | mTodoListView->addColumn(i18n("Start Time")); | 391 | mTodoListView->addColumn(i18n("Start Time")); |
392 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 392 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
393 | 393 | ||
394 | mTodoListView->addColumn(i18n("Cancelled")); | 394 | mTodoListView->addColumn(i18n("Cancelled")); |
395 | mTodoListView->addColumn(i18n("Categories")); | 395 | mTodoListView->addColumn(i18n("Categories")); |
396 | #if 0 | 396 | #if 0 |
397 | mTodoListView->addColumn(i18n("Sort Id")); | 397 | mTodoListView->addColumn(i18n("Sort Id")); |
398 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 398 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | mTodoListView->setMinimumHeight( 60 ); | 401 | mTodoListView->setMinimumHeight( 60 ); |
402 | mTodoListView->setItemsRenameable( true ); | 402 | mTodoListView->setItemsRenameable( true ); |
403 | mTodoListView->setRenameable( 0 ); | 403 | mTodoListView->setRenameable( 0 ); |
404 | mTodoListView->setColumnWidth( 0, 120 ); | 404 | mTodoListView->setColumnWidth( 0, 120 ); |
405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 405 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 406 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 407 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 408 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 409 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 410 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 411 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 412 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 413 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
414 | 414 | ||
415 | 415 | ||
416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 416 | new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
417 | 417 | ||
418 | mPriorityPopupMenu = new QPopupMenu(this); | 418 | mPriorityPopupMenu = new QPopupMenu(this); |
419 | for (int i = 1; i <= 5; i++) { | 419 | for (int i = 1; i <= 5; i++) { |
420 | QString label = QString ("%1").arg (i); | 420 | QString label = QString ("%1").arg (i); |
421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 421 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
422 | } | 422 | } |
423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 423 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
424 | 424 | ||
425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 425 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
426 | for (int i = 0; i <= 100; i+=20) { | 426 | for (int i = 0; i <= 100; i+=20) { |
427 | QString label = QString ("%1 %").arg (i); | 427 | QString label = QString ("%1 %").arg (i); |
428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 428 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
429 | } | 429 | } |
430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 430 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
431 | 431 | ||
432 | 432 | ||
433 | 433 | ||
434 | mItemPopupMenu = new QPopupMenu(this); | 434 | mItemPopupMenu = new QPopupMenu(this); |
435 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 435 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
436 | SLOT (showTodo())); | 436 | SLOT (showTodo())); |
437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 437 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
438 | SLOT (editTodo())); | 438 | SLOT (editTodo())); |
439 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 439 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
440 | SLOT (deleteTodo())); | 440 | SLOT (deleteTodo())); |
441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 441 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
442 | SLOT (cloneTodo())); | 442 | SLOT (cloneTodo())); |
443 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 443 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
444 | SLOT (moveTodo())); | 444 | SLOT (moveTodo())); |
445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 445 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
446 | SLOT (beamTodo())); | 446 | SLOT (beamTodo())); |
447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 447 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
448 | SLOT (cancelTodo())); | 448 | SLOT (cancelTodo())); |
449 | mItemPopupMenu->insertSeparator(); | 449 | mItemPopupMenu->insertSeparator(); |
450 | 450 | ||
451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 451 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
452 | SLOT (newTodo())); | 452 | SLOT (newTodo())); |
453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 453 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
454 | SLOT (newSubTodo())); | 454 | SLOT (newSubTodo())); |
455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 455 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
456 | SLOT (unparentTodo()),0,21); | 456 | SLOT (unparentTodo()),0,21); |
457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 457 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
458 | SLOT (reparentTodo()),0,22); | 458 | SLOT (reparentTodo()),0,22); |
459 | mItemPopupMenu->insertSeparator(); | 459 | mItemPopupMenu->insertSeparator(); |
460 | #if 0 | 460 | #if 0 |
461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 461 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
462 | this, SLOT( purgeCompleted() ) ); | 462 | this, SLOT( purgeCompleted() ) ); |
463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
464 | this, SLOT( toggleCompleted() ),0, 33 ); | 464 | this, SLOT( toggleCompleted() ),0, 33 ); |
465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
466 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 466 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
468 | this, SLOT( toggleRunning() ),0, 35 ); | 468 | this, SLOT( toggleRunning() ),0, 35 ); |
469 | 469 | ||
470 | #endif | 470 | #endif |
471 | mPopupMenu = new QPopupMenu(this); | 471 | mPopupMenu = new QPopupMenu(this); |
472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
473 | SLOT (newTodo()),0,1); | 473 | SLOT (newTodo()),0,1); |
474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
475 | this, SLOT(purgeCompleted()),0,2); | 475 | this, SLOT(purgeCompleted()),0,2); |
476 | mPopupMenu->insertItem(i18n("Show Completed"), | 476 | mPopupMenu->insertItem(i18n("Show Completed"), |
477 | this, SLOT( toggleCompleted() ),0,3 ); | 477 | this, SLOT( toggleCompleted() ),0,3 ); |
478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
479 | this, SLOT( toggleQuickTodo() ),0,4 ); | 479 | this, SLOT( toggleQuickTodo() ),0,4 ); |
480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
481 | this, SLOT( toggleRunning() ),0,5 ); | 481 | this, SLOT( toggleRunning() ),0,5 ); |
482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
483 | this, SLOT( setAllOpen() ),0,6 ); | 483 | this, SLOT( setAllOpen() ),0,6 ); |
484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
485 | this, SLOT( setAllClose() ),0,7 ); | 485 | this, SLOT( setAllClose() ),0,7 ); |
486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
487 | this, SLOT( setAllFlat() ),0,8 ); | 487 | this, SLOT( setAllFlat() ),0,8 ); |
488 | mDocPrefs = new DocPrefs( name ); | 488 | mDocPrefs = new DocPrefs( name ); |
489 | 489 | ||
490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
491 | mPopupMenu->setCheckable( true ); | 491 | mPopupMenu->setCheckable( true ); |
492 | mItemPopupMenu->setCheckable( true ); | 492 | mItemPopupMenu->setCheckable( true ); |
493 | 493 | ||
494 | 494 | ||
495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
497 | 497 | ||
498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
500 | 500 | ||
501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
503 | 503 | ||
504 | 504 | ||
505 | // Double clicking conflicts with opening/closing the subtree | 505 | // Double clicking conflicts with opening/closing the subtree |
506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
507 | SLOT( editItem( QListViewItem *) ) ); | 507 | SLOT( editItem( QListViewItem *) ) ); |
508 | /* | 508 | /* |
509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
510 | const QPoint &,int ) ), | 510 | const QPoint &,int ) ), |
511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
512 | */ | 512 | */ |
513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
514 | const QPoint &,int ) ), | 514 | const QPoint &,int ) ), |
515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
517 | SLOT( itemClicked( QListViewItem * ) ) ); | 517 | SLOT( itemClicked( QListViewItem * ) ) ); |
518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
521 | SLOT( updateView() ) ); | 521 | SLOT( updateView() ) ); |
522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
523 | SLOT( todoModified(Todo *, int) ) ); | 523 | SLOT( todoModified(Todo *, int) ) ); |
524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
525 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 525 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
527 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 527 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
528 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 528 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
529 | SLOT( paintNeeded()) ); | 529 | SLOT( paintNeeded()) ); |
530 | 530 | ||
531 | #if 0 | 531 | #if 0 |
532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
533 | SLOT(selectionChanged(QListViewItem *))); | 533 | SLOT(selectionChanged(QListViewItem *))); |
534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
535 | SLOT(selectionChanged(QListViewItem *))); | 535 | SLOT(selectionChanged(QListViewItem *))); |
536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
537 | SLOT(selectionChanged(QListViewItem *))); | 537 | SLOT(selectionChanged(QListViewItem *))); |
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
543 | 543 | ||
544 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 544 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
545 | SLOT( processSelectionChange() ) ); | 545 | SLOT( processSelectionChange() ) ); |
546 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 546 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
547 | SLOT( addQuickTodo() ) ); | 547 | SLOT( addQuickTodo() ) ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | KOTodoView::~KOTodoView() | 551 | KOTodoView::~KOTodoView() |
552 | { | 552 | { |
553 | delete mDocPrefs; | 553 | delete mDocPrefs; |
554 | } | 554 | } |
555 | QString KOTodoView::getWhatsThisText(QPoint p) | 555 | QString KOTodoView::getWhatsThisText(QPoint p) |
556 | { | 556 | { |
557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
558 | if ( item ) | 558 | if ( item ) |
559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo() ); | 559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
560 | KOPrefs::instance()->mWTshowDetails, | ||
561 | KOPrefs::instance()->mWTshowCreated, | ||
562 | KOPrefs::instance()->mWTshowChanged); | ||
560 | return i18n("That is the todo view" ); | 563 | return i18n("That is the todo view" ); |
561 | 564 | ||
562 | } | 565 | } |
563 | 566 | ||
564 | void KOTodoView::jumpToDate () | 567 | void KOTodoView::jumpToDate () |
565 | { | 568 | { |
566 | // if (mActiveItem) { | 569 | // if (mActiveItem) { |
567 | // mActiveItem->todo()); | 570 | // mActiveItem->todo()); |
568 | // if ( mActiveItem->todo()->hasDueDate() ) | 571 | // if ( mActiveItem->todo()->hasDueDate() ) |
569 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
570 | } | 573 | } |
571 | void KOTodoView::paintNeeded() | 574 | void KOTodoView::paintNeeded() |
572 | { | 575 | { |
573 | if ( mPendingUpdateBeforeRepaint ) { | 576 | if ( mPendingUpdateBeforeRepaint ) { |
574 | updateView(); | 577 | updateView(); |
575 | mPendingUpdateBeforeRepaint = false; | 578 | mPendingUpdateBeforeRepaint = false; |
576 | } | 579 | } |
577 | } | 580 | } |
578 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 581 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
579 | { | 582 | { |
580 | if ( mPendingUpdateBeforeRepaint ) { | 583 | if ( mPendingUpdateBeforeRepaint ) { |
581 | updateView(); | 584 | updateView(); |
582 | mPendingUpdateBeforeRepaint = false; | 585 | mPendingUpdateBeforeRepaint = false; |
583 | } | 586 | } |
584 | KOrg::BaseView::paintEvent( pevent); | 587 | KOrg::BaseView::paintEvent( pevent); |
585 | } | 588 | } |
586 | 589 | ||
587 | void KOTodoView::updateView() | 590 | void KOTodoView::updateView() |
588 | { | 591 | { |
589 | pendingSubtodo = 0; | 592 | pendingSubtodo = 0; |
590 | if ( mBlockUpdate ) { | 593 | if ( mBlockUpdate ) { |
591 | return; | 594 | return; |
592 | } | 595 | } |
593 | if ( !isVisible() ) { | 596 | if ( !isVisible() ) { |
594 | mPendingUpdateBeforeRepaint = true; | 597 | mPendingUpdateBeforeRepaint = true; |
595 | return; | 598 | return; |
596 | } | 599 | } |
597 | //qDebug("KOTodoView::updateView() %x", this); | 600 | //qDebug("KOTodoView::updateView() %x", this); |
598 | if ( isFlatDisplay ) { | 601 | if ( isFlatDisplay ) { |
599 | displayAllFlat(); | 602 | displayAllFlat(); |
600 | return; | 603 | return; |
601 | } | 604 | } |
602 | //qDebug("update "); | 605 | //qDebug("update "); |
603 | // kdDebug() << "KOTodoView::updateView()" << endl; | 606 | // kdDebug() << "KOTodoView::updateView()" << endl; |
604 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 607 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
605 | mTodoListView->clear(); | 608 | mTodoListView->clear(); |
606 | if ( mName == "todolistsmall" ) { | 609 | if ( mName == "todolistsmall" ) { |
607 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 610 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
608 | int ps = fo.pointSize() -2; | 611 | int ps = fo.pointSize() -2; |
609 | if ( ps > 12 ) | 612 | if ( ps > 12 ) |
610 | ps -= 2; | 613 | ps -= 2; |
611 | fo.setPointSize( ps ); | 614 | fo.setPointSize( ps ); |
612 | } | 615 | } |
613 | } | 616 | } |
614 | 617 | ||
615 | mTodoListView->setFont( fo ); | 618 | mTodoListView->setFont( fo ); |
616 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 619 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
617 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 620 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
618 | QPtrList<Todo> todoList = calendar()->todos(); | 621 | QPtrList<Todo> todoList = calendar()->todos(); |
619 | 622 | ||
620 | /* | 623 | /* |
621 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 624 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
622 | Event *t; | 625 | Event *t; |
623 | for(t = todoList.first(); t; t = todoList.next()) { | 626 | for(t = todoList.first(); t; t = todoList.next()) { |
624 | kdDebug() << " " << t->getSummary() << endl; | 627 | kdDebug() << " " << t->getSummary() << endl; |
625 | 628 | ||
626 | if (t->getRelatedTo()) { | 629 | if (t->getRelatedTo()) { |
627 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 630 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
628 | } | 631 | } |
629 | 632 | ||
630 | QPtrList<Event> l = t->getRelations(); | 633 | QPtrList<Event> l = t->getRelations(); |
631 | Event *c; | 634 | Event *c; |
632 | for(c=l.first();c;c=l.next()) { | 635 | for(c=l.first();c;c=l.next()) { |
633 | kdDebug() << " - relation: " << c->getSummary() << endl; | 636 | kdDebug() << " - relation: " << c->getSummary() << endl; |
634 | } | 637 | } |
635 | } | 638 | } |
636 | */ | 639 | */ |
637 | 640 | ||
638 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 641 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
639 | // specific order of events. That means that we have to generate parent items | 642 | // specific order of events. That means that we have to generate parent items |
640 | // recursively for proper hierarchical display of Todos. | 643 | // recursively for proper hierarchical display of Todos. |
641 | mTodoMap.clear(); | 644 | mTodoMap.clear(); |
642 | Todo *todo; | 645 | Todo *todo; |
643 | todo = todoList.first();// todo; todo = todoList.next()) { | 646 | todo = todoList.first();// todo; todo = todoList.next()) { |
644 | while ( todo ) { | 647 | while ( todo ) { |
645 | bool next = true; | 648 | bool next = true; |
646 | // qDebug("todo %s ", todo->summary().latin1()); | 649 | // qDebug("todo %s ", todo->summary().latin1()); |
647 | Incidence *incidence = todo->relatedTo(); | 650 | Incidence *incidence = todo->relatedTo(); |
648 | while ( incidence ) { | 651 | while ( incidence ) { |
649 | if ( incidence->type() == "Todo") { | 652 | if ( incidence->type() == "Todo") { |
650 | //qDebug("related %s ",incidence->summary().latin1() ); | 653 | //qDebug("related %s ",incidence->summary().latin1() ); |
651 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 654 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
652 | //qDebug("related not found "); | 655 | //qDebug("related not found "); |
653 | todoList.remove( ); | 656 | todoList.remove( ); |
654 | todo = todoList.current(); | 657 | todo = todoList.current(); |
655 | next = false; | 658 | next = false; |
656 | incidence = 0; | 659 | incidence = 0; |
657 | 660 | ||
658 | } else { | 661 | } else { |
659 | //qDebug("related found "); | 662 | //qDebug("related found "); |
660 | incidence = incidence->relatedTo(); | 663 | incidence = incidence->relatedTo(); |
661 | } | 664 | } |
662 | } else | 665 | } else |
663 | incidence = 0; | 666 | incidence = 0; |
664 | } | 667 | } |
665 | if ( next ) | 668 | if ( next ) |
666 | todo = todoList.next(); | 669 | todo = todoList.next(); |
667 | } | 670 | } |
668 | // qDebug("again .... "); | 671 | // qDebug("again .... "); |
669 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 672 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
670 | 673 | ||
671 | // qDebug("yytodo %s ", todo->summary().latin1()); | 674 | // qDebug("yytodo %s ", todo->summary().latin1()); |
672 | // } | 675 | // } |
673 | //qDebug("for "); | 676 | //qDebug("for "); |
674 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 677 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
675 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) | 678 | if (!mTodoMap.contains(todo) && checkTodo( todo ) ) |
676 | { | 679 | { |
677 | insertTodoItem(todo); | 680 | insertTodoItem(todo); |
678 | } | 681 | } |
679 | } | 682 | } |
680 | //qDebug("for end "); | 683 | //qDebug("for end "); |
681 | // Restore opened/closed state | 684 | // Restore opened/closed state |
682 | mTodoListView->blockSignals( true ); | 685 | mTodoListView->blockSignals( true ); |
683 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 686 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
684 | mTodoListView->blockSignals( false ); | 687 | mTodoListView->blockSignals( false ); |
685 | mTodoListView->setFocus(); | 688 | mTodoListView->setFocus(); |
686 | processSelectionChange(); | 689 | processSelectionChange(); |
687 | } | 690 | } |
688 | 691 | ||
689 | bool KOTodoView::checkTodo( Todo * todo ) | 692 | bool KOTodoView::checkTodo( Todo * todo ) |
690 | { | 693 | { |
691 | 694 | ||
692 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) | 695 | if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) |
693 | return false; | 696 | return false; |
694 | if ( !todo->isCompleted() ) { | 697 | if ( !todo->isCompleted() ) { |
695 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) | 698 | if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) |
696 | return true; | 699 | return true; |
697 | } | 700 | } |
698 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { | 701 | if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { |
699 | if ( todo->hasStartDate() ) | 702 | if ( todo->hasStartDate() ) |
700 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) | 703 | if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) |
701 | return false; | 704 | return false; |
702 | if ( todo->hasDueDate() ) | 705 | if ( todo->hasDueDate() ) |
703 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) | 706 | if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) |
704 | return false; | 707 | return false; |
705 | } | 708 | } |
706 | return true; | 709 | return true; |
707 | } | 710 | } |
708 | 711 | ||
709 | void KOTodoView::restoreItemState( QListViewItem *item ) | 712 | void KOTodoView::restoreItemState( QListViewItem *item ) |
710 | { | 713 | { |
711 | pendingSubtodo = 0; | 714 | pendingSubtodo = 0; |
712 | while( item ) { | 715 | while( item ) { |
713 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 716 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
714 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 717 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
715 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 718 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
716 | item = item->nextSibling(); | 719 | item = item->nextSibling(); |
717 | } | 720 | } |
718 | } | 721 | } |
719 | 722 | ||
720 | 723 | ||
721 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 724 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
722 | KOTodoView::insertTodoItem(Todo *todo) | 725 | KOTodoView::insertTodoItem(Todo *todo) |
723 | { | 726 | { |
724 | 727 | ||
725 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 728 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
726 | // TODO: Check, if dynmaic cast is necessary | 729 | // TODO: Check, if dynmaic cast is necessary |
727 | 730 | ||
728 | pendingSubtodo = 0; | 731 | pendingSubtodo = 0; |
729 | Incidence *incidence = todo->relatedTo(); | 732 | Incidence *incidence = todo->relatedTo(); |
730 | if (incidence && incidence->type() == "Todo") { | 733 | if (incidence && incidence->type() == "Todo") { |
731 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 734 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
732 | 735 | ||
733 | // kdDebug() << " has Related" << endl; | 736 | // kdDebug() << " has Related" << endl; |
734 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 737 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
735 | itemIterator = mTodoMap.find(relatedTodo); | 738 | itemIterator = mTodoMap.find(relatedTodo); |
736 | if (itemIterator == mTodoMap.end()) { | 739 | if (itemIterator == mTodoMap.end()) { |
737 | // kdDebug() << " related not yet in list" << endl; | 740 | // kdDebug() << " related not yet in list" << endl; |
738 | itemIterator = insertTodoItem (relatedTodo); | 741 | itemIterator = insertTodoItem (relatedTodo); |
739 | } | 742 | } |
740 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 743 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
741 | // and one into the map. Sure finding is more easy but why? -zecke | 744 | // and one into the map. Sure finding is more easy but why? -zecke |
742 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 745 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
743 | return mTodoMap.insert(todo,todoItem); | 746 | return mTodoMap.insert(todo,todoItem); |
744 | } else { | 747 | } else { |
745 | // kdDebug() << " no Related" << endl; | 748 | // kdDebug() << " no Related" << endl; |
746 | // see above -zecke | 749 | // see above -zecke |
747 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 750 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
748 | return mTodoMap.insert(todo,todoItem); | 751 | return mTodoMap.insert(todo,todoItem); |
749 | } | 752 | } |
750 | } | 753 | } |
751 | 754 | ||