From 14f8adb33ca434d36e80b3b7e7e262f4ede24d0d Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 17 Sep 2004 00:39:46 +0000 Subject: More lib changes --- 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 #DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOKABC KORG_NOARCHIVE KORG_NOMAIL #DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER #DEFINES += KORG_NOLVALTERNATION -#LIBS += -lmicrokdepim +LIBS += -lmicrokdepim #LIBS += -lmicrokcal LIBS += -lmicrokde LIBS += -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 @@ #include #include "koprefs.h" -#include #include #ifndef KORG_NODCOP @@ -46,13 +45,14 @@ #endif #include "koeventviewer.h" -#ifndef KORG_NOKABC -#include -#define size count -#endif +//#ifndef KORG_NOKABC +//#include +//#define size count +//#endif #ifdef DESKTOP_VERSION #include +#include #else //DESKTOP_VERSION #include #include 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 @@ +#include "kincidenceformatter.h" +#include +#include +#include +#ifdef DEKTOP_VERSION +#include +#define size count +#endif + +KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; +static KStaticDeleter insd; + +QString KIncidenceFormatter::getFormattedText( Incidence * inc ) +{ +// #ifndef QT_NO_INPUTDIALOG +// return QInputDialog::getItem( caption, label, items, current, editable ); +// #else +// return QString::null; +// #endif + mText = ""; + if ( inc->type() == "Event" ) + setEvent((Event *) inc ); + else if ( inc->type() == "Todo" ) + setTodo((Todo *) inc ); + return mText; +} + +KIncidenceFormatter* KIncidenceFormatter::instance() +{ + if (!mInstance) { + mInstance = insd.setObject(new KIncidenceFormatter()); + } + return mInstance; +} +KIncidenceFormatter::~KIncidenceFormatter() +{ + if (mInstance == this) + mInstance = insd.setObject(0); + //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); +} +KIncidenceFormatter::KIncidenceFormatter() +{ + mColorMode = 0; +} +void KIncidenceFormatter::setEvent(Event *event) +{ + int mode = 0; + mCurrentIncidence = event; + bool shortDate = true; + if ( mode == 0 ) { + addTag("h3",event->summary()); + } + else { + if ( mColorMode == 1 ) { + mText +=""; + } + if ( mColorMode == 2 ) { + mText +=""; + } + // mText +="" + i18n("O-due!") + ""; + if ( mode == 1 ) { + addTag("h2",i18n( "Local: " ) +event->summary()); + } else { + addTag("h2",i18n( "Remote: " ) +event->summary()); + } + addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); + if ( mColorMode ) + mText += ""; + } + if (event->cancelled ()) { + mText +=""; + addTag("i",i18n("This event has been cancelled!")); + mText.append("
"); + mText += "
"; + } + if (!event->location().isEmpty()) { + addTag("b",i18n("Location: ")); + mText.append(event->location()+"
"); + } + if (event->doesFloat()) { + if (event->isMultiDay()) { + mText.append(i18n("

From: %1

To: %2

") + .arg(event->dtStartDateStr(shortDate)) + .arg(event->dtEndDateStr(shortDate))); + } else { + mText.append(i18n("

On: %1

").arg(event->dtStartDateStr( shortDate ))); + } + } else { + if (event->isMultiDay()) { + mText.append(i18n("

From: %1

") + .arg(event->dtStartStr( shortDate))); + mText.append(i18n("

To: %1

") + .arg(event->dtEndStr(shortDate))); + } else { + mText.append(i18n("

On: %1

") + .arg(event->dtStartDateStr( shortDate ))); + mText.append(i18n("

From: %1 To: %2

") + .arg(event->dtStartTimeStr()) + .arg(event->dtEndTimeStr())); + } + } + + if (event->recurrence()->doesRecur()) { + + QString recurText = event->recurrence()->recurrenceText(); + addTag("p","" + i18n("This is a %1 recurring event.").arg(recurText ) + ""); + bool last; + QDate start = QDate::currentDate(); + QDate next; + next = event->recurrence()->getPreviousDate( start , &last ); + if ( !last ) { + next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); + addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); + //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + } else { + addTag("p",i18n("Last recurrence was on:") ); + addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + } + } + + + if (event->isAlarmEnabled()) { + Alarm *alarm =event->alarms().first() ; + QDateTime t = alarm->time(); + int min = t.secsTo( event->dtStart() )/60; + QString s =i18n("(%1 min before)").arg( min ); + addTag("p",i18n("Alarm on: ") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); + //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); + //addTag("p",s); + } + + addTag("p",i18n("Access: ") +event->secrecyStr() ); + // mText.append(event->secrecyStr()+"
"); + formatCategories(event); + if (!event->description().isEmpty()) { + addTag("p",i18n("Details: ")); + addTag("p",event->description()); + } + + + formatReadOnly(event); + formatAttendees(event); + + +} + +void KIncidenceFormatter::setTodo(Todo *event ) +{ + int mode = 0; + mCurrentIncidence = event; + bool shortDate = true; + if (mode == 0 ) + addTag("h3",event->summary()); + else { + if ( mColorMode == 1 ) { + mText +=""; + } + if ( mColorMode == 2 ) { + mText +=""; + } + if ( mode == 1 ) { + addTag("h2",i18n( "Local: " ) +event->summary()); + } else { + addTag("h2",i18n( "Remote: " ) +event->summary()); + } + addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); + if ( mColorMode ) + mText += ""; + } + if (event->cancelled ()) { + mText +=""; + addTag("i",i18n("This todo has been cancelled!")); + mText.append("
"); + mText += "
"; + } + + if (!event->location().isEmpty()) { + addTag("b",i18n("Location: ")); + mText.append(event->location()+"
"); + } + if (event->hasDueDate()) { + mText.append(i18n("

Due on: %1

").arg(event->dtDueStr(shortDate))); + } + mText.append(i18n("

Priority: %2

") + .arg(QString::number(event->priority()))); + + mText.append(i18n("

%1 % completed

") + .arg(event->percentComplete())); + addTag("p",i18n("Access: ") +event->secrecyStr() ); + formatCategories(event); + if (!event->description().isEmpty()) { + addTag("p",i18n("Details: ")); + addTag("p",event->description()); + } + + + + formatReadOnly(event); + formatAttendees(event); + +} + +void KIncidenceFormatter::setJournal(Journal* ) +{ + +} + +void KIncidenceFormatter::formatCategories(Incidence *event) +{ + if (!event->categoriesStr().isEmpty()) { + addTag("p",i18n("Categories: ")+event->categoriesStr() ); + //mText.append(event->categoriesStr()); + } +} +void KIncidenceFormatter::addTag(const QString & tag,const QString & text) +{ + int number=text.contains("\n"); + QString str = "<" + tag + ">"; + QString tmpText=text; + QString tmpStr=str; + if(number !=-1) + { + if (number > 0) { + int pos=0; + QString tmp; + for(int i=0;i<=number;i++) { + pos=tmpText.find("\n"); + tmp=tmpText.left(pos); + tmpText=tmpText.right(tmpText.length()-pos-1); + tmpStr+=tmp+"
"; + } + } + else tmpStr += tmpText; + tmpStr+=""; + mText.append(tmpStr); + } + else + { + str += text + ""; + mText.append(str); + } +} + +void KIncidenceFormatter::formatAttendees(Incidence *event) +{ + QPtrList attendees = event->attendees(); + if (attendees.count()) { + QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); + addTag("h3",i18n("Organizer")); + mText.append("
  • "); +#if 0 + //ndef KORG_NOKABC + + KABC::AddressBook *add_book = KABC::StdAddressBook::self(); + KABC::Addressee::List addressList; + addressList = add_book->findByEmail(event->organizer()); + KABC::Addressee o = addressList.first(); + if (!o.isEmpty() && addressList.size()<2) { + mText += ""; + mText += o.formattedName(); + mText += "\n"; + } else { + mText.append(event->organizer()); + } +#else + mText.append(event->organizer()); +#endif + if (iconPath) { + mText += " organizer() + "\">"; + mText += ""; + mText += "\n"; + } + mText.append("
"); + + addTag("h3",i18n("Attendees")); + Attendee *a; + mText.append(""); + } +} + +void KIncidenceFormatter::formatReadOnly(Incidence *event) +{ + if (event->isReadOnly()) { + addTag("p","(" + i18n("read-only") + ")"); + } +} 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 @@ +#ifndef KINCIDENCENFORMATTER_H +#define KINCIDENCENFORMATTER_H + +#include +#include + +#include "incidence.h" +#include "event.h" +#include "todo.h" +#include "journal.h" + +using namespace KCal; + +class KIncidenceFormatter : public QObject +{ + public: + static KIncidenceFormatter* instance(); + KIncidenceFormatter(); + ~KIncidenceFormatter(); + QString getFormattedText( Incidence * inc ); + + void setEvent(Event *event); + void setTodo(Todo *event ); + void setJournal(Journal* ); + + protected: + int mColorMode; + void addTag(const QString & tag,const QString & text); + + void formatCategories(Incidence *event); + void formatAttendees(Incidence *event); + void formatReadOnly(Incidence *event); + + private: + bool mSyncMode; + + QString mText; + Incidence* mCurrentIncidence; + static KIncidenceFormatter* mInstance; +}; + +#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 = \ imipscheduler.h \ incidence.h \ incidencebase.h \ +kincidenceformatter.h \ journal.h \ period.h \ person.h \ @@ -73,6 +74,7 @@ SOURCES = \ imipscheduler.cpp \ incidence.cpp \ incidencebase.cpp \ + kincidenceformatter.cpp \ journal.cpp \ period.cpp \ 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 TARGET = microkdepim INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include LIBS += -lmicrokde -LIBS += -lmicrokcal +#LIBS += -lmicrokcal LIBS += -L$(QPEDIR)/lib OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) @@ -21,7 +21,6 @@ HEADERS = \ kdateedit.h \ kdatepicker.h \ kinputdialog.h \ - kincidenceformatter.h \ kpimprefs.h \ kpimglobalprefs.h \ kprefsdialog.h \ @@ -41,7 +40,6 @@ SOURCES = \ kdateedit.cpp \ kinputdialog.cpp \ kdatepicker.cpp \ - kincidenceformatter.cpp \ kpimprefs.cpp \ kpimglobalprefs.cpp \ kprefsdialog.cpp \ @@ -49,3 +47,5 @@ SOURCES = \ ksyncprefsdialog.cpp \ kcmconfigs/kcmkdepimconfig.cpp \ kcmconfigs/kdepimconfigwidget.cpp + + diff --git a/setZaurus3 b/setZaurus3 new file mode 100755 index 0000000..2649292 --- a/dev/null +++ b/setZaurus3 @@ -0,0 +1,24 @@ +# Settings to compile KDE-Pim/Pi with gcc 3.3.2 cross compiler for Zaurus +# copy this dir to /opt/Qtopia/examples/ +# Now this file should be in the path /opt/Qtopia/examples/kdepim/setZaurus3 +# add the following line to ~/.bashrc without leading # +# alias cz='source /opt/Qtopia/examples/kdepim/setZaurus3' +# then type in terminal cz3 to set the variables +# for cross-compiling +export QPEDIR=/opt/Qtopia/sharp3 +export OPIEDIR=/kde_dev/opie +#export BUILD_NO_OPIE_PLUGIN=1 +export BUILD_NO_QTOPIA_PLUGIN=1 +export BUILD_NO_SHARP_PLUGIN=1 +#export BUILD_NO_GAMMU=1 +export QTDIR=/opt/Qtopia/sharp3 +#insert here path to your gcc 3.3.2 compiler +export PATH=$QTDIR/bin:/opt/cross/bin:$PATH +export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-sharp-g++ +export PLATFORM=zaurus3 +export RELEASE_DEBUG=release +export SHARPDTMSDK=/opt/dtm +#export RELEASE_DEBUG=debug +export GCC3EXTRALIB1=-lpng12 +export GCC3EXTRALIB2=-lz +export KDEPIM_VERSION=1.9.5c \ No newline at end of file -- cgit v0.9.0.2