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) (show 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
@@ -12,7 +12,7 @@ DEFINES += 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
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 948047a..e938e4e 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -35,7 +35,6 @@
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
@@ -46,13 +45,14 @@
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>
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
@@ -36,6 +36,7 @@ HEADERS = \
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 \
@@ -73,6 +74,7 @@ SOURCES = \
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 \
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro
index 102d827..69980e3 100644
--- a/libkdepim/libkdepimE.pro
+++ b/libkdepim/libkdepimE.pro
@@ -3,7 +3,7 @@ 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)
@@ -21,7 +21,6 @@ HEADERS = \
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 \
@@ -41,7 +40,6 @@ SOURCES = \
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 \
@@ -49,3 +47,5 @@ SOURCES = \
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