author | zautrix <zautrix> | 2004-09-17 00:05:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-17 00:05:23 (UTC) |
commit | 8462751df135b9ad08b1269661d2c7eb18c67976 (patch) (side-by-side diff) | |
tree | 1c40fa2638f9f22df2d96b0879acfd20a9c2c502 | |
parent | eebe4409884ccd4dedb7cb697a800f74b33eb292 (diff) | |
download | kdepimpi-8462751df135b9ad08b1269661d2c7eb18c67976.zip kdepimpi-8462751df135b9ad08b1269661d2c7eb18c67976.tar.gz kdepimpi-8462751df135b9ad08b1269661d2c7eb18c67976.tar.bz2 |
Rearranged linking
-rw-r--r-- | kabc/addresseeview.cpp | 401 | ||||
-rw-r--r-- | kabc/addresseeview.h | 60 | ||||
-rw-r--r-- | kabc/kabc.pro | 2 | ||||
-rw-r--r-- | kabc/kabcE.pro | 2 | ||||
-rw-r--r-- | kaddressbook/details/look_html.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kaddressbookE.pro | 6 | ||||
-rw-r--r-- | kaddressbook/xxportmanager.cpp | 2 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/incomingdialog.cpp | 3 | ||||
-rw-r--r-- | korganizer/korganizerE.pro | 4 | ||||
-rw-r--r-- | korganizer/publishdialog.cpp | 3 | ||||
-rw-r--r-- | libkdepim/libkdepim.pro | 2 | ||||
-rw-r--r-- | libkdepim/libkdepimE.pro | 2 |
14 files changed, 482 insertions, 13 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp new file mode 100644 index 0000000..b4717d7 --- a/dev/null +++ b/kabc/addresseeview.cpp @@ -0,0 +1,401 @@ +/* + This file is part of libkdepim. + + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#include <kabc/address.h> +#include <kabc/addressee.h> +#include <kabc/phonenumber.h> +#include <kglobal.h> +//US#include <kglobalsettings.h> +#include <kiconloader.h> +#include <klocale.h> +//US #include <kstringhandler.h> +#include <qscrollview.h> +#include <qregexp.h> +#include <qfile.h> +#include <qapplication.h> + + +#include "externalapphandler.h" +#include "addresseeview.h" + + +//US #ifndef DESKTOP_VERSION +//US #include <qtopia/qcopenvelope_qws.h> +//US #include <qpe/qpeapplication.h> +//US #endif + +//US static int kphoneInstalled = 0; + +using namespace KPIM; + +AddresseeView::AddresseeView( QWidget *parent, const char *name ) +//US : KTextBrowser( parent, name ) + : QTextBrowser( parent, name ) + + +{ +//US setWrapPolicy( QTextEdit::AtWordBoundary ); + setLinkUnderline( false ); + // setVScrollBarMode( QScrollView::AlwaysOff ); + //setHScrollBarMode( QScrollView::AlwaysOff ); + +//US QStyleSheet *sheet = styleSheet(); +//US QStyleSheetItem *link = sheet->item( "a" ); +//US link->setColor( KGlobalSettings::linkColor() ); + +} + +void AddresseeView::setSource(const QString& n) +{ + //qDebug("********AddresseeView::setSource %s", n.latin1()); + + if ( n.left( 6 ) == "mailto" ) + ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); + else if ( n.left( 7 ) == "phoneto" ) + ExternalAppHandler::instance()->callByPhone( n.mid(8) ); + else if ( n.left( 5 ) == "faxto" ) + ExternalAppHandler::instance()->callByFax( n.mid(6) ); + else if ( n.left( 5 ) == "smsto" ) + ExternalAppHandler::instance()->callBySMS( n.mid(6) ); + else if ( n.left( 7 ) == "pagerto" ) + ExternalAppHandler::instance()->callByPager( n.mid(8) ); + else if ( n.left( 5 ) == "sipto" ) + ExternalAppHandler::instance()->callBySIP( n.mid(6) ); + +} +void AddresseeView::setAddressee( const KABC::Addressee& addr ) +{ + ExternalAppHandler* eah = ExternalAppHandler::instance(); + bool kemailAvail = eah->isEmailAppAvailable(); + bool kphoneAvail = eah->isPhoneAppAvailable(); + bool kfaxAvail = eah->isFaxAppAvailable(); + bool ksmsAvail = eah->isSMSAppAvailable(); + bool kpagerAvail = eah->isPagerAppAvailable(); + bool ksipAvail = eah->isSIPAppAvailable(); + + + mAddressee = addr; + // clear view + setText( QString::null ); + + if ( mAddressee.isEmpty() ) + return; + + QString name = ( mAddressee.assembledName().isEmpty() ? + mAddressee.formattedName() : mAddressee.assembledName() ); + + QString dynamicPart; + + QStringList emails = mAddressee.emails(); + QStringList::ConstIterator emailIt; + QString type = i18n( "Email" ); + emailIt = emails.begin(); + if ( emailIt != emails.end() ) { + if ( kemailAvail ) { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) + .arg( type ) + .arg( name ) + .arg( *emailIt ) + .arg( *emailIt ); + ++emailIt; + } else { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( type ) + .arg( *emailIt ); + ++emailIt; + } + } + if ( mAddressee.birthday().date().isValid() ) { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n ("Birthday") ) + .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); + } + KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); + KABC::PhoneNumber::List::ConstIterator phoneIt; + QString extension; + int phonetype; + QString sms; + for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { + phonetype = (*phoneIt).type(); + if (ksmsAvail && + ( + ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || + ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) + ) + ) + { + sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) + .arg( (*phoneIt).number() ); + + } + else + sms = ""; + + extension = QString::null; + if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { + if (kfaxAvail) extension = "faxto:"; + } + else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { + if (kpagerAvail) extension = "pagerto:"; + } + else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { + if (ksipAvail) extension = "sipto:"; + } + else if (kphoneAvail) { + extension = "phoneto:"; + } + else + extension = QString::null; + + if ( !extension.isEmpty() ) { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) + .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) + .arg( extension ) + .arg( (*phoneIt).number() ) + .arg( (*phoneIt).number() ) + .arg( sms ); + + } else { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2 %3</td></tr>" ) + .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) + .arg( (*phoneIt).number() ) + .arg( sms ); + } + } + + + for ( ; emailIt != emails.end(); ++emailIt ) { + if ( kemailAvail ) { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) + .arg( type ) + .arg( name ) + .arg( *emailIt ) + .arg( *emailIt ); + } else { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( type ) + .arg( *emailIt ); + } + } + + if ( !mAddressee.url().url().isEmpty() ) { + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n( "Homepage" ) ) +//US .arg( KStringHandler::tagURLs( mAddressee.url().url() ) ); + .arg( mAddressee.url().url() ); + //qDebug("AddresseeView::setAddressee has to be verified."); + } + + KABC::Address::List addresses = mAddressee.addresses(); + KABC::Address::List::ConstIterator addrIt; + for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { + if ( true /*(*addrIt).label().isEmpty()*/ ) { + QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); +//US formattedAddress = formattedAddress.replace( '\n', "<br>" ); + //qDebug("adresss %s ",formattedAddress.latin1() ); + formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); + //qDebug("AddresseeView::setAddressee has to be verified."); + + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) + .arg( formattedAddress ); + } else { + + dynamicPart += QString( + "<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) +//US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); + .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); + + } + } + + QString notes; + if ( !mAddressee.note().isEmpty() ) { + notes = QString( + "<tr>" + "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label + "<td align=\"left\">%2</td>" // note + "</tr>" ).arg( i18n( "Notes" ) ) +//US .arg( mAddressee.note().replace( '\n', "<br>" ) ); + .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); + //qDebug("AddresseeView::setAddressee has to be verified."); + } + + QString aRole = ""; + QString aOrga = ""; + if ( true /*!mAddressee.role().isEmpty()*/ ) { + aRole = "<tr>" + "<td align=\"left\">" + mAddressee.role() + "</td>" + "</tr>"; + } + if ( true /*!mAddressee.organization().isEmpty()*/ ) { + aOrga = "<tr>" + "<td align=\"left\">" + mAddressee.organization() + "</td>" ; + "</tr>"; + } + mText = ""; + QString picString = ""; + KABC::Picture picture = mAddressee.photo(); + bool picAvailintern = false; + bool picAvailUrl = false; + if (! picture.undefined() ) { + picAvailintern = (picture.isIntern() && !picture.data().isNull()); + picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); + } + if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { + if ( picAvailintern ) { + QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); + } else { + if ( picAvailUrl ) { + QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", QPixmap( picture.url() )); + } else { + QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", KGlobal::iconLoader()->loadIcon( "package_toys", KIcon::Desktop, 128 ) ); + } + } + picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; + mText = QString::fromLatin1( + "<html>" + "<body text=\"%1\" bgcolor=\"%2\">" // text and background color + "<table>" + "<tr>" + "<td rowspan=\"3\" align=\"right\" valign=\"top\">" + "%3" + "</td>" + "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name + "</tr>" + "%5" // role + "%6" // organization + "<td colspan=\"2\"> </td>" + "%7" // dynamic part + "%8" // notes + "</table>" + "</body>" + "</html>") +//US + .arg( /*KGlobalSettings::textColor().name()*/ "black" ) +//US + .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) + .arg( picString ) + .arg( name ) + .arg( aRole ) + .arg( aOrga ) + .arg( dynamicPart ) + .arg( notes ); + + } else { // no picture! + +mText = "<table width=\"100%\">\n"; + //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; +#ifdef DESKTOP_VERSION + mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; +#else + mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h2>"; +#endif + +#ifdef DESKTOP_VERSION + mText += "<font color=\"#FFFFFF\"> <em>" + name+"</em></font></h1>"; +#else + mText += "<font color=\"#FFFFFF\"> <em>" + name +"</em></font></h2>"; +#endif + mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; + + mText += "<table><td colspan=\"2\"> </td>"; + /* + mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" + "<td align=\"left\"><b>%2</b></td></tr>" ) + .arg( i18n(" ") ) + .arg( name ); + */ + if ( ! mAddressee.role().isEmpty() ) + mText += QString("<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n(" ") ) + .arg( mAddressee.role()); + if ( ! mAddressee.organization().isEmpty() ) + mText += QString("<tr><td align=\"right\"><b>%1</b></td>" + "<td align=\"left\">%2</td></tr>" ) + .arg( i18n(" ") ) + .arg( mAddressee.organization()); + mText += dynamicPart; + mText += notes; + mText += "</table>"; + + } + + // at last display it... + setText( mText ); + +} + +KABC::Addressee AddresseeView::addressee() const +{ + return mAddressee; +} +void AddresseeView::addTag(const QString & tag,const QString & text) +{ + if ( text.isEmpty() ) + return; + 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+"<br>"; + } + } + else tmpStr += tmpText; + tmpStr+="</" + tag + ">"; + mText.append(tmpStr); + } + else + { + str += text + "</" + tag + ">"; + mText.append(str); + } +} diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h new file mode 100644 index 0000000..1865fc4 --- a/dev/null +++ b/kabc/addresseeview.h @@ -0,0 +1,60 @@ +/* + This file is part of libkdepim. + + Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef KPIM_ADDRESSEEVIEW_H +#define KPIM_ADDRESSEEVIEW_H + +#include <kabc/addressee.h> + +//US #include <ktextbrowser.h> +#include <qtextbrowser.h> + +namespace KPIM { + +//US class AddresseeView : public KTextBrowser +class AddresseeView : public QTextBrowser +{ + public: + AddresseeView( QWidget *parent = 0, const char *name = 0 ); + + /** + Sets the addressee object. The addressee is displayed immediately. + + @param addr The addressee object. + */ + void setAddressee( const KABC::Addressee& addr ); + void setSource(const QString& n); + /** + Returns the current addressee object. + */ + KABC::Addressee addressee() const; + + private: + KABC::Addressee mAddressee; + QString mText; + void addTag(const QString & tag,const QString & text); + class AddresseeViewPrivate; + AddresseeViewPrivate *d; +}; + +} + +#endif diff --git a/kabc/kabc.pro b/kabc/kabc.pro index 417f5b0..d690acc 100644 --- a/kabc/kabc.pro +++ b/kabc/kabc.pro @@ -1,218 +1,220 @@ TEMPLATE = lib CONFIG += qt warn_on #release debug DESTDIR=../bin TARGET = microkabc include( ../variables.pri ) INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui .. #LIBS += -lmicrokde -lldap LIBS += -L$(QPEDIR)/lib DEFINES += KAB_EMBEDDED DESKTOP_VERSION unix : { OBJECTS_DIR = obj/unix MOC_DIR = moc/unix } win32: { DEFINES += _WIN32_ OBJECTS_DIR = obj/win MOC_DIR = moc/win } INTERFACES = \ HEADERS = \ resource.h \ stdaddressbook.h \ agent.h \ geo.h \ key.h \ field.h \ plugin.h \ address.h \ addresseelist.h \ + addresseeview.h \ formatfactory.h \ formatplugin.h \ phonenumber.h \ distributionlist.h \ distributionlistdialog.h \ distributionlisteditor.h \ vcardformatplugin.h \ formats/vcardformatplugin2.h \ picture.h \ secrecy.h \ sound.h \ addressbook.h \ syncprefwidget.h \ timezone.h \ tmpaddressbook.h \ addressee.h \ addresseedialog.h \ vcardconverter.h \ vcard21parser.h \ vcardformatimpl.h \ plugins/file/resourcefile.h \ plugins/file/resourcefileconfig.h \ plugins/dir/resourcedir.h \ plugins/dir/resourcedirconfig.h \ vcardparser/vcardline.h \ vcardparser/vcard.h \ vcardparser/vcardtool.h \ vcardparser/vcardparser.h \ vcard/include/VCardAdrParam.h \ vcard/include/VCardAdrValue.h \ vcard/include/VCardAgentParam.h \ vcard/include/VCardContentLine.h \ vcard/include/VCardDateParam.h \ vcard/include/VCardDateValue.h \ vcard/include/VCardEmailParam.h \ vcard/include/VCardGeoValue.h \ vcard/include/VCardGroup.h \ vcard/include/VCardImageParam.h \ vcard/include/VCardImageValue.h \ vcard/include/VCardLangValue.h \ vcard/include/VCardNValue.h \ vcard/include/VCardParam.h \ vcard/include/VCardPhoneNumberValue.h \ vcard/include/VCardSourceParam.h \ vcard/include/VCardTelParam.h \ vcard/include/VCardTextParam.h \ vcard/include/VCardTextValue.h \ vcard/include/VCardTextBinParam.h \ vcard/include/VCardURIValue.h \ vcard/include/VCardVCard.h \ vcard/include/VCardEntity.h \ vcard/include/VCardValue.h \ vcard/include/VCardSoundValue.h \ vcard/include/VCardAgentValue.h \ vcard/include/VCardTelValue.h \ vcard/include/VCardTextBinValue.h \ vcard/include/VCardOrgValue.h \ vcard/include/VCardUTCValue.h \ vcard/include/VCardClassValue.h \ vcard/include/VCardFloatValue.h \ vcard/include/VCardTextListValue.h \ vcard/include/generated/AdrParam-generated.h \ vcard/include/generated/AdrValue-generated.h \ vcard/include/generated/AgentParam-generated.h \ vcard/include/generated/ContentLine-generated.h \ vcard/include/generated/DateParam-generated.h \ vcard/include/generated/DateValue-generated.h \ vcard/include/generated/EmailParam-generated.h \ vcard/include/generated/GeoValue-generated.h \ vcard/include/generated/Group-generated.h \ vcard/include/generated/ImageParam-generated.h \ vcard/include/generated/ImageValue-generated.h \ vcard/include/generated/LangValue-generated.h \ vcard/include/generated/NValue-generated.h \ vcard/include/generated/Param-generated.h \ vcard/include/generated/PhoneNumberValue-generated.h \ vcard/include/generated/SourceParam-generated.h \ vcard/include/generated/TelParam-generated.h \ vcard/include/generated/TextParam-generated.h \ vcard/include/generated/TextNSParam-generated.h \ vcard/include/generated/TextValue-generated.h \ vcard/include/generated/TextBinParam-generated.h \ vcard/include/generated/URIValue-generated.h \ vcard/include/generated/VCard-generated.h \ vcard/include/generated/VCardEntity-generated.h \ vcard/include/generated/Value-generated.h \ vcard/include/generated/SoundValue-generated.h \ vcard/include/generated/AgentValue-generated.h \ vcard/include/generated/TelValue-generated.h \ vcard/include/generated/TextBinValue-generated.h \ vcard/include/generated/OrgValue-generated.h \ vcard/include/generated/UTCValue-generated.h \ vcard/include/generated/ClassValue-generated.h \ vcard/include/generated/FloatValue-generated.h \ vcard/include/generated/TextListValue-generated.h # plugins/ldap/resourceldap.h \ # plugins/ldap/resourceldapconfig.h \ #formats/binary/binaryformat.h \ #vcard/include/VCardTextNSParam.h \ SOURCES = \ distributionlist.cpp \ distributionlistdialog.cpp \ distributionlisteditor.cpp \ vcardformatplugin.cpp \ formats/vcardformatplugin2.cpp \ formatfactory.cpp \ resource.cpp \ stdaddressbook.cpp \ plugin.cpp \ agent.cpp \ geo.cpp \ key.cpp \ field.cpp \ + addresseeview.cpp \ address.cpp \ phonenumber.cpp \ picture.cpp \ secrecy.cpp \ sound.cpp \ addressbook.cpp \ syncprefwidget.cpp \ timezone.cpp \ tmpaddressbook.cpp \ addressee.cpp \ addresseelist.cpp \ addresseedialog.cpp \ vcardconverter.cpp \ vcard21parser.cpp \ vcardformatimpl.cpp \ plugins/file/resourcefile.cpp \ plugins/file/resourcefileconfig.cpp \ plugins/dir/resourcedir.cpp \ plugins/dir/resourcedirconfig.cpp \ vcardparser/vcardline.cpp \ vcardparser/vcard.cpp \ vcardparser/vcardtool.cpp \ vcardparser/vcardparser.cpp \ vcard/AdrParam.cpp \ vcard/AdrValue.cpp \ vcard/AgentParam.cpp \ vcard/ContentLine.cpp \ vcard/DateParam.cpp \ vcard/DateValue.cpp \ vcard/EmailParam.cpp \ vcard/Entity.cpp \ vcard/Enum.cpp \ vcard/GeoValue.cpp \ vcard/ImageParam.cpp \ vcard/ImageValue.cpp \ vcard/LangValue.cpp \ vcard/NValue.cpp \ vcard/Param.cpp \ vcard/PhoneNumberValue.cpp \ vcard/RToken.cpp \ vcard/SourceParam.cpp \ vcard/TelParam.cpp \ vcard/TextParam.cpp \ vcard/TextValue.cpp \ vcard/TextBinParam.cpp \ vcard/URIValue.cpp \ vcard/VCardv.cpp \ vcard/VCardEntity.cpp \ vcard/Value.cpp \ vcard/SoundValue.cpp \ vcard/AgentValue.cpp \ vcard/TelValue.cpp \ vcard/TextBinValue.cpp \ vcard/OrgValue.cpp \ vcard/UTCValue.cpp \ vcard/ClassValue.cpp \ vcard/FloatValue.cpp \ vcard/TextListValue.cpp # plugins/ldap/resourceldap.cpp \ # plugins/ldap/resourceldapconfig.cpp \ #formats/binary/binaryformat.cpp \ diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro index dfdbcff..b360e8c 100644 --- a/kabc/kabcE.pro +++ b/kabc/kabcE.pro @@ -1,193 +1,195 @@ TEMPLATE = lib CONFIG += qt warn_on TARGET = microkabc INCLUDEPATH += . $(KDEPIMDIR) vcard/include vcard/include/generated $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(QPEDIR)/include OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR = $(QPEDIR)/lib LIBS += -lmicrokde LIBS += -lmicrokdepim #LIBS += -lldap LIBS += -L$(QPEDIR)/lib DEFINES += KAB_EMBEDDED INTERFACES = \ HEADERS = \ address.h \ addressbook.h \ addressee.h \ addresseedialog.h \ addresseelist.h \ + addresseeview.h \ agent.h \ distributionlist.h \ distributionlistdialog.h \ distributionlisteditor.h \ field.h \ formatfactory.h \ formatplugin.h \ geo.h \ key.h \ phonenumber.h \ picture.h \ plugin.h \ resource.h \ secrecy.h \ sound.h \ stdaddressbook.h \ syncprefwidget.h \ timezone.h \ tmpaddressbook.h \ vcardconverter.h \ vcard21parser.h \ vcardformatimpl.h \ vcardformatplugin.h \ vcardparser/vcardline.h \ vcardparser/vcard.h \ vcardparser/vcardtool.h \ vcardparser/vcardparser.h \ vcard/include/VCardAdrParam.h \ vcard/include/VCardAdrValue.h \ vcard/include/VCardAgentParam.h \ vcard/include/VCardContentLine.h \ vcard/include/VCardDateParam.h \ vcard/include/VCardDateValue.h \ vcard/include/VCardEmailParam.h \ vcard/include/VCardGeoValue.h \ vcard/include/VCardGroup.h \ vcard/include/VCardImageParam.h \ vcard/include/VCardImageValue.h \ vcard/include/VCardLangValue.h \ vcard/include/VCardNValue.h \ vcard/include/VCardParam.h \ vcard/include/VCardPhoneNumberValue.h \ vcard/include/VCardSourceParam.h \ vcard/include/VCardTelParam.h \ vcard/include/VCardTextParam.h \ vcard/include/VCardTextNSParam.h \ vcard/include/VCardTextValue.h \ vcard/include/VCardTextBinParam.h \ vcard/include/VCardURIValue.h \ vcard/include/VCardVCard.h \ vcard/include/VCardEntity.h \ vcard/include/VCardValue.h \ vcard/include/VCardSoundValue.h \ vcard/include/VCardAgentValue.h \ vcard/include/VCardTelValue.h \ vcard/include/VCardTextBinValue.h \ vcard/include/VCardOrgValue.h \ vcard/include/VCardUTCValue.h \ vcard/include/VCardClassValue.h \ vcard/include/VCardFloatValue.h \ vcard/include/VCardTextListValue.h \ vcard/include/generated/AdrParam-generated.h \ vcard/include/generated/AdrValue-generated.h \ vcard/include/generated/AgentParam-generated.h \ vcard/include/generated/ContentLine-generated.h \ vcard/include/generated/DateParam-generated.h \ vcard/include/generated/DateValue-generated.h \ vcard/include/generated/EmailParam-generated.h \ vcard/include/generated/GeoValue-generated.h \ vcard/include/generated/Group-generated.h \ vcard/include/generated/ImageParam-generated.h \ vcard/include/generated/ImageValue-generated.h \ vcard/include/generated/LangValue-generated.h \ vcard/include/generated/NValue-generated.h \ vcard/include/generated/Param-generated.h \ vcard/include/generated/PhoneNumberValue-generated.h \ vcard/include/generated/SourceParam-generated.h \ vcard/include/generated/TelParam-generated.h \ vcard/include/generated/TextParam-generated.h \ vcard/include/generated/TextNSParam-generated.h \ vcard/include/generated/TextValue-generated.h \ vcard/include/generated/TextBinParam-generated.h \ vcard/include/generated/URIValue-generated.h \ vcard/include/generated/VCard-generated.h \ vcard/include/generated/VCardEntity-generated.h \ vcard/include/generated/Value-generated.h \ vcard/include/generated/SoundValue-generated.h \ vcard/include/generated/AgentValue-generated.h \ vcard/include/generated/TelValue-generated.h \ vcard/include/generated/TextBinValue-generated.h \ vcard/include/generated/OrgValue-generated.h \ vcard/include/generated/UTCValue-generated.h \ vcard/include/generated/ClassValue-generated.h \ vcard/include/generated/FloatValue-generated.h \ vcard/include/generated/TextListValue-generated.h SOURCES = \ address.cpp \ addressbook.cpp \ addressee.cpp \ addresseedialog.cpp \ addresseelist.cpp \ + addresseeview.cpp \ agent.cpp \ distributionlist.cpp \ distributionlistdialog.cpp \ distributionlisteditor.cpp \ field.cpp \ formatfactory.cpp \ geo.cpp \ key.cpp \ phonenumber.cpp \ picture.cpp \ plugin.cpp \ resource.cpp \ secrecy.cpp \ sound.cpp \ stdaddressbook.cpp \ syncprefwidget.cpp \ timezone.cpp \ tmpaddressbook.cpp \ vcardconverter.cpp \ vcard21parser.cpp \ vcardformatimpl.cpp \ vcardformatplugin.cpp \ vcardparser/vcardline.cpp \ vcardparser/vcard.cpp \ vcardparser/vcardtool.cpp \ vcardparser/vcardparser.cpp \ vcard/AdrParam.cpp \ vcard/AdrValue.cpp \ vcard/AgentParam.cpp \ vcard/ContentLine.cpp \ vcard/DateParam.cpp \ vcard/DateValue.cpp \ vcard/EmailParam.cpp \ vcard/Entity.cpp \ vcard/Enum.cpp \ vcard/GeoValue.cpp \ vcard/ImageParam.cpp \ vcard/ImageValue.cpp \ vcard/LangValue.cpp \ vcard/NValue.cpp \ vcard/Param.cpp \ vcard/PhoneNumberValue.cpp \ vcard/RToken.cpp \ vcard/SourceParam.cpp \ vcard/TelParam.cpp \ vcard/TextParam.cpp \ vcard/TextValue.cpp \ vcard/TextBinParam.cpp \ vcard/URIValue.cpp \ vcard/VCardv.cpp \ vcard/VCardEntity.cpp \ vcard/Value.cpp \ vcard/SoundValue.cpp \ vcard/AgentValue.cpp \ vcard/TelValue.cpp \ vcard/TextBinValue.cpp \ vcard/OrgValue.cpp \ vcard/UTCValue.cpp \ vcard/ClassValue.cpp \ vcard/FloatValue.cpp \ vcard/TextListValue.cpp # plugins/ldap/resourceldap.cpp \ # plugins/ldap/resourceldapconfig.cpp \ diff --git a/kaddressbook/details/look_html.cpp b/kaddressbook/details/look_html.cpp index 2a70273..63364a7 100644 --- a/kaddressbook/details/look_html.cpp +++ b/kaddressbook/details/look_html.cpp @@ -1,45 +1,45 @@ /* This file is part of KAddressBook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ -#include <libkdepim/addresseeview.h> +#include <addresseeview.h> #include "look_html.h" #include <qscrollview.h> KABHtmlView::KABHtmlView( QWidget *parent, const char *name ) : KABBasicLook( parent, name ) { mView = new KPIM::AddresseeView( this ); } KABHtmlView::~KABHtmlView() { } void KABHtmlView::setAddressee( const KABC::Addressee &addr ) { mView->setAddressee( addr ); } #ifndef KAB_EMBEDDED #include "look_html.moc" #endif //KAB_EMBEDDED diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index f21507a..32dd43a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1,463 +1,463 @@ /* This file is part of KAddressbook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include "kabcore.h" #include <stdaddressbook.h> #include <klocale.h> #ifndef KAB_EMBEDDED #include <qclipboard.h> #include <qdir.h> #include <qfile.h> #include <qapplicaton.h> #include <qlayout.h> #include <qregexp.h> #include <qvbox.h> #include <kabc/addresseelist.h> #include <kabc/errorhandler.h> #include <kabc/resource.h> #include <kabc/vcardconverter.h> #include <kapplication.h> #include <kactionclasses.h> #include <kcmultidialog.h> #include <kdebug.h> #include <kdeversion.h> #include <kkeydialog.h> #include <kmessagebox.h> #include <kprinter.h> #include <kprotocolinfo.h> #include <kresources/selectdialog.h> #include <kstandarddirs.h> #include <ktempfile.h> #include <kxmlguiclient.h> #include <kaboutdata.h> #include <libkdepim/categoryselectdialog.h> #include "addresseeutil.h" #include "addresseeeditordialog.h" #include "extensionmanager.h" #include "kstdaction.h" #include "kaddressbookservice.h" #include "ldapsearchdialog.h" #include "printing/printingwizard.h" #else // KAB_EMBEDDED #include <kapplication.h> #include "KDGanttMinimizeSplitter.h" #include "kaddressbookmain.h" #include "kactioncollection.h" #include "addresseedialog.h" //US -#include <libkdepim/addresseeview.h> +#include <addresseeview.h> #include <qapp.h> #include <qmenubar.h> //#include <qtoolbar.h> #include <qmessagebox.h> #include <kdebug.h> #include <kiconloader.h> // needed for SmallIcon #include <kresources/kcmkresources.h> #include <ktoolbar.h> //#include <qlabel.h> #ifndef DESKTOP_VERSION #include <qpe/ir.h> #include <qpe/qpemenubar.h> #include <qtopia/qcopenvelope_qws.h> #else #include <qmenubar.h> #endif #endif // KAB_EMBEDDED #include "kcmconfigs/kcmkabconfig.h" #include "kcmconfigs/kcmkdepimconfig.h" #include "kpimglobalprefs.h" #include "externalapphandler.h" #include <kresources/selectdialog.h> #include <kmessagebox.h> #include <picture.h> #include <resource.h> //US#include <qsplitter.h> #include <qmap.h> #include <qdir.h> #include <qfile.h> #include <qvbox.h> #include <qlayout.h> #include <qclipboard.h> #include <qtextstream.h> #include <libkdepim/categoryselectdialog.h> #include <kabc/vcardconverter.h> #include "addresseeutil.h" #include "undocmds.h" #include "addresseeeditordialog.h" #include "viewmanager.h" #include "details/detailsviewcontainer.h" #include "kabprefs.h" #include "xxportmanager.h" #include "incsearchwidget.h" #include "jumpbuttonbar.h" #include "extensionmanager.h" #include "addresseeconfig.h" #include <kcmultidialog.h> #ifdef _WIN32_ #include "kaimportoldialog.h" #endif bool pasteWithNewUid = true; #ifdef KAB_EMBEDDED KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ mReadWrite( readWrite ), mModified( false ), mMainWindow(client) #else //KAB_EMBEDDED KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), mReadWrite( readWrite ), mModified( false ) #endif //KAB_EMBEDDED { mExtensionBarSplitter = 0; mIsPart = !parent->inherits( "KAddressBookMain" ); mAddressBook = KABC::StdAddressBook::self(); KABC::StdAddressBook::setAutomaticSave( false ); #ifndef KAB_EMBEDDED mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); #endif //KAB_EMBEDDED connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), SLOT( addressBookChanged() ) ); mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, "X-Department", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, "X-Profession", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, "X-AssistantsName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, "X-ManagersName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, "X-SpousesName", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, "X-Office", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, "X-IMAddress", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, "X-Anniversary", "KADDRESSBOOK" ); //US added this field to become compatible with Opie/qtopia addressbook // values can be "female" or "male" or "". An empty field represents undefined. mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, "X-Gender", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, "X-Children", "KADDRESSBOOK" ); mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, "X-FreeBusyUrl", "KADDRESSBOOK" ); initGUI(); mIncSearchWidget->setFocus(); connect( mViewManager, SIGNAL( selected( const QString& ) ), SLOT( setContactSelected( const QString& ) ) ); connect( mViewManager, SIGNAL( executed( const QString& ) ), SLOT( executeContact( const QString& ) ) ); connect( mViewManager, SIGNAL( deleteRequest( ) ), SLOT( deleteContacts( ) ) ); connect( mViewManager, SIGNAL( modified() ), SLOT( setModified() ) ); connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); connect( mXXPortManager, SIGNAL( modified() ), SLOT( setModified() ) ); connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), SLOT( incrementalSearch( const QString& ) ) ); connect( mIncSearchWidget, SIGNAL( fieldChanged() ), mJumpButtonBar, SLOT( recreateButtons() ) ); connect( mDetails, SIGNAL( sendEmail( const QString& ) ), SLOT( sendMail( const QString& ) ) ); connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); #ifndef KAB_EMBEDDED connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), mXXPortManager, SLOT( importVCard( const KURL& ) ) ); connect( mDetails, SIGNAL( browse( const QString& ) ), SLOT( browse( const QString& ) ) ); mAddressBookService = new KAddressBookService( this ); #endif //KAB_EMBEDDED mEditorDialog = 0; createAddresseeEditorDialog( this ); setModified( false ); } KABCore::~KABCore() { // save(); //saveSettings(); //KABPrefs::instance()->writeConfig(); delete AddresseeConfig::instance(); mAddressBook = 0; KABC::StdAddressBook::close(); } void KABCore::restoreSettings() { mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; bool state; if (mMultipleViewsAtOnce) state = KABPrefs::instance()->mDetailsPageVisible; else state = false; mActionDetails->setChecked( state ); setDetailsVisible( state ); state = KABPrefs::instance()->mJumpButtonBarVisible; mActionJumpBar->setChecked( state ); setJumpButtonBarVisible( state ); /*US QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); } mMiniSplitter->setSizes( splitterSize ); if ( mExtensionBarSplitter ) { splitterSize = KABPrefs::instance()->mExtensionsSplitter; if ( splitterSize.count() == 0 ) { splitterSize.append( width() / 2 ); splitterSize.append( width() / 2 ); } mExtensionBarSplitter->setSizes( splitterSize ); } */ mViewManager->restoreSettings(); mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); mExtensionManager->restoreSettings(); #ifdef DESKTOP_VERSION int wid = width(); if ( wid < 10 ) wid = 400; #else int wid = QApplication::desktop()->width(); if ( wid < 640 ) wid = QApplication::desktop()->height(); #endif QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; if ( true /*splitterSize.count() == 0*/ ) { splitterSize.append( wid / 2 ); splitterSize.append( wid / 2 ); } mMiniSplitter->setSizes( splitterSize ); if ( mExtensionBarSplitter ) { //splitterSize = KABPrefs::instance()->mExtensionsSplitter; if ( true /*splitterSize.count() == 0*/ ) { splitterSize.append( wid / 2 ); splitterSize.append( wid / 2 ); } mExtensionBarSplitter->setSizes( splitterSize ); } } void KABCore::saveSettings() { KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); if ( mExtensionBarSplitter ) KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); #ifndef KAB_EMBEDDED KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); #endif //KAB_EMBEDDED mExtensionManager->saveSettings(); mViewManager->saveSettings(); KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); } KABC::AddressBook *KABCore::addressBook() const { return mAddressBook; } KConfig *KABCore::config() { #ifndef KAB_EMBEDDED return KABPrefs::instance()->config(); #else //KAB_EMBEDDED return KABPrefs::instance()->getConfig(); #endif //KAB_EMBEDDED } KActionCollection *KABCore::actionCollection() const { return mGUIClient->actionCollection(); } KABC::Field *KABCore::currentSearchField() const { if (mIncSearchWidget) return mIncSearchWidget->currentField(); else return 0; } QStringList KABCore::selectedUIDs() const { return mViewManager->selectedUids(); } KABC::Resource *KABCore::requestResource( QWidget *parent ) { QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); QPtrList<KRES::Resource> kresResources; QPtrListIterator<KABC::Resource> resIt( kabcResources ); KABC::Resource *resource; while ( ( resource = resIt.current() ) != 0 ) { ++resIt; if ( !resource->readOnly() ) { KRES::Resource *res = static_cast<KRES::Resource*>( resource ); if ( res ) kresResources.append( res ); } } KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); return static_cast<KABC::Resource*>( res ); } #ifndef KAB_EMBEDDED KAboutData *KABCore::createAboutData() #else //KAB_EMBEDDED void KABCore::createAboutData() #endif //KAB_EMBEDDED { #ifndef KAB_EMBEDDED KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), "3.1", I18N_NOOP( "The KDE Address Book" ), KAboutData::License_GPL_V2, I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); about->addAuthor( "Cornelius Schumacher", I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), "schumacher@kde.org" ); about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), "mpilone@slac.com" ); about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), "michel@klaralvdalens-datakonsult.se" ); about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), "hansen@kde.org" ); return about; #endif //KAB_EMBEDDED QString version; #include <../version> QMessageBox::about( this, "About KAddressbook/Pi", "KAddressbook/Platform-independent\n" "(KA/Pi) " +version + " - " + #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\n" "for: Zaurus 5500 / 7x0 / 8x0\n" #endif "(c) 2004 Ulf Schenk\n" "(c) 2004 Lutz Rogowski\n" "(c) 1997-2003, The KDE PIM Team\n" "Tobias Koenig Current maintainer\ntokoe@kde.org\n" "Don Sanders Original author\n" "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" "Greg Stern DCOP interface\n" "Mark Westcot Contact pinning\n" "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" #ifdef _WIN32_ "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" #endif ); } void KABCore::setContactSelected( const QString &uid ) { KABC::Addressee addr = mAddressBook->findByUid( uid ); if ( !mDetails->isHidden() ) mDetails->setAddressee( addr ); if ( !addr.isEmpty() ) { emit contactSelected( addr.formattedName() ); KABC::Picture pic = addr.photo(); if ( pic.isIntern() ) { diff --git a/kaddressbook/kaddressbookE.pro b/kaddressbook/kaddressbookE.pro index 1c9eeef..c027895 100644 --- a/kaddressbook/kaddressbookE.pro +++ b/kaddressbook/kaddressbookE.pro @@ -1,159 +1,161 @@ TEMPLATE = app CONFIG += qt warn_on TARGET = kapi OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/bin INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../qtcompat ../ interfaces $(QPEDIR)/include 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 += -lmicrokcal +#LIBS += -lmicrokdepim +#LIBS += -lmicrokcal LIBS += -lmicrokde LIBS += -lmicroqtcompat LIBS += -lmicrokabc LIBS += -lqpe LIBS += -ljpeg LIBS += $(QTOPIALIB) LIBS += -L$(QPEDIR)/lib LIBS += -Wl,-export-dynamic +LIBS += $(GCC3EXTRALIB1) +LIBS += $(GCC3EXTRALIB2) INTERFACES = \ # filteredit_base.ui \ # kofilterview_base.ui \ HEADERS = \ features/mergewidget.h \ features/distributionlistwidget.h \ kcmconfigs/addresseewidget.h \ kcmconfigs/extensionconfigdialog.h \ kcmconfigs/kcmkabconfig.h \ kcmconfigs/kabconfigwidget.h \ addresseeeditordialog.h \ addresseeeditorwidget.h \ addresseditwidget.h \ addresseeconfig.h \ addresseeutil.h \ emaileditwidget.h \ filtereditdialog.h \ kaddressbookmain.h \ kabprefs.h \ kabcore.h \ viewmanager.h \ extensionmanager.h \ extensionwidget.h \ kaddressbookview.h \ geowidget.h \ imagewidget.h \ incsearchwidget.h \ jumpbuttonbar.h \ phoneeditwidget.h \ secrecywidget.h \ keywidget.h \ nameeditdialog.h \ filter.h \ addviewdialog.h \ configurewidget.h \ viewconfigurewidget.h \ viewconfigurefieldspage.h \ viewconfigurefilterpage.h \ typecombo.h \ undo.h \ undocmds.h \ xxportmanager.h \ xxportobject.h \ xxportselectdialog.h \ details/detailsviewcontainer.h \ details/look_basic.h \ details/look_html.h \ views/kaddressbookiconview.h \ views/kaddressbooktableview.h \ views/kaddressbookcardview.h \ views/configuretableviewdialog.h \ views/configurecardviewdialog.h \ views/cardview.h \ views/colorlistbox.h \ views/contactlistview.h \ xxport/vcard_xxport.h \ xxport/kde2_xxport.h \ xxport/csv_xxport.h \ xxport/csvimportdialog.h \ xxport/opie_xxport.h \ xxport/qtopia_xxport.h \ xxport/sharpdtm_xxport.h \ #details/look_details.h \ #mainwindoiw.h \ # alarmclient.h \ # calendarview.h \ # customlistviewitem.h \ # datenavigator.h SOURCES = \ addresseeeditordialog.cpp \ addresseeeditorwidget.cpp \ addresseditwidget.cpp \ addresseeconfig.cpp \ addresseeutil.cpp \ extensionmanager.cpp \ features/mergewidget.cpp \ features/distributionlistwidget.cpp \ kcmconfigs/addresseewidget.cpp \ kcmconfigs/extensionconfigdialog.cpp \ kcmconfigs/kcmkabconfig.cpp \ kcmconfigs/kabconfigwidget.cpp \ emaileditwidget.cpp \ filtereditdialog.cpp \ mainembedded.cpp \ kaddressbookmain.cpp \ kabcore.cpp \ kabprefs.cpp \ viewmanager.cpp \ kaddressbookview.cpp \ extensionwidget.cpp \ geowidget.cpp \ imagewidget.cpp \ incsearchwidget.cpp \ jumpbuttonbar.cpp \ phoneeditwidget.cpp \ secrecywidget.cpp \ keywidget.cpp \ nameeditdialog.cpp \ filter.cpp \ addviewdialog.cpp \ configurewidget.cpp \ viewconfigurewidget.cpp \ viewconfigurefieldspage.cpp \ viewconfigurefilterpage.cpp \ undo.cpp \ undocmds.cpp \ xxportmanager.cpp \ xxportobject.cpp \ xxportselectdialog.cpp \ details/detailsviewcontainer.cpp \ details/look_basic.cpp \ details/look_html.cpp \ views/kaddressbookiconview.cpp \ views/kaddressbooktableview.cpp \ views/kaddressbookcardview.cpp \ views/configuretableviewdialog.cpp \ views/configurecardviewdialog.cpp \ views/cardview.cpp \ views/contactlistview.cpp \ views/colorlistbox.cpp \ xxport/vcard_xxport.cpp \ xxport/kde2_xxport.cpp \ xxport/csv_xxport.cpp \ xxport/csvimportdialog.cpp \ xxport/opie_xxport.cpp \ xxport/qtopia_xxport.cpp \ xxport/sharpdtm_xxport.cpp \ #details/look_details.cpp \ #mainwindow.cpp \ # calendarview.cpp \ # timespanview.cpp diff --git a/kaddressbook/xxportmanager.cpp b/kaddressbook/xxportmanager.cpp index 713b0fc..810c3e2 100644 --- a/kaddressbook/xxportmanager.cpp +++ b/kaddressbook/xxportmanager.cpp @@ -1,243 +1,243 @@ /* This file is part of KAddressbook. Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <qlayout.h> #include <qlist.h> #include <kabc/addressbook.h> #include <kabc/resource.h> #include <kdebug.h> #include <kdialogbase.h> #include <klocale.h> #include <kmessagebox.h> #ifndef KAB_EMBEDDED #include <ktrader.h> #else //KAB_EMBEDDED extern "C" { void* init_microkaddrbk_csv_xxport(); void* init_microkaddrbk_kde2_xxport(); void* init_microkaddrbk_vcard_xxport(); void* init_microkaddrbk_opie_xxport(); void* init_microkaddrbk_qtopia_xxport(); void* init_microkaddrbk_sharpdtm_xxport(); } #endif //KAB_EMBEDDED -#include <libkdepim/addresseeview.h> +#include <addresseeview.h> #include "kabcore.h" #include "undocmds.h" #include "xxportselectdialog.h" #include "xxportmanager.h" KURL XXPortManager::importURL = KURL(); QString XXPortManager::importData = QString::null; class PreviewDialog : public KDialogBase { public: PreviewDialog( const KABC::Addressee &addr, QWidget *parent, const char *name = 0 ); }; XXPortManager::XXPortManager( KABCore *core, QObject *parent, const char *name ) : QObject( parent, name ), mCore( core ), mShowPreview( false ) { loadPlugins(); } XXPortManager::~XXPortManager() { } void XXPortManager::restoreSettings() { } void XXPortManager::saveSettings() { } void XXPortManager::importVCard( const KURL &url ) { importVCard( url, false ); } void XXPortManager::importVCard( const KURL &url, bool showPreview ) { importURL = url; mShowPreview = showPreview; slotImport( "vcard", "<empty>" ); mShowPreview = false; importURL = KURL(); } void XXPortManager::importVCard( const QString &vCard, bool showPreview ) { importData = vCard; mShowPreview = showPreview; slotImport( "vcard", "<empty>" ); mShowPreview = false; importData = ""; } void XXPortManager::slotImport( const QString &identifier, const QString &data ) { XXPortObject *obj = mXXPortObjects[ identifier ]; if ( !obj ) { KMessageBox::error( mCore, i18n( "<qt>No import plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); return; } KABC::Resource *resource = mCore->requestResource( mCore ); if ( !resource ) return; KABC::AddresseeList list = obj->importContacts( data ); KABC::AddresseeList::Iterator it; bool imported = false; for ( it = list.begin(); it != list.end(); ++it ) { if ( mShowPreview ) { PreviewDialog dlg( *it, mCore ); if ( !dlg.exec() ) continue; } (*it).setResource( resource ); // We use a PwNewCommand so the user can undo it. PwNewCommand *command = new PwNewCommand( mCore->addressBook(), *it ); UndoStack::instance()->push( command ); RedoStack::instance()->clear(); imported = true; } if ( imported ) { KMessageBox::information( mCore, i18n( "contacts successfully imported." ) ); emit modified(); } } void XXPortManager::slotExport( const QString &identifier, const QString &data ) { XXPortObject *obj = mXXPortObjects[ identifier ]; if ( !obj ) { KMessageBox::error( mCore, i18n( "<qt>No export plugin available for <b>%1</b>.</qt>" ).arg( identifier ) ); return; } KABC::AddresseeList addrList; XXPortSelectDialog dlg( mCore, obj->requiresSorting(), mCore ); if ( dlg.exec() ) addrList = dlg.contacts(); else return; if ( !obj->exportContacts( addrList, data ) ) KMessageBox::error( mCore, i18n( "Unable to export contacts." ) ); else KMessageBox::information( mCore, i18n( "contacts successfully exported." ) ); } void XXPortManager::loadPlugins() { mXXPortObjects.clear(); #ifndef KAB_EMBEDDED KTrader::OfferList plugins = KTrader::self()->query( "KAddressBook/XXPort" ); KTrader::OfferList::ConstIterator it; for ( it = plugins.begin(); it != plugins.end(); ++it ) { if ( !(*it)->hasServiceType( "KAddressBook/XXPort" ) ) continue; KLibFactory *factory = KLibLoader::self()->factory( (*it)->library().latin1() ); if ( !factory ) { kdDebug(5720) << "XXPortManager::loadExtensions(): Factory creation failed" << endl; continue; } XXPortFactory *xxportFactory = static_cast<XXPortFactory*>( factory ); if ( !xxportFactory ) { kdDebug(5720) << "XXPortManager::loadExtensions(): Cast failed" << endl; continue; } #else //KAB_EMBEDDED QList<XXPortFactory> factorylist; factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_csv_xxport())); factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_kde2_xxport())); factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_vcard_xxport())); factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_opie_xxport())); factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_qtopia_xxport())); factorylist.append(static_cast<XXPortFactory*>(init_microkaddrbk_sharpdtm_xxport())); QListIterator<XXPortFactory> it(factorylist); for ( ; it.current(); ++it ) { XXPortFactory *xxportFactory = it.current(); #endif //KAB_EMBEDDED XXPortObject *obj = xxportFactory->xxportObject( mCore->addressBook(), mCore ); if ( obj ) { mCore->addGUIClient( obj ); mXXPortObjects.insert( obj->identifier(), obj ); connect( obj, SIGNAL( exportActivated( const QString&, const QString& ) ), this, SLOT( slotExport( const QString&, const QString& ) ) ); connect( obj, SIGNAL( importActivated( const QString&, const QString& ) ), this, SLOT( slotImport( const QString&, const QString& ) ) ); } } } PreviewDialog::PreviewDialog( const KABC::Addressee &addr, QWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "Contact Preview" ), Ok | Cancel, Ok, parent, name, true, true ) { QWidget *page = plainPage(); QVBoxLayout *layout = new QVBoxLayout( page, marginHint(), spacingHint() ); KPIM::AddresseeView *view = new KPIM::AddresseeView( page ); view->setAddressee( addr ); layout->addWidget( view ); resize( 400, 300 ); } #ifndef KAB_EMBEDDED #include "xxportmanager.moc" #endif //KAB_EMBEDDED diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 369c7a0..56b3fb0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -945,811 +945,813 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int local->resetTempSyncStat(); mLastCalendarSync = QDateTime::currentDateTime(); QDateTime modifiedCalendar = mLastCalendarSync;; eventLSync = getLastSyncEvent(); eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); if ( eventR ) { eventRSync = (Event*) eventR->clone(); remote->deleteEvent(eventR ); } else { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { eventRSync = (Event*)eventLSync->clone(); } else { fullDateRange = true; eventRSync = new Event(); eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); eventRSync->setDtStart( mLastCalendarSync ); eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); eventRSync->setCategories( i18n("SyncEvent") ); } } if ( eventLSync->dtStart() == mLastCalendarSync ) fullDateRange = true; if ( ! fullDateRange ) { if ( eventLSync->dtStart() != eventRSync->dtStart() ) { // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); fullDateRange = true; } } if ( fullDateRange ) mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); else mLastCalendarSync = eventLSync->dtStart(); // for resyncing if own file has changed if ( mCurrentSyncDevice == "deleteaftersync" ) { mLastCalendarSync = loadedFileVersion; qDebug("setting mLastCalendarSync "); } //qDebug("*************************** "); qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); QPtrList<Incidence> er = remote->rawIncidences(); Incidence* inR = er.first(); Incidence* inL; QProgressBar bar( er.count(),0 ); bar.setCaption (i18n("Syncing - close to abort!") ); int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar.sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); bar.show(); int modulo = (er.count()/10)+1; int incCounter = 0; while ( inR ) { if ( ! bar.isVisible() ) return false; if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); ++incCounter; uid = inR->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; QString idS; qApp->processEvents(); if ( !skipIncidence ) { inL = local->incidence( uid ); if ( inL ) { // maybe conflict - same uid in both calendars int maxrev = inL->revision(); if ( maxrev < inR->revision() ) maxrev = inR->revision(); if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { //qDebug("take %d %s ", take, inL->summary().latin1()); if ( take == 3 ) return false; if ( take == 1 ) {// take local if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); else idS = inR->IDStr(); remote->deleteIncidence( inR ); if ( inL->revision() < maxrev ) inL->setRevision( maxrev ); inR = inL->clone(); inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) inR->setIDStr( idS ); remote->addIncidence( inR ); ++changedRemote; } else { if ( inR->revision() < maxrev ) inR->setRevision( maxrev ); idS = inL->IDStr(); local->deleteIncidence( inL ); inL = inR->clone(); inL->setIDStr( idS ); local->addIncidence( inL ); ++changedLocal; } } } else { // no conflict if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { QString des = eventLSync->description(); QString pref = "e"; if ( inR->type() == "Todo" ) pref = "t"; if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); //remote->deleteIncidence( inR ); ++deletedEventR; } else { inR->setLastModified( modifiedCalendar ); inL = inR->clone(); local->addIncidence( inL ); ++addedEvent; } } else { if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { inR->setLastModified( modifiedCalendar ); local->addIncidence( inR->clone() ); ++addedEvent; } else { checkExternSyncEvent(eventRSyncSharp, inR); remote->deleteIncidence( inR ); ++deletedEventR; } } } } inR = er.next(); } QPtrList<Incidence> el = local->rawIncidences(); inL = el.first(); modulo = (el.count()/10)+1; bar.setCaption (i18n("Add / remove events") ); bar.setTotalSteps ( el.count() ) ; bar.show(); incCounter = 0; while ( inL ) { qApp->processEvents(); if ( ! bar.isVisible() ) return false; if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); ++incCounter; uid = inL->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) skipIncidence = true; if ( !skipIncidence ) { inR = remote->incidence( uid ); if ( ! inR ) { if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { inL->removeID(mCurrentSyncDevice ); ++addedEventR; //qDebug("remote added Incidence %s ", inL->summary().latin1()); inL->setLastModified( modifiedCalendar ); inR = inL->clone(); inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); remote->addIncidence( inR ); } } } else { if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { ++addedEventR; inL->setLastModified( modifiedCalendar ); remote->addIncidence( inL->clone() ); } } } } } inL = el.next(); } int delFut = 0; if ( KOPrefs::instance()->mWriteBackInFuture ) { er = remote->rawIncidences(); inR = er.first(); QDateTime dt; QDateTime cur = QDateTime::currentDateTime(); QDateTime end = cur.addSecs( KOPrefs::instance()->mWriteBackInFuture * 3600 *24 *7 ); while ( inR ) { if ( inR->type() == "Todo" ) { Todo * t = (Todo*)inR; if ( t->hasDueDate() ) dt = t->dtDue(); else dt = cur.addSecs( 62 ); } else if (inR->type() == "Event" ) { bool ok; dt = inR->getNextOccurence( cur, &ok ); if ( !ok ) dt = cur.addSecs( -62 ); } else dt = inR->dtStart(); if ( dt < cur || dt > end ) { remote->deleteIncidence( inR ); ++delFut; } inR = er.next(); } } bar.hide(); mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); eventLSync->setReadOnly( false ); eventLSync->setDtStart( mLastCalendarSync ); eventRSync->setDtStart( mLastCalendarSync ); eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); eventLSync->setReadOnly( true ); if ( mGlobalSyncMode == SYNC_MODE_NORMAL) remote->addEvent( eventRSync ); QString mes; mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); QString delmess; if ( delFut ) { delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\n"),delFut, KOPrefs::instance()->mWriteBackInFuture ); mes += delmess; } if ( KOPrefs::instance()->mShowSyncSummary ) { KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); } qDebug( mes ); mCalendar->checkAlarmForIncidence( 0, true ); return syncOK; } void CalendarView::setSyncDevice( QString s ) { mCurrentSyncDevice= s; } void CalendarView::setSyncName( QString s ) { mCurrentSyncName= s; } bool CalendarView::syncCalendar(QString filename, int mode) { mGlobalSyncMode = SYNC_MODE_NORMAL; CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); FileStorage* storage = new FileStorage( calendar ); bool syncOK = false; storage->setFileName( filename ); // qDebug("loading ... "); if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, mode ); getEventViewerDialog()->setSyncMode( false ); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); storage->save(); } } setModified( true ); } delete storage; delete calendar; if ( syncOK ) updateView(); return syncOK; } void CalendarView::syncPhone() { syncExternal( 1 ); } void CalendarView::syncExternal( int mode ) { mGlobalSyncMode = SYNC_MODE_EXTERNAL; //mCurrentSyncDevice = "sharp-DTM"; if ( KOPrefs::instance()->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); bool syncOK = false; bool loadSuccess = false; PhoneFormat* phoneFormat = 0; #ifndef DESKTOP_VERSION SharpFormat* sharpFormat = 0; if ( mode == 0 ) { // sharp sharpFormat = new SharpFormat () ; loadSuccess = sharpFormat->load( calendar, mCalendar ); } else #endif if ( mode == 1 ) { // phone phoneFormat = new PhoneFormat (mCurrentSyncDevice, KOPrefs::instance()->mPhoneDevice, KOPrefs::instance()->mPhoneConnection, KOPrefs::instance()->mPhoneModel); loadSuccess = phoneFormat->load( calendar,mCalendar); } else return; if ( loadSuccess ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { QPtrList<Incidence> iL = mCalendar->rawIncidences(); Incidence* inc = iL.first(); if ( phoneFormat ) { while ( inc ) { inc->removeID(mCurrentSyncDevice); inc = iL.next(); } } #ifndef DESKTOP_VERSION if ( sharpFormat ) sharpFormat->save(calendar); #endif if ( phoneFormat ) phoneFormat->save(calendar); iL = calendar->rawIncidences(); inc = iL.first(); Incidence* loc; while ( inc ) { if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { loc = mCalendar->incidence(inc->uid() ); if ( loc ) { loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); } } inc = iL.next(); } Incidence* lse = getLastSyncEvent(); if ( lse ) { lse->setReadOnly( false ); lse->setDescription( "" ); lse->setReadOnly( true ); } } } setModified( true ); } else { QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return ;//syncOK; } void CalendarView::syncSharp() { syncExternal( 0 ); } -#include <kabc/stdaddressbook.h> +//#include <kabc/stdaddressbook.h> bool CalendarView::importBday() { +#if 0 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); KABC::AddressBook::Iterator it; int count = 0; for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { ++count; } QProgressBar bar(count,0 ); int w = 300; if ( QApplication::desktop()->width() < 320 ) w = 220; int h = bar.sizeHint().height() ; int dw = QApplication::desktop()->width(); int dh = QApplication::desktop()->height(); bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); bar.show(); bar.setCaption (i18n("Reading addressbook - close to abort!") ); qApp->processEvents(); count = 0; int addCount = 0; KCal::Attendee* a = 0; for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { if ( ! bar.isVisible() ) return false; bar.setProgress( count++ ); qApp->processEvents(); //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); if ( (*it).birthday().date().isValid() ){ a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) ++addCount; } QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); if ( anni.isValid() ){ a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) ++addCount; } } updateView(); topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); +#endif return true; } bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) { //qDebug("addAnni "); Event * ev = new Event(); if ( a ) { ev->addAttendee( a ); } QString kind; if ( birthday ) kind = i18n( "Birthday" ); else kind = i18n( "Anniversary" ); ev->setSummary( name + " - " + kind ); ev->setOrganizer( "nobody@nowhere" ); ev->setCategories( kind ); ev->setDtStart( QDateTime(date) ); ev->setDtEnd( QDateTime(date) ); ev->setFloats( true ); Recurrence * rec = ev->recurrence(); rec->setYearly(Recurrence::rYearlyMonth,1,-1); rec->addYearlyNum( date.month() ); if ( !mCalendar->addAnniversaryNoDup( ev ) ) { delete ev; return false; } return true; } bool CalendarView::importQtopia( const QString &categories, const QString &datebook, const QString &todolist ) { QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); updateView(); return true; #if 0 mGlobalSyncMode = SYNC_MODE_QTOPIA; mCurrentSyncDevice = "qtopia-XML"; if ( KOPrefs::instance()->mAskForPreferences ) edit_sync_options(); qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); bool syncOK = false; QtopiaFormat qtopiaFormat; qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); bool loadOk = true; if ( !categories.isEmpty() ) loadOk = qtopiaFormat.load( calendar, categories ); if ( loadOk && !datebook.isEmpty() ) loadOk = qtopiaFormat.load( calendar, datebook ); if ( loadOk && !todolist.isEmpty() ) loadOk = qtopiaFormat.load( calendar, todolist ); if ( loadOk ) { getEventViewerDialog()->setSyncMode( true ); syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); getEventViewerDialog()->setSyncMode( false ); qApp->processEvents(); if ( syncOK ) { if ( KOPrefs::instance()->mWriteBackFile ) { // write back XML file } setModified( true ); } } else { QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), question, i18n("Ok")) ; } delete calendar; updateView(); return syncOK; #endif } void CalendarView::setSyncEventsReadOnly() { Event * ev; QPtrList<Event> eL = mCalendar->rawEvents(); ev = eL.first(); while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) ev->setReadOnly( true ); ev = eL.next(); } } bool CalendarView::openCalendar(QString filename, bool merge) { if (filename.isEmpty()) { return false; } if (!QFile::exists(filename)) { KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); return false; } globalFlagBlockAgenda = 1; if (!merge) mCalendar->close(); mStorage->setFileName( filename ); if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { if ( merge ) ;//setModified( true ); else { //setModified( true ); mViewManager->setDocumentId( filename ); mDialogManager->setDocumentId( filename ); mTodoList->setDocumentId( filename ); } globalFlagBlockAgenda = 2; // if ( getLastSyncEvent() ) // getLastSyncEvent()->setReadOnly( true ); mCalendar->reInitAlarmSettings(); setSyncEventsReadOnly(); updateUnmanagedViews(); updateView(); if ( filename != MainWindow::defaultFileName() ) saveCalendar( MainWindow::defaultFileName() ); loadedFileVersion = QDateTime::currentDateTime(); return true; } else { // while failing to load, the calendar object could // have become partially populated. Clear it out. if ( !merge ) mCalendar->close(); KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); globalFlagBlockAgenda = 2; updateView(); } return false; } void CalendarView::setLoadedFileVersion(QDateTime dt) { loadedFileVersion = dt; } bool CalendarView::checkFileChanged(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); if ( dt <= loadedFileVersion ) return false; return true; } bool CalendarView::checkFileVersion(QString fn) { QFileInfo finf ( fn ); if ( !finf.exists() ) return true; QDateTime dt = finf.lastModified (); //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); //qDebug("file on disk version %s",dt.toString().latin1()); if ( dt <= loadedFileVersion ) return true; int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , i18n("KO/Pi Warning"),i18n("Overwrite"), i18n("Sync+save")); if ( km == KMessageBox::Cancel ) return false; if ( km == KMessageBox::Yes ) return true; setSyncDevice("deleteaftersync" ); KOPrefs::instance()->mAskForPreferences = true; KOPrefs::instance()->mSyncAlgoPrefs = 3; KOPrefs::instance()->mWriteBackFile = false; KOPrefs::instance()->mWriteBackExistingOnly = false; KOPrefs::instance()->mShowSyncSummary = false; syncCalendar( fn, 3 ); Event * e = getLastSyncEvent(); mCalendar->deleteEvent ( e ); updateView(); return true; } bool CalendarView::saveCalendar( QString filename ) { // Store back all unsaved data into calendar object // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); if ( mViewManager->currentView() ) mViewManager->currentView()->flushView(); //mStorage->setFileName( filename ); mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); mStorage->setFileName( filename ); bool success; success = mStorage->save(); if ( !success ) { return false; } return true; } void CalendarView::closeCalendar() { // child windows no longer valid emit closingDown(); mCalendar->close(); setModified(false); updateView(); } void CalendarView::archiveCalendar() { mDialogManager->showArchiveDialog(); } void CalendarView::readSettings() { // mViewManager->showAgendaView(); QString str; //qDebug("CalendarView::readSettings() "); // read settings from the KConfig, supplying reasonable // defaults where none are to be found KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> sizes = config->readIntListEntry("Separator1"); if (sizes.count() != 2) { sizes << mDateNavigator->minimumSizeHint().width(); sizes << 300; } mPanner->setSizes(sizes); sizes = config->readIntListEntry("Separator2"); if ( ( mResourceView && sizes.count() == 4 ) || ( !mResourceView && sizes.count() == 3 ) ) { mLeftSplitter->setSizes(sizes); } #endif globalFlagBlockAgenda = 1; mViewManager->showAgendaView(); //mViewManager->readSettings( config ); mTodoList->restoreLayout(config,QString("Todo Layout")); readFilterSettings(config); config->setGroup( "Views" ); int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); if ( dateCount == 5 ) mNavigator->selectWorkWeek(); else if ( dateCount == 7 ) mNavigator->selectWeek(); else mNavigator->selectDates( dateCount ); // mViewManager->readSettings( config ); updateConfig(); globalFlagBlockAgenda = 2; mViewManager->readSettings( config ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list; list = config->readListEntry("MainLayout"); int x,y,w,h; if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); topLevelWidget()->setGeometry(x,y,w,h); } else { topLevelWidget()->setGeometry( 40 ,40 , 640, 440); } list = config->readListEntry("EditEventLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); mEventEditor->setGeometry(x,y,w,h); } list = config->readListEntry("EditTodoLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); mTodoEditor->setGeometry(x,y,w,h); } list = config->readListEntry("ViewerLayout"); if ( ! list.isEmpty() ) { x = list[0].toInt(); y = list[1].toInt(); w = list[2].toInt(); h = list[3].toInt(); getEventViewerDialog()->setGeometry(x,y,w,h); } #endif } void CalendarView::writeSettings() { // kdDebug() << "CalendarView::writeSettings" << endl; KConfig *config = KOGlobals::config(); #ifndef KORG_NOSPLITTER config->setGroup("KOrganizer Geometry"); QValueList<int> list = mPanner->sizes(); config->writeEntry("Separator1",list); list = mLeftSplitter->sizes(); config->writeEntry("Separator2",list); #endif mViewManager->writeSettings( config ); mTodoList->saveLayout(config,QString("Todo Layout")); mDialogManager->writeSettings( config ); //KOPrefs::instance()->usrWriteConfig(); KOPrefs::instance()->writeConfig(); writeFilterSettings(config); config->setGroup( "Views" ); config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); #ifdef DESKTOP_VERSION config->setGroup("WidgetLayout"); QStringList list ;//= config->readListEntry("MainLayout"); int x,y,w,h; QWidget* wid; wid = topLevelWidget(); x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("MainLayout",list ); wid = mEventEditor; x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); list << QString::number( y ); list << QString::number( w ); list << QString::number( h ); config->writeEntry("EditEventLayout",list ); wid = mTodoEditor; x = wid->geometry().x(); y = wid->geometry().y(); w = wid->width(); h = wid->height(); list.clear(); list << QString::number( x ); diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp index f3bd09f..50e3077 100644 --- a/korganizer/incomingdialog.cpp +++ b/korganizer/incomingdialog.cpp @@ -1,437 +1,438 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlistview.h> #include <qfile.h> #include <qdir.h> #include <qmap.h> #include <kglobal.h> #include <klocale.h> #include <kdebug.h> #include <kstandarddirs.h> #include <kmessagebox.h> #include <libkcal/incidence.h> #include <libkcal/event.h> #include <libkcal/calendar.h> #include <libkcal/freebusy.h> #include <libkcal/attendee.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> #ifndef KORG_NOMAIL #include "mailscheduler.h" #else #include <libkcal/dummyscheduler.h> #endif #include "incomingdialog.h" #include "koeventviewerdialog.h" #include "kocounterdialog.h" #include "koprefs.h" #ifndef KORG_NOKABC -#include <kabc/stdaddressbook.h> +#define KORG_NOKABC +//#include <kabc/stdaddressbook.h> #define size count #endif ScheduleItemIn::ScheduleItemIn(QListView *parent,IncidenceBase *ev, Scheduler::Method method,ScheduleMessage::Status status) : QListViewItem(parent) { mIncidence = ev; mMethod = method; mStatus = status; setText(6,Scheduler::translatedMethodName(mMethod)+" "); setText(7,ScheduleMessage::statusName(status)); } /* Visitor */ ScheduleItemVisitor::ScheduleItemVisitor(ScheduleItemIn *item) { mItem = item; } ScheduleItemVisitor::~ScheduleItemVisitor() { } bool ScheduleItemVisitor::visit(Event *e) { mItem->setText(0,e->summary()); mItem->setText(1,e->dtStartDateStr()); if (e->doesFloat()) { mItem->setText(2,i18n("no time ")); mItem->setText(4,i18n("no time ")); } else { mItem->setText(2,e->dtStartTimeStr()); mItem->setText(4,e->dtEndTimeStr()); } if (e->hasEndDate()) { mItem->setText(3,e->dtEndDateStr()); } else { mItem->setText(3,""); } mItem->setText(5,e->organizer()+" "); return true; } bool ScheduleItemVisitor::visit(Todo *e) { mItem->setText(0,e->summary()); if (e->hasStartDate()) { mItem->setText(1,e->dtStartDateStr()); if (!e->doesFloat()) { mItem->setText(2,e->dtStartTimeStr()); } } if (e->hasDueDate()) { mItem->setText(1,e->dtDueDateStr()); if (!e->doesFloat()) { mItem->setText(2,e->dtDueTimeStr()); } } mItem->setText(5,e->organizer()+" "); return true; } bool ScheduleItemVisitor::visit(Journal *) { return false; } /* * Constructs a IncomingDialog which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, QWidget* parent,const char* name,bool modal,WFlags fl) : IncomingDialog_base(parent,name,modal,fl) { mCalendar = calendar; mOutgoing = outgoing; #ifndef KORG_NOMAIL mScheduler = new MailScheduler(mCalendar); #else mScheduler = new DummyScheduler(mCalendar); #endif mMessageListView->setColumnAlignment(1,AlignHCenter); mMessageListView->setColumnAlignment(2,AlignHCenter); mMessageListView->setColumnAlignment(3,AlignHCenter); mMessageListView->setColumnAlignment(4,AlignHCenter); QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), this,SLOT(showEvent(QListViewItem *))); retrieve(); } /* * Destroys the object and frees any allocated resources */ IncomingDialog::~IncomingDialog() { // no need to delete child widgets, Qt does it all for us } void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) { mOutgoing = outgoing; } void IncomingDialog::retrieve() { QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); ScheduleMessage *message; for(message = messages.first();message;message = messages.next()) { IncidenceBase *inc = message->event(); Scheduler::Method method = (Scheduler::Method)message->method(); ScheduleMessage::Status status = message->status(); ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); if(inc->type()!="FreeBusy") { Incidence *incidence = static_cast<Incidence *>(inc); ScheduleItemVisitor v(item); if (!incidence->accept(v)) delete item; } else { FreeBusy *fb = static_cast<FreeBusy *>(item->event()); item->setText(0, "FreeBusy"); item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); item->setText(5, fb->organizer()); } automaticAction(item); } emit numMessagesChanged(mMessageListView->childCount()); } void IncomingDialog::acceptAllMessages() { bool success = false; ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild(); while(item) { ScheduleItemIn *nextitem = (ScheduleItemIn *)(item->nextSibling()); if (acceptMessage(item)) success = true; item = nextitem; } if (success) emit calendarUpdated(); } void IncomingDialog::acceptMessage() { ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); if (item) { if (acceptMessage(item)) emit calendarUpdated(); } } bool IncomingDialog::acceptMessage(ScheduleItemIn *item) { switch (item->method()) { case Scheduler::Refresh: return incomeRefresh(item); break; case Scheduler::Counter: return incomeCounter(item); break; case Scheduler::Declinecounter: return incomeDeclineCounter(item); break; case Scheduler::Add: return incomeAdd(item); break; case Scheduler::Request: return incomeRequest(item); break; default: return incomeDefault(item); } return false; } void IncomingDialog::rejectMessage() { ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); if (item) { mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); } } void IncomingDialog::showEvent(QListViewItem *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); if( incidence && incidence->type() == "Event" ) { Event *event = static_cast<Event *>(incidence); KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); eventViewer->setEvent(event); eventViewer->show(); } } bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) { Event *ev = mCalendar->event(item->event()->uid()); if (ev) { //user interaction before?? Attendee *att; QPtrList<Attendee> attlist = ev->attendees(); for (att=attlist.first(); att; att=attlist.next()) { Event *event = new Event(*ev); mOutgoing->addMessage(event,Scheduler::Request,att->email()); delete(event); } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeCounter(ScheduleItemIn *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); // currently only events supportet - attetion at insertion below! if ( incidence->type() != "Event" ) return false; Event *counterEvent = static_cast<Event *>( incidence ); Event *even = mCalendar->event(counterEvent->uid()); KOCounterDialog *eventViewer = new KOCounterDialog(this); eventViewer->addText(i18n("counter proposal event","<b>Counter-event:</b><p>")); eventViewer->addEvent(counterEvent); eventViewer->addText("<hr>"); eventViewer->addText(i18n("<b>Original event:</b><p>")); if (even) eventViewer->addEvent(even); else eventViewer->addText(i18n("A corresponding event is missing in your calendar!")); eventViewer->addText("<hr>"); eventViewer->addText(i18n("If this counter-event is a good proposal for your event, press 'Accept'. All Attendees will then get the new version of this event")); eventViewer->show(); eventViewer->exec(); if (eventViewer->result()) { kdDebug() << "IncomingDialog::Counter:Accept" << endl; int revision = 0; if (even) { revision = even->revision(); mCalendar->deleteEvent(even); } mCalendar->addIncidence(counterEvent); even = mCalendar->event(item->event()->uid()); if (even) { if (revision < even->revision()) even->setRevision(even->revision()+1); else even->setRevision(revision+1); Event *ev = new Event(*even); mOutgoing->addMessage(ev,Scheduler::Request); delete(ev); } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { kdDebug() << "IncomingDialog::Counter:Decline" << endl; //the counter-sender's email is missing... //now every attendee gets an declinecounter :-( mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter); delete item; emit numMessagesChanged(mMessageListView->childCount()); mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } //mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item) { Event *even = mCalendar->event(item->event()->uid()); if (even) { mOutgoing->addMessage(even,Scheduler::Refresh); mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } mScheduler->deleteTransaction(item->event()); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } bool IncomingDialog::incomeAdd(ScheduleItemIn *item) { IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); if (incidence->type() == "Event" ) { Event *refr = static_cast<Event *>( incidence ); mOutgoing->addMessage(refr,Scheduler::Refresh); mScheduler->deleteTransaction( incidence ); delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl; mScheduler->deleteTransaction( incidence ); delete item; emit numMessagesChanged(mMessageListView->childCount()); return false; } } bool IncomingDialog::incomeDefault(ScheduleItemIn *item) { if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) { delete item; emit numMessagesChanged(mMessageListView->childCount()); return true; } else { KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses.")); kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl; return false; } return false; } bool IncomingDialog::incomeRequest(ScheduleItemIn *item) { if (item->event()->type()=="FreeBusy") { //handel freebusy request IncidenceBase *inc = item->event(); QDateTime start = inc->dtStart(); QDateTime end = start.addDays(inc->duration()/86400); FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); freebusy->setOrganizer(inc->organizer()); Attendee *att = new Attendee(KOPrefs::instance()->fullName(), KOPrefs::instance()->email()); freebusy->addAttendee(att); kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " << KGlobal::locale()->formatDateTime( start ) << " End Date: " << KGlobal::locale()->formatDateTime( end ) << endl; if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) { delete item; emit numMessagesChanged(mMessageListView->childCount()); delete(freebusy); return true; } return false; } else { return incomeDefault(item); } return false; } bool IncomingDialog::automaticAction(ScheduleItemIn *item) { bool autoAction = false; IncidenceBase *inc = item->event(); Scheduler::Method method = item->method(); diff --git a/korganizer/korganizerE.pro b/korganizer/korganizerE.pro index 4247838..d841193 100644 --- a/korganizer/korganizerE.pro +++ b/korganizer/korganizerE.pro @@ -1,155 +1,157 @@ TEMPLATE = app CONFIG += qt warn_on TARGET = kopi OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/bin INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/libkdepim interfaces $(KDEPIMDIR)/kabc $(QPEDIR)/include DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL DEFINES += KORG_NOPRINTER KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER DEFINES += KORG_NOLVALTERNATION #KORG_NOKABC LIBS += -lmicrokdepim LIBS += -lmicrokcal LIBS += -lmicrokde LIBS += -lmicroqtcompat -LIBS += -lmicrokabc +#LIBS += -lmicrokabc #LIBS += $(QPEDIR)/lib/gammu #LIBS += -lmicrogammu #LIBS += -lbluetooth #LIBS += -lsdp +LIBS += $(GCC3EXTRALIB1) +LIBS += $(GCC3EXTRALIB2) LIBS += -lqpe LIBS += -ljpeg LIBS += $(QTOPIALIB) LIBS += -L$(QPEDIR)/lib INTERFACES = kofilterview_base.ui #filteredit_base.ui HEADERS = \ wordsgerman.h \ filteredit_base.h \ alarmclient.h \ calendarview.h \ customlistviewitem.h \ datenavigator.h \ docprefs.h \ filtereditdialog.h \ incomingdialog.h \ incomingdialog_base.h \ interfaces/korganizer/baseview.h \ interfaces/korganizer/calendarviewbase.h \ journalentry.h \ kdateedit.h \ kdatenavigator.h \ koagenda.h \ koagendaitem.h \ koagendaview.h \ kocounterdialog.h \ kodaymatrix.h \ kodialogmanager.h \ koeditordetails.h \ koeditorgeneral.h \ koeditorgeneralevent.h \ koeditorgeneraltodo.h \ koeditorrecurrence.h \ koeventeditor.h \ koeventpopupmenu.h \ koeventview.h \ koeventviewer.h \ koeventviewerdialog.h \ kofilterview.h \ koglobals.h \ koincidenceeditor.h \ kojournalview.h \ kolistview.h \ kolocationbox.h \ komonthview.h \ koprefs.h \ koprefsdialog.h \ kotimespanview.h \ kotodoeditor.h \ kotodoview.h \ kotodoviewitem.h \ koviewmanager.h \ kowhatsnextview.h \ ktimeedit.h \ lineview.h \ mainwindow.h \ navigatorbar.h \ outgoingdialog.h \ outgoingdialog_base.h \ publishdialog.h \ publishdialog_base.h \ savetemplatedialog.h \ searchdialog.h \ simplealarmclient.h \ statusdialog.h \ timeline.h \ timespanview.h \ version.h \ ../kalarmd/alarmdialog.h SOURCES = \ filteredit_base.cpp \ calendarview.cpp \ datenavigator.cpp \ docprefs.cpp \ filtereditdialog.cpp \ incomingdialog.cpp \ incomingdialog_base.cpp \ journalentry.cpp \ kdatenavigator.cpp \ koagenda.cpp \ koagendaitem.cpp \ koagendaview.cpp \ kocounterdialog.cpp \ kodaymatrix.cpp \ kodialogmanager.cpp \ koeditordetails.cpp \ koeditorgeneral.cpp \ koeditorgeneralevent.cpp \ koeditorgeneraltodo.cpp \ koeditorrecurrence.cpp \ koeventeditor.cpp \ koeventpopupmenu.cpp \ koeventview.cpp \ koeventviewer.cpp \ koeventviewerdialog.cpp \ kofilterview.cpp \ koglobals.cpp \ koincidenceeditor.cpp \ kojournalview.cpp \ kolistview.cpp \ kolocationbox.cpp \ komonthview.cpp \ koprefs.cpp \ koprefsdialog.cpp \ kotimespanview.cpp \ kotodoeditor.cpp \ kotodoview.cpp \ kotodoviewitem.cpp \ koviewmanager.cpp \ kowhatsnextview.cpp \ ktimeedit.cpp \ lineview.cpp \ main.cpp \ mainwindow.cpp \ navigatorbar.cpp \ outgoingdialog.cpp \ outgoingdialog_base.cpp \ publishdialog.cpp \ publishdialog_base.cpp \ savetemplatedialog.cpp \ searchdialog.cpp \ simplealarmclient.cpp \ statusdialog.cpp \ timeline.cpp \ timespanview.cpp \ ../kalarmd/alarmdialog.cpp diff --git a/korganizer/publishdialog.cpp b/korganizer/publishdialog.cpp index 4323b91..2ae6720 100644 --- a/korganizer/publishdialog.cpp +++ b/korganizer/publishdialog.cpp @@ -1,150 +1,151 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include <qlineedit.h> #include <kdebug.h> #include <kglobal.h> #include <klocale.h> #ifndef KORG_NOKABC -#include <kabc/addresseedialog.h> +#define KORG_NOKABC +//#include <kabc/addresseedialog.h> #endif #include "koprefs.h" #include "publishdialog.h" PublishDialog::PublishDialog(QWidget* parent, const char* name, bool modal, WFlags fl) : PublishDialog_base(parent,name,modal,fl) { setCaption(i18n("Select Addresses")); mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); connect(mAddressListView,SIGNAL(selectionChanged(QListViewItem *)), SLOT(updateInput())); } PublishDialog::~PublishDialog() { } void PublishDialog::addAttendee(Attendee *attendee) { mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); item->setText(0,attendee->name()); item->setText(1,attendee->email()); mAddressListView->insertItem(item); } QString PublishDialog::addresses() { QString to = ""; QListViewItem *item; int i, count; count = mAddressListView->childCount(); for (i=0;i<count;i++) { item = mAddressListView->firstChild(); mAddressListView->takeItem(item); to += item->text(1); if (i<count-1) { to += ", "; } } return to; } void PublishDialog::addItem() { mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); mAddressListView->insertItem(item); mAddressListView->setSelected(item,true); mNameLineEdit->setText(i18n("(EmptyName)")); mEmailLineEdit->setText(i18n("(EmptyEmail)")); } void PublishDialog::removeItem() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; mAddressListView->takeItem(item); item = mAddressListView->selectedItem(); if (!item) { mNameLineEdit->setText(""); mEmailLineEdit->setText(""); mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); } if (mAddressListView->childCount() == 0) { mNameLineEdit->setEnabled(false); mEmailLineEdit->setEnabled(false); } } void PublishDialog::openAddressbook() { #ifndef KORG_NOKABC KABC::Addressee::List addressList; addressList = KABC::AddresseeDialog::getAddressees(this); //KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this); KABC::Addressee a = addressList.first(); if (!a.isEmpty()) { uint i; for (i=0;i<addressList.count();i++) { a = addressList[i]; mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QListViewItem *item = new QListViewItem(mAddressListView); mAddressListView->setSelected(item,true); mNameLineEdit->setText(a.realName()); mEmailLineEdit->setText(a.preferredEmail()); mAddressListView->insertItem(item); } } #endif } void PublishDialog::updateItem() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; item->setText(0,mNameLineEdit->text()); item->setText(1,mEmailLineEdit->text()); } void PublishDialog::updateInput() { QListViewItem *item; item = mAddressListView->selectedItem(); if (!item) return; mNameLineEdit->setEnabled(true); mEmailLineEdit->setEnabled(true); QString mail = item->text(1); mNameLineEdit->setText(item->text(0)); mEmailLineEdit->setText(mail); } diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro index 060145e..f5de653 100644 --- a/libkdepim/libkdepim.pro +++ b/libkdepim/libkdepim.pro @@ -1,59 +1,57 @@ TEMPLATE = lib CONFIG = qt warn_on DEFINES +=KORG_NOKABC TARGET = microkdepim INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . .. DESTDIR=../bin DEFINES += DESKTOP_VERSION include( ../variables.pri ) unix : { OBJECTS_DIR = obj/unix MOC_DIR = moc/unix } win32: { DEFINES += _WIN32_ OBJECTS_DIR = obj/win MOC_DIR = moc/win } INTERFACES = \ HEADERS = \ categoryeditdialog.h \ categoryeditdialog_base.h \ categoryselectdialog.h \ categoryselectdialog_base.h \ externalapphandler.h \ kdateedit.h \ kdatepicker.h \ kinputdialog.h \ kincidenceformatter.h \ kpimprefs.h \ kpimglobalprefs.h \ kprefsdialog.h \ - addresseeview.h \ ksyncprofile.h \ ksyncprefsdialog.h \ kcmconfigs/kcmkdepimconfig.h \ kcmconfigs/kdepimconfigwidget.h SOURCES = \ categoryeditdialog.cpp \ categoryeditdialog_base.cpp \ categoryselectdialog.cpp \ categoryselectdialog_base.cpp \ externalapphandler.cpp \ kdateedit.cpp \ kdatepicker.cpp \ kinputdialog.cpp \ kincidenceformatter.cpp \ kpimprefs.cpp \ kpimglobalprefs.cpp \ kprefsdialog.cpp \ - addresseeview.cpp \ ksyncprofile.cpp \ ksyncprefsdialog.cpp \ kcmconfigs/kcmkdepimconfig.cpp \ kcmconfigs/kdepimconfigwidget.cpp diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro index b455a3e..102d827 100644 --- a/libkdepim/libkdepimE.pro +++ b/libkdepim/libkdepimE.pro @@ -1,53 +1,51 @@ TEMPLATE = lib 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 += -L$(QPEDIR)/lib OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/lib INTERFACES = \ HEADERS = \ categoryeditdialog.h \ categoryeditdialog_base.h \ categoryselectdialog.h \ categoryselectdialog_base.h \ externalapphandler.h \ kdateedit.h \ kdatepicker.h \ kinputdialog.h \ kincidenceformatter.h \ kpimprefs.h \ kpimglobalprefs.h \ kprefsdialog.h \ - addresseeview.h \ ksyncprofile.h \ ksyncprefsdialog.h \ kcmconfigs/kcmkdepimconfig.h \ kcmconfigs/kdepimconfigwidget.h SOURCES = \ categoryeditdialog.cpp \ categoryeditdialog_base.cpp \ categoryselectdialog.cpp \ categoryselectdialog_base.cpp \ externalapphandler.cpp \ kdateedit.cpp \ kinputdialog.cpp \ kdatepicker.cpp \ kincidenceformatter.cpp \ kpimprefs.cpp \ kpimglobalprefs.cpp \ kprefsdialog.cpp \ - addresseeview.cpp \ ksyncprofile.cpp \ ksyncprefsdialog.cpp \ kcmconfigs/kcmkdepimconfig.cpp \ kcmconfigs/kdepimconfigwidget.cpp |