summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-30 08:04:41 (UTC)
committer zautrix <zautrix>2005-06-30 08:04:41 (UTC)
commit00e631189f1dca0d596b6ce5816f2fcde9124bd7 (patch) (unidiff)
treea6e770eef02b128663b3090ec4b3f9c3ac22715f /korganizer
parent0bcf4379652b763423d0c1843cb8ab8945b798bd (diff)
downloadkdepimpi-00e631189f1dca0d596b6ce5816f2fcde9124bd7.zip
kdepimpi-00e631189f1dca0d596b6ce5816f2fcde9124bd7.tar.gz
kdepimpi-00e631189f1dca0d596b6ce5816f2fcde9124bd7.tar.bz2
j fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp2
-rw-r--r--korganizer/koeventviewer.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 3c01eeb..9e2c902 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,199 +1,199 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// Journal Entry 25// Journal Entry
26 26
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qvbox.h> 29#include <qvbox.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qtextcodec.h> 33#include <qtextcodec.h>
34#include <qpixmap.h> 34#include <qpixmap.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qapplication.h> 36#include <qapplication.h>
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <ktextedit.h> 41#include <ktextedit.h>
42#include <kfiledialog.h> 42#include <kfiledialog.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#include <klineedit.h> 45#include <klineedit.h>
46 46
47#include <libkcal/journal.h> 47#include <libkcal/journal.h>
48#include <libkcal/calendarresources.h> 48#include <libkcal/calendarresources.h>
49#include <libkcal/resourcecalendar.h> 49#include <libkcal/resourcecalendar.h>
50#include <kresources/resourceselectdialog.h> 50#include <kresources/resourceselectdialog.h>
51 51
52#include "journalentry.h" 52#include "journalentry.h"
53//#include "journalentry.moc" 53//#include "journalentry.moc"
54#ifndef DESKTOP_VERSION 54#ifndef DESKTOP_VERSION
55#include <qpe/qpeapplication.h> 55#include <qpe/qpeapplication.h>
56#endif 56#endif
57JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 57JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
58 QFrame(parent) 58 QFrame(parent)
59{ 59{
60 heiHint = QApplication::desktop()->height() / 5 ; 60 heiHint = QApplication::desktop()->height() / 5 ;
61 showOnlyMode = false; 61 showOnlyMode = false;
62 mCalendar = calendar; 62 mCalendar = calendar;
63 mJournal = 0; 63 mJournal = 0;
64 visibleMode = true; 64 visibleMode = true;
65 QHBox * vb = new QHBox ( this ); 65 QHBox * vb = new QHBox ( this );
66 QPixmap iconp; 66 QPixmap iconp;
67 67
68 QPushButton * toggleJournal = new QPushButton( vb ); 68 QPushButton * toggleJournal = new QPushButton( vb );
69 iconp = SmallIcon("1updownarrow"); 69 iconp = SmallIcon("1updownarrow");
70 toggleJournal->setPixmap (iconp ) ; 70 toggleJournal->setPixmap (iconp ) ;
71 new QLabel(i18n(" Title: "),vb); 71 new QLabel(" "+i18n("Title: "),vb);
72 mTitle = new KLineEdit ( vb ); 72 mTitle = new KLineEdit ( vb );
73 mTitleLabel = new QLabel(i18n("Title"),vb); 73 mTitleLabel = new QLabel(i18n("Title"),vb);
74 mTitleLabel->setMargin(0); 74 mTitleLabel->setMargin(0);
75 mTitleLabel->setAlignment(AlignCenter); 75 mTitleLabel->setAlignment(AlignCenter);
76 QPushButton * loadTemplate = new QPushButton( vb ); 76 QPushButton * loadTemplate = new QPushButton( vb );
77 QPushButton * saveTemplate = new QPushButton( vb ); 77 QPushButton * saveTemplate = new QPushButton( vb );
78 if ( QApplication::desktop()->width() < 321 ) 78 if ( QApplication::desktop()->width() < 321 )
79 iconp = SmallIcon("fileexport16"); 79 iconp = SmallIcon("fileexport16");
80 else 80 else
81 iconp = SmallIcon("fileexport"); 81 iconp = SmallIcon("fileexport");
82 saveTemplate->setPixmap (iconp ) ; 82 saveTemplate->setPixmap (iconp ) ;
83 int size = saveTemplate->sizeHint().height(); 83 int size = saveTemplate->sizeHint().height();
84 if ( QApplication::desktop()->width() < 321 ) 84 if ( QApplication::desktop()->width() < 321 )
85 iconp = SmallIcon("fileimport16"); 85 iconp = SmallIcon("fileimport16");
86 else 86 else
87 iconp = SmallIcon("fileimport"); 87 iconp = SmallIcon("fileimport");
88 loadTemplate->setPixmap (iconp ) ; 88 loadTemplate->setPixmap (iconp ) ;
89 loadTemplate->setFixedSize( size, size ); 89 loadTemplate->setFixedSize( size, size );
90 saveTemplate->setFixedSize( size, size ); 90 saveTemplate->setFixedSize( size, size );
91 toggleJournal->setFixedSize( size , size ); 91 toggleJournal->setFixedSize( size , size );
92 mEditor = new KTextEdit(this); 92 mEditor = new KTextEdit(this);
93#ifndef DESKTOP_VERSION 93#ifndef DESKTOP_VERSION
94 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 94 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
95#endif 95#endif
96 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 96 mEditor->setWordWrap( KTextEdit::WidgetWidth );
97 QBoxLayout *topLayout = new QVBoxLayout(this); 97 QBoxLayout *topLayout = new QVBoxLayout(this);
98 topLayout->addWidget(vb); 98 topLayout->addWidget(vb);
99 topLayout->addWidget(mEditor); 99 topLayout->addWidget(mEditor);
100 mEditor->installEventFilter(this); 100 mEditor->installEventFilter(this);
101 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 101 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
102 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 102 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
103 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 103 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
104} 104}
105 105
106JournalEntry::~JournalEntry() 106JournalEntry::~JournalEntry()
107{ 107{
108 //qDebug("JournalEntry::~JournalEntry() "); 108 //qDebug("JournalEntry::~JournalEntry() ");
109} 109}
110QSize JournalEntry::sizeHint() const 110QSize JournalEntry::sizeHint() const
111{ 111{
112 return QSize ( 240, heiHint ); 112 return QSize ( 240, heiHint );
113} 113}
114void JournalEntry::slotSaveTemplate() 114void JournalEntry::slotSaveTemplate()
115{ 115{
116 QString fileName =locateLocal( "templates", "journals" ); 116 QString fileName =locateLocal( "templates", "journals" );
117 QDir t_dir; 117 QDir t_dir;
118 if ( !t_dir.exists(fileName) ) 118 if ( !t_dir.exists(fileName) )
119 t_dir.mkdir ( fileName ); 119 t_dir.mkdir ( fileName );
120 fileName += "/journal"; 120 fileName += "/journal";
121 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 121 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
122 if ( fileName.length() == 0 ) 122 if ( fileName.length() == 0 )
123 return; 123 return;
124 124
125 QFile fileIn( fileName ); 125 QFile fileIn( fileName );
126 if (!fileIn.open( IO_WriteOnly ) ) { 126 if (!fileIn.open( IO_WriteOnly ) ) {
127 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 127 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
128 .arg( fileName ) ); 128 .arg( fileName ) );
129 return; 129 return;
130 } 130 }
131 // QString text; 131 // QString text;
132 QTextStream tsIn( &fileIn ); 132 QTextStream tsIn( &fileIn );
133 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 133 tsIn.setCodec( QTextCodec::codecForName("utf8") );
134 tsIn << mEditor->text(); 134 tsIn << mEditor->text();
135 fileIn.close(); 135 fileIn.close();
136} 136}
137void JournalEntry::slotLoadTemplate() 137void JournalEntry::slotLoadTemplate()
138{ 138{
139 QString fileName =locateLocal( "templates", "journals" ); 139 QString fileName =locateLocal( "templates", "journals" );
140 QDir t_dir; 140 QDir t_dir;
141 if ( !t_dir.exists(fileName) ) 141 if ( !t_dir.exists(fileName) )
142 t_dir.mkdir ( fileName ); 142 t_dir.mkdir ( fileName );
143 fileName += "/journal"; 143 fileName += "/journal";
144 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); 144 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
145 if ( fileName.length() == 0 ) 145 if ( fileName.length() == 0 )
146 return; 146 return;
147 QFile fileIn( fileName ); 147 QFile fileIn( fileName );
148 if (!fileIn.open( IO_ReadOnly ) ) { 148 if (!fileIn.open( IO_ReadOnly ) ) {
149 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 149 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
150 .arg( fileName ) ); 150 .arg( fileName ) );
151 return; 151 return;
152 } 152 }
153 QTextStream tsIn( &fileIn ); 153 QTextStream tsIn( &fileIn );
154 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 154 tsIn.setCodec( QTextCodec::codecForName("utf8") );
155 QString text = tsIn.read(); 155 QString text = tsIn.read();
156 fileIn.close(); 156 fileIn.close();
157 int line, col; 157 int line, col;
158 mEditor->getCursorPosition (& line, & col ); 158 mEditor->getCursorPosition (& line, & col );
159 mEditor-> insertAt ( text, line, col, true ); 159 mEditor-> insertAt ( text, line, col, true );
160 //mEditor->setIgnoreMark( true ); 160 //mEditor->setIgnoreMark( true );
161} 161}
162void JournalEntry::setDate(const QDate &date) 162void JournalEntry::setDate(const QDate &date)
163{ 163{
164 showOnlyMode = false; 164 showOnlyMode = false;
165 mDate = date; 165 mDate = date;
166 writeJournal(); 166 writeJournal();
167 int id = mCalendar->defaultCalendar(); 167 int id = mCalendar->defaultCalendar();
168 QString calname = KOPrefs::instance()->getCalendar( id )->mName; 168 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
169 mTitleLabel->setText( " (" + calname +")"); 169 mTitleLabel->setText( " (" + calname +")");
170} 170}
171 171
172void JournalEntry::toggleShowJournal() 172void JournalEntry::toggleShowJournal()
173{ 173{
174 if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) 174 if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty())
175 flushEntry(); 175 flushEntry();
176 if ( showOnlyMode ) 176 if ( showOnlyMode )
177 emit showJournalOnly( 0 ); 177 emit showJournalOnly( 0 );
178 else { 178 else {
179 // we have to protect mJournal from deleting if mJournal has empty text 179 // we have to protect mJournal from deleting if mJournal has empty text
180 visibleMode = false; // set to true via :setShowOnly() 180 visibleMode = false; // set to true via :setShowOnly()
181 emit showJournalOnly( mJournal ); 181 emit showJournalOnly( mJournal );
182 } 182 }
183} 183}
184void JournalEntry::setShowOnly() 184void JournalEntry::setShowOnly()
185{ 185{
186 showOnlyMode = true; 186 showOnlyMode = true;
187 mEditor->setFocus(); 187 mEditor->setFocus();
188 visibleMode = true; 188 visibleMode = true;
189} 189}
190void JournalEntry::setJournal(Journal *journal) 190void JournalEntry::setJournal(Journal *journal)
191{ 191{
192 writeJournal(); 192 writeJournal();
193 193
194 mJournal = journal; 194 mJournal = journal;
195 if ( journal->isReadOnly() ) 195 if ( journal->isReadOnly() )
196 mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); 196 mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")");
197 else 197 else
198 mTitle->setText(mJournal->summary()); 198 mTitle->setText(mJournal->summary());
199 mEditor->setText(mJournal->description()); 199 mEditor->setText(mJournal->description());
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 52c5247..d3b2ccf 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -563,247 +563,247 @@ void KOEventViewer::formatCategories(Incidence *event)
563void KOEventViewer::formatAttendees(Incidence *event) 563void KOEventViewer::formatAttendees(Incidence *event)
564{ 564{
565 QPtrList<Attendee> attendees = event->attendees(); 565 QPtrList<Attendee> attendees = event->attendees();
566 if (attendees.count()) { 566 if (attendees.count()) {
567 567
568 568
569 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 569 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
570 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 570 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
571 addTag("h3",i18n("Organizer")); 571 addTag("h3",i18n("Organizer"));
572 mText.append("<ul><li>"); 572 mText.append("<ul><li>");
573#ifndef KORG_NOKABC 573#ifndef KORG_NOKABC
574 574
575#ifdef DESKTOP_VERSION 575#ifdef DESKTOP_VERSION
576 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 576 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
577 KABC::Addressee::List addressList; 577 KABC::Addressee::List addressList;
578 addressList = add_book->findByEmail(event->organizer()); 578 addressList = add_book->findByEmail(event->organizer());
579 KABC::Addressee o = addressList.first(); 579 KABC::Addressee o = addressList.first();
580 if (!o.isEmpty() && addressList.size()<2) { 580 if (!o.isEmpty() && addressList.size()<2) {
581 mText += "<a href=\"uid:" + o.uid() + "\">"; 581 mText += "<a href=\"uid:" + o.uid() + "\">";
582 mText += o.formattedName(); 582 mText += o.formattedName();
583 mText += "</a>\n"; 583 mText += "</a>\n";
584 } else { 584 } else {
585 mText.append(event->organizer()); 585 mText.append(event->organizer());
586 } 586 }
587#else //DESKTOP_VERSION 587#else //DESKTOP_VERSION
588 mText += "<a href=\"uid:organizer\">"; 588 mText += "<a href=\"uid:organizer\">";
589 mText += event->organizer(); 589 mText += event->organizer();
590 mText += "</a>\n"; 590 mText += "</a>\n";
591#endif //DESKTOP_VERSION 591#endif //DESKTOP_VERSION
592 592
593 593
594#else 594#else
595 mText.append(event->organizer()); 595 mText.append(event->organizer());
596#endif 596#endif
597 597
598 if (iconPath) { 598 if (iconPath) {
599 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 599 mText += " <a href=\"mailto:" + event->organizer() + "\">";
600 mText += "<IMG src=\"" + iconPath + "\">"; 600 mText += "<IMG src=\"" + iconPath + "\">";
601 mText += "</a>\n"; 601 mText += "</a>\n";
602 } 602 }
603 mText.append("</li></ul>"); 603 mText.append("</li></ul>");
604 604
605 addTag("h3",i18n("Attendees")); 605 addTag("h3",i18n("Attendees"));
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}
688void KOEventViewer::appendJournal(Journal *jour, int mode ) 688void KOEventViewer::appendJournal(Journal *jour, int mode )
689{ 689{
690 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 690 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
691 QString text_d = i18n("Journal from: ");
692 if ( !jour->summary().isEmpty() )
693 text_d = jour->summary();
691 if (mode == 0 ) { 694 if (mode == 0 ) {
692 addTag("h2",i18n("Journal from: ")); 695 addTag("h2", text_d );
693 } 696 }
694 else { 697 else {
695 if ( mode == 1 ) { 698 if ( mode == 1 ) {
696 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 699 addTag("h3",i18n( "Local: " ) + text_d );
697 } else { 700 } else {
698 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 701 addTag("h3",i18n( "Remote: " ) + text_d );
699 } 702 }
700 } 703 }
701 topLevelWidget()->setCaption("Journal Viewer"); 704 topLevelWidget()->setCaption("Journal Viewer");
702 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 705 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
703 if (!jour->summary().isEmpty()) {
704 addTag("b",i18n(" Title: ") + deTag(jour->summary()));
705 }
706 formatReadOnly(jour); 706 formatReadOnly(jour);
707 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 707 addTag("p","<b>"+i18n( "Last modified: " ) + "</b>"+KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
708 708
709 if (!jour->description().isEmpty()) { 709 if (!jour->description().isEmpty()) {
710 addTag("p",deTag(jour->description())); 710 addTag("p",deTag(jour->description()));
711 } 711 }
712 setText(mText); 712 setText(mText);
713} 713}
714 714
715void KOEventViewer::formatReadOnly(Incidence *event) 715void KOEventViewer::formatReadOnly(Incidence *event)
716{ 716{
717 int id = event->calID(); 717 int id = event->calID();
718 if ( id > 1 ) { 718 if ( id > 1 ) {
719 addTag("p", "<em>("+i18n("Calendar:")+" " + KOPrefs::instance()->getCalendar( id )->mName + ")</em>"); 719 addTag("p", "<em>("+i18n("Calendar:")+" " + KOPrefs::instance()->getCalendar( id )->mName + ")</em>");
720 } 720 }
721 if (event->isReadOnly()) { 721 if (event->isReadOnly()) {
722 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 722 addTag("p","<em>(" + i18n("read-only") + ")</em>");
723 } 723 }
724} 724}
725void KOEventViewer::setSyncMode( bool b ) 725void KOEventViewer::setSyncMode( bool b )
726{ 726{
727 mSyncMode = b; 727 mSyncMode = b;
728} 728}
729 729
730void KOEventViewer::setTodo(Todo *event, bool clearV ) 730void KOEventViewer::setTodo(Todo *event, bool clearV )
731{ 731{
732 if ( clearV ) 732 if ( clearV )
733 clearEvents(); 733 clearEvents();
734 if ( mSyncMode ) { 734 if ( mSyncMode ) {
735 if ( clearV ) 735 if ( clearV )
736 appendTodo(event,1 ); 736 appendTodo(event,1 );
737 else 737 else
738 appendTodo(event,2); 738 appendTodo(event,2);
739 } else 739 } else
740 appendTodo(event); 740 appendTodo(event);
741} 741}
742void KOEventViewer::setJournal(Journal *event, bool clearV ) 742void KOEventViewer::setJournal(Journal *event, bool clearV )
743{ 743{
744 if ( clearV ) 744 if ( clearV )
745 clearEvents(); 745 clearEvents();
746 if ( mSyncMode ) { 746 if ( mSyncMode ) {
747 if ( clearV ) 747 if ( clearV )
748 appendJournal(event, 1); 748 appendJournal(event, 1);
749 else 749 else
750 appendJournal(event, 2); 750 appendJournal(event, 2);
751 } else 751 } else
752 appendJournal(event); 752 appendJournal(event);
753} 753}
754 754
755void KOEventViewer::setEvent(Event *event) 755void KOEventViewer::setEvent(Event *event)
756{ 756{
757 clearEvents(); 757 clearEvents();
758 if ( mSyncMode ) 758 if ( mSyncMode )
759 appendEvent(event, 1); 759 appendEvent(event, 1);
760 else 760 else
761 appendEvent(event); 761 appendEvent(event);
762} 762}
763 763
764void KOEventViewer::addEvent(Event *event) 764void KOEventViewer::addEvent(Event *event)
765{ 765{
766 if ( mSyncMode ) 766 if ( mSyncMode )
767 appendEvent(event, 2); 767 appendEvent(event, 2);
768 else 768 else
769 appendEvent(event); 769 appendEvent(event);
770} 770}
771 771
772void KOEventViewer::clearEvents(bool now) 772void KOEventViewer::clearEvents(bool now)
773{ 773{
774 mText = ""; 774 mText = "";
775 if (now) setText(mText); 775 if (now) setText(mText);
776} 776}
777 777
778void KOEventViewer::addText(QString text) 778void KOEventViewer::addText(QString text)
779{ 779{
780 mText.append(text); 780 mText.append(text);
781 setText(mText); 781 setText(mText);
782} 782}
783QString KOEventViewer::deTag(QString text) 783QString KOEventViewer::deTag(QString text)
784{ 784{
785#if QT_VERSION >= 0x030000 785#if QT_VERSION >= 0x030000
786 text.replace( '<' , "&lt;" ); 786 text.replace( '<' , "&lt;" );
787 text.replace( '>' , "&gt;" ); 787 text.replace( '>' , "&gt;" );
788#else 788#else
789 if ( text.find ('<') >= 0 ) { 789 if ( text.find ('<') >= 0 ) {
790 text.replace( QRegExp("<") , "&lt;" ); 790 text.replace( QRegExp("<") , "&lt;" );
791 } 791 }
792 if ( text.find ('>') >= 0 ) { 792 if ( text.find ('>') >= 0 ) {
793 text.replace( QRegExp(">") , "&gt;" ); 793 text.replace( QRegExp(">") , "&gt;" );
794 } 794 }
795#endif 795#endif
796 return text; 796 return text;
797} 797}
798void KOEventViewer::keyPressEvent ( QKeyEvent * e ) 798void KOEventViewer::keyPressEvent ( QKeyEvent * e )
799{ 799{
800 switch ( e->key() ) { 800 switch ( e->key() ) {
801 case Qt::Key_Return: 801 case Qt::Key_Return:
802 case Qt::Key_Enter : 802 case Qt::Key_Enter :
803 e->ignore(); 803 e->ignore();
804 break; 804 break;
805 default: 805 default:
806 QTextBrowser::keyPressEvent ( e ); 806 QTextBrowser::keyPressEvent ( e );
807 break; 807 break;
808 } 808 }
809} 809}