summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-17 00:39:46 (UTC)
committer zautrix <zautrix>2004-09-17 00:39:46 (UTC)
commit14f8adb33ca434d36e80b3b7e7e262f4ede24d0d (patch) (unidiff)
tree477f0cbf3c5b4d8e5b1c01c682c5e650f34c2912
parent8462751df135b9ad08b1269661d2c7eb18c67976 (diff)
downloadkdepimpi-14f8adb33ca434d36e80b3b7e7e262f4ede24d0d.zip
kdepimpi-14f8adb33ca434d36e80b3b7e7e262f4ede24d0d.tar.gz
kdepimpi-14f8adb33ca434d36e80b3b7e7e262f4ede24d0d.tar.bz2
More lib changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookE.pro2
-rw-r--r--korganizer/koeventviewer.cpp10
-rw-r--r--libkcal/kincidenceformatter.cpp328
-rw-r--r--libkcal/kincidenceformatter.h42
-rw-r--r--libkcal/libkcalE.pro2
-rw-r--r--libkdepim/libkdepimE.pro6
-rwxr-xr-xsetZaurus324
7 files changed, 405 insertions, 9 deletions
diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro
index c027895..7eb85fd 100644
--- a/kaddressbook/kaddressbookE.pro
+++ b/kaddressbook/kaddressbookE.pro
@@ -1,161 +1,161 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 3
4 4
5 TARGET = kapi 5 TARGET = kapi
6OBJECTS_DIR = obj/$(PLATFORM) 6OBJECTS_DIR = obj/$(PLATFORM)
7MOC_DIR = moc/$(PLATFORM) 7MOC_DIR = moc/$(PLATFORM)
8DESTDIR=$(QPEDIR)/bin 8DESTDIR=$(QPEDIR)/bin
9 9
10INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include 10INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include
11DEFINES += KAB_EMBEDDED KAB_NOSPLITTER 11DEFINES += KAB_EMBEDDED KAB_NOSPLITTER
12#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL 12#DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL
13#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 13#DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
14#DEFINES += KORG_NOLVALTERNATION 14#DEFINES += KORG_NOLVALTERNATION
15#LIBS += -lmicrokdepim 15LIBS += -lmicrokdepim
16#LIBS += -lmicrokcal 16#LIBS += -lmicrokcal
17LIBS += -lmicrokde 17LIBS += -lmicrokde
18LIBS += -lmicroqtcompat 18LIBS += -lmicroqtcompat
19LIBS += -lmicrokabc 19LIBS += -lmicrokabc
20LIBS += -lqpe 20LIBS += -lqpe
21LIBS += -ljpeg 21LIBS += -ljpeg
22LIBS += $(QTOPIALIB) 22LIBS += $(QTOPIALIB)
23LIBS += -L$(QPEDIR)/lib 23LIBS += -L$(QPEDIR)/lib
24LIBS += -Wl,-export-dynamic 24LIBS += -Wl,-export-dynamic
25LIBS += $(GCC3EXTRALIB1) 25LIBS += $(GCC3EXTRALIB1)
26LIBS += $(GCC3EXTRALIB2) 26LIBS += $(GCC3EXTRALIB2)
27 27
28INTERFACES = \ 28INTERFACES = \
29# filteredit_base.ui \ 29# filteredit_base.ui \
30# kofilterview_base.ui \ 30# kofilterview_base.ui \
31 31
32HEADERS = \ 32HEADERS = \
33features/mergewidget.h \ 33features/mergewidget.h \
34features/distributionlistwidget.h \ 34features/distributionlistwidget.h \
35kcmconfigs/addresseewidget.h \ 35kcmconfigs/addresseewidget.h \
36kcmconfigs/extensionconfigdialog.h \ 36kcmconfigs/extensionconfigdialog.h \
37kcmconfigs/kcmkabconfig.h \ 37kcmconfigs/kcmkabconfig.h \
38kcmconfigs/kabconfigwidget.h \ 38kcmconfigs/kabconfigwidget.h \
39addresseeeditordialog.h \ 39addresseeeditordialog.h \
40addresseeeditorwidget.h \ 40addresseeeditorwidget.h \
41addresseditwidget.h \ 41addresseditwidget.h \
42addresseeconfig.h \ 42addresseeconfig.h \
43addresseeutil.h \ 43addresseeutil.h \
44emaileditwidget.h \ 44emaileditwidget.h \
45filtereditdialog.h \ 45filtereditdialog.h \
46kaddressbookmain.h \ 46kaddressbookmain.h \
47kabprefs.h \ 47kabprefs.h \
48kabcore.h \ 48kabcore.h \
49viewmanager.h \ 49viewmanager.h \
50extensionmanager.h \ 50extensionmanager.h \
51extensionwidget.h \ 51extensionwidget.h \
52kaddressbookview.h \ 52kaddressbookview.h \
53geowidget.h \ 53geowidget.h \
54imagewidget.h \ 54imagewidget.h \
55incsearchwidget.h \ 55incsearchwidget.h \
56jumpbuttonbar.h \ 56jumpbuttonbar.h \
57phoneeditwidget.h \ 57phoneeditwidget.h \
58secrecywidget.h \ 58secrecywidget.h \
59keywidget.h \ 59keywidget.h \
60nameeditdialog.h \ 60nameeditdialog.h \
61filter.h \ 61filter.h \
62addviewdialog.h \ 62addviewdialog.h \
63configurewidget.h \ 63configurewidget.h \
64viewconfigurewidget.h \ 64viewconfigurewidget.h \
65viewconfigurefieldspage.h \ 65viewconfigurefieldspage.h \
66viewconfigurefilterpage.h \ 66viewconfigurefilterpage.h \
67typecombo.h \ 67typecombo.h \
68undo.h \ 68undo.h \
69undocmds.h \ 69undocmds.h \
70xxportmanager.h \ 70xxportmanager.h \
71xxportobject.h \ 71xxportobject.h \
72xxportselectdialog.h \ 72xxportselectdialog.h \
73details/detailsviewcontainer.h \ 73details/detailsviewcontainer.h \
74details/look_basic.h \ 74details/look_basic.h \
75details/look_html.h \ 75details/look_html.h \
76views/kaddressbookiconview.h \ 76views/kaddressbookiconview.h \
77views/kaddressbooktableview.h \ 77views/kaddressbooktableview.h \
78views/kaddressbookcardview.h \ 78views/kaddressbookcardview.h \
79views/configuretableviewdialog.h \ 79views/configuretableviewdialog.h \
80views/configurecardviewdialog.h \ 80views/configurecardviewdialog.h \
81views/cardview.h \ 81views/cardview.h \
82views/colorlistbox.h \ 82views/colorlistbox.h \
83views/contactlistview.h \ 83views/contactlistview.h \
84xxport/vcard_xxport.h \ 84xxport/vcard_xxport.h \
85xxport/kde2_xxport.h \ 85xxport/kde2_xxport.h \
86xxport/csv_xxport.h \ 86xxport/csv_xxport.h \
87xxport/csvimportdialog.h \ 87xxport/csvimportdialog.h \
88xxport/opie_xxport.h \ 88xxport/opie_xxport.h \
89xxport/qtopia_xxport.h \ 89xxport/qtopia_xxport.h \
90xxport/sharpdtm_xxport.h \ 90xxport/sharpdtm_xxport.h \
91#details/look_details.h \ 91#details/look_details.h \
92#mainwindoiw.h \ 92#mainwindoiw.h \
93# alarmclient.h \ 93# alarmclient.h \
94# calendarview.h \ 94# calendarview.h \
95# customlistviewitem.h \ 95# customlistviewitem.h \
96# datenavigator.h 96# datenavigator.h
97 97
98SOURCES = \ 98SOURCES = \
99addresseeeditordialog.cpp \ 99addresseeeditordialog.cpp \
100addresseeeditorwidget.cpp \ 100addresseeeditorwidget.cpp \
101addresseditwidget.cpp \ 101addresseditwidget.cpp \
102addresseeconfig.cpp \ 102addresseeconfig.cpp \
103addresseeutil.cpp \ 103addresseeutil.cpp \
104extensionmanager.cpp \ 104extensionmanager.cpp \
105features/mergewidget.cpp \ 105features/mergewidget.cpp \
106features/distributionlistwidget.cpp \ 106features/distributionlistwidget.cpp \
107kcmconfigs/addresseewidget.cpp \ 107kcmconfigs/addresseewidget.cpp \
108kcmconfigs/extensionconfigdialog.cpp \ 108kcmconfigs/extensionconfigdialog.cpp \
109kcmconfigs/kcmkabconfig.cpp \ 109kcmconfigs/kcmkabconfig.cpp \
110kcmconfigs/kabconfigwidget.cpp \ 110kcmconfigs/kabconfigwidget.cpp \
111emaileditwidget.cpp \ 111emaileditwidget.cpp \
112filtereditdialog.cpp \ 112filtereditdialog.cpp \
113mainembedded.cpp \ 113mainembedded.cpp \
114kaddressbookmain.cpp \ 114kaddressbookmain.cpp \
115kabcore.cpp \ 115kabcore.cpp \
116kabprefs.cpp \ 116kabprefs.cpp \
117viewmanager.cpp \ 117viewmanager.cpp \
118kaddressbookview.cpp \ 118kaddressbookview.cpp \
119extensionwidget.cpp \ 119extensionwidget.cpp \
120geowidget.cpp \ 120geowidget.cpp \
121imagewidget.cpp \ 121imagewidget.cpp \
122incsearchwidget.cpp \ 122incsearchwidget.cpp \
123jumpbuttonbar.cpp \ 123jumpbuttonbar.cpp \
124phoneeditwidget.cpp \ 124phoneeditwidget.cpp \
125secrecywidget.cpp \ 125secrecywidget.cpp \
126keywidget.cpp \ 126keywidget.cpp \
127nameeditdialog.cpp \ 127nameeditdialog.cpp \
128filter.cpp \ 128filter.cpp \
129addviewdialog.cpp \ 129addviewdialog.cpp \
130configurewidget.cpp \ 130configurewidget.cpp \
131viewconfigurewidget.cpp \ 131viewconfigurewidget.cpp \
132viewconfigurefieldspage.cpp \ 132viewconfigurefieldspage.cpp \
133viewconfigurefilterpage.cpp \ 133viewconfigurefilterpage.cpp \
134undo.cpp \ 134undo.cpp \
135undocmds.cpp \ 135undocmds.cpp \
136xxportmanager.cpp \ 136xxportmanager.cpp \
137xxportobject.cpp \ 137xxportobject.cpp \
138xxportselectdialog.cpp \ 138xxportselectdialog.cpp \
139details/detailsviewcontainer.cpp \ 139details/detailsviewcontainer.cpp \
140details/look_basic.cpp \ 140details/look_basic.cpp \
141details/look_html.cpp \ 141details/look_html.cpp \
142views/kaddressbookiconview.cpp \ 142views/kaddressbookiconview.cpp \
143views/kaddressbooktableview.cpp \ 143views/kaddressbooktableview.cpp \
144views/kaddressbookcardview.cpp \ 144views/kaddressbookcardview.cpp \
145views/configuretableviewdialog.cpp \ 145views/configuretableviewdialog.cpp \
146views/configurecardviewdialog.cpp \ 146views/configurecardviewdialog.cpp \
147views/cardview.cpp \ 147views/cardview.cpp \
148views/contactlistview.cpp \ 148views/contactlistview.cpp \
149views/colorlistbox.cpp \ 149views/colorlistbox.cpp \
150xxport/vcard_xxport.cpp \ 150xxport/vcard_xxport.cpp \
151xxport/kde2_xxport.cpp \ 151xxport/kde2_xxport.cpp \
152xxport/csv_xxport.cpp \ 152xxport/csv_xxport.cpp \
153xxport/csvimportdialog.cpp \ 153xxport/csvimportdialog.cpp \
154xxport/opie_xxport.cpp \ 154xxport/opie_xxport.cpp \
155xxport/qtopia_xxport.cpp \ 155xxport/qtopia_xxport.cpp \
156xxport/sharpdtm_xxport.cpp \ 156xxport/sharpdtm_xxport.cpp \
157#details/look_details.cpp \ 157#details/look_details.cpp \
158#mainwindow.cpp \ 158#mainwindow.cpp \
159# calendarview.cpp \ 159# calendarview.cpp \
160# timespanview.cpp 160# timespanview.cpp
161 161
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 948047a..e938e4e 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,439 +1,439 @@
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 19
20#include <qcstring.h> 20#include <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <libkdepim/addresseeview.h>
39#include <kabc/stdaddressbook.h> 38#include <kabc/stdaddressbook.h>
40 39
41#ifndef KORG_NODCOP 40#ifndef KORG_NODCOP
42#include <dcopclient.h> 41#include <dcopclient.h>
43#include "korganizer.h" 42#include "korganizer.h"
44#include "koprefs.h" 43#include "koprefs.h"
45#include "actionmanager.h" 44#include "actionmanager.h"
46#endif 45#endif
47 46
48#include "koeventviewer.h" 47#include "koeventviewer.h"
49#ifndef KORG_NOKABC 48//#ifndef KORG_NOKABC
50#include <kabc/stdaddressbook.h> 49//#include <kabc/stdaddressbook.h>
51#define size count 50//#define size count
52#endif 51//#endif
53 52
54#ifdef DESKTOP_VERSION 53#ifdef DESKTOP_VERSION
55#include <kabc/addresseedialog.h> 54#include <kabc/addresseedialog.h>
55#include <kabc/addresseeview.h>
56#else //DESKTOP_VERSION 56#else //DESKTOP_VERSION
57#include <externalapphandler.h> 57#include <externalapphandler.h>
58#include <qtopia/qcopenvelope_qws.h> 58#include <qtopia/qcopenvelope_qws.h>
59#endif //DESKTOP_VERSION 59#endif //DESKTOP_VERSION
60 60
61KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 61KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
62 : QTextBrowser(parent,name) 62 : QTextBrowser(parent,name)
63{ 63{
64 mSyncMode = false; 64 mSyncMode = false;
65 mColorMode = 0; 65 mColorMode = 0;
66} 66}
67 67
68KOEventViewer::~KOEventViewer() 68KOEventViewer::~KOEventViewer()
69{ 69{
70} 70}
71 71
72void KOEventViewer::setSource(const QString& n) 72void KOEventViewer::setSource(const QString& n)
73{ 73{
74 74
75 if ( n.left(3) == "uid" ) 75 if ( n.left(3) == "uid" )
76#ifdef DESKTOP_VERSION 76#ifdef DESKTOP_VERSION
77 { 77 {
78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
79 KABC::AddressBook::Iterator it; 79 KABC::AddressBook::Iterator it;
80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
81 // LR I do not understand, why the uid string is different on zaurus and desktop 81 // LR I do not understand, why the uid string is different on zaurus and desktop
82 QString uid = "uid://"+(*it).uid(); 82 QString uid = "uid://"+(*it).uid();
83 83
84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
85 if (n == uid ) { 85 if (n == uid ) {
86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
87 QDialog dia( this,"dia123", true ); 87 QDialog dia( this,"dia123", true );
88 dia.setCaption( i18n("Details of attendee") ); 88 dia.setCaption( i18n("Details of attendee") );
89 QVBoxLayout lay ( &dia ); 89 QVBoxLayout lay ( &dia );
90 KPIM::AddresseeView av ( &dia ); 90 KPIM::AddresseeView av ( &dia );
91 av.setAddressee( (*it) ); 91 av.setAddressee( (*it) );
92 lay.addWidget( &av ); 92 lay.addWidget( &av );
93 if ( QApplication::desktop()->width() < 480 ) 93 if ( QApplication::desktop()->width() < 480 )
94 dia.resize( 220, 240); 94 dia.resize( 220, 240);
95 else { 95 else {
96 dia.resize( 400,400); 96 dia.resize( 400,400);
97 } 97 }
98 dia.exec(); 98 dia.exec();
99 break; 99 break;
100 } 100 }
101 } 101 }
102 return; 102 return;
103 } 103 }
104#else 104#else
105 { 105 {
106 if ( "uid:organizer" == n ) { 106 if ( "uid:organizer" == n ) {
107 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); 107 ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),"");
108 return; 108 return;
109 } 109 }
110 QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); 110 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
111 if (attendees.count()) { 111 if (attendees.count()) {
112 Attendee *a; 112 Attendee *a;
113 for(a=attendees.first();a;a=attendees.next()) { 113 for(a=attendees.first();a;a=attendees.next()) {
114 if ( "uid:"+a->uid() == n ) { 114 if ( "uid:"+a->uid() == n ) {
115 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); 115 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid());
116 return; 116 return;
117 } 117 }
118 } 118 }
119 } 119 }
120 return; 120 return;
121 } 121 }
122 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); 122 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
123 // the result should now arrive through method insertAttendees 123 // the result should now arrive through method insertAttendees
124 //QString uid = "uid:"+(*it).uid(); 124 //QString uid = "uid:"+(*it).uid();
125#endif 125#endif
126 if ( n.left(6) == "mailto" ) { 126 if ( n.left(6) == "mailto" ) {
127 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 127 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
128#ifndef DESKTOP_VERSION 128#ifndef DESKTOP_VERSION
129 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); 129 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
130 e << n.mid(7); 130 e << n.mid(7);
131#endif 131#endif
132 132
133 } 133 }
134 134
135 135
136#ifndef KORG_NODCOP 136#ifndef KORG_NODCOP
137 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 137 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
138 QString tmpStr; 138 QString tmpStr;
139 if (n.startsWith("mailto:")) { 139 if (n.startsWith("mailto:")) {
140 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 140 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
141 //emit showIncidence(n); 141 //emit showIncidence(n);
142 return; 142 return;
143 } else if (n.startsWith("uid:")) { 143 } else if (n.startsWith("uid:")) {
144 DCOPClient *client = KApplication::kApplication()->dcopClient(); 144 DCOPClient *client = KApplication::kApplication()->dcopClient();
145 const QByteArray noParamData; 145 const QByteArray noParamData;
146 const QByteArray paramData; 146 const QByteArray paramData;
147 QByteArray replyData; 147 QByteArray replyData;
148 QCString replyTypeStr; 148 QCString replyTypeStr;
149#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 149#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
150 bool foundAbbrowser = PING_ABBROWSER; 150 bool foundAbbrowser = PING_ABBROWSER;
151 151
152 if (foundAbbrowser) { 152 if (foundAbbrowser) {
153 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 153 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
154 //client->send("kaddressbook","KAddressBookIface", 154 //client->send("kaddressbook","KAddressBookIface",
155 QDataStream arg(paramData, IO_WriteOnly); 155 QDataStream arg(paramData, IO_WriteOnly);
156 arg << n.mid(6); 156 arg << n.mid(6);
157 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 157 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
158 return; 158 return;
159 } else { 159 } else {
160 /* 160 /*
161 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 161 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
162 We start it without its main interface 162 We start it without its main interface
163 */ 163 */
164 KIconLoader* iconLoader = new KIconLoader(); 164 KIconLoader* iconLoader = new KIconLoader();
165 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 165 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
166 ActionManager::setStartedKAddressBook(true); 166 ActionManager::setStartedKAddressBook(true);
167 tmpStr = "kaddressbook --editor-only --uid "; 167 tmpStr = "kaddressbook --editor-only --uid ";
168 tmpStr += KProcess::quote(n.mid(6)); 168 tmpStr += KProcess::quote(n.mid(6));
169 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 169 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
170 return; 170 return;
171 } 171 }
172 } else { 172 } else {
173 //QTextBrowser::setSource(n); 173 //QTextBrowser::setSource(n);
174 } 174 }
175#endif 175#endif
176} 176}
177 177
178void KOEventViewer::addTag(const QString & tag,const QString & text) 178void KOEventViewer::addTag(const QString & tag,const QString & text)
179{ 179{
180 int number=text.contains("\n"); 180 int number=text.contains("\n");
181 QString str = "<" + tag + ">"; 181 QString str = "<" + tag + ">";
182 QString tmpText=text; 182 QString tmpText=text;
183 QString tmpStr=str; 183 QString tmpStr=str;
184 if(number !=-1) 184 if(number !=-1)
185 { 185 {
186 if (number > 0) { 186 if (number > 0) {
187 int pos=0; 187 int pos=0;
188 QString tmp; 188 QString tmp;
189 for(int i=0;i<=number;i++) { 189 for(int i=0;i<=number;i++) {
190 pos=tmpText.find("\n"); 190 pos=tmpText.find("\n");
191 tmp=tmpText.left(pos); 191 tmp=tmpText.left(pos);
192 tmpText=tmpText.right(tmpText.length()-pos-1); 192 tmpText=tmpText.right(tmpText.length()-pos-1);
193 tmpStr+=tmp+"<br>"; 193 tmpStr+=tmp+"<br>";
194 } 194 }
195 } 195 }
196 else tmpStr += tmpText; 196 else tmpStr += tmpText;
197 tmpStr+="</" + tag + ">"; 197 tmpStr+="</" + tag + ">";
198 mText.append(tmpStr); 198 mText.append(tmpStr);
199 } 199 }
200 else 200 else
201 { 201 {
202 str += text + "</" + tag + ">"; 202 str += text + "</" + tag + ">";
203 mText.append(str); 203 mText.append(str);
204 } 204 }
205} 205}
206 206
207void KOEventViewer::setColorMode( int m ) 207void KOEventViewer::setColorMode( int m )
208{ 208{
209 mColorMode = m; 209 mColorMode = m;
210} 210}
211void KOEventViewer::appendEvent(Event *event, int mode ) 211void KOEventViewer::appendEvent(Event *event, int mode )
212{ 212{
213 mMailSubject = ""; 213 mMailSubject = "";
214 mCurrentIncidence = event; 214 mCurrentIncidence = event;
215 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 215 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
216 topLevelWidget()->setCaption(i18n("Event Viewer")); 216 topLevelWidget()->setCaption(i18n("Event Viewer"));
217 if ( mode == 0 ) { 217 if ( mode == 0 ) {
218 addTag("h2",event->summary()); 218 addTag("h2",event->summary());
219 } 219 }
220 else { 220 else {
221 if ( mColorMode == 1 ) { 221 if ( mColorMode == 1 ) {
222 mText +="<font color=\"#00A000\">"; 222 mText +="<font color=\"#00A000\">";
223 } 223 }
224 if ( mColorMode == 2 ) { 224 if ( mColorMode == 2 ) {
225 mText +="<font color=\"#C00000\">"; 225 mText +="<font color=\"#C00000\">";
226 } 226 }
227 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 227 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
228 if ( mode == 1 ) { 228 if ( mode == 1 ) {
229 addTag("h2",i18n( "Local: " ) +event->summary()); 229 addTag("h2",i18n( "Local: " ) +event->summary());
230 } else { 230 } else {
231 addTag("h2",i18n( "Remote: " ) +event->summary()); 231 addTag("h2",i18n( "Remote: " ) +event->summary());
232 } 232 }
233 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 233 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
234 if ( mColorMode ) 234 if ( mColorMode )
235 mText += "</font>"; 235 mText += "</font>";
236 } 236 }
237 mMailSubject += i18n( "Meeting " )+ event->summary(); 237 mMailSubject += i18n( "Meeting " )+ event->summary();
238 if (event->cancelled ()) { 238 if (event->cancelled ()) {
239 mText +="<font color=\"#B00000\">"; 239 mText +="<font color=\"#B00000\">";
240 addTag("i",i18n("This event has been cancelled!")); 240 addTag("i",i18n("This event has been cancelled!"));
241 mText.append("<br>"); 241 mText.append("<br>");
242 mText += "</font>"; 242 mText += "</font>";
243 mMailSubject += i18n("(cancelled)"); 243 mMailSubject += i18n("(cancelled)");
244 } 244 }
245 if (!event->location().isEmpty()) { 245 if (!event->location().isEmpty()) {
246 addTag("b",i18n("Location: ")); 246 addTag("b",i18n("Location: "));
247 mText.append(event->location()+"<br>"); 247 mText.append(event->location()+"<br>");
248 mMailSubject += i18n(" at ") + event->location(); 248 mMailSubject += i18n(" at ") + event->location();
249 } 249 }
250 if (event->doesFloat()) { 250 if (event->doesFloat()) {
251 if (event->isMultiDay()) { 251 if (event->isMultiDay()) {
252 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 252 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
253 .arg(event->dtStartDateStr(shortDate)) 253 .arg(event->dtStartDateStr(shortDate))
254 .arg(event->dtEndDateStr(shortDate))); 254 .arg(event->dtEndDateStr(shortDate)));
255 } else { 255 } else {
256 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 256 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
257 } 257 }
258 } else { 258 } else {
259 if (event->isMultiDay()) { 259 if (event->isMultiDay()) {
260 mText.append(i18n("<p><b>From:</b> %1</p> ") 260 mText.append(i18n("<p><b>From:</b> %1</p> ")
261 .arg(event->dtStartStr( shortDate))); 261 .arg(event->dtStartStr( shortDate)));
262 mText.append(i18n("<p><b>To:</b> %1</p>") 262 mText.append(i18n("<p><b>To:</b> %1</p>")
263 .arg(event->dtEndStr(shortDate))); 263 .arg(event->dtEndStr(shortDate)));
264 } else { 264 } else {
265 mText.append(i18n("<p><b>On:</b> %1</p> ") 265 mText.append(i18n("<p><b>On:</b> %1</p> ")
266 .arg(event->dtStartDateStr( shortDate ))); 266 .arg(event->dtStartDateStr( shortDate )));
267 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 267 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
268 .arg(event->dtStartTimeStr()) 268 .arg(event->dtStartTimeStr())
269 .arg(event->dtEndTimeStr())); 269 .arg(event->dtEndTimeStr()));
270 } 270 }
271 } 271 }
272 272
273 if (event->recurrence()->doesRecur()) { 273 if (event->recurrence()->doesRecur()) {
274 274
275 QString recurText = event->recurrence()->recurrenceText(); 275 QString recurText = event->recurrence()->recurrenceText();
276 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 276 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
277 bool last; 277 bool last;
278 QDate start = QDate::currentDate(); 278 QDate start = QDate::currentDate();
279 QDate next; 279 QDate next;
280 next = event->recurrence()->getPreviousDate( start , &last ); 280 next = event->recurrence()->getPreviousDate( start , &last );
281 if ( !last ) { 281 if ( !last ) {
282 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 282 next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
283 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 283 addTag("p",i18n("<b>Next recurrence is on:</b>") );
284 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 284 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
285 QDateTime nextdt = QDateTime( next, event->dtStart().time()); 285 QDateTime nextdt = QDateTime( next, event->dtStart().time());
286 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); 286 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true );
287 287
288 } else { 288 } else {
289 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 289 addTag("p",i18n("<b>Last recurrence was on:</b>") );
290 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 290 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
291 } 291 }
292 } else { 292 } else {
293 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 293 mMailSubject += i18n(" - " )+event->dtStartStr( true );
294 294
295 } 295 }
296 296
297 297
298 if (event->isAlarmEnabled()) { 298 if (event->isAlarmEnabled()) {
299 Alarm *alarm =event->alarms().first() ; 299 Alarm *alarm =event->alarms().first() ;
300 QDateTime t = alarm->time(); 300 QDateTime t = alarm->time();
301 int min = t.secsTo( event->dtStart() )/60; 301 int min = t.secsTo( event->dtStart() )/60;
302 QString s =i18n("( %1 min before )").arg( min ); 302 QString s =i18n("( %1 min before )").arg( min );
303 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 303 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
304 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 304 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
305 //addTag("p",s); 305 //addTag("p",s);
306 } 306 }
307 307
308 addTag("b",i18n("Access: ")); 308 addTag("b",i18n("Access: "));
309 mText.append(event->secrecyStr()+"<br>"); 309 mText.append(event->secrecyStr()+"<br>");
310 if (!event->description().isEmpty()) { 310 if (!event->description().isEmpty()) {
311 addTag("p",i18n("<b>Details: </b>")); 311 addTag("p",i18n("<b>Details: </b>"));
312 addTag("p",event->description()); 312 addTag("p",event->description());
313 } 313 }
314 314
315 formatCategories(event); 315 formatCategories(event);
316 316
317 formatReadOnly(event); 317 formatReadOnly(event);
318 formatAttendees(event); 318 formatAttendees(event);
319 319
320 setText(mText); 320 setText(mText);
321 //QWhatsThis::add(this,mText); 321 //QWhatsThis::add(this,mText);
322 322
323} 323}
324 324
325void KOEventViewer::appendTodo(Todo *event, int mode ) 325void KOEventViewer::appendTodo(Todo *event, int mode )
326{ 326{
327 mMailSubject = ""; 327 mMailSubject = "";
328 mCurrentIncidence = event; 328 mCurrentIncidence = event;
329 topLevelWidget()->setCaption(i18n("Todo Viewer")); 329 topLevelWidget()->setCaption(i18n("Todo Viewer"));
330 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 330 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
331 if (mode == 0 ) 331 if (mode == 0 )
332 addTag("h2",event->summary()); 332 addTag("h2",event->summary());
333 else { 333 else {
334 if ( mColorMode == 1 ) { 334 if ( mColorMode == 1 ) {
335 mText +="<font color=\"#00A000\">"; 335 mText +="<font color=\"#00A000\">";
336 } 336 }
337 if ( mColorMode == 2 ) { 337 if ( mColorMode == 2 ) {
338 mText +="<font color=\"#B00000\">"; 338 mText +="<font color=\"#B00000\">";
339 } 339 }
340 if ( mode == 1 ) { 340 if ( mode == 1 ) {
341 addTag("h2",i18n( "Local: " ) +event->summary()); 341 addTag("h2",i18n( "Local: " ) +event->summary());
342 } else { 342 } else {
343 addTag("h2",i18n( "Remote: " ) +event->summary()); 343 addTag("h2",i18n( "Remote: " ) +event->summary());
344 } 344 }
345 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 345 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
346 if ( mColorMode ) 346 if ( mColorMode )
347 mText += "</font>"; 347 mText += "</font>";
348 } 348 }
349 mMailSubject += i18n( "Todo " )+ event->summary(); 349 mMailSubject += i18n( "Todo " )+ event->summary();
350 if (event->cancelled ()) { 350 if (event->cancelled ()) {
351 mText +="<font color=\"#B00000\">"; 351 mText +="<font color=\"#B00000\">";
352 addTag("i",i18n("This todo has been cancelled!")); 352 addTag("i",i18n("This todo has been cancelled!"));
353 mText.append("<br>"); 353 mText.append("<br>");
354 mText += "</font>"; 354 mText += "</font>";
355 mMailSubject += i18n("(cancelled)"); 355 mMailSubject += i18n("(cancelled)");
356 } 356 }
357 357
358 if (!event->location().isEmpty()) { 358 if (!event->location().isEmpty()) {
359 addTag("b",i18n("Location: ")); 359 addTag("b",i18n("Location: "));
360 mText.append(event->location()+"<br>"); 360 mText.append(event->location()+"<br>");
361 mMailSubject += i18n(" at ") + event->location(); 361 mMailSubject += i18n(" at ") + event->location();
362 } 362 }
363 if (event->hasDueDate()) { 363 if (event->hasDueDate()) {
364 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 364 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
365 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 365 mMailSubject += i18n(" - " )+event->dtDueStr( true );
366 } 366 }
367 addTag("b",i18n("Access: ")); 367 addTag("b",i18n("Access: "));
368 mText.append(event->secrecyStr()+"<br>"); 368 mText.append(event->secrecyStr()+"<br>");
369 if (!event->description().isEmpty()) { 369 if (!event->description().isEmpty()) {
370 addTag("p",i18n("<b>Details: </b>")); 370 addTag("p",i18n("<b>Details: </b>"));
371 addTag("p",event->description()); 371 addTag("p",event->description());
372 } 372 }
373 373
374 formatCategories(event); 374 formatCategories(event);
375 375
376 mText.append(i18n("<p><b>Priority:</b> %2</p>") 376 mText.append(i18n("<p><b>Priority:</b> %2</p>")
377 .arg(QString::number(event->priority()))); 377 .arg(QString::number(event->priority())));
378 378
379 mText.append(i18n("<p><i>%1 % completed</i></p>") 379 mText.append(i18n("<p><i>%1 % completed</i></p>")
380 .arg(event->percentComplete())); 380 .arg(event->percentComplete()));
381 381
382 formatReadOnly(event); 382 formatReadOnly(event);
383 formatAttendees(event); 383 formatAttendees(event);
384 384
385 setText(mText); 385 setText(mText);
386} 386}
387 387
388void KOEventViewer::formatCategories(Incidence *event) 388void KOEventViewer::formatCategories(Incidence *event)
389{ 389{
390 if (!event->categoriesStr().isEmpty()) { 390 if (!event->categoriesStr().isEmpty()) {
391 if (event->categories().count() == 1) { 391 if (event->categories().count() == 1) {
392 addTag("h3",i18n("Category")); 392 addTag("h3",i18n("Category"));
393 } else { 393 } else {
394 addTag("h3",i18n("Categories")); 394 addTag("h3",i18n("Categories"));
395 } 395 }
396 addTag("p",event->categoriesStr()); 396 addTag("p",event->categoriesStr());
397 } 397 }
398} 398}
399void KOEventViewer::formatAttendees(Incidence *event) 399void KOEventViewer::formatAttendees(Incidence *event)
400{ 400{
401 QPtrList<Attendee> attendees = event->attendees(); 401 QPtrList<Attendee> attendees = event->attendees();
402 if (attendees.count()) { 402 if (attendees.count()) {
403 403
404 404
405 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 405 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
406 addTag("h3",i18n("Organizer")); 406 addTag("h3",i18n("Organizer"));
407 mText.append("<ul><li>"); 407 mText.append("<ul><li>");
408#ifndef KORG_NOKABC 408#ifndef KORG_NOKABC
409 409
410#ifdef DESKTOP_VERSION 410#ifdef DESKTOP_VERSION
411 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 411 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
412 KABC::Addressee::List addressList; 412 KABC::Addressee::List addressList;
413 addressList = add_book->findByEmail(event->organizer()); 413 addressList = add_book->findByEmail(event->organizer());
414 KABC::Addressee o = addressList.first(); 414 KABC::Addressee o = addressList.first();
415 if (!o.isEmpty() && addressList.size()<2) { 415 if (!o.isEmpty() && addressList.size()<2) {
416 mText += "<a href=\"uid:" + o.uid() + "\">"; 416 mText += "<a href=\"uid:" + o.uid() + "\">";
417 mText += o.formattedName(); 417 mText += o.formattedName();
418 mText += "</a>\n"; 418 mText += "</a>\n";
419 } else { 419 } else {
420 mText.append(event->organizer()); 420 mText.append(event->organizer());
421 } 421 }
422#else //DESKTOP_VERSION 422#else //DESKTOP_VERSION
423 mText += "<a href=\"uid:organizer\">"; 423 mText += "<a href=\"uid:organizer\">";
424 mText += event->organizer(); 424 mText += event->organizer();
425 mText += "</a>\n"; 425 mText += "</a>\n";
426#endif //DESKTOP_VERSION 426#endif //DESKTOP_VERSION
427 427
428 428
429#else 429#else
430 mText.append(event->organizer()); 430 mText.append(event->organizer());
431#endif 431#endif
432 432
433 if (iconPath) { 433 if (iconPath) {
434 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 434 mText += " <a href=\"mailto:" + event->organizer() + "\">";
435 mText += "<IMG src=\"" + iconPath + "\">"; 435 mText += "<IMG src=\"" + iconPath + "\">";
436 mText += "</a>\n"; 436 mText += "</a>\n";
437 } 437 }
438 mText.append("</li></ul>"); 438 mText.append("</li></ul>");
439 439
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
new file mode 100644
index 0000000..2c45f21
--- a/dev/null
+++ b/libkcal/kincidenceformatter.cpp
@@ -0,0 +1,328 @@
1#include "kincidenceformatter.h"
2#include <kstaticdeleter.h>
3#include <kglobal.h>
4#include <klocale.h>
5#ifdef DEKTOP_VERSION
6#include <kabc/stdaddressbook.h>
7#define size count
8#endif
9
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd;
12
13QString KIncidenceFormatter::getFormattedText( Incidence * inc )
14{
15// #ifndef QT_NO_INPUTDIALOG
16// return QInputDialog::getItem( caption, label, items, current, editable );
17// #else
18// return QString::null;
19// #endif
20 mText = "";
21 if ( inc->type() == "Event" )
22 setEvent((Event *) inc );
23 else if ( inc->type() == "Todo" )
24 setTodo((Todo *) inc );
25 return mText;
26}
27
28KIncidenceFormatter* KIncidenceFormatter::instance()
29{
30 if (!mInstance) {
31 mInstance = insd.setObject(new KIncidenceFormatter());
32 }
33 return mInstance;
34}
35KIncidenceFormatter::~KIncidenceFormatter()
36{
37 if (mInstance == this)
38 mInstance = insd.setObject(0);
39 //qDebug("KIncidenceFormatter::~KIncidenceFormatter ");
40}
41KIncidenceFormatter::KIncidenceFormatter()
42{
43 mColorMode = 0;
44}
45void KIncidenceFormatter::setEvent(Event *event)
46{
47 int mode = 0;
48 mCurrentIncidence = event;
49 bool shortDate = true;
50 if ( mode == 0 ) {
51 addTag("h3",event->summary());
52 }
53 else {
54 if ( mColorMode == 1 ) {
55 mText +="<font color=\"#00A000\">";
56 }
57 if ( mColorMode == 2 ) {
58 mText +="<font color=\"#C00000\">";
59 }
60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
61 if ( mode == 1 ) {
62 addTag("h2",i18n( "Local: " ) +event->summary());
63 } else {
64 addTag("h2",i18n( "Remote: " ) +event->summary());
65 }
66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
67 if ( mColorMode )
68 mText += "</font>";
69 }
70 if (event->cancelled ()) {
71 mText +="<font color=\"#B00000\">";
72 addTag("i",i18n("This event has been cancelled!"));
73 mText.append("<br>");
74 mText += "</font>";
75 }
76 if (!event->location().isEmpty()) {
77 addTag("b",i18n("Location: "));
78 mText.append(event->location()+"<br>");
79 }
80 if (event->doesFloat()) {
81 if (event->isMultiDay()) {
82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
83 .arg(event->dtStartDateStr(shortDate))
84 .arg(event->dtEndDateStr(shortDate)));
85 } else {
86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
87 }
88 } else {
89 if (event->isMultiDay()) {
90 mText.append(i18n("<p><b>From:</b> %1</p> ")
91 .arg(event->dtStartStr( shortDate)));
92 mText.append(i18n("<p><b>To:</b> %1</p>")
93 .arg(event->dtEndStr(shortDate)));
94 } else {
95 mText.append(i18n("<p><b>On:</b> %1</p> ")
96 .arg(event->dtStartDateStr( shortDate )));
97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
98 .arg(event->dtStartTimeStr())
99 .arg(event->dtEndTimeStr()));
100 }
101 }
102
103 if (event->recurrence()->doesRecur()) {
104
105 QString recurText = event->recurrence()->recurrenceText();
106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
107 bool last;
108 QDate start = QDate::currentDate();
109 QDate next;
110 next = event->recurrence()->getPreviousDate( start , &last );
111 if ( !last ) {
112 next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
113 addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) );
114 //addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
115 } else {
116 addTag("p",i18n("<b>Last recurrence was on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
118 }
119 }
120
121
122 if (event->isAlarmEnabled()) {
123 Alarm *alarm =event->alarms().first() ;
124 QDateTime t = alarm->time();
125 int min = t.secsTo( event->dtStart() )/60;
126 QString s =i18n("(%1 min before)").arg( min );
127 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
128 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
129 //addTag("p",s);
130 }
131
132 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
133 // mText.append(event->secrecyStr()+"<br>");
134 formatCategories(event);
135 if (!event->description().isEmpty()) {
136 addTag("p",i18n("<b>Details: </b>"));
137 addTag("p",event->description());
138 }
139
140
141 formatReadOnly(event);
142 formatAttendees(event);
143
144
145}
146
147void KIncidenceFormatter::setTodo(Todo *event )
148{
149 int mode = 0;
150 mCurrentIncidence = event;
151 bool shortDate = true;
152 if (mode == 0 )
153 addTag("h3",event->summary());
154 else {
155 if ( mColorMode == 1 ) {
156 mText +="<font color=\"#00A000\">";
157 }
158 if ( mColorMode == 2 ) {
159 mText +="<font color=\"#B00000\">";
160 }
161 if ( mode == 1 ) {
162 addTag("h2",i18n( "Local: " ) +event->summary());
163 } else {
164 addTag("h2",i18n( "Remote: " ) +event->summary());
165 }
166 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
167 if ( mColorMode )
168 mText += "</font>";
169 }
170 if (event->cancelled ()) {
171 mText +="<font color=\"#B00000\">";
172 addTag("i",i18n("This todo has been cancelled!"));
173 mText.append("<br>");
174 mText += "</font>";
175 }
176
177 if (!event->location().isEmpty()) {
178 addTag("b",i18n("Location: "));
179 mText.append(event->location()+"<br>");
180 }
181 if (event->hasDueDate()) {
182 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
183 }
184 mText.append(i18n("<p><b>Priority:</b> %2</p>")
185 .arg(QString::number(event->priority())));
186
187 mText.append(i18n("<p><i>%1 % completed</i></p>")
188 .arg(event->percentComplete()));
189 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
190 formatCategories(event);
191 if (!event->description().isEmpty()) {
192 addTag("p",i18n("<b>Details: </b>"));
193 addTag("p",event->description());
194 }
195
196
197
198 formatReadOnly(event);
199 formatAttendees(event);
200
201}
202
203void KIncidenceFormatter::setJournal(Journal* )
204{
205
206}
207
208void KIncidenceFormatter::formatCategories(Incidence *event)
209{
210 if (!event->categoriesStr().isEmpty()) {
211 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
212 //mText.append(event->categoriesStr());
213 }
214}
215void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
216{
217 int number=text.contains("\n");
218 QString str = "<" + tag + ">";
219 QString tmpText=text;
220 QString tmpStr=str;
221 if(number !=-1)
222 {
223 if (number > 0) {
224 int pos=0;
225 QString tmp;
226 for(int i=0;i<=number;i++) {
227 pos=tmpText.find("\n");
228 tmp=tmpText.left(pos);
229 tmpText=tmpText.right(tmpText.length()-pos-1);
230 tmpStr+=tmp+"<br>";
231 }
232 }
233 else tmpStr += tmpText;
234 tmpStr+="</" + tag + ">";
235 mText.append(tmpStr);
236 }
237 else
238 {
239 str += text + "</" + tag + ">";
240 mText.append(str);
241 }
242}
243
244void KIncidenceFormatter::formatAttendees(Incidence *event)
245{
246 QPtrList<Attendee> attendees = event->attendees();
247 if (attendees.count()) {
248 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
249 addTag("h3",i18n("Organizer"));
250 mText.append("<ul><li>");
251#if 0
252 //ndef KORG_NOKABC
253
254 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
255 KABC::Addressee::List addressList;
256 addressList = add_book->findByEmail(event->organizer());
257 KABC::Addressee o = addressList.first();
258 if (!o.isEmpty() && addressList.size()<2) {
259 mText += "<a href=\"uid:" + o.uid() + "\">";
260 mText += o.formattedName();
261 mText += "</a>\n";
262 } else {
263 mText.append(event->organizer());
264 }
265#else
266 mText.append(event->organizer());
267#endif
268 if (iconPath) {
269 mText += " <a href=\"mailto:" + event->organizer() + "\">";
270 mText += "<IMG src=\"" + iconPath + "\">";
271 mText += "</a>\n";
272 }
273 mText.append("</li></ul>");
274
275 addTag("h3",i18n("Attendees"));
276 Attendee *a;
277 mText.append("<ul>");
278 for(a=attendees.first();a;a=attendees.next()) {
279#if 0
280//ndef KORG_NOKABC
281 if (a->name().isEmpty()) {
282 addressList = add_book->findByEmail(a->email());
283 KABC::Addressee o = addressList.first();
284 if (!o.isEmpty() && addressList.size()<2) {
285 mText += "<a href=\"uid:" + o.uid() + "\">";
286 mText += o.formattedName();
287 mText += "</a>\n";
288 } else {
289 mText += "<li>";
290 mText.append(a->email());
291 mText += "\n";
292 }
293 } else {
294 mText += "<li><a href=\"uid:" + a->uid() + "\">";
295 if (!a->name().isEmpty()) mText += a->name();
296 else mText += a->email();
297 mText += "</a>\n";
298 }
299#else
300 //qDebug("nokabc ");
301 mText += "<li><a href=\"uid:" + a->uid() + "\">";
302 if (!a->name().isEmpty()) mText += a->name();
303 else mText += a->email();
304 mText += "</a>\n";
305#endif
306
307 if (!a->email().isEmpty()) {
308 if (iconPath) {
309 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
310 mText += "<IMG src=\"" + iconPath + "\">";
311 mText += "</a>\n";
312 }
313 }
314 if (a->status() != Attendee::NeedsAction )
315 mText +="[" + a->statusStr() + "] ";
316 if (a->role() == Attendee::Chair )
317 mText +="(" + a->roleStr().left(1) + ".)";
318 }
319 mText.append("</li></ul>");
320 }
321}
322
323void KIncidenceFormatter::formatReadOnly(Incidence *event)
324{
325 if (event->isReadOnly()) {
326 addTag("p","<em>(" + i18n("read-only") + ")</em>");
327 }
328}
diff --git a/libkcal/kincidenceformatter.h b/libkcal/kincidenceformatter.h
new file mode 100644
index 0000000..6165a9f
--- a/dev/null
+++ b/libkcal/kincidenceformatter.h
@@ -0,0 +1,42 @@
1#ifndef KINCIDENCENFORMATTER_H
2#define KINCIDENCENFORMATTER_H
3
4#include <qstring.h>
5#include <qobject.h>
6
7#include "incidence.h"
8#include "event.h"
9#include "todo.h"
10#include "journal.h"
11
12using namespace KCal;
13
14class KIncidenceFormatter : public QObject
15{
16 public:
17 static KIncidenceFormatter* instance();
18 KIncidenceFormatter();
19 ~KIncidenceFormatter();
20 QString getFormattedText( Incidence * inc );
21
22 void setEvent(Event *event);
23 void setTodo(Todo *event );
24 void setJournal(Journal* );
25
26 protected:
27 int mColorMode;
28 void addTag(const QString & tag,const QString & text);
29
30 void formatCategories(Incidence *event);
31 void formatAttendees(Incidence *event);
32 void formatReadOnly(Incidence *event);
33
34 private:
35 bool mSyncMode;
36
37 QString mText;
38 Incidence* mCurrentIncidence;
39 static KIncidenceFormatter* mInstance;
40};
41
42#endif
diff --git a/libkcal/libkcalE.pro b/libkcal/libkcalE.pro
index f5be980..1f5ef78 100644
--- a/libkcal/libkcalE.pro
+++ b/libkcal/libkcalE.pro
@@ -1,89 +1,91 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3 TARGET = microkcal 3 TARGET = microkcal
4 4
5INCLUDEPATH += ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include 5INCLUDEPATH += ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include
6INCLUDEPATH += ../libical/src/libical 6INCLUDEPATH += ../libical/src/libical
7INCLUDEPATH += ../libical/src/libicalss 7INCLUDEPATH += ../libical/src/libicalss
8OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
9MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
10DESTDIR = $(QPEDIR)/lib 10DESTDIR = $(QPEDIR)/lib
11LIBS += ../libical/lib/$(PLATFORM)/libical.a 11LIBS += ../libical/lib/$(PLATFORM)/libical.a
12LIBS += ../libical/lib/$(PLATFORM)/libicalss.a 12LIBS += ../libical/lib/$(PLATFORM)/libicalss.a
13 13
14INTERFACES = \ 14INTERFACES = \
15 15
16HEADERS = \ 16HEADERS = \
17 alarm.h \ 17 alarm.h \
18 attachment.h \ 18 attachment.h \
19 attendee.h \ 19 attendee.h \
20 calendar.h \ 20 calendar.h \
21 calendarlocal.h \ 21 calendarlocal.h \
22 calfilter.h \ 22 calfilter.h \
23 calformat.h \ 23 calformat.h \
24 calstorage.h \ 24 calstorage.h \
25 compat.h \ 25 compat.h \
26 customproperties.h \ 26 customproperties.h \
27 dummyscheduler.h \ 27 dummyscheduler.h \
28 duration.h \ 28 duration.h \
29 event.h \ 29 event.h \
30 exceptions.h \ 30 exceptions.h \
31 filestorage.h \ 31 filestorage.h \
32 freebusy.h \ 32 freebusy.h \
33 icaldrag.h \ 33 icaldrag.h \
34 icalformat.h \ 34 icalformat.h \
35 icalformatimpl.h \ 35 icalformatimpl.h \
36 imipscheduler.h \ 36 imipscheduler.h \
37 incidence.h \ 37 incidence.h \
38 incidencebase.h \ 38 incidencebase.h \
39kincidenceformatter.h \
39 journal.h \ 40 journal.h \
40 period.h \ 41 period.h \
41 person.h \ 42 person.h \
42 qtopiaformat.h \ 43 qtopiaformat.h \
43 sharpformat.h \ 44 sharpformat.h \
44 phoneformat.h \ 45 phoneformat.h \
45 recurrence.h \ 46 recurrence.h \
46 scheduler.h \ 47 scheduler.h \
47 todo.h \ 48 todo.h \
48 vcaldrag.h \ 49 vcaldrag.h \
49 vcalformat.h \ 50 vcalformat.h \
50 versit/port.h \ 51 versit/port.h \
51 versit/vcc.h \ 52 versit/vcc.h \
52 versit/vobject.h \ 53 versit/vobject.h \
53 54
54SOURCES = \ 55SOURCES = \
55 alarm.cpp \ 56 alarm.cpp \
56 attachment.cpp \ 57 attachment.cpp \
57 attendee.cpp \ 58 attendee.cpp \
58 calendar.cpp \ 59 calendar.cpp \
59 calendarlocal.cpp \ 60 calendarlocal.cpp \
60 calfilter.cpp \ 61 calfilter.cpp \
61 calformat.cpp \ 62 calformat.cpp \
62 compat.cpp \ 63 compat.cpp \
63 customproperties.cpp \ 64 customproperties.cpp \
64 dummyscheduler.cpp \ 65 dummyscheduler.cpp \
65 duration.cpp \ 66 duration.cpp \
66 event.cpp \ 67 event.cpp \
67 exceptions.cpp \ 68 exceptions.cpp \
68 filestorage.cpp \ 69 filestorage.cpp \
69 freebusy.cpp \ 70 freebusy.cpp \
70 icaldrag.cpp \ 71 icaldrag.cpp \
71 icalformat.cpp \ 72 icalformat.cpp \
72 icalformatimpl.cpp \ 73 icalformatimpl.cpp \
73 imipscheduler.cpp \ 74 imipscheduler.cpp \
74 incidence.cpp \ 75 incidence.cpp \
75 incidencebase.cpp \ 76 incidencebase.cpp \
77 kincidenceformatter.cpp \
76 journal.cpp \ 78 journal.cpp \
77 period.cpp \ 79 period.cpp \
78 person.cpp \ 80 person.cpp \
79 qtopiaformat.cpp \ 81 qtopiaformat.cpp \
80 sharpformat.cpp \ 82 sharpformat.cpp \
81 phoneformat.cpp \ 83 phoneformat.cpp \
82 recurrence.cpp \ 84 recurrence.cpp \
83 scheduler.cpp \ 85 scheduler.cpp \
84 todo.cpp \ 86 todo.cpp \
85 vcaldrag.cpp \ 87 vcaldrag.cpp \
86 vcalformat.cpp \ 88 vcalformat.cpp \
87 versit/vcc.c \ 89 versit/vcc.c \
88 versit/vobject.c \ 90 versit/vobject.c \
89 91
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 102d827..69980e3 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -1,51 +1,51 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on 2 CONFIG += qt warn_on
3TARGET = microkdepim 3TARGET = microkdepim
4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include 4INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include
5LIBS += -lmicrokde 5LIBS += -lmicrokde
6LIBS += -lmicrokcal 6#LIBS += -lmicrokcal
7LIBS += -L$(QPEDIR)/lib 7LIBS += -L$(QPEDIR)/lib
8OBJECTS_DIR = obj/$(PLATFORM) 8OBJECTS_DIR = obj/$(PLATFORM)
9MOC_DIR = moc/$(PLATFORM) 9MOC_DIR = moc/$(PLATFORM)
10DESTDIR=$(QPEDIR)/lib 10DESTDIR=$(QPEDIR)/lib
11 11
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 categoryeditdialog.h \ 16 categoryeditdialog.h \
17 categoryeditdialog_base.h \ 17 categoryeditdialog_base.h \
18 categoryselectdialog.h \ 18 categoryselectdialog.h \
19 categoryselectdialog_base.h \ 19 categoryselectdialog_base.h \
20 externalapphandler.h \ 20 externalapphandler.h \
21 kdateedit.h \ 21 kdateedit.h \
22 kdatepicker.h \ 22 kdatepicker.h \
23 kinputdialog.h \ 23 kinputdialog.h \
24 kincidenceformatter.h \
25 kpimprefs.h \ 24 kpimprefs.h \
26 kpimglobalprefs.h \ 25 kpimglobalprefs.h \
27 kprefsdialog.h \ 26 kprefsdialog.h \
28 ksyncprofile.h \ 27 ksyncprofile.h \
29 ksyncprefsdialog.h \ 28 ksyncprefsdialog.h \
30 kcmconfigs/kcmkdepimconfig.h \ 29 kcmconfigs/kcmkdepimconfig.h \
31 kcmconfigs/kdepimconfigwidget.h 30 kcmconfigs/kdepimconfigwidget.h
32 31
33 32
34 33
35SOURCES = \ 34SOURCES = \
36 categoryeditdialog.cpp \ 35 categoryeditdialog.cpp \
37 categoryeditdialog_base.cpp \ 36 categoryeditdialog_base.cpp \
38 categoryselectdialog.cpp \ 37 categoryselectdialog.cpp \
39 categoryselectdialog_base.cpp \ 38 categoryselectdialog_base.cpp \
40 externalapphandler.cpp \ 39 externalapphandler.cpp \
41 kdateedit.cpp \ 40 kdateedit.cpp \
42 kinputdialog.cpp \ 41 kinputdialog.cpp \
43 kdatepicker.cpp \ 42 kdatepicker.cpp \
44 kincidenceformatter.cpp \
45 kpimprefs.cpp \ 43 kpimprefs.cpp \
46 kpimglobalprefs.cpp \ 44 kpimglobalprefs.cpp \
47 kprefsdialog.cpp \ 45 kprefsdialog.cpp \
48 ksyncprofile.cpp \ 46 ksyncprofile.cpp \
49 ksyncprefsdialog.cpp \ 47 ksyncprefsdialog.cpp \
50 kcmconfigs/kcmkdepimconfig.cpp \ 48 kcmconfigs/kcmkdepimconfig.cpp \
51 kcmconfigs/kdepimconfigwidget.cpp 49 kcmconfigs/kdepimconfigwidget.cpp
50
51
diff --git a/setZaurus3 b/setZaurus3
new file mode 100755
index 0000000..2649292
--- a/dev/null
+++ b/setZaurus3
@@ -0,0 +1,24 @@
1# Settings to compile KDE-Pim/Pi with gcc 3.3.2 cross compiler for Zaurus
2# copy this dir to /opt/Qtopia/examples/
3# Now this file should be in the path /opt/Qtopia/examples/kdepim/setZaurus3
4# add the following line to ~/.bashrc without leading #
5# alias cz='source /opt/Qtopia/examples/kdepim/setZaurus3'
6# then type in terminal cz3<return> to set the variables
7# for cross-compiling
8export QPEDIR=/opt/Qtopia/sharp3
9export OPIEDIR=/kde_dev/opie
10#export BUILD_NO_OPIE_PLUGIN=1
11export BUILD_NO_QTOPIA_PLUGIN=1
12export BUILD_NO_SHARP_PLUGIN=1
13#export BUILD_NO_GAMMU=1
14export QTDIR=/opt/Qtopia/sharp3
15#insert here path to your gcc 3.3.2 compiler
16export PATH=$QTDIR/bin:/opt/cross/bin:$PATH
17export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-sharp-g++
18export PLATFORM=zaurus3
19export RELEASE_DEBUG=release
20export SHARPDTMSDK=/opt/dtm
21#export RELEASE_DEBUG=debug
22export GCC3EXTRALIB1=-lpng12
23export GCC3EXTRALIB2=-lz
24export KDEPIM_VERSION=1.9.5c \ No newline at end of file