-rw-r--r-- | korganizer/kodaymatrix.cpp | 5 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 4 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 493382d..a776cb6 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -106,199 +106,200 @@ KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) | |||
106 | : QFrame( parent, name ), mCalendar( 0 ) | 106 | : QFrame( parent, name ), mCalendar( 0 ) |
107 | 107 | ||
108 | #if 0 | 108 | #if 0 |
109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
110 | QFrame(parent, name) | 110 | QFrame(parent, name) |
111 | #endif | 111 | #endif |
112 | { | 112 | { |
113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); | 113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
114 | mPendingUpdateBeforeRepaint = false; | 114 | mPendingUpdateBeforeRepaint = false; |
115 | mouseDown = false; | 115 | mouseDown = false; |
116 | // initialize dynamic arrays | 116 | // initialize dynamic arrays |
117 | bDays.resize ( NUMDAYS ); | 117 | bDays.resize ( NUMDAYS ); |
118 | days = new QDate[NUMDAYS]; | 118 | days = new QDate[NUMDAYS]; |
119 | daylbls = new QString[NUMDAYS]; | 119 | daylbls = new QString[NUMDAYS]; |
120 | events = new int[NUMDAYS]; | 120 | events = new int[NUMDAYS]; |
121 | mToolTip = new DynamicTip(this); | 121 | mToolTip = new DynamicTip(this); |
122 | 122 | ||
123 | // set default values used for drawing the matrix | 123 | // set default values used for drawing the matrix |
124 | mDefaultBackColor = palette().active().base(); | 124 | mDefaultBackColor = palette().active().base(); |
125 | mDefaultTextColor = palette().active().foreground(); | 125 | mDefaultTextColor = palette().active().foreground(); |
126 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 126 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
127 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 127 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
128 | mSelectedDaysColor = QColor("white"); | 128 | mSelectedDaysColor = QColor("white"); |
129 | mTodayMarginWidth = 2; | 129 | mTodayMarginWidth = 2; |
130 | mSelEnd = mSelStart = NOSELECTION; | 130 | mSelEnd = mSelStart = NOSELECTION; |
131 | 131 | ||
132 | setAcceptDrops(true); | 132 | setAcceptDrops(true); |
133 | //setFont( QFont("Arial", 10) ); | 133 | //setFont( QFont("Arial", 10) ); |
134 | 134 | ||
135 | mUpdateTimer = new QTimer( this ); | 135 | mUpdateTimer = new QTimer( this ); |
136 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 136 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
137 | mRepaintTimer = new QTimer( this ); | 137 | mRepaintTimer = new QTimer( this ); |
138 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 138 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
139 | mDayChanged = false; | 139 | mDayChanged = false; |
140 | updateView(); | 140 | updateView(); |
141 | } | 141 | } |
142 | QString KODayMatrix::getWhatsThisText( QPoint p ) | 142 | QString KODayMatrix::getWhatsThisText( QPoint p ) |
143 | { | 143 | { |
144 | 144 | ||
145 | int tmp = getDayIndexFrom(p.x(), p.y()); | 145 | int tmp = getDayIndexFrom(p.x(), p.y()); |
146 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) | 146 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) |
147 | return QString(); | 147 | return QString(); |
148 | QDate mDate = days[tmp]; | 148 | QDate mDate = days[tmp]; |
149 | QPtrList<Event> eventlist = mCalendar->events(mDate); | 149 | QPtrList<Event> eventlist = mCalendar->events(mDate); |
150 | Event *event; | 150 | Event *event; |
151 | QStringList mToolTip; | 151 | QStringList mToolTip; |
152 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 152 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
153 | QString mToolTipText; | 153 | QString mToolTipText; |
154 | QString text; | 154 | QString text; |
155 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 155 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
156 | if (event->isMultiDay()) { | 156 | if (event->isMultiDay()) { |
157 | QString prefix = "<->";multiday = 2; | 157 | QString prefix = "<->";multiday = 2; |
158 | QString time; | 158 | QString time; |
159 | if ( event->doesRecur() ) { | 159 | if ( event->doesRecur() ) { |
160 | if ( event->recursOn( mDate) ) { | 160 | if ( event->recursOn( mDate) ) { |
161 | prefix ="->" ;multiday = 1; | 161 | prefix ="->" ;multiday = 1; |
162 | } | 162 | } |
163 | else { | 163 | else { |
164 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 164 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
165 | if ( event->recursOn( mDate.addDays( -days)) ) { | 165 | if ( event->recursOn( mDate.addDays( -days)) ) { |
166 | prefix ="<-" ;multiday = 3; | 166 | prefix ="<-" ;multiday = 3; |
167 | } | 167 | } |
168 | } | 168 | } |
169 | } else { | 169 | } else { |
170 | if (mDate == event->dtStart().date()) { | 170 | if (mDate == event->dtStart().date()) { |
171 | prefix ="->" ;multiday = 1; | 171 | prefix ="->" ;multiday = 1; |
172 | } else if (mDate == event->dtEnd().date()) { | 172 | } else if (mDate == event->dtEnd().date()) { |
173 | prefix ="<-" ;multiday = 3; | 173 | prefix ="<-" ;multiday = 3; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | if ( !event->doesFloat() ) { | 176 | if ( !event->doesFloat() ) { |
177 | if ( mDate == event->dtStart().date () ) | 177 | if ( mDate == event->dtStart().date () ) |
178 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 178 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
179 | else if ( mDate == event->dtEnd().date () ) | 179 | else if ( mDate == event->dtEnd().date () ) |
180 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 180 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
181 | 181 | ||
182 | } | 182 | } |
183 | text = time + event->summary(); | 183 | text = time + event->summary(); |
184 | mToolTipText += prefix + text; | 184 | mToolTipText += prefix + text; |
185 | } else { | 185 | } else { |
186 | if (event->doesFloat()) { | 186 | if (event->doesFloat()) { |
187 | text = event->summary(); | 187 | text = event->summary(); |
188 | mToolTipText += text; | 188 | mToolTipText += text; |
189 | } | 189 | } |
190 | else { | 190 | else { |
191 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 191 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
192 | text += " " + event->summary(); | 192 | text += " " + event->summary(); |
193 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 193 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | if ( !event->location().isEmpty() ) | 196 | if ( !event->location().isEmpty() ) |
197 | mToolTipText += " (" + event->location() + ")"; | 197 | mToolTipText += " (" + event->location() + ")"; |
198 | #if QT_VERSION >= 0x030000 | 198 | #if QT_VERSION >= 0x030000 |
199 | mToolTipText.replace( '<' , "<" ); | 199 | mToolTipText.replace( '<' , "<" ); |
200 | mToolTipText.replace( '>' , ">" ); | 200 | mToolTipText.replace( '>' , ">" ); |
201 | #else | 201 | #else |
202 | if ( mToolTipText.find ('<') > 0 ) { | 202 | if ( mToolTipText.find ('<') >= 0 ) { |
203 | mToolTipText.replace( QRegExp("<") , "<" ); | 203 | mToolTipText.replace( QRegExp("<") , "<" ); |
204 | } | 204 | } |
205 | if ( mToolTipText.find ('>') > 0 ) { | 205 | if ( mToolTipText.find ('>') >= 0 ) { |
206 | mToolTipText.replace( QRegExp(">") , ">" ); | 206 | mToolTipText.replace( QRegExp(">") , ">" ); |
207 | } | 207 | } |
208 | #endif | 208 | #endif |
209 | //qDebug("TTT: %s ", mToolTipText.latin1()); | ||
209 | mToolTip.append( mToolTipText ); | 210 | mToolTip.append( mToolTipText ); |
210 | } | 211 | } |
211 | mToolTip.sort(); | 212 | mToolTip.sort(); |
212 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); | 213 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); |
213 | } | 214 | } |
214 | void KODayMatrix::setCalendar( Calendar *cal ) | 215 | void KODayMatrix::setCalendar( Calendar *cal ) |
215 | { | 216 | { |
216 | mCalendar = cal; | 217 | mCalendar = cal; |
217 | 218 | ||
218 | setAcceptDrops( mCalendar ); | 219 | setAcceptDrops( mCalendar ); |
219 | 220 | ||
220 | updateEvents(); | 221 | updateEvents(); |
221 | } | 222 | } |
222 | 223 | ||
223 | QColor KODayMatrix::getShadedColor(QColor color) | 224 | QColor KODayMatrix::getShadedColor(QColor color) |
224 | { | 225 | { |
225 | QColor shaded; | 226 | QColor shaded; |
226 | int h=0; | 227 | int h=0; |
227 | int s=0; | 228 | int s=0; |
228 | int v=0; | 229 | int v=0; |
229 | color.hsv(&h,&s,&v); | 230 | color.hsv(&h,&s,&v); |
230 | s = s/4; | 231 | s = s/4; |
231 | v = 192+v/4; | 232 | v = 192+v/4; |
232 | shaded.setHsv(h,s,v); | 233 | shaded.setHsv(h,s,v); |
233 | 234 | ||
234 | return shaded; | 235 | return shaded; |
235 | } | 236 | } |
236 | 237 | ||
237 | KODayMatrix::~KODayMatrix() | 238 | KODayMatrix::~KODayMatrix() |
238 | { | 239 | { |
239 | // delete mKODaymatrixWhatsThis; | 240 | // delete mKODaymatrixWhatsThis; |
240 | delete [] days; | 241 | delete [] days; |
241 | delete [] daylbls; | 242 | delete [] daylbls; |
242 | delete [] events; | 243 | delete [] events; |
243 | delete mToolTip; | 244 | delete mToolTip; |
244 | } | 245 | } |
245 | 246 | ||
246 | /* | 247 | /* |
247 | void KODayMatrix::setStartDate(QDate start) | 248 | void KODayMatrix::setStartDate(QDate start) |
248 | { | 249 | { |
249 | updateView(start); | 250 | updateView(start); |
250 | } | 251 | } |
251 | */ | 252 | */ |
252 | 253 | ||
253 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 254 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
254 | { | 255 | { |
255 | 256 | ||
256 | if (mSelStart == NOSELECTION) { | 257 | if (mSelStart == NOSELECTION) { |
257 | return; | 258 | return; |
258 | } | 259 | } |
259 | 260 | ||
260 | //cope with selection being out of matrix limits at top (< 0) | 261 | //cope with selection being out of matrix limits at top (< 0) |
261 | int i0 = mSelStart; | 262 | int i0 = mSelStart; |
262 | if (i0 < 0) { | 263 | if (i0 < 0) { |
263 | for (int i = i0; i < 0; i++) { | 264 | for (int i = i0; i < 0; i++) { |
264 | selDays.append(days[0].addDays(i)); | 265 | selDays.append(days[0].addDays(i)); |
265 | } | 266 | } |
266 | i0 = 0; | 267 | i0 = 0; |
267 | } | 268 | } |
268 | 269 | ||
269 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 270 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
270 | if (mSelEnd > NUMDAYS-1) { | 271 | if (mSelEnd > NUMDAYS-1) { |
271 | for (int i = i0; i <= NUMDAYS-1; i++) { | 272 | for (int i = i0; i <= NUMDAYS-1; i++) { |
272 | selDays.append(days[i]); | 273 | selDays.append(days[i]); |
273 | } | 274 | } |
274 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 275 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
275 | selDays.append(days[0].addDays(i)); | 276 | selDays.append(days[0].addDays(i)); |
276 | } | 277 | } |
277 | 278 | ||
278 | // apply normal routine to selection being entirely within matrix limits | 279 | // apply normal routine to selection being entirely within matrix limits |
279 | } else { | 280 | } else { |
280 | for (int i = i0; i <= mSelEnd; i++) { | 281 | for (int i = i0; i <= mSelEnd; i++) { |
281 | selDays.append(days[i]); | 282 | selDays.append(days[i]); |
282 | } | 283 | } |
283 | } | 284 | } |
284 | } | 285 | } |
285 | 286 | ||
286 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 287 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
287 | { | 288 | { |
288 | mSelStart = startdate.daysTo(start); | 289 | mSelStart = startdate.daysTo(start); |
289 | if ( mSelStart < 0 ) | 290 | if ( mSelStart < 0 ) |
290 | mSelStart = 0; | 291 | mSelStart = 0; |
291 | mSelEnd = startdate.daysTo(end); | 292 | mSelEnd = startdate.daysTo(end); |
292 | if ( mSelEnd < 0 ) | 293 | if ( mSelEnd < 0 ) |
293 | clearSelection(); | 294 | clearSelection(); |
294 | } | 295 | } |
295 | void KODayMatrix::clearSelection() | 296 | void KODayMatrix::clearSelection() |
296 | { | 297 | { |
297 | mSelEnd = mSelStart = NOSELECTION; | 298 | mSelEnd = mSelStart = NOSELECTION; |
298 | } | 299 | } |
299 | 300 | ||
300 | 301 | ||
301 | void KODayMatrix::recalculateToday() | 302 | void KODayMatrix::recalculateToday() |
302 | { | 303 | { |
303 | today = -1; | 304 | today = -1; |
304 | for (int i=0; i<NUMDAYS; i++) { | 305 | for (int i=0; i<NUMDAYS; i++) { |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 135ca73..1508638 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -605,117 +605,117 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | } | 608 | } |
609 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 609 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
610 | { | 610 | { |
611 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 611 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
612 | if (mode == 0 ) { | 612 | if (mode == 0 ) { |
613 | addTag("h2",i18n("Journal from: ")); | 613 | addTag("h2",i18n("Journal from: ")); |
614 | } | 614 | } |
615 | else { | 615 | else { |
616 | if ( mode == 1 ) { | 616 | if ( mode == 1 ) { |
617 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 617 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
618 | } else { | 618 | } else { |
619 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 619 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | topLevelWidget()->setCaption("Journal Viewer"); | 622 | topLevelWidget()->setCaption("Journal Viewer"); |
623 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 623 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
624 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 624 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
625 | if (!jour->description().isEmpty()) { | 625 | if (!jour->description().isEmpty()) { |
626 | addTag("p",deTag(jour->description())); | 626 | addTag("p",deTag(jour->description())); |
627 | } | 627 | } |
628 | setText(mText); | 628 | setText(mText); |
629 | } | 629 | } |
630 | 630 | ||
631 | void KOEventViewer::formatReadOnly(Incidence *event) | 631 | void KOEventViewer::formatReadOnly(Incidence *event) |
632 | { | 632 | { |
633 | if (event->isReadOnly()) { | 633 | if (event->isReadOnly()) { |
634 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 634 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
635 | } | 635 | } |
636 | } | 636 | } |
637 | void KOEventViewer::setSyncMode( bool b ) | 637 | void KOEventViewer::setSyncMode( bool b ) |
638 | { | 638 | { |
639 | mSyncMode = b; | 639 | mSyncMode = b; |
640 | } | 640 | } |
641 | 641 | ||
642 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 642 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
643 | { | 643 | { |
644 | if ( clearV ) | 644 | if ( clearV ) |
645 | clearEvents(); | 645 | clearEvents(); |
646 | if ( mSyncMode ) { | 646 | if ( mSyncMode ) { |
647 | if ( clearV ) | 647 | if ( clearV ) |
648 | appendTodo(event,1 ); | 648 | appendTodo(event,1 ); |
649 | else | 649 | else |
650 | appendTodo(event,2); | 650 | appendTodo(event,2); |
651 | } else | 651 | } else |
652 | appendTodo(event); | 652 | appendTodo(event); |
653 | } | 653 | } |
654 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 654 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
655 | { | 655 | { |
656 | if ( clearV ) | 656 | if ( clearV ) |
657 | clearEvents(); | 657 | clearEvents(); |
658 | if ( mSyncMode ) { | 658 | if ( mSyncMode ) { |
659 | if ( clearV ) | 659 | if ( clearV ) |
660 | appendJournal(event, 1); | 660 | appendJournal(event, 1); |
661 | else | 661 | else |
662 | appendJournal(event, 2); | 662 | appendJournal(event, 2); |
663 | } else | 663 | } else |
664 | appendJournal(event); | 664 | appendJournal(event); |
665 | } | 665 | } |
666 | 666 | ||
667 | void KOEventViewer::setEvent(Event *event) | 667 | void KOEventViewer::setEvent(Event *event) |
668 | { | 668 | { |
669 | clearEvents(); | 669 | clearEvents(); |
670 | if ( mSyncMode ) | 670 | if ( mSyncMode ) |
671 | appendEvent(event, 1); | 671 | appendEvent(event, 1); |
672 | else | 672 | else |
673 | appendEvent(event); | 673 | appendEvent(event); |
674 | } | 674 | } |
675 | 675 | ||
676 | void KOEventViewer::addEvent(Event *event) | 676 | void KOEventViewer::addEvent(Event *event) |
677 | { | 677 | { |
678 | if ( mSyncMode ) | 678 | if ( mSyncMode ) |
679 | appendEvent(event, 2); | 679 | appendEvent(event, 2); |
680 | else | 680 | else |
681 | appendEvent(event); | 681 | appendEvent(event); |
682 | } | 682 | } |
683 | 683 | ||
684 | void KOEventViewer::clearEvents(bool now) | 684 | void KOEventViewer::clearEvents(bool now) |
685 | { | 685 | { |
686 | mText = ""; | 686 | mText = ""; |
687 | if (now) setText(mText); | 687 | if (now) setText(mText); |
688 | } | 688 | } |
689 | 689 | ||
690 | void KOEventViewer::addText(QString text) | 690 | void KOEventViewer::addText(QString text) |
691 | { | 691 | { |
692 | mText.append(text); | 692 | mText.append(text); |
693 | setText(mText); | 693 | setText(mText); |
694 | } | 694 | } |
695 | QString KOEventViewer::deTag(QString text) | 695 | QString KOEventViewer::deTag(QString text) |
696 | { | 696 | { |
697 | #if QT_VERSION >= 0x030000 | 697 | #if QT_VERSION >= 0x030000 |
698 | text.replace( '<' , "<" ); | 698 | text.replace( '<' , "<" ); |
699 | text.replace( '>' , ">" ); | 699 | text.replace( '>' , ">" ); |
700 | #else | 700 | #else |
701 | if ( text.find ('<') > 0 ) { | 701 | if ( text.find ('<') >= 0 ) { |
702 | text.replace( QRegExp("<") , "<" ); | 702 | text.replace( QRegExp("<") , "<" ); |
703 | } | 703 | } |
704 | if ( text.find ('>') > 0 ) { | 704 | if ( text.find ('>') >= 0 ) { |
705 | text.replace( QRegExp(">") , ">" ); | 705 | text.replace( QRegExp(">") , ">" ); |
706 | } | 706 | } |
707 | #endif | 707 | #endif |
708 | return text; | 708 | return text; |
709 | } | 709 | } |
710 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) | 710 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) |
711 | { | 711 | { |
712 | switch ( e->key() ) { | 712 | switch ( e->key() ) { |
713 | case Qt::Key_Return: | 713 | case Qt::Key_Return: |
714 | case Qt::Key_Enter : | 714 | case Qt::Key_Enter : |
715 | e->ignore(); | 715 | e->ignore(); |
716 | break; | 716 | break; |
717 | default: | 717 | default: |
718 | QTextBrowser::keyPressEvent ( e ); | 718 | QTextBrowser::keyPressEvent ( e ); |
719 | break; | 719 | break; |
720 | } | 720 | } |
721 | } | 721 | } |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 57a9ede..e506a96 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -289,105 +289,105 @@ void KIncidenceFormatter::addTag(const QString & tag,const QString & text) | |||
289 | 289 | ||
290 | void KIncidenceFormatter::formatAttendees(Incidence *event) | 290 | void KIncidenceFormatter::formatAttendees(Incidence *event) |
291 | { | 291 | { |
292 | QPtrList<Attendee> attendees = event->attendees(); | 292 | QPtrList<Attendee> attendees = event->attendees(); |
293 | if (attendees.count()) { | 293 | if (attendees.count()) { |
294 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 294 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
295 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 295 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
296 | addTag("h3",i18n("Organizer")); | 296 | addTag("h3",i18n("Organizer")); |
297 | mText.append("<ul><li>"); | 297 | mText.append("<ul><li>"); |
298 | #if 0 | 298 | #if 0 |
299 | //ndef KORG_NOKABC | 299 | //ndef KORG_NOKABC |
300 | 300 | ||
301 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 301 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
302 | KABC::Addressee::List addressList; | 302 | KABC::Addressee::List addressList; |
303 | addressList = add_book->findByEmail(event->organizer()); | 303 | addressList = add_book->findByEmail(event->organizer()); |
304 | KABC::Addressee o = addressList.first(); | 304 | KABC::Addressee o = addressList.first(); |
305 | if (!o.isEmpty() && addressList.size()<2) { | 305 | if (!o.isEmpty() && addressList.size()<2) { |
306 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 306 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
307 | mText += o.formattedName(); | 307 | mText += o.formattedName(); |
308 | mText += "</a>\n"; | 308 | mText += "</a>\n"; |
309 | } else { | 309 | } else { |
310 | mText.append(event->organizer()); | 310 | mText.append(event->organizer()); |
311 | } | 311 | } |
312 | #else | 312 | #else |
313 | mText.append(event->organizer()); | 313 | mText.append(event->organizer()); |
314 | #endif | 314 | #endif |
315 | if (iconPath) { | 315 | if (iconPath) { |
316 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 316 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
317 | mText += "<IMG src=\"" + iconPath + "\">"; | 317 | mText += "<IMG src=\"" + iconPath + "\">"; |
318 | mText += "</a>\n"; | 318 | mText += "</a>\n"; |
319 | } | 319 | } |
320 | mText.append("</li></ul>"); | 320 | mText.append("</li></ul>"); |
321 | 321 | ||
322 | addTag("h3",i18n("Attendees")); | 322 | addTag("h3",i18n("Attendees")); |
323 | Attendee *a; | 323 | Attendee *a; |
324 | mText.append("<ul>"); | 324 | mText.append("<ul>"); |
325 | for(a=attendees.first();a;a=attendees.next()) { | 325 | for(a=attendees.first();a;a=attendees.next()) { |
326 | #if 0 | 326 | #if 0 |
327 | //ndef KORG_NOKABC | 327 | //ndef KORG_NOKABC |
328 | if (a->name().isEmpty()) { | 328 | if (a->name().isEmpty()) { |
329 | addressList = add_book->findByEmail(a->email()); | 329 | addressList = add_book->findByEmail(a->email()); |
330 | KABC::Addressee o = addressList.first(); | 330 | KABC::Addressee o = addressList.first(); |
331 | if (!o.isEmpty() && addressList.size()<2) { | 331 | if (!o.isEmpty() && addressList.size()<2) { |
332 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 332 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
333 | mText += o.formattedName(); | 333 | mText += o.formattedName(); |
334 | mText += "</a>\n"; | 334 | mText += "</a>\n"; |
335 | } else { | 335 | } else { |
336 | mText += "<li>"; | 336 | mText += "<li>"; |
337 | mText.append(a->email()); | 337 | mText.append(a->email()); |
338 | mText += "\n"; | 338 | mText += "\n"; |
339 | } | 339 | } |
340 | } else { | 340 | } else { |
341 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 341 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
342 | if (!a->name().isEmpty()) mText += a->name(); | 342 | if (!a->name().isEmpty()) mText += a->name(); |
343 | else mText += a->email(); | 343 | else mText += a->email(); |
344 | mText += "</a>\n"; | 344 | mText += "</a>\n"; |
345 | } | 345 | } |
346 | #else | 346 | #else |
347 | //qDebug("nokabc "); | 347 | //qDebug("nokabc "); |
348 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 348 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
349 | if (!a->name().isEmpty()) mText += a->name(); | 349 | if (!a->name().isEmpty()) mText += a->name(); |
350 | else mText += a->email(); | 350 | else mText += a->email(); |
351 | mText += "</a>\n"; | 351 | mText += "</a>\n"; |
352 | #endif | 352 | #endif |
353 | 353 | ||
354 | if (!a->email().isEmpty()) { | 354 | if (!a->email().isEmpty()) { |
355 | if (iconPath) { | 355 | if (iconPath) { |
356 | mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; | 356 | mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; |
357 | if ( a->RSVP() ) | 357 | if ( a->RSVP() ) |
358 | mText += "<IMG src=\"" + iconPath + "\">"; | 358 | mText += "<IMG src=\"" + iconPath + "\">"; |
359 | else | 359 | else |
360 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 360 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
361 | mText += "</a>\n"; | 361 | mText += "</a>\n"; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | if (a->status() != Attendee::NeedsAction ) | 364 | if (a->status() != Attendee::NeedsAction ) |
365 | mText +="[" + a->statusStr() + "] "; | 365 | mText +="[" + a->statusStr() + "] "; |
366 | if (a->role() == Attendee::Chair ) | 366 | if (a->role() == Attendee::Chair ) |
367 | mText +="(" + a->roleStr().left(1) + ".)"; | 367 | mText +="(" + a->roleStr().left(1) + ".)"; |
368 | } | 368 | } |
369 | mText.append("</li></ul>"); | 369 | mText.append("</li></ul>"); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | 372 | ||
373 | void KIncidenceFormatter::formatReadOnly(Incidence *event) | 373 | void KIncidenceFormatter::formatReadOnly(Incidence *event) |
374 | { | 374 | { |
375 | if (event->isReadOnly()) { | 375 | if (event->isReadOnly()) { |
376 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 376 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | QString KIncidenceFormatter::deTag(QString text) | 379 | QString KIncidenceFormatter::deTag(QString text) |
380 | { | 380 | { |
381 | #if QT_VERSION >= 0x030000 | 381 | #if QT_VERSION >= 0x030000 |
382 | text.replace( '<' , "<" ); | 382 | text.replace( '<' , "<" ); |
383 | text.replace( '>' , ">" ); | 383 | text.replace( '>' , ">" ); |
384 | #else | 384 | #else |
385 | if ( text.find ('<') > 0 ) { | 385 | if ( text.find ('<') >= 0 ) { |
386 | text.replace( QRegExp("<") , "<" ); | 386 | text.replace( QRegExp("<") , "<" ); |
387 | } | 387 | } |
388 | if ( text.find ('>') > 0 ) { | 388 | if ( text.find ('>') >= 0 ) { |
389 | text.replace( QRegExp(">") , ">" ); | 389 | text.replace( QRegExp(">") , ">" ); |
390 | } | 390 | } |
391 | #endif | 391 | #endif |
392 | return text; | 392 | return text; |
393 | } | 393 | } |