author | zautrix <zautrix> | 2005-06-29 12:52:24 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-29 12:52:24 (UTC) |
commit | 4c19dcc4e5b45d9cf04c91af82f00b764b01e985 (patch) (unidiff) | |
tree | b9b6b679c499207c06f74db090ead71bc175866d /korganizer | |
parent | 0d4d5898a32f162dca010db329e02310a14629d5 (diff) | |
download | kdepimpi-4c19dcc4e5b45d9cf04c91af82f00b764b01e985.zip kdepimpi-4c19dcc4e5b45d9cf04c91af82f00b764b01e985.tar.gz kdepimpi-4c19dcc4e5b45d9cf04c91af82f00b764b01e985.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/journalentry.cpp | 7 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 12 |
2 files changed, 15 insertions, 4 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 05bfd31..232ea58 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -99,183 +99,188 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
99 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 99 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
100 | QBoxLayout *topLayout = new QVBoxLayout(this); | 100 | QBoxLayout *topLayout = new QVBoxLayout(this); |
101 | topLayout->addWidget(vb); | 101 | topLayout->addWidget(vb); |
102 | topLayout->addWidget(mEditor); | 102 | topLayout->addWidget(mEditor); |
103 | mEditor->installEventFilter(this); | 103 | mEditor->installEventFilter(this); |
104 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 104 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
105 | connect( mTitle, SIGNAL( textChanged ( const QString & ) ), this , SLOT( setDirty() ) ); | 105 | connect( mTitle, SIGNAL( textChanged ( const QString & ) ), this , SLOT( setDirty() ) ); |
106 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 106 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
107 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 107 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
108 | } | 108 | } |
109 | 109 | ||
110 | JournalEntry::~JournalEntry() | 110 | JournalEntry::~JournalEntry() |
111 | { | 111 | { |
112 | //qDebug("JournalEntry::~JournalEntry() "); | 112 | //qDebug("JournalEntry::~JournalEntry() "); |
113 | } | 113 | } |
114 | QSize JournalEntry::sizeHint() const | 114 | QSize JournalEntry::sizeHint() const |
115 | { | 115 | { |
116 | return QSize ( 240, heiHint ); | 116 | return QSize ( 240, heiHint ); |
117 | } | 117 | } |
118 | void JournalEntry::slotSaveTemplate() | 118 | void JournalEntry::slotSaveTemplate() |
119 | { | 119 | { |
120 | QString fileName =locateLocal( "templates", "journals" ); | 120 | QString fileName =locateLocal( "templates", "journals" ); |
121 | QDir t_dir; | 121 | QDir t_dir; |
122 | if ( !t_dir.exists(fileName) ) | 122 | if ( !t_dir.exists(fileName) ) |
123 | t_dir.mkdir ( fileName ); | 123 | t_dir.mkdir ( fileName ); |
124 | fileName += "/journal"; | 124 | fileName += "/journal"; |
125 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 125 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
126 | if ( fileName.length() == 0 ) | 126 | if ( fileName.length() == 0 ) |
127 | return; | 127 | return; |
128 | 128 | ||
129 | QFile fileIn( fileName ); | 129 | QFile fileIn( fileName ); |
130 | if (!fileIn.open( IO_WriteOnly ) ) { | 130 | if (!fileIn.open( IO_WriteOnly ) ) { |
131 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 131 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
132 | .arg( fileName ) ); | 132 | .arg( fileName ) ); |
133 | return; | 133 | return; |
134 | } | 134 | } |
135 | // QString text; | 135 | // QString text; |
136 | QTextStream tsIn( &fileIn ); | 136 | QTextStream tsIn( &fileIn ); |
137 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 137 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
138 | tsIn << mEditor->text(); | 138 | tsIn << mEditor->text(); |
139 | fileIn.close(); | 139 | fileIn.close(); |
140 | } | 140 | } |
141 | void JournalEntry::slotLoadTemplate() | 141 | void JournalEntry::slotLoadTemplate() |
142 | { | 142 | { |
143 | QString fileName =locateLocal( "templates", "journals" ); | 143 | QString fileName =locateLocal( "templates", "journals" ); |
144 | QDir t_dir; | 144 | QDir t_dir; |
145 | if ( !t_dir.exists(fileName) ) | 145 | if ( !t_dir.exists(fileName) ) |
146 | t_dir.mkdir ( fileName ); | 146 | t_dir.mkdir ( fileName ); |
147 | fileName += "/journal"; | 147 | fileName += "/journal"; |
148 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 148 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
149 | if ( fileName.length() == 0 ) | 149 | if ( fileName.length() == 0 ) |
150 | return; | 150 | return; |
151 | QFile fileIn( fileName ); | 151 | QFile fileIn( fileName ); |
152 | if (!fileIn.open( IO_ReadOnly ) ) { | 152 | if (!fileIn.open( IO_ReadOnly ) ) { |
153 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 153 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
154 | .arg( fileName ) ); | 154 | .arg( fileName ) ); |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | QTextStream tsIn( &fileIn ); | 157 | QTextStream tsIn( &fileIn ); |
158 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 158 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
159 | QString text = tsIn.read(); | 159 | QString text = tsIn.read(); |
160 | fileIn.close(); | 160 | fileIn.close(); |
161 | int line, col; | 161 | int line, col; |
162 | mEditor->getCursorPosition (& line, & col ); | 162 | mEditor->getCursorPosition (& line, & col ); |
163 | mEditor-> insertAt ( text, line, col, true ); | 163 | mEditor-> insertAt ( text, line, col, true ); |
164 | //mEditor->setIgnoreMark( true ); | 164 | //mEditor->setIgnoreMark( true ); |
165 | setDirty(); | 165 | setDirty(); |
166 | } | 166 | } |
167 | void JournalEntry::setDate(const QDate &date) | 167 | void JournalEntry::setDate(const QDate &date) |
168 | { | 168 | { |
169 | showOnlyMode = false; | 169 | showOnlyMode = false; |
170 | mDate = date; | 170 | mDate = date; |
171 | writeJournal(); | 171 | writeJournal(); |
172 | int id = mCalendar->defaultCalendar(); | 172 | int id = mCalendar->defaultCalendar(); |
173 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 173 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
174 | mTitleLabel->setText( " (" + calname +")"); | 174 | mTitleLabel->setText( " (" + calname +")"); |
175 | } | 175 | } |
176 | 176 | ||
177 | void JournalEntry::toggleShowJournal() | 177 | void JournalEntry::toggleShowJournal() |
178 | { | 178 | { |
179 | flushEntry(); | 179 | flushEntry(); |
180 | if ( showOnlyMode ) | 180 | if ( showOnlyMode ) |
181 | emit showJournalOnly( 0 ); | 181 | emit showJournalOnly( 0 ); |
182 | else | 182 | else |
183 | emit showJournalOnly( mJournal ); | 183 | emit showJournalOnly( mJournal ); |
184 | } | 184 | } |
185 | void JournalEntry::setShowOnly() | 185 | void JournalEntry::setShowOnly() |
186 | { | 186 | { |
187 | showOnlyMode = true; | 187 | showOnlyMode = true; |
188 | mEditor->setFocus(); | 188 | mEditor->setFocus(); |
189 | } | 189 | } |
190 | void JournalEntry::setJournal(Journal *journal) | 190 | void JournalEntry::setJournal(Journal *journal) |
191 | { | 191 | { |
192 | writeJournal(); | 192 | writeJournal(); |
193 | 193 | ||
194 | mJournal = journal; | 194 | mJournal = journal; |
195 | mTitle->setText(mJournal->summary()); | 195 | if ( journal->isReadOnly() ) |
196 | mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); | ||
197 | else | ||
198 | mTitle->setText(mJournal->summary()); | ||
196 | mEditor->setText(mJournal->description()); | 199 | mEditor->setText(mJournal->description()); |
200 | mTitle->setReadOnly (journal->isReadOnly() ); | ||
201 | mEditor->setReadOnly ( journal->isReadOnly() ); | ||
197 | int id = mJournal->calID(); | 202 | int id = mJournal->calID(); |
198 | 203 | ||
199 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 204 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
200 | mTitleLabel->setText( " (" + calname +")"); | 205 | mTitleLabel->setText( " (" + calname +")"); |
201 | 206 | ||
202 | mDirty = false; | 207 | mDirty = false; |
203 | } | 208 | } |
204 | 209 | ||
205 | Journal *JournalEntry::journal() const | 210 | Journal *JournalEntry::journal() const |
206 | { | 211 | { |
207 | return mJournal; | 212 | return mJournal; |
208 | } | 213 | } |
209 | 214 | ||
210 | void JournalEntry::setDirty() | 215 | void JournalEntry::setDirty() |
211 | { | 216 | { |
212 | mDirty = true; | 217 | mDirty = true; |
213 | 218 | ||
214 | // kdDebug() << "JournalEntry::setDirty()" << endl; | 219 | // kdDebug() << "JournalEntry::setDirty()" << endl; |
215 | } | 220 | } |
216 | 221 | ||
217 | void JournalEntry::clear() | 222 | void JournalEntry::clear() |
218 | { | 223 | { |
219 | mJournal = 0; | 224 | mJournal = 0; |
220 | mEditor->setText(""); | 225 | mEditor->setText(""); |
221 | } | 226 | } |
222 | 227 | ||
223 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 228 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
224 | { | 229 | { |
225 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 230 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
226 | 231 | ||
227 | if ( e->type() == QEvent::FocusOut ) { | 232 | if ( e->type() == QEvent::FocusOut ) { |
228 | writeJournal(); | 233 | writeJournal(); |
229 | } | 234 | } |
230 | if ( e->type() == QEvent::KeyPress ) { | 235 | if ( e->type() == QEvent::KeyPress ) { |
231 | QKeyEvent * k = (QKeyEvent *) e; | 236 | QKeyEvent * k = (QKeyEvent *) e; |
232 | if ( k->state() == Qt::ControlButton ) { | 237 | if ( k->state() == Qt::ControlButton ) { |
233 | k->ignore(); | 238 | k->ignore(); |
234 | //return true; | 239 | //return true; |
235 | } | 240 | } |
236 | } | 241 | } |
237 | 242 | ||
238 | return QFrame::eventFilter( o, e ); // standard event processing | 243 | return QFrame::eventFilter( o, e ); // standard event processing |
239 | } | 244 | } |
240 | 245 | ||
241 | void JournalEntry::writeJournal() | 246 | void JournalEntry::writeJournal() |
242 | { | 247 | { |
243 | // kdDebug() << "JournalEntry::writeJournal()" << endl; | 248 | // kdDebug() << "JournalEntry::writeJournal()" << endl; |
244 | if (!mDirty) return; | 249 | if (!mDirty) return; |
245 | 250 | ||
246 | if (mEditor->text().isEmpty()) { | 251 | if (mEditor->text().isEmpty()) { |
247 | if ( mJournal ) { | 252 | if ( mJournal ) { |
248 | mDirty = false; | 253 | mDirty = false; |
249 | bool conf = KOPrefs::instance()->mConfirm; | 254 | bool conf = KOPrefs::instance()->mConfirm; |
250 | KOPrefs::instance()->mConfirm = false; | 255 | KOPrefs::instance()->mConfirm = false; |
251 | emit deleteJournal(mJournal); | 256 | emit deleteJournal(mJournal); |
252 | KOPrefs::instance()->mConfirm = conf; | 257 | KOPrefs::instance()->mConfirm = conf; |
253 | mJournal = 0; | 258 | mJournal = 0; |
254 | } | 259 | } |
255 | return; | 260 | return; |
256 | } | 261 | } |
257 | 262 | ||
258 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 263 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
259 | 264 | ||
260 | if (!mJournal) { | 265 | if (!mJournal) { |
261 | mJournal = new Journal; | 266 | mJournal = new Journal; |
262 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 267 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
263 | mCalendar->addJournal(mJournal); | 268 | mCalendar->addJournal(mJournal); |
264 | } | 269 | } |
265 | 270 | ||
266 | mJournal->setDescription(mEditor->text()); | 271 | mJournal->setDescription(mEditor->text()); |
267 | mJournal->setSummary(mTitle->text()); | 272 | mJournal->setSummary(mTitle->text()); |
268 | mDirty = false; | 273 | mDirty = false; |
269 | } | 274 | } |
270 | 275 | ||
271 | void JournalEntry::flushEntry() | 276 | void JournalEntry::flushEntry() |
272 | { | 277 | { |
273 | if (!mDirty) return; | 278 | if (!mDirty) return; |
274 | 279 | ||
275 | writeJournal(); | 280 | writeJournal(); |
276 | } | 281 | } |
277 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 282 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
278 | { | 283 | { |
279 | e->ignore(); | 284 | e->ignore(); |
280 | 285 | ||
281 | } | 286 | } |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index dcbb99f..8c1e5b2 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -606,198 +606,204 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
606 | Attendee *a; | 606 | Attendee *a; |
607 | mText.append("<ul>"); | 607 | mText.append("<ul>"); |
608 | int a_count = 0; | 608 | int a_count = 0; |
609 | int a_count_nr = 0; | 609 | int a_count_nr = 0; |
610 | 610 | ||
611 | for(a=attendees.first();a;a=attendees.next()) { | 611 | for(a=attendees.first();a;a=attendees.next()) { |
612 | #ifndef KORG_NOKABC | 612 | #ifndef KORG_NOKABC |
613 | #ifdef DESKTOP_VERSION | 613 | #ifdef DESKTOP_VERSION |
614 | if (a->name().isEmpty()) { | 614 | if (a->name().isEmpty()) { |
615 | addressList = add_book->findByEmail(a->email()); | 615 | addressList = add_book->findByEmail(a->email()); |
616 | KABC::Addressee o = addressList.first(); | 616 | KABC::Addressee o = addressList.first(); |
617 | if (!o.isEmpty() && addressList.size()<2) { | 617 | if (!o.isEmpty() && addressList.size()<2) { |
618 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 618 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
619 | mText += o.formattedName(); | 619 | mText += o.formattedName(); |
620 | mText += "</a>\n"; | 620 | mText += "</a>\n"; |
621 | } else { | 621 | } else { |
622 | mText += "<li>"; | 622 | mText += "<li>"; |
623 | mText.append(a->email()); | 623 | mText.append(a->email()); |
624 | mText += "\n"; | 624 | mText += "\n"; |
625 | } | 625 | } |
626 | } else { | 626 | } else { |
627 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 627 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
628 | if (!a->name().isEmpty()) mText += a->name(); | 628 | if (!a->name().isEmpty()) mText += a->name(); |
629 | else mText += a->email(); | 629 | else mText += a->email(); |
630 | mText += "</a>\n"; | 630 | mText += "</a>\n"; |
631 | } | 631 | } |
632 | #else //DESKTOP_VERSION | 632 | #else //DESKTOP_VERSION |
633 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 633 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
634 | if (!a->name().isEmpty()) mText += a->name(); | 634 | if (!a->name().isEmpty()) mText += a->name(); |
635 | else mText += a->email(); | 635 | else mText += a->email(); |
636 | mText += "</a>\n"; | 636 | mText += "</a>\n"; |
637 | #endif //DESKTOP_VERSION | 637 | #endif //DESKTOP_VERSION |
638 | #else | 638 | #else |
639 | //qDebug("nokabc "); | 639 | //qDebug("nokabc "); |
640 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 640 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
641 | if (!a->name().isEmpty()) mText += a->name(); | 641 | if (!a->name().isEmpty()) mText += a->name(); |
642 | else mText += a->email(); | 642 | else mText += a->email(); |
643 | mText += "</a>\n"; | 643 | mText += "</a>\n"; |
644 | #endif | 644 | #endif |
645 | 645 | ||
646 | 646 | ||
647 | if (!a->email().isEmpty()) { | 647 | if (!a->email().isEmpty()) { |
648 | if (iconPath) { | 648 | if (iconPath) { |
649 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 649 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
650 | if ( a->RSVP() ) { | 650 | if ( a->RSVP() ) { |
651 | ++a_count_nr; | 651 | ++a_count_nr; |
652 | mText += "<IMG src=\"" + iconPath + "\">"; | 652 | mText += "<IMG src=\"" + iconPath + "\">"; |
653 | } | 653 | } |
654 | else { | 654 | else { |
655 | ++a_count; | 655 | ++a_count; |
656 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 656 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
657 | } | 657 | } |
658 | mText += "</a>\n"; | 658 | mText += "</a>\n"; |
659 | } | 659 | } |
660 | } | 660 | } |
661 | if (a->status() != Attendee::NeedsAction ) | 661 | if (a->status() != Attendee::NeedsAction ) |
662 | mText +="[" + a->statusStr() + "] "; | 662 | mText +="[" + a->statusStr() + "] "; |
663 | if (a->role() == Attendee::Chair ) | 663 | if (a->role() == Attendee::Chair ) |
664 | mText +="(" + a->roleStr().left(1) + ".)"; | 664 | mText +="(" + a->roleStr().left(1) + ".)"; |
665 | } | 665 | } |
666 | mText.append("</li></ul>"); | 666 | mText.append("</li></ul>"); |
667 | if ( (a_count+a_count_nr) > 1 ) { | 667 | if ( (a_count+a_count_nr) > 1 ) { |
668 | mText += "<a href=\"mailto:ALL\">"; | 668 | mText += "<a href=\"mailto:ALL\">"; |
669 | mText += i18n( "Mail to all" ); | 669 | mText += i18n( "Mail to all" ); |
670 | mText += "</a> ( "; | 670 | mText += "</a> ( "; |
671 | mText += "<IMG src=\"" + iconPath + "\">"; | 671 | mText += "<IMG src=\"" + iconPath + "\">"; |
672 | mText += i18n( " and " ); | 672 | mText += i18n( " and " ); |
673 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | 673 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; |
674 | mText += "<br>\n"; | 674 | mText += "<br>\n"; |
675 | 675 | ||
676 | 676 | ||
677 | } | 677 | } |
678 | if ( a_count_nr > 1 ) { | 678 | if ( a_count_nr > 1 ) { |
679 | mText += "<a href=\"mailto:RSVP\">"; | 679 | mText += "<a href=\"mailto:RSVP\">"; |
680 | mText += i18n( "Mail to selected" ); | 680 | mText += i18n( "Mail to selected" ); |
681 | mText += "</a> ( "; | 681 | mText += "</a> ( "; |
682 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | 682 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); |
683 | mText += "<br>\n"; | 683 | mText += "<br>\n"; |
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | } | 687 | } |
688 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 688 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
689 | { | 689 | { |
690 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 690 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
691 | if (mode == 0 ) { | 691 | if (mode == 0 ) { |
692 | addTag("h2",i18n("Journal from: ")); | 692 | addTag("h2",i18n("Journal from: ")); |
693 | } | 693 | } |
694 | else { | 694 | else { |
695 | if ( mode == 1 ) { | 695 | if ( mode == 1 ) { |
696 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 696 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
697 | } else { | 697 | } else { |
698 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 698 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
699 | } | 699 | } |
700 | } | 700 | } |
701 | topLevelWidget()->setCaption("Journal Viewer"); | 701 | topLevelWidget()->setCaption("Journal Viewer"); |
702 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 702 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
703 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | ||
704 | if (!jour->summary().isEmpty()) { | 703 | if (!jour->summary().isEmpty()) { |
705 | addTag("p",i18n(" Title: ") + deTag(jour->summary())); | 704 | addTag("b",i18n(" Title: ") + deTag(jour->summary())); |
706 | } | 705 | } |
706 | formatReadOnly(jour); | ||
707 | addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | ||
708 | |||
707 | if (!jour->description().isEmpty()) { | 709 | if (!jour->description().isEmpty()) { |
708 | addTag("p",deTag(jour->description())); | 710 | addTag("p",deTag(jour->description())); |
709 | } | 711 | } |
710 | setText(mText); | 712 | setText(mText); |
711 | } | 713 | } |
712 | 714 | ||
713 | void KOEventViewer::formatReadOnly(Incidence *event) | 715 | void KOEventViewer::formatReadOnly(Incidence *event) |
714 | { | 716 | { |
717 | int id = event->calID(); | ||
718 | if ( id > 1 ) { | ||
719 | addTag("p", i18n("Calendar:")+" " + KOPrefs::instance()->getCalendar( id )->mName ); | ||
720 | } | ||
715 | if (event->isReadOnly()) { | 721 | if (event->isReadOnly()) { |
716 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 722 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
717 | } | 723 | } |
718 | } | 724 | } |
719 | void KOEventViewer::setSyncMode( bool b ) | 725 | void KOEventViewer::setSyncMode( bool b ) |
720 | { | 726 | { |
721 | mSyncMode = b; | 727 | mSyncMode = b; |
722 | } | 728 | } |
723 | 729 | ||
724 | void KOEventViewer::setTodo(Todo *event, bool clearV ) | 730 | void KOEventViewer::setTodo(Todo *event, bool clearV ) |
725 | { | 731 | { |
726 | if ( clearV ) | 732 | if ( clearV ) |
727 | clearEvents(); | 733 | clearEvents(); |
728 | if ( mSyncMode ) { | 734 | if ( mSyncMode ) { |
729 | if ( clearV ) | 735 | if ( clearV ) |
730 | appendTodo(event,1 ); | 736 | appendTodo(event,1 ); |
731 | else | 737 | else |
732 | appendTodo(event,2); | 738 | appendTodo(event,2); |
733 | } else | 739 | } else |
734 | appendTodo(event); | 740 | appendTodo(event); |
735 | } | 741 | } |
736 | void KOEventViewer::setJournal(Journal *event, bool clearV ) | 742 | void KOEventViewer::setJournal(Journal *event, bool clearV ) |
737 | { | 743 | { |
738 | if ( clearV ) | 744 | if ( clearV ) |
739 | clearEvents(); | 745 | clearEvents(); |
740 | if ( mSyncMode ) { | 746 | if ( mSyncMode ) { |
741 | if ( clearV ) | 747 | if ( clearV ) |
742 | appendJournal(event, 1); | 748 | appendJournal(event, 1); |
743 | else | 749 | else |
744 | appendJournal(event, 2); | 750 | appendJournal(event, 2); |
745 | } else | 751 | } else |
746 | appendJournal(event); | 752 | appendJournal(event); |
747 | } | 753 | } |
748 | 754 | ||
749 | void KOEventViewer::setEvent(Event *event) | 755 | void KOEventViewer::setEvent(Event *event) |
750 | { | 756 | { |
751 | clearEvents(); | 757 | clearEvents(); |
752 | if ( mSyncMode ) | 758 | if ( mSyncMode ) |
753 | appendEvent(event, 1); | 759 | appendEvent(event, 1); |
754 | else | 760 | else |
755 | appendEvent(event); | 761 | appendEvent(event); |
756 | } | 762 | } |
757 | 763 | ||
758 | void KOEventViewer::addEvent(Event *event) | 764 | void KOEventViewer::addEvent(Event *event) |
759 | { | 765 | { |
760 | if ( mSyncMode ) | 766 | if ( mSyncMode ) |
761 | appendEvent(event, 2); | 767 | appendEvent(event, 2); |
762 | else | 768 | else |
763 | appendEvent(event); | 769 | appendEvent(event); |
764 | } | 770 | } |
765 | 771 | ||
766 | void KOEventViewer::clearEvents(bool now) | 772 | void KOEventViewer::clearEvents(bool now) |
767 | { | 773 | { |
768 | mText = ""; | 774 | mText = ""; |
769 | if (now) setText(mText); | 775 | if (now) setText(mText); |
770 | } | 776 | } |
771 | 777 | ||
772 | void KOEventViewer::addText(QString text) | 778 | void KOEventViewer::addText(QString text) |
773 | { | 779 | { |
774 | mText.append(text); | 780 | mText.append(text); |
775 | setText(mText); | 781 | setText(mText); |
776 | } | 782 | } |
777 | QString KOEventViewer::deTag(QString text) | 783 | QString KOEventViewer::deTag(QString text) |
778 | { | 784 | { |
779 | #if QT_VERSION >= 0x030000 | 785 | #if QT_VERSION >= 0x030000 |
780 | text.replace( '<' , "<" ); | 786 | text.replace( '<' , "<" ); |
781 | text.replace( '>' , ">" ); | 787 | text.replace( '>' , ">" ); |
782 | #else | 788 | #else |
783 | if ( text.find ('<') >= 0 ) { | 789 | if ( text.find ('<') >= 0 ) { |
784 | text.replace( QRegExp("<") , "<" ); | 790 | text.replace( QRegExp("<") , "<" ); |
785 | } | 791 | } |
786 | if ( text.find ('>') >= 0 ) { | 792 | if ( text.find ('>') >= 0 ) { |
787 | text.replace( QRegExp(">") , ">" ); | 793 | text.replace( QRegExp(">") , ">" ); |
788 | } | 794 | } |
789 | #endif | 795 | #endif |
790 | return text; | 796 | return text; |
791 | } | 797 | } |
792 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) | 798 | void KOEventViewer::keyPressEvent ( QKeyEvent * e ) |
793 | { | 799 | { |
794 | switch ( e->key() ) { | 800 | switch ( e->key() ) { |
795 | case Qt::Key_Return: | 801 | case Qt::Key_Return: |
796 | case Qt::Key_Enter : | 802 | case Qt::Key_Enter : |
797 | e->ignore(); | 803 | e->ignore(); |
798 | break; | 804 | break; |
799 | default: | 805 | default: |
800 | QTextBrowser::keyPressEvent ( e ); | 806 | QTextBrowser::keyPressEvent ( e ); |
801 | break; | 807 | break; |
802 | } | 808 | } |
803 | } | 809 | } |