Menu

#36 kickpim 0.5.3 fails to build

current_version
open
nobody
compile (15)
5
2014-06-23
2004-03-19
Anonymous
No

kickpim 0.5.3 fails to build on my gentoo system (gcc 3.2.3, glibc 2.3.2,
qt 3.2.3, kde 3.2.1).
for more info contact me at radon (at) psj (dot) cz

make stderr output:
In file included from kickpimcard.cpp:39:
kickpiminfodialog.h:22:28: kickpiminfodlg.h: není souborem ani
adresá?em
In file included from kickpimcard.cpp:39:
kickpiminfodialog.h:32: syntax error before `{' token
kickpiminfodialog.h:33: virtual outside class declaration
kickpiminfodialog.h:33: non-member function `const char* className()'
cannot
have `const' method qualifier
kickpiminfodialog.h:33: virtual outside class declaration
kickpiminfodialog.h:33: virtual outside class declaration
kickpiminfodialog.h:33: virtual outside class declaration
kickpiminfodialog.h:33: virtual outside class declaration
kickpiminfodialog.h: In function `QObject* qObject()':
kickpiminfodialog.h:33: invalid use of `this' in non-member function
kickpiminfodialog.h: At global scope:
kickpiminfodialog.h:33: syntax error before `private'
kickpiminfodialog.h:36: destructors must be member functions
kickpiminfodialog.h:40: syntax error before `}' token
kickpimcard.cpp: In member function `virtual void KickPimCard::show()':
kickpimcard.cpp:447: `KickPimInfoDialog' undeclared (first use this
function)
kickpimcard.cpp:447: (Each undeclared identifier is reported only once
for each
function it appears in.)
kickpimcard.cpp:447: syntax error before `;' token
kickpimcard.cpp:448: `dlg' undeclared (first use this function)
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include/g++-v3/bits/stl_map.h: At
top
level:
kickpiminfodialog.h:33: warning: `bool qt_static_property(QObject*, int,
int,
QVariant*)' declared `static' but never defined
kickpiminfodialog.h:33: warning: `QMetaObject* staticMetaObject()'
declared
`static' but never defined
kickpiminfodialog.h:33: warning: `QString tr(const char*, const char*)'
declared `static' but never defined
kickpiminfodialog.h:33: warning: `QString trUtf8(const char*, const
char*)'
declared `static' but never defined
make[3]: *** [kickpimcard.o] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I had the same error, and had to modify a few syntax errors
    in the files to get it to work, savethe following into a
    patch file and apply it inside the kickpim-0.5.3 directory
    using, patch -p1:

    diff -Naur kickpim-0.5.3/src/dialogs/kickpimcard.cpp
    kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp
    --- kickpim-0.5.3/src/dialogs/kickpimcard.cpp 2003-12-04
    13:13:33.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp
    2005-01-05 18:52:37.108936495 +0000
    @@ -309,7 +309,7 @@
    if (prefFound) m_content[PHONE]->selectContent(
    i18n("Preferred Number") );
    else if (homeFound) m_content[PHONE]->selectContent(
    i18n("home phone") );
    else m_content[PHONE]->selectContent(
    i18n(phoneMap.begin().key()) );
    -};
    +}

    void KickPimCard::setAddressContent()
    @@ -352,7 +352,7 @@
    if (type && KABC::Address::Pref) text+="Pref<br>";
    */
    return text;
    -};
    +}

    void KickPimCard::setBirthdayContent ()
    {
    diff -Naur kickpim-0.5.3/src/dialogs/kickpimcard.cpp~
    kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp~
    --- kickpim-0.5.3/src/dialogs/kickpimcard.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp~
    2005-01-05 18:50:45.000000000 +0000
    @@ -0,0 +1,454 @@
    +/***************************************************************************
    + KickPimCard.cpp - description
    + -------------------
    + begin : Don Okt 17 2002
    + copyright : (C) 2002 by Bert Speckels
    + email : bert@speckels.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +#include "kickpimcard.h"
    +
    +#include "../kickpim.h"
    +
    +#include "kpinfo.h"
    +
    +#include <qstringlist.h>
    +#include <qlayout.h>
    +#include <qcursor.h>
    +#include <qlabel.h>
    +#include <qtoolbutton.h>
    +#include <qdesktopwidget.h>
    +#include <qapplication.h>
    +
    +#include <kpopupmenu.h>
    +#include <ktextbrowser.h>
    +#include <kglobalsettings.h>
    +#include <klocale.h>
    +#include <kmimetype.h>
    +#include <krun.h>
    +
    +#include "kickpiminfodialog.h"
    +
    +#include "../kpcontact.h"
    +
    +using namespace std;
    +
    +KickPimCard::KickPimCard(QWidget *parent, const char *name,
    WFlags/* f */)
    + : QFrame(parent,name, Qt::WType_Popup)
    +{
    + FUNC_CALL(KickPimCard::KickPimCard)
    +
    + setFrameStyle(QFrame::Box | QFrame::Plain );
    +
    + QLabel* label=0;
    + QWidget* titleWidget=0;
    +
    + // fonts
    + QFont contentfont = this->font();
    + contentfont.setPixelSize(12);
    + contentfont.setWeight(QFont::Bold);
    + setFont(contentfont);
    +
    + QFont buttonfont = this->font();
    + buttonfont.setPixelSize(10);
    + buttonfont.setWeight(QFont::Normal);
    +
    + QFont smallfont = this->font();
    + smallfont.setPixelSize(10);
    + smallfont.setWeight(QFont::Normal);
    +
    + QFont titlefont = this->font();
    + titlefont.setPixelSize(12);
    + titlefont.setWeight(QFont::Bold);
    +
    + m_button [ADDRESS] = new QLabel (
    i18n("Address"),this,"Address");
    + m_content[ADDRESS] = new KMultiContentWidget (
    this,"AddressContent");
    + m_button [BIRTHDAY] = new QLabel
    (i18n("Birthday"),this,"Birthday");
    + m_content[BIRTHDAY] = new KMultiContentWidget
    (this,"BirthdayContent");
    + m_button [EMAIL] = new QLabel (
    i18n("Email"),this,"Email");
    + m_content[EMAIL] = new KMultiContentWidget (
    this,"EmailContent");
    + m_button [PHONE] = new QLabel (
    i18n("Phone"),this,"Phone");
    + m_content[PHONE] = new KMultiContentWidget (
    this,"PhoneContent");
    +
    + for (int i=0;i<CONTENT_MAX;i++)
    + {
    + m_content[i]->setLabelWidget(m_button[i]);
    +
    + m_button[i]->setFont(buttonfont);
    + m_button[i]->setAlignment(Qt::AlignBottom);
    +
    + m_content[i]->setFont(contentfont);
    + m_content[i]->setAlignment(Qt::AlignTop);
    +
    + m_content[i]->setMinimumWidth(100);
    + m_button[i]->setMinimumWidth(100);
    +
    +// m_content[i]->setPaletteBackgroundColor(
    QColor(128,128,128) );
    +// m_button[i]->setPaletteBackgroundColor(
    QColor(128,128,196) );
    +
    + connect(m_content[i],SIGNAL(contentChanged(const
    QString&)),this,SLOT(onContentChanged(const QString&)));
    +
    + }
    +
    + m_note = new KTextBrowser(this,"Note");
    + m_note->setFixedHeight(80);
    + m_note->setBaseSize(300,80);
    + m_note->setFrameStyle(QFrame::Box | QFrame::Plain );
    + m_note->setLineWidth(1);
    + m_note->setFont(smallfont);
    +
    + // layout
    +
    + QBoxLayout* root_layout = new QVBoxLayout(this);
    + root_layout->setSpacing(4);
    + root_layout->setMargin(4);
    +
    + titleWidget = new QWidget(this);
    +
    titleWidget->setPaletteBackgroundColor(KGlobalSettings::activeTitleColor());
    +
    titleWidget->setPaletteForegroundColor(KGlobalSettings::activeTextColor());
    + root_layout->addWidget(titleWidget);
    +
    + QBoxLayout* title_layout = new QHBoxLayout(titleWidget);
    + title_layout->setMargin(4);
    +
    + m_name = new KMultiContentWidget(titleWidget,"Name");
    + m_name->setFont(titlefont);
    + title_layout->addWidget(m_name);
    +
    + QBoxLayout* contentLayout = new QVBoxLayout();
    + contentLayout->setMargin(4);
    + root_layout->addLayout(contentLayout);
    +
    + QBoxLayout* col_layout = new QHBoxLayout();
    + col_layout->setSpacing(10);
    + col_layout->setMargin(0);
    + contentLayout->addLayout(col_layout);
    +
    + QBoxLayout* left_layout = new QVBoxLayout();
    + left_layout->setSpacing(0);
    + col_layout->addLayout(left_layout);
    +
    + left_layout->addWidget( m_button [ADDRESS] );
    + left_layout->addWidget( m_content [ADDRESS] );
    + left_layout->addStretch(1);
    +
    + //col_layout->addStretch(0);
    +
    + QBoxLayout* right_layout = new QVBoxLayout();
    + right_layout->setSpacing(0);
    + col_layout->addLayout(right_layout);
    +
    + right_layout->addWidget( m_button [PHONE] );
    + right_layout->addWidget( m_content [PHONE] );
    + right_layout->addStretch(1);
    + right_layout->addWidget( m_button [BIRTHDAY] );
    + right_layout->addWidget( m_content [BIRTHDAY] );
    +
    +
    + contentLayout->addWidget( m_button [EMAIL] );
    + contentLayout->addWidget( m_content [EMAIL] );
    + contentLayout->addSpacing(5);
    +
    + contentLayout->addWidget( m_note );
    +
    +
    + connect(m_content[EMAIL],SIGNAL(mouseButtonClicked()),
    + this, SLOT (mailContentClicked()) );
    + connect(m_name, SIGNAL(mouseButtonClicked()),
    + this, SLOT (nameContentClicked()) );
    +
    + QFont helpfont = buttonfont;
    +
    + QHBoxLayout* toolBarLayout = new QHBoxLayout();
    + root_layout->addLayout(toolBarLayout);
    +
    + /*
    + QToolButton* menuButton = new QToolButton(this);
    + menuButton->setPixmap( QPixmap(
    KickPIM::rep()->dirOfIcons() + "hi12-kickpim-cardmenu.png") );
    + menuButton->setFixedSize(20,18);
    + toolBarLayout->addWidget(menuButton);
    + */
    +
    + label = new QLabel(this,"help");
    + label->setFont(helpfont);
    + label->setText(i18n("Use left and right mouse button
    for actions and selections!"));
    + label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    + toolBarLayout->addWidget(label);
    +
    +
    + root_layout->setStretchFactor(titleWidget,0);
    + contentLayout->setStretchFactor(col_layout,1);
    +
    + updateGeometry();
    +}
    +
    +KickPimCard::~KickPimCard()
    +{
    + FUNC_CALL(KickPimCard::~KickPimCard);
    +}
    +
    +
    +void KickPimCard::setContact(KPContact* contact)
    +{
    + m_contact = contact;
    +
    + QString text="";
    +
    + setNameContent ();
    + setAddressContent ();
    + setEmailContent ();
    + setPhoneContent ();
    + setBirthdayContent ();
    +
    + m_note->setText( contact->note() );
    +
    + recalcSize();
    +}
    +
    +
    +void KickPimCard::setNameContent()
    +{
    + m_name->clearContent();
    + if (!m_contact) return;
    +
    + QStringMap names = m_contact->names();
    +
    + QString org = names["organizationName"];
    + QString nick = names["nickName"];
    + QString job = "";//entry.role(); TODO: reinsert
    + KURL url;
    + // KURL url = m_contact->webpageURLs();
    +
    +
    + // name
    + QString text=KickPIM::rep()->displayName(m_contact);
    +
    + // job title
    + if (!job.isEmpty()) text+=" ("+job+")";
    +
    + // organisation
    + if (!org.isEmpty())
    + {
    + if (!text.isEmpty()) text+="; ";
    + text+=org;
    + }
    + if (!nick.isEmpty()) text+=" ["+nick+"]";
    +
    + // webpage?
    + m_webpage = url.url();
    + if (!m_webpage.isEmpty()) m_name->setCursor(
    QCursor(Qt::PointingHandCursor) );
    + else m_name->setCursor(
    QCursor(Qt::ArrowCursor) );
    +
    + m_name->addContent("1",text,true);
    +
    +}
    +
    +void KickPimCard::setEmailContent()
    +{
    + m_content[EMAIL]->clearContent();
    + if (!m_contact) return;
    +
    + QString email;
    + QStringList mailList = m_contact->emailAddresses();
    + // mailList.sort();
    + QStringList::iterator mailItor = mailList.begin();
    + int count=0;
    + QString label = i18n("Email");
    +
    + if (mailList.count()>1)
    + {
    + QString amountString =
    "/"+QString::number(mailList.count());
    + while (mailItor != mailList.end())
    + {
    + email = QString(*mailItor);
    + m_content[EMAIL]->addContent(label+"
    "+QString::number(count+1)+amountString,email, false);
    + count++;
    + mailItor++;
    + }
    + m_content[EMAIL]->selectContent(label+" 1"+amountString);
    + }
    + else
    + {
    + email = QString(*mailItor);
    + m_content[EMAIL]->setText(email);
    + }
    +
    + if (mailList.count()>0) m_content[EMAIL]->setCursor(
    QCursor(Qt::PointingHandCursor) );
    + else m_content[EMAIL]->setCursor(
    QCursor(Qt::ArrowCursor) );
    +
    +}
    +
    +
    +void KickPimCard::setPhoneContent()
    +{
    + m_content[PHONE]->clearContent();
    + if (!m_contact) return;
    +
    + bool prefFound = false;
    + bool homeFound = false;
    + QStringMap phoneMap = m_contact->phoneNumbers();
    + QStringMap::iterator itor = phoneMap.begin();
    + int count=0;
    + while (itor != phoneMap.end())
    + {
    + m_content[PHONE]->addContent( i18n(itor.key())
    ,itor.data(),count==0);
    + prefFound = prefFound || (itor.key()=="Preferred Number");
    + homeFound = homeFound || (itor.key()=="home phone");
    + ++count;
    + ++itor;
    + }
    + if (prefFound) m_content[PHONE]->selectContent(
    i18n("Preferred Number") );
    + else if (homeFound) m_content[PHONE]->selectContent(
    i18n("home phone") );
    + else m_content[PHONE]->selectContent(
    i18n(phoneMap.begin().key()) );
    +};
    +
    +
    +void KickPimCard::setAddressContent()
    +{
    + m_content[ADDRESS]->clearContent();
    + if (!m_contact) return;
    +
    + QAddressMap addrMap = m_contact->addresses();
    + KPContactAddress address;
    +
    + bool prefFound=false;
    + bool homeFound=false;
    + QAddressMap::iterator itor = addrMap.begin();
    + int count=0;
    + while (itor != addrMap.end())
    + {
    + address = itor.data();
    + m_content[ADDRESS]->addContent(
    i18n(itor.key()),address.formattedAddress("\n",true),count==0);
    + prefFound = prefFound || (itor.key()=="Preferred Address");
    + homeFound = homeFound || (itor.key()=="Home Address");
    + ++count;
    + ++itor;
    + }
    + if (prefFound) m_content[ADDRESS]->selectContent(
    i18n("Preferred Address") );
    + else if (homeFound) m_content[ADDRESS]->selectContent(
    i18n("Home Address") );
    + else m_content[ADDRESS]->selectContent(
    i18n(addrMap.begin().key()) );
    +}
    +
    +
    +QString KickPimCard::getAddressType(int)
    +{
    + QString text="";
    +/*
    + if (type && KABC::Address::Dom) text+="Dom<br>";
    + if (type && KABC::Address::Intl) text+="Intl<br>";
    + if (type && KABC::Address::Postal) text+="Postal<br>";
    + if (type && KABC::Address::Parcel) text+="Parcel<br>";
    + if (type && KABC::Address::Home) text+="Home<br>";
    + if (type && KABC::Address::Work) text+="Work<br>";
    + if (type && KABC::Address::Pref) text+="Pref<br>";
    +*/
    + return text;
    +};
    +
    +void KickPimCard::setBirthdayContent ()
    +{
    + m_content[BIRTHDAY]->clearContent();
    + if (!m_contact) return;
    +
    + bool first = true;
    +
    + QDate birthday = m_contact->birthday();
    + if( birthday.isValid() )
    + {
    + QString text="";
    + QDate today = QDate().currentDate();
    +
    + int year = today.year();
    + if( today.dayOfYear() < birthday.dayOfYear() ) year--;
    + int age = year - birthday.year();
    +
    + QString birthdate = birthday.toString(Qt::LocalDate);
    + text+=birthdate+", ";
    + text+=i18n("age: %n year","age: %n years",age);
    +
    m_content[BIRTHDAY]->addContent(i18n("Birthday"),text,false);
    +
    + m_content[BIRTHDAY]->selectContent(i18n("Birthday"));
    + first = false;
    + }
    +
    + QDate anniversary = m_contact->anniversary();
    + if( anniversary.isValid() )
    + {
    + QString text="";
    + QDate today = QDate().currentDate();
    +
    + int year = today.year();
    + if( today.dayOfYear() < anniversary.dayOfYear() )
    year--;
    + int age = year - anniversary.year();
    +
    + QString annidate = anniversary.toString(Qt::LocalDate);
    + text+=annidate+", ";
    +
    + text+=i18n("%n year","%n years",age);
    +
    m_content[BIRTHDAY]->addContent(i18n("Anniversary"),text,false);
    +
    + if (first)
    m_content[BIRTHDAY]->selectContent(i18n("Anniversary"));
    + }
    +}
    +
    +
    +void KickPimCard::nameContentClicked ()
    +{
    + if (m_webpage.isEmpty()) return;
    +
    + close();
    +
    + cout << "Visit " << m_webpage << endl;
    + KURL url("http://"+m_webpage);
    + new KRun(url);
    +}
    +
    +
    +void KickPimCard::mailContentClicked ()
    +{
    + QString address = m_content[EMAIL]->text();
    + if (address.isEmpty()) return;
    + close();
    +
    + QStringMap names = m_contact->names();
    + QString email = names["givenName"] + " " +
    names["familyName"]+" <"+address+">";
    + LogService::logInfo( LogService::CAT_MAIL, "Mail to " +
    email );
    + KURL url("mailto:"+email);
    + new KRun(url);
    +}
    +
    +void KickPimCard::onContentChanged(const QString&)
    +{
    + cout << "KickPimCard::onContentChanged" << endl;
    + recalcSize();
    +}
    +
    +void KickPimCard::recalcSize()
    +{
    + if (layout()) layout()->activate();
    + resize(sizeHint());
    +}
    +
    +void KickPimCard::show()
    +{
    + FUNC_CALL(KickPimCard::show);
    + if (KickPIM::opt()->isInfoActive(KickPimOptions::INFO_CARD))
    + {
    +
    KickPIM::opt()->deactivateInfo(KickPimOptions::INFO_CARD);
    + KickPimInfoDialog dlg;
    + dlg.setInfoText( i18n(infoCardView) );
    + dlg.setPicture( QPixmap( KickPIM::rep()->dirOfInfo() +
    "info-kickpim-card.png") );
    + dlg.exec();
    + }
    +
    + QFrame::show();
    +}
    diff -Naur kickpim-0.5.3/src/kickpimcontactview.cpp
    kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp
    --- kickpim-0.5.3/src/kickpimcontactview.cpp 2003-11-30
    13:40:02.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp
    2005-01-05 18:53:15.022081805 +0000
    @@ -111,7 +111,7 @@
    setSorting(0);
    sort();
    setSorting(-1);
    -};
    +}

    void
    KickPimContactView::onContactsDoubleClick(QListViewItem* qitem)
    {
    @@ -129,7 +129,7 @@
    KickPimContactViewItem* item = 0;
    item = new KickPimContactViewItem( this, 0,
    KickPIM::rep()->displayName(contact) );
    item->setContact(contact);
    -};
    +}

    void
    KickPimContactView::addDistributionList(DistributionList*
    distList)
    {
    @@ -137,7 +137,7 @@
    KickPimContactViewItem* item = 0;
    item = new KickPimContactViewItem( this, lastItem(),
    "["+distList->name()+"]" );
    item->setDistributionList(distList);
    -};
    +}

    int KickPimContactView::preferredHeight()
    {
    diff -Naur kickpim-0.5.3/src/kickpimcontactview.cpp~
    kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp~
    --- kickpim-0.5.3/src/kickpimcontactview.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp~
    2005-01-05 18:50:45.000000000 +0000
    @@ -0,0 +1,166 @@
    +/***************************************************************************
    + kpcontactlistview.cpp - description
    + -------------------
    + begin : Die Jan 21 2003
    + copyright : (C) 2003 by Bert Speckels
    + email : bert.speckels@web.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +
    +#include <qcolor.h>
    +#include <qheader.h>
    +#include <qscrollbar.h>
    +#include <klocale.h>
    +
    +#include "kickpim.h"
    +#include "kpcontact.h"
    +
    +#include "kickpimcontactview.h"
    +#include "kickpimcontactviewitem.h"
    +
    +// #define STRESS_TEST
    +
    +const QString KickPimContactView::CAT_REST =
    I18N_NOOP("[Without Categories]");
    +const QString KickPimContactView::CAT_DISTLISTS =
    I18N_NOOP("[Distribution Lists]");
    +const QString KickPimContactView::CAT_ALL =
    I18N_NOOP("[All Contacts]");
    +
    +
    +KickPimContactView::KickPimContactView(QWidget *parent,
    const char *name ) : KListView(parent,name)
    +{
    + if (LogService::doLogConstruct)
    LogService::construct("KickPimContactView");
    +
    + QString iconDir = KickPIM::rep()->dirOfIcons();
    + m_pixmapBirthday = new
    QPixmap(iconDir+"hi12-kickpim-birthday.png");
    + m_pixmapAnniversary = new
    QPixmap(iconDir+"hi12-kickpim-anniversary.png");
    + m_pixmapEvent = new
    QPixmap(iconDir+"hi12-kickpim-event.png");
    + QColor bgcolor = parent->paletteBackgroundColor();
    +
    + setPaletteBackgroundColor ( bgcolor );
    + setFrameStyle ( QFrame::NoFrame );
    + setHScrollBarMode ( QScrollView::AlwaysOff );
    +
    + setSelectionMode ( QListView::Extended );
    + setMultiSelection ( KickPIM::opt()->multipleSelection );
    +
    + addColumn("name");
    + header()->hide();
    +
    + connect( this, SIGNAL ( doubleClicked
    (QListViewItem*) ),
    + this, SLOT ( onContactsDoubleClick
    (QListViewItem*) ) );
    +
    + m_tips = new KPDynamicTip( viewport() );
    +
    + setAcceptDrops(TRUE);
    +}
    +
    +KickPimContactView::~KickPimContactView()
    +{
    + if (LogService::doLogConstruct)
    LogService::destruct("KickPimContactView");
    + delete m_tips;m_tips=0;
    +}
    +
    +void KickPimContactView::updateContactList()
    +{
    + if (LogService::doLogCall)
    LogService::call("KickPimContactView","updateContactList");
    + clear();
    +
    + // insert contacts
    + QString cat = KickPIM::opt()->contactCategory;
    +
    + if (cat==i18n(CAT_DISTLISTS))
    + {
    + QPtrList<DistributionList> list =
    KickPIM::rep()->distributionLists();
    + DistributionList* dist = list.first();
    + while (dist)
    + {
    + addDistributionList(dist);
    + dist = list.next();
    + }
    + }
    + else {
    + KPContactList list = KickPIM::rep()->contacts();
    + KPContact* contact = list.first();
    + while (contact) {
    + if ( cat.length() == 0 ||
    + cat == i18n(CAT_ALL) ||
    + (contact->categories().isEmpty() && cat ==
    i18n(CAT_REST)) ||
    + contact->categories().contains(cat) )
    + {
    + addContact(contact);
    + }
    + // stress test
    + #ifdef STRESS_TEST
    + for (int i=0;i<100;i++) addContact(contact);
    + #endif
    +
    + contact = list.next();
    + }
    + }
    +
    + // sort contacts
    +
    + setSorting(0);
    + sort();
    + setSorting(-1);
    +};
    +
    +void
    KickPimContactView::onContactsDoubleClick(QListViewItem* qitem)
    +{
    + if (!qitem ||
    !dynamic_cast<KickPimContactViewItem*>(qitem)) return;
    +
    + KickPimContactViewItem* item =
    static_cast<KickPimContactViewItem*>(qitem);
    +
    + emit contactDoubleClicked(item);
    +}
    +
    +
    +void KickPimContactView::addContact(KPContact* contact)
    +{
    + // add to the top of the list
    + KickPimContactViewItem* item = 0;
    + item = new KickPimContactViewItem( this, 0,
    KickPIM::rep()->displayName(contact) );
    + item->setContact(contact);
    +};
    +
    +void
    KickPimContactView::addDistributionList(DistributionList*
    distList)
    +{
    + // append to the end of the list
    + KickPimContactViewItem* item = 0;
    + item = new KickPimContactViewItem( this, lastItem(),
    "["+distList->name()+"]" );
    + item->setDistributionList(distList);
    +};
    +
    +int KickPimContactView::preferredHeight()
    +{
    + updateGeometry();
    + show();
    + return contentsHeight();
    +}
    +
    +
    +
    +void KickPimContactView::dragEnterEvent(QDragEnterEvent* event)
    +{
    + if (LogService::doLogCall) LogService::call(
    "KickPimContactView","dragEnterEvent");
    + event->accept(true);
    +}
    +
    +
    +void KickPimContactView::dropEvent(QDropEvent* event)
    +{
    + KickPimContactViewItem* item =
    (KickPimContactViewItem*)this->itemAt(event->pos());
    + if (item!=0) {
    + QString contactName = item->contact()->name();
    + if (LogService::doLogInfo) LogService::logInfo(
    LogService::CAT_CONTACTS,"DropEvent on contact
    '"+contactName+"'");
    + }
    +}
    +
    diff -Naur kickpim-0.5.3/src/kpcontactevent.cpp
    kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp
    --- kickpim-0.5.3/src/kpcontactevent.cpp 2003-09-06
    11:42:07.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp 2005-01-05
    18:53:36.313793859 +0000
    @@ -24,7 +24,7 @@
    m_text = "";
    m_date = QDate(25,61,61); // invalid
    m_contact = 0;
    -};
    +}

    KPContactEvent::~KPContactEvent()
    {
    diff -Naur kickpim-0.5.3/src/kpcontactevent.cpp~
    kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp~
    --- kickpim-0.5.3/src/kpcontactevent.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp~ 2005-01-05
    18:50:45.000000000 +0000
    @@ -0,0 +1,92 @@
    +/***************************************************************************
    + KPContactEvent.cpp - description
    + -------------------
    + begin : Don Okt 24 2002
    + copyright : (C) 2002 by Bert Speckels
    + email : bert@speckels.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +#include "kpcontactevent.h"
    +#include "kickpim.h"
    +
    +KPContactEvent::KPContactEvent()
    +{
    + m_type = BIRTHDAY;
    + m_text = "";
    + m_date = QDate(25,61,61); // invalid
    + m_contact = 0;
    +};
    +
    +KPContactEvent::~KPContactEvent()
    +{
    +}
    +
    +bool KPContactEvent::isEmpty() const
    +{
    + return m_date.isValid(); // every event needs a date
    +}
    +
    +void KPContactEvent::setText(QString text)
    +{
    + m_text = text;
    +}
    +
    +void KPContactEvent::setDate(QDate date)
    +{
    + m_date = date;
    +}
    +
    +void KPContactEvent::setTime(QTime)
    +{
    + // birthdays and anniversaries don't need a time-value
    +}
    +
    +void KPContactEvent::setContact(KPContact* contact)
    +{
    + m_contact = contact;
    +}
    +
    +void KPContactEvent::setType(int type)
    +{
    + m_type = type;
    +}
    +
    +
    +QString KPContactEvent::text() const
    +{
    + return m_text;
    +}
    +
    +QDate KPContactEvent::date() const
    +{
    + return m_date;
    +}
    +
    +QTime KPContactEvent::time() const
    +{
    + return QTime(25,61,61); // return invalid time
    +}
    +
    +
    +int KPContactEvent::type() const
    +{
    + return m_type;
    +}
    +
    +KPContact* KPContactEvent::contact() const
    +{
    + return m_contact;
    +}
    +
    +
    +
    +
    diff -Naur kickpim-0.5.3/src/kpkabcontact.cpp
    kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp
    --- kickpim-0.5.3/src/kpkabcontact.cpp 2003-11-14
    23:09:16.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp 2005-01-05
    19:10:39.577777602 +0000
    @@ -240,7 +240,7 @@
    {
    m_addr->insertEmail(emailAddr, preferred);
    }
    -};
    +}

    @@ -255,7 +255,7 @@
    ++itor;
    }

    -};
    +}

    void KPKabContact::addPhoneNumber(QString number, QString key)
    {
    @@ -270,20 +270,20 @@
    }
    }
    }
    -};
    +}

    void KPKabContact::setBirthday ( QDate date )
    {
    if (!m_addr) return;
    m_addr->setBirthday(date);
    -};
    +}

    void KPKabContact::setAnniversary ( QDate date )
    {
    if (!m_addr) return;
    QString dateStr = date.toString( Qt::ISODate );
    m_addr->insertCustom( "KADDRESSBOOK", "X-Anniversary" ,
    dateStr );
    -};
    +}

    bool KPKabContact::edit()
    @@ -322,4 +322,4 @@
    }
    }
    KABC::StdAddressBook::save();
    -};
    +}
    diff -Naur kickpim-0.5.3/src/kpkabcontact.cpp~
    kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp~
    --- kickpim-0.5.3/src/kpkabcontact.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp~ 2005-01-05
    18:54:23.000000000 +0000
    @@ -0,0 +1,325 @@
    +/***************************************************************************
    + kpkabcontact.cpp - description
    + -------------------
    + begin : Fre Jan 17 2003
    + copyright : (C) 2003 by Bert Speckels
    + email : bert.speckels@web.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +#include <iostream>
    +#include <list>
    +
    +#include <klocale.h>
    +#include <kprocess.h>
    +#include <krun.h>
    +#include <kabc/addressbook.h>
    +#include <kabc/phonenumber.h>
    +#include <kabc/stdaddressbook.h>
    +
    +#include "kickpim.h"
    +#include "kpkabcontact.h"
    +
    +using namespace std;
    +
    +const int numAddressTypes = 7;
    +const int AddressTypes[numAddressTypes] =
    + { Address::Dom, Address::Intl, Address::Postal,
    Address::Parcel,
    + Address::Home, Address::Work, Address::Pref
    + };
    +const QString AddressTypeNames[numAddressTypes]=
    + { I18N_NOOP("Domestic Address"),
    I18N_NOOP("International Address"), I18N_NOOP("Postal Address"),
    + I18N_NOOP("Parcel Address"), I18N_NOOP("Home
    Address"), I18N_NOOP("Work Address"),
    + I18N_NOOP("Preferred Address")
    + };
    +
    +const int numPhoneTypes = 14;
    +
    +const int PhoneTypes[numPhoneTypes] =
    +{
    + PhoneNumber::Home, PhoneNumber::Work, PhoneNumber::Msg,
    + PhoneNumber::Pref, PhoneNumber::Voice, PhoneNumber::Fax,
    + PhoneNumber::Cell, PhoneNumber::Video, PhoneNumber::Bbs,
    + PhoneNumber::Modem, PhoneNumber::Car, PhoneNumber::Isdn,
    + PhoneNumber::Pcs, PhoneNumber::Pager
    +};
    +
    +const QString PhoneTypeNames[numPhoneTypes]=
    +{
    + I18N_NOOP("home phone"), I18N_NOOP("work
    phone"), I18N_NOOP("Messaging"),
    + I18N_NOOP("Preferred Number"), I18N_NOOP("Voice"),
    I18N_NOOP("Fax Number"),
    + I18N_NOOP("mobile phone"), I18N_NOOP("Video
    phone"), I18N_NOOP("Mailbox"),
    + I18N_NOOP("Modem"), I18N_NOOP("Car
    Phone"), I18N_NOOP("ISDN connection"),
    + I18N_NOOP("Personal Communication Service"),
    I18N_NOOP("Pager")
    +};
    +
    +
    +KPKabContact::KPKabContact(bool autoInsert)
    +{
    + m_addr = new Addressee();
    + m_toBeInserted = autoInsert;
    +}
    +
    +KPKabContact::KPKabContact(Addressee& addr)
    +{
    + m_addr = &addr;
    + m_toBeInserted = false;
    +}
    +
    +
    +KPKabContact::~KPKabContact()
    +{
    + m_addr = 0;
    +}
    +
    +
    +bool KPKabContact::isEmpty() const
    +{
    + return m_addr->isEmpty();
    +}
    +
    +
    +
    +QStringMap KPKabContact::names() const
    +{
    + // "formattedName", "realName", "familyName",
    "givenName", "nickName", "organizationName"
    +
    + if (!m_addr) return QStringMap();
    +
    + QStringMap map;
    + map["formattedName"] = m_addr->formattedName();
    + map["familyName"] = m_addr->familyName();
    + map["givenName"] = m_addr->givenName();
    + map["nickName"] = m_addr->nickName();
    + map["organizationName"] = m_addr->organization();
    + return map;
    +}
    +
    +QAddressMap KPKabContact::addresses() const
    +{
    + if (isEmpty()) return QAddressMap();
    +
    + QAddressMap map;
    + Address addr;
    +
    + for (int i=0;i<numAddressTypes;i++)
    + {
    + addr = m_addr->address( AddressTypes[i] );
    + if (!addr.isEmpty())
    + {
    + KPContactAddress address;
    + address.setStreet ( addr.street() );
    + address.setCountry ( addr.country() );
    + address.setLocality ( addr.locality() );
    + address.setPostOfficeBox ( addr.postOfficeBox() );
    + address.setPostalCode ( addr.postalCode() );
    + address.setRegion ( addr.region() );
    +
    + QString key = AddressTypeNames[i];
    + map[ key ] = address;
    + }
    + }
    +
    + return map;
    +}
    +
    +QStringList KPKabContact::emailAddresses() const
    +{
    + if (isEmpty()) return QStringList();
    +
    + return m_addr->emails();
    +}
    +
    +QStringMap KPKabContact::phoneNumbers() const
    +{
    + if (isEmpty()) return QStringMap();
    +
    + QStringMap map;
    + PhoneNumber phone;
    +
    + for (int i=0;i<numPhoneTypes;i++)
    + {
    + phone = m_addr->phoneNumber( PhoneTypes[i] );
    + if (!phone.number().isEmpty())
    + {
    + QString key = PhoneTypeNames[i];
    + map[ key ] = phone.number();
    + }
    + }
    +
    + return map;
    +}
    +
    +QStringList KPKabContact::categories() const
    +{
    + if (isEmpty()) return QStringList();
    +
    + QStringList list = m_addr->categories();
    +
    + return m_addr->categories();
    +}
    +
    +void KPKabContact::setCategories ( QStringList list )
    +{
    + m_addr->setCategories( list );
    +}
    +
    +QDate KPKabContact::birthday() const
    +{
    + if (isEmpty()) return QDate(99,99,99); // invalid date
    + return m_addr->birthday().date();
    +}
    +
    +#include <kmessagebox.h>
    +
    +QDate KPKabContact::anniversary() const
    +{
    + if (isEmpty()) return QDate(99,99,99); // invalid date
    +
    + QString dateStr = m_addr->custom( "KADDRESSBOOK" ,
    "X-Anniversary" );
    +
    + return QDate::fromString( dateStr, Qt::ISODate );
    +}
    +
    +QStringMap KPKabContact::webpageURLs() const
    +{
    + if (isEmpty()) return QStringMap();
    + return QStringMap();
    +}
    +
    +QString KPKabContact::note() const
    +{
    + if (isEmpty()) return QString();
    + return m_addr->note();
    +}
    +
    +void KPKabContact::setName(QString name, QString key)
    +{
    + if (!m_addr) return;
    +
    + if (key==QString("formattedName"))
    m_addr->setFormattedName(name);
    + else if (key==QString("familyName"))
    m_addr->setFamilyName(name);
    + else if (key==QString("givenName"))
    m_addr->setGivenName(name);
    + else if (key==QString("nickName"))
    m_addr->setNickName(name);
    + else if (key==QString("organizationName"))
    m_addr->setOrganization(name);
    +}
    +
    +bool KPKabContact::setNote(QString& note)
    +{
    + if (!m_addr) return false;
    +
    + m_addr->setNote(note);
    +
    + return true;
    +}
    +
    +
    +void KPKabContact::clearEmailAddresses()
    +{
    + if (!m_addr) return;
    + QStringList list = m_addr->emails();
    + QStringList::iterator itor = list.begin();
    + while ( itor != list.end() )
    + {
    + m_addr->removeEmail( *itor );
    + ++itor;
    + }
    +}
    +
    +void KPKabContact::addEmailAddress(QString emailAddr, bool
    preferred)
    +{
    + if (m_addr && !emailAddr.isEmpty())
    + {
    + m_addr->insertEmail(emailAddr, preferred);
    + }
    +}
    +
    +
    +
    +void KPKabContact::clearPhoneNumbers()
    +{
    + if (!m_addr) return;
    + PhoneNumber::List list = m_addr->phoneNumbers();
    + PhoneNumber::List::iterator itor = list.begin();
    + while ( itor != list.end() )
    + {
    + m_addr->removePhoneNumber( *itor );
    + ++itor;
    + }
    +
    +}
    +
    +void KPKabContact::addPhoneNumber(QString number, QString key)
    +{
    + if (m_addr && !number.isEmpty())
    + {
    + for (int i=0;i<numPhoneTypes;i++)
    + {
    + if (PhoneTypeNames[i] == key)
    + {
    + PhoneNumber phone(number,AddressTypes[i]);
    + m_addr->insertPhoneNumber( phone );
    + }
    + }
    + }
    +}
    +
    +void KPKabContact::setBirthday ( QDate date )
    +{
    + if (!m_addr) return;
    + m_addr->setBirthday(date);
    +};
    +
    +void KPKabContact::setAnniversary ( QDate date )
    +{
    + if (!m_addr) return;
    + QString dateStr = date.toString( Qt::ISODate );
    + m_addr->insertCustom( "KADDRESSBOOK", "X-Anniversary" ,
    dateStr );
    +}
    +
    +
    +bool KPKabContact::edit()
    +{
    + if (!m_addr) return false;
    +
    + return KPContact::edit();
    +}
    +
    +
    +bool KPKabContact::remove()
    +{
    + AddressBook* book = KABC::StdAddressBook::self();
    + if (!book) return false;
    +
    + book->removeAddressee(*m_addr);
    +
    + changed();
    +
    + return true;
    +}
    +
    +
    +void KPKabContact::changed( )
    +{
    + if (m_toBeInserted)
    + {
    + AddressBook* book = StdAddressBook::self();
    + if (book)
    + {
    + QString s = m_addr->givenName() + " " +
    m_addr->familyName();
    + if (LogService::doLogInfo)
    LogService::logInfo(LogService::CAT_CONTACTS,"KPKabContact.changed.
    Inserted name="+s);
    +
    + book->insertAddressee(*m_addr);
    + m_toBeInserted=false;
    + }
    + }
    + KABC::StdAddressBook::save();
    +}

     
  • Charlie Pearce

    Charlie Pearce - 2005-01-05

    Logged In: YES
    user_id=1191013

    I had the same error, and had to modify a few syntax errors
    in the files to get it to work, savethe following into a
    patch file and apply it inside the kickpim-0.5.3 directory
    using, patch -p1:

    diff -Naur kickpim-0.5.3/src/dialogs/kickpimcard.cpp
    kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp
    --- kickpim-0.5.3/src/dialogs/kickpimcard.cpp 2003-12-04
    13:13:33.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp
    2005-01-05 18:52:37.108936495 +0000
    @@ -309,7 +309,7 @@
    if (prefFound) m_content[PHONE]->selectContent(
    i18n("Preferred Number") );
    else if (homeFound) m_content[PHONE]->selectContent(
    i18n("home phone") );
    else m_content[PHONE]->selectContent(
    i18n(phoneMap.begin().key()) );
    -};
    +}

    void KickPimCard::setAddressContent()
    @@ -352,7 +352,7 @@
    if (type && KABC::Address::Pref) text+="Pref<br>";
    */
    return text;
    -};
    +}

    void KickPimCard::setBirthdayContent ()
    {
    diff -Naur kickpim-0.5.3/src/dialogs/kickpimcard.cpp~
    kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp~
    --- kickpim-0.5.3/src/dialogs/kickpimcard.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/dialogs/kickpimcard.cpp~
    2005-01-05 18:50:45.000000000 +0000
    @@ -0,0 +1,454 @@
    +/***************************************************************************
    + KickPimCard.cpp - description
    + -------------------
    + begin : Don Okt 17 2002
    + copyright : (C) 2002 by Bert Speckels
    + email : bert@speckels.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +#include "kickpimcard.h"
    +
    +#include "../kickpim.h"
    +
    +#include "kpinfo.h"
    +
    +#include <qstringlist.h>
    +#include <qlayout.h>
    +#include <qcursor.h>
    +#include <qlabel.h>
    +#include <qtoolbutton.h>
    +#include <qdesktopwidget.h>
    +#include <qapplication.h>
    +
    +#include <kpopupmenu.h>
    +#include <ktextbrowser.h>
    +#include <kglobalsettings.h>
    +#include <klocale.h>
    +#include <kmimetype.h>
    +#include <krun.h>
    +
    +#include "kickpiminfodialog.h"
    +
    +#include "../kpcontact.h"
    +
    +using namespace std;
    +
    +KickPimCard::KickPimCard(QWidget *parent, const char *name,
    WFlags/* f */)
    + : QFrame(parent,name, Qt::WType_Popup)
    +{
    + FUNC_CALL(KickPimCard::KickPimCard)
    +
    + setFrameStyle(QFrame::Box | QFrame::Plain );
    +
    + QLabel* label=0;
    + QWidget* titleWidget=0;
    +
    + // fonts
    + QFont contentfont = this->font();
    + contentfont.setPixelSize(12);
    + contentfont.setWeight(QFont::Bold);
    + setFont(contentfont);
    +
    + QFont buttonfont = this->font();
    + buttonfont.setPixelSize(10);
    + buttonfont.setWeight(QFont::Normal);
    +
    + QFont smallfont = this->font();
    + smallfont.setPixelSize(10);
    + smallfont.setWeight(QFont::Normal);
    +
    + QFont titlefont = this->font();
    + titlefont.setPixelSize(12);
    + titlefont.setWeight(QFont::Bold);
    +
    + m_button [ADDRESS] = new QLabel (
    i18n("Address"),this,"Address");
    + m_content[ADDRESS] = new KMultiContentWidget (
    this,"AddressContent");
    + m_button [BIRTHDAY] = new QLabel
    (i18n("Birthday"),this,"Birthday");
    + m_content[BIRTHDAY] = new KMultiContentWidget
    (this,"BirthdayContent");
    + m_button [EMAIL] = new QLabel (
    i18n("Email"),this,"Email");
    + m_content[EMAIL] = new KMultiContentWidget (
    this,"EmailContent");
    + m_button [PHONE] = new QLabel (
    i18n("Phone"),this,"Phone");
    + m_content[PHONE] = new KMultiContentWidget (
    this,"PhoneContent");
    +
    + for (int i=0;i<CONTENT_MAX;i++)
    + {
    + m_content[i]->setLabelWidget(m_button[i]);
    +
    + m_button[i]->setFont(buttonfont);
    + m_button[i]->setAlignment(Qt::AlignBottom);
    +
    + m_content[i]->setFont(contentfont);
    + m_content[i]->setAlignment(Qt::AlignTop);
    +
    + m_content[i]->setMinimumWidth(100);
    + m_button[i]->setMinimumWidth(100);
    +
    +// m_content[i]->setPaletteBackgroundColor(
    QColor(128,128,128) );
    +// m_button[i]->setPaletteBackgroundColor(
    QColor(128,128,196) );
    +
    + connect(m_content[i],SIGNAL(contentChanged(const
    QString&)),this,SLOT(onContentChanged(const QString&)));
    +
    + }
    +
    + m_note = new KTextBrowser(this,"Note");
    + m_note->setFixedHeight(80);
    + m_note->setBaseSize(300,80);
    + m_note->setFrameStyle(QFrame::Box | QFrame::Plain );
    + m_note->setLineWidth(1);
    + m_note->setFont(smallfont);
    +
    + // layout
    +
    + QBoxLayout* root_layout = new QVBoxLayout(this);
    + root_layout->setSpacing(4);
    + root_layout->setMargin(4);
    +
    + titleWidget = new QWidget(this);
    +
    titleWidget->setPaletteBackgroundColor(KGlobalSettings::activeTitleColor());
    +
    titleWidget->setPaletteForegroundColor(KGlobalSettings::activeTextColor());
    + root_layout->addWidget(titleWidget);
    +
    + QBoxLayout* title_layout = new QHBoxLayout(titleWidget);
    + title_layout->setMargin(4);
    +
    + m_name = new KMultiContentWidget(titleWidget,"Name");
    + m_name->setFont(titlefont);
    + title_layout->addWidget(m_name);
    +
    + QBoxLayout* contentLayout = new QVBoxLayout();
    + contentLayout->setMargin(4);
    + root_layout->addLayout(contentLayout);
    +
    + QBoxLayout* col_layout = new QHBoxLayout();
    + col_layout->setSpacing(10);
    + col_layout->setMargin(0);
    + contentLayout->addLayout(col_layout);
    +
    + QBoxLayout* left_layout = new QVBoxLayout();
    + left_layout->setSpacing(0);
    + col_layout->addLayout(left_layout);
    +
    + left_layout->addWidget( m_button [ADDRESS] );
    + left_layout->addWidget( m_content [ADDRESS] );
    + left_layout->addStretch(1);
    +
    + //col_layout->addStretch(0);
    +
    + QBoxLayout* right_layout = new QVBoxLayout();
    + right_layout->setSpacing(0);
    + col_layout->addLayout(right_layout);
    +
    + right_layout->addWidget( m_button [PHONE] );
    + right_layout->addWidget( m_content [PHONE] );
    + right_layout->addStretch(1);
    + right_layout->addWidget( m_button [BIRTHDAY] );
    + right_layout->addWidget( m_content [BIRTHDAY] );
    +
    +
    + contentLayout->addWidget( m_button [EMAIL] );
    + contentLayout->addWidget( m_content [EMAIL] );
    + contentLayout->addSpacing(5);
    +
    + contentLayout->addWidget( m_note );
    +
    +
    + connect(m_content[EMAIL],SIGNAL(mouseButtonClicked()),
    + this, SLOT (mailContentClicked()) );
    + connect(m_name, SIGNAL(mouseButtonClicked()),
    + this, SLOT (nameContentClicked()) );
    +
    + QFont helpfont = buttonfont;
    +
    + QHBoxLayout* toolBarLayout = new QHBoxLayout();
    + root_layout->addLayout(toolBarLayout);
    +
    + /*
    + QToolButton* menuButton = new QToolButton(this);
    + menuButton->setPixmap( QPixmap(
    KickPIM::rep()->dirOfIcons() + "hi12-kickpim-cardmenu.png") );
    + menuButton->setFixedSize(20,18);
    + toolBarLayout->addWidget(menuButton);
    + */
    +
    + label = new QLabel(this,"help");
    + label->setFont(helpfont);
    + label->setText(i18n("Use left and right mouse button
    for actions and selections!"));
    + label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    + toolBarLayout->addWidget(label);
    +
    +
    + root_layout->setStretchFactor(titleWidget,0);
    + contentLayout->setStretchFactor(col_layout,1);
    +
    + updateGeometry();
    +}
    +
    +KickPimCard::~KickPimCard()
    +{
    + FUNC_CALL(KickPimCard::~KickPimCard);
    +}
    +
    +
    +void KickPimCard::setContact(KPContact* contact)
    +{
    + m_contact = contact;
    +
    + QString text="";
    +
    + setNameContent ();
    + setAddressContent ();
    + setEmailContent ();
    + setPhoneContent ();
    + setBirthdayContent ();
    +
    + m_note->setText( contact->note() );
    +
    + recalcSize();
    +}
    +
    +
    +void KickPimCard::setNameContent()
    +{
    + m_name->clearContent();
    + if (!m_contact) return;
    +
    + QStringMap names = m_contact->names();
    +
    + QString org = names["organizationName"];
    + QString nick = names["nickName"];
    + QString job = "";//entry.role(); TODO: reinsert
    + KURL url;
    + // KURL url = m_contact->webpageURLs();
    +
    +
    + // name
    + QString text=KickPIM::rep()->displayName(m_contact);
    +
    + // job title
    + if (!job.isEmpty()) text+=" ("+job+")";
    +
    + // organisation
    + if (!org.isEmpty())
    + {
    + if (!text.isEmpty()) text+="; ";
    + text+=org;
    + }
    + if (!nick.isEmpty()) text+=" ["+nick+"]";
    +
    + // webpage?
    + m_webpage = url.url();
    + if (!m_webpage.isEmpty()) m_name->setCursor(
    QCursor(Qt::PointingHandCursor) );
    + else m_name->setCursor(
    QCursor(Qt::ArrowCursor) );
    +
    + m_name->addContent("1",text,true);
    +
    +}
    +
    +void KickPimCard::setEmailContent()
    +{
    + m_content[EMAIL]->clearContent();
    + if (!m_contact) return;
    +
    + QString email;
    + QStringList mailList = m_contact->emailAddresses();
    + // mailList.sort();
    + QStringList::iterator mailItor = mailList.begin();
    + int count=0;
    + QString label = i18n("Email");
    +
    + if (mailList.count()>1)
    + {
    + QString amountString =
    "/"+QString::number(mailList.count());
    + while (mailItor != mailList.end())
    + {
    + email = QString(*mailItor);
    + m_content[EMAIL]->addContent(label+"
    "+QString::number(count+1)+amountString,email, false);
    + count++;
    + mailItor++;
    + }
    + m_content[EMAIL]->selectContent(label+" 1"+amountString);
    + }
    + else
    + {
    + email = QString(*mailItor);
    + m_content[EMAIL]->setText(email);
    + }
    +
    + if (mailList.count()>0) m_content[EMAIL]->setCursor(
    QCursor(Qt::PointingHandCursor) );
    + else m_content[EMAIL]->setCursor(
    QCursor(Qt::ArrowCursor) );
    +
    +}
    +
    +
    +void KickPimCard::setPhoneContent()
    +{
    + m_content[PHONE]->clearContent();
    + if (!m_contact) return;
    +
    + bool prefFound = false;
    + bool homeFound = false;
    + QStringMap phoneMap = m_contact->phoneNumbers();
    + QStringMap::iterator itor = phoneMap.begin();
    + int count=0;
    + while (itor != phoneMap.end())
    + {
    + m_content[PHONE]->addContent( i18n(itor.key())
    ,itor.data(),count==0);
    + prefFound = prefFound || (itor.key()=="Preferred Number");
    + homeFound = homeFound || (itor.key()=="home phone");
    + ++count;
    + ++itor;
    + }
    + if (prefFound) m_content[PHONE]->selectContent(
    i18n("Preferred Number") );
    + else if (homeFound) m_content[PHONE]->selectContent(
    i18n("home phone") );
    + else m_content[PHONE]->selectContent(
    i18n(phoneMap.begin().key()) );
    +};
    +
    +
    +void KickPimCard::setAddressContent()
    +{
    + m_content[ADDRESS]->clearContent();
    + if (!m_contact) return;
    +
    + QAddressMap addrMap = m_contact->addresses();
    + KPContactAddress address;
    +
    + bool prefFound=false;
    + bool homeFound=false;
    + QAddressMap::iterator itor = addrMap.begin();
    + int count=0;
    + while (itor != addrMap.end())
    + {
    + address = itor.data();
    + m_content[ADDRESS]->addContent(
    i18n(itor.key()),address.formattedAddress("\n",true),count==0);
    + prefFound = prefFound || (itor.key()=="Preferred Address");
    + homeFound = homeFound || (itor.key()=="Home Address");
    + ++count;
    + ++itor;
    + }
    + if (prefFound) m_content[ADDRESS]->selectContent(
    i18n("Preferred Address") );
    + else if (homeFound) m_content[ADDRESS]->selectContent(
    i18n("Home Address") );
    + else m_content[ADDRESS]->selectContent(
    i18n(addrMap.begin().key()) );
    +}
    +
    +
    +QString KickPimCard::getAddressType(int)
    +{
    + QString text="";
    +/*
    + if (type && KABC::Address::Dom) text+="Dom<br>";
    + if (type && KABC::Address::Intl) text+="Intl<br>";
    + if (type && KABC::Address::Postal) text+="Postal<br>";
    + if (type && KABC::Address::Parcel) text+="Parcel<br>";
    + if (type && KABC::Address::Home) text+="Home<br>";
    + if (type && KABC::Address::Work) text+="Work<br>";
    + if (type && KABC::Address::Pref) text+="Pref<br>";
    +*/
    + return text;
    +};
    +
    +void KickPimCard::setBirthdayContent ()
    +{
    + m_content[BIRTHDAY]->clearContent();
    + if (!m_contact) return;
    +
    + bool first = true;
    +
    + QDate birthday = m_contact->birthday();
    + if( birthday.isValid() )
    + {
    + QString text="";
    + QDate today = QDate().currentDate();
    +
    + int year = today.year();
    + if( today.dayOfYear() < birthday.dayOfYear() ) year--;
    + int age = year - birthday.year();
    +
    + QString birthdate = birthday.toString(Qt::LocalDate);
    + text+=birthdate+", ";
    + text+=i18n("age: %n year","age: %n years",age);
    +
    m_content[BIRTHDAY]->addContent(i18n("Birthday"),text,false);
    +
    + m_content[BIRTHDAY]->selectContent(i18n("Birthday"));
    + first = false;
    + }
    +
    + QDate anniversary = m_contact->anniversary();
    + if( anniversary.isValid() )
    + {
    + QString text="";
    + QDate today = QDate().currentDate();
    +
    + int year = today.year();
    + if( today.dayOfYear() < anniversary.dayOfYear() )
    year--;
    + int age = year - anniversary.year();
    +
    + QString annidate = anniversary.toString(Qt::LocalDate);
    + text+=annidate+", ";
    +
    + text+=i18n("%n year","%n years",age);
    +
    m_content[BIRTHDAY]->addContent(i18n("Anniversary"),text,false);
    +
    + if (first)
    m_content[BIRTHDAY]->selectContent(i18n("Anniversary"));
    + }
    +}
    +
    +
    +void KickPimCard::nameContentClicked ()
    +{
    + if (m_webpage.isEmpty()) return;
    +
    + close();
    +
    + cout << "Visit " << m_webpage << endl;
    + KURL url("http://"+m_webpage);
    + new KRun(url);
    +}
    +
    +
    +void KickPimCard::mailContentClicked ()
    +{
    + QString address = m_content[EMAIL]->text();
    + if (address.isEmpty()) return;
    + close();
    +
    + QStringMap names = m_contact->names();
    + QString email = names["givenName"] + " " +
    names["familyName"]+" <"+address+">";
    + LogService::logInfo( LogService::CAT_MAIL, "Mail to " +
    email );
    + KURL url("mailto:"+email);
    + new KRun(url);
    +}
    +
    +void KickPimCard::onContentChanged(const QString&)
    +{
    + cout << "KickPimCard::onContentChanged" << endl;
    + recalcSize();
    +}
    +
    +void KickPimCard::recalcSize()
    +{
    + if (layout()) layout()->activate();
    + resize(sizeHint());
    +}
    +
    +void KickPimCard::show()
    +{
    + FUNC_CALL(KickPimCard::show);
    + if (KickPIM::opt()->isInfoActive(KickPimOptions::INFO_CARD))
    + {
    +
    KickPIM::opt()->deactivateInfo(KickPimOptions::INFO_CARD);
    + KickPimInfoDialog dlg;
    + dlg.setInfoText( i18n(infoCardView) );
    + dlg.setPicture( QPixmap( KickPIM::rep()->dirOfInfo() +
    "info-kickpim-card.png") );
    + dlg.exec();
    + }
    +
    + QFrame::show();
    +}
    diff -Naur kickpim-0.5.3/src/kickpimcontactview.cpp
    kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp
    --- kickpim-0.5.3/src/kickpimcontactview.cpp 2003-11-30
    13:40:02.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp
    2005-01-05 18:53:15.022081805 +0000
    @@ -111,7 +111,7 @@
    setSorting(0);
    sort();
    setSorting(-1);
    -};
    +}

    void
    KickPimContactView::onContactsDoubleClick(QListViewItem* qitem)
    {
    @@ -129,7 +129,7 @@
    KickPimContactViewItem* item = 0;
    item = new KickPimContactViewItem( this, 0,
    KickPIM::rep()->displayName(contact) );
    item->setContact(contact);
    -};
    +}

    void
    KickPimContactView::addDistributionList(DistributionList*
    distList)
    {
    @@ -137,7 +137,7 @@
    KickPimContactViewItem* item = 0;
    item = new KickPimContactViewItem( this, lastItem(),
    "["+distList->name()+"]" );
    item->setDistributionList(distList);
    -};
    +}

    int KickPimContactView::preferredHeight()
    {
    diff -Naur kickpim-0.5.3/src/kickpimcontactview.cpp~
    kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp~
    --- kickpim-0.5.3/src/kickpimcontactview.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kickpimcontactview.cpp~
    2005-01-05 18:50:45.000000000 +0000
    @@ -0,0 +1,166 @@
    +/***************************************************************************
    + kpcontactlistview.cpp - description
    + -------------------
    + begin : Die Jan 21 2003
    + copyright : (C) 2003 by Bert Speckels
    + email : bert.speckels@web.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +
    +#include <qcolor.h>
    +#include <qheader.h>
    +#include <qscrollbar.h>
    +#include <klocale.h>
    +
    +#include "kickpim.h"
    +#include "kpcontact.h"
    +
    +#include "kickpimcontactview.h"
    +#include "kickpimcontactviewitem.h"
    +
    +// #define STRESS_TEST
    +
    +const QString KickPimContactView::CAT_REST =
    I18N_NOOP("[Without Categories]");
    +const QString KickPimContactView::CAT_DISTLISTS =
    I18N_NOOP("[Distribution Lists]");
    +const QString KickPimContactView::CAT_ALL =
    I18N_NOOP("[All Contacts]");
    +
    +
    +KickPimContactView::KickPimContactView(QWidget *parent,
    const char *name ) : KListView(parent,name)
    +{
    + if (LogService::doLogConstruct)
    LogService::construct("KickPimContactView");
    +
    + QString iconDir = KickPIM::rep()->dirOfIcons();
    + m_pixmapBirthday = new
    QPixmap(iconDir+"hi12-kickpim-birthday.png");
    + m_pixmapAnniversary = new
    QPixmap(iconDir+"hi12-kickpim-anniversary.png");
    + m_pixmapEvent = new
    QPixmap(iconDir+"hi12-kickpim-event.png");
    + QColor bgcolor = parent->paletteBackgroundColor();
    +
    + setPaletteBackgroundColor ( bgcolor );
    + setFrameStyle ( QFrame::NoFrame );
    + setHScrollBarMode ( QScrollView::AlwaysOff );
    +
    + setSelectionMode ( QListView::Extended );
    + setMultiSelection ( KickPIM::opt()->multipleSelection );
    +
    + addColumn("name");
    + header()->hide();
    +
    + connect( this, SIGNAL ( doubleClicked
    (QListViewItem*) ),
    + this, SLOT ( onContactsDoubleClick
    (QListViewItem*) ) );
    +
    + m_tips = new KPDynamicTip( viewport() );
    +
    + setAcceptDrops(TRUE);
    +}
    +
    +KickPimContactView::~KickPimContactView()
    +{
    + if (LogService::doLogConstruct)
    LogService::destruct("KickPimContactView");
    + delete m_tips;m_tips=0;
    +}
    +
    +void KickPimContactView::updateContactList()
    +{
    + if (LogService::doLogCall)
    LogService::call("KickPimContactView","updateContactList");
    + clear();
    +
    + // insert contacts
    + QString cat = KickPIM::opt()->contactCategory;
    +
    + if (cat==i18n(CAT_DISTLISTS))
    + {
    + QPtrList<DistributionList> list =
    KickPIM::rep()->distributionLists();
    + DistributionList* dist = list.first();
    + while (dist)
    + {
    + addDistributionList(dist);
    + dist = list.next();
    + }
    + }
    + else {
    + KPContactList list = KickPIM::rep()->contacts();
    + KPContact* contact = list.first();
    + while (contact) {
    + if ( cat.length() == 0 ||
    + cat == i18n(CAT_ALL) ||
    + (contact->categories().isEmpty() && cat ==
    i18n(CAT_REST)) ||
    + contact->categories().contains(cat) )
    + {
    + addContact(contact);
    + }
    + // stress test
    + #ifdef STRESS_TEST
    + for (int i=0;i<100;i++) addContact(contact);
    + #endif
    +
    + contact = list.next();
    + }
    + }
    +
    + // sort contacts
    +
    + setSorting(0);
    + sort();
    + setSorting(-1);
    +};
    +
    +void
    KickPimContactView::onContactsDoubleClick(QListViewItem* qitem)
    +{
    + if (!qitem ||
    !dynamic_cast<KickPimContactViewItem*>(qitem)) return;
    +
    + KickPimContactViewItem* item =
    static_cast<KickPimContactViewItem*>(qitem);
    +
    + emit contactDoubleClicked(item);
    +}
    +
    +
    +void KickPimContactView::addContact(KPContact* contact)
    +{
    + // add to the top of the list
    + KickPimContactViewItem* item = 0;
    + item = new KickPimContactViewItem( this, 0,
    KickPIM::rep()->displayName(contact) );
    + item->setContact(contact);
    +};
    +
    +void
    KickPimContactView::addDistributionList(DistributionList*
    distList)
    +{
    + // append to the end of the list
    + KickPimContactViewItem* item = 0;
    + item = new KickPimContactViewItem( this, lastItem(),
    "["+distList->name()+"]" );
    + item->setDistributionList(distList);
    +};
    +
    +int KickPimContactView::preferredHeight()
    +{
    + updateGeometry();
    + show();
    + return contentsHeight();
    +}
    +
    +
    +
    +void KickPimContactView::dragEnterEvent(QDragEnterEvent* event)
    +{
    + if (LogService::doLogCall) LogService::call(
    "KickPimContactView","dragEnterEvent");
    + event->accept(true);
    +}
    +
    +
    +void KickPimContactView::dropEvent(QDropEvent* event)
    +{
    + KickPimContactViewItem* item =
    (KickPimContactViewItem*)this->itemAt(event->pos());
    + if (item!=0) {
    + QString contactName = item->contact()->name();
    + if (LogService::doLogInfo) LogService::logInfo(
    LogService::CAT_CONTACTS,"DropEvent on contact
    '"+contactName+"'");
    + }
    +}
    +
    diff -Naur kickpim-0.5.3/src/kpcontactevent.cpp
    kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp
    --- kickpim-0.5.3/src/kpcontactevent.cpp 2003-09-06
    11:42:07.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp 2005-01-05
    18:53:36.313793859 +0000
    @@ -24,7 +24,7 @@
    m_text = "";
    m_date = QDate(25,61,61); // invalid
    m_contact = 0;
    -};
    +}

    KPContactEvent::~KPContactEvent()
    {
    diff -Naur kickpim-0.5.3/src/kpcontactevent.cpp~
    kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp~
    --- kickpim-0.5.3/src/kpcontactevent.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpcontactevent.cpp~ 2005-01-05
    18:50:45.000000000 +0000
    @@ -0,0 +1,92 @@
    +/***************************************************************************
    + KPContactEvent.cpp - description
    + -------------------
    + begin : Don Okt 24 2002
    + copyright : (C) 2002 by Bert Speckels
    + email : bert@speckels.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +#include "kpcontactevent.h"
    +#include "kickpim.h"
    +
    +KPContactEvent::KPContactEvent()
    +{
    + m_type = BIRTHDAY;
    + m_text = "";
    + m_date = QDate(25,61,61); // invalid
    + m_contact = 0;
    +};
    +
    +KPContactEvent::~KPContactEvent()
    +{
    +}
    +
    +bool KPContactEvent::isEmpty() const
    +{
    + return m_date.isValid(); // every event needs a date
    +}
    +
    +void KPContactEvent::setText(QString text)
    +{
    + m_text = text;
    +}
    +
    +void KPContactEvent::setDate(QDate date)
    +{
    + m_date = date;
    +}
    +
    +void KPContactEvent::setTime(QTime)
    +{
    + // birthdays and anniversaries don't need a time-value
    +}
    +
    +void KPContactEvent::setContact(KPContact* contact)
    +{
    + m_contact = contact;
    +}
    +
    +void KPContactEvent::setType(int type)
    +{
    + m_type = type;
    +}
    +
    +
    +QString KPContactEvent::text() const
    +{
    + return m_text;
    +}
    +
    +QDate KPContactEvent::date() const
    +{
    + return m_date;
    +}
    +
    +QTime KPContactEvent::time() const
    +{
    + return QTime(25,61,61); // return invalid time
    +}
    +
    +
    +int KPContactEvent::type() const
    +{
    + return m_type;
    +}
    +
    +KPContact* KPContactEvent::contact() const
    +{
    + return m_contact;
    +}
    +
    +
    +
    +
    diff -Naur kickpim-0.5.3/src/kpkabcontact.cpp
    kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp
    --- kickpim-0.5.3/src/kpkabcontact.cpp 2003-11-14
    23:09:16.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp 2005-01-05
    19:10:39.577777602 +0000
    @@ -240,7 +240,7 @@
    {
    m_addr->insertEmail(emailAddr, preferred);
    }
    -};
    +}

    @@ -255,7 +255,7 @@
    ++itor;
    }

    -};
    +}

    void KPKabContact::addPhoneNumber(QString number, QString key)
    {
    @@ -270,20 +270,20 @@
    }
    }
    }
    -};
    +}

    void KPKabContact::setBirthday ( QDate date )
    {
    if (!m_addr) return;
    m_addr->setBirthday(date);
    -};
    +}

    void KPKabContact::setAnniversary ( QDate date )
    {
    if (!m_addr) return;
    QString dateStr = date.toString( Qt::ISODate );
    m_addr->insertCustom( "KADDRESSBOOK", "X-Anniversary" ,
    dateStr );
    -};
    +}

    bool KPKabContact::edit()
    @@ -322,4 +322,4 @@
    }
    }
    KABC::StdAddressBook::save();
    -};
    +}
    diff -Naur kickpim-0.5.3/src/kpkabcontact.cpp~
    kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp~
    --- kickpim-0.5.3/src/kpkabcontact.cpp~ 1970-01-01
    00:00:00.000000000 +0000
    +++ kickpim-0.5.3-PATCHED/src/kpkabcontact.cpp~ 2005-01-05
    18:54:23.000000000 +0000
    @@ -0,0 +1,325 @@
    +/***************************************************************************
    + kpkabcontact.cpp - description
    + -------------------
    + begin : Fre Jan 17 2003
    + copyright : (C) 2003 by Bert Speckels
    + email : bert.speckels@web.de
    +
    ***************************************************************************/
    +
    +/***************************************************************************
    + *
    *
    + * 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.
    *
    + *
    *
    +
    ***************************************************************************/
    +
    +#include <iostream>
    +#include <list>
    +
    +#include <klocale.h>
    +#include <kprocess.h>
    +#include <krun.h>
    +#include <kabc/addressbook.h>
    +#include <kabc/phonenumber.h>
    +#include <kabc/stdaddressbook.h>
    +
    +#include "kickpim.h"
    +#include "kpkabcontact.h"
    +
    +using namespace std;
    +
    +const int numAddressTypes = 7;
    +const int AddressTypes[numAddressTypes] =
    + { Address::Dom, Address::Intl, Address::Postal,
    Address::Parcel,
    + Address::Home, Address::Work, Address::Pref
    + };
    +const QString AddressTypeNames[numAddressTypes]=
    + { I18N_NOOP("Domestic Address"),
    I18N_NOOP("International Address"), I18N_NOOP("Postal Address"),
    + I18N_NOOP("Parcel Address"), I18N_NOOP("Home
    Address"), I18N_NOOP("Work Address"),
    + I18N_NOOP("Preferred Address")
    + };
    +
    +const int numPhoneTypes = 14;
    +
    +const int PhoneTypes[numPhoneTypes] =
    +{
    + PhoneNumber::Home, PhoneNumber::Work, PhoneNumber::Msg,
    + PhoneNumber::Pref, PhoneNumber::Voice, PhoneNumber::Fax,
    + PhoneNumber::Cell, PhoneNumber::Video, PhoneNumber::Bbs,
    + PhoneNumber::Modem, PhoneNumber::Car, PhoneNumber::Isdn,
    + PhoneNumber::Pcs, PhoneNumber::Pager
    +};
    +
    +const QString PhoneTypeNames[numPhoneTypes]=
    +{
    + I18N_NOOP("home phone"), I18N_NOOP("work
    phone"), I18N_NOOP("Messaging"),
    + I18N_NOOP("Preferred Number"), I18N_NOOP("Voice"),
    I18N_NOOP("Fax Number"),
    + I18N_NOOP("mobile phone"), I18N_NOOP("Video
    phone"), I18N_NOOP("Mailbox"),
    + I18N_NOOP("Modem"), I18N_NOOP("Car
    Phone"), I18N_NOOP("ISDN connection"),
    + I18N_NOOP("Personal Communication Service"),
    I18N_NOOP("Pager")
    +};
    +
    +
    +KPKabContact::KPKabContact(bool autoInsert)
    +{
    + m_addr = new Addressee();
    + m_toBeInserted = autoInsert;
    +}
    +
    +KPKabContact::KPKabContact(Addressee& addr)
    +{
    + m_addr = &addr;
    + m_toBeInserted = false;
    +}
    +
    +
    +KPKabContact::~KPKabContact()
    +{
    + m_addr = 0;
    +}
    +
    +
    +bool KPKabContact::isEmpty() const
    +{
    + return m_addr->isEmpty();
    +}
    +
    +
    +
    +QStringMap KPKabContact::names() const
    +{
    + // "formattedName", "realName", "familyName",
    "givenName", "nickName", "organizationName"
    +
    + if (!m_addr) return QStringMap();
    +
    + QStringMap map;
    + map["formattedName"] = m_addr->formattedName();
    + map["familyName"] = m_addr->familyName();
    + map["givenName"] = m_addr->givenName();
    + map["nickName"] = m_addr->nickName();
    + map["organizationName"] = m_addr->organization();
    + return map;
    +}
    +
    +QAddressMap KPKabContact::addresses() const
    +{
    + if (isEmpty()) return QAddressMap();
    +
    + QAddressMap map;
    + Address addr;
    +
    + for (int i=0;i<numAddressTypes;i++)
    + {
    + addr = m_addr->address( AddressTypes[i] );
    + if (!addr.isEmpty())
    + {
    + KPContactAddress address;
    + address.setStreet ( addr.street() );
    + address.setCountry ( addr.country() );
    + address.setLocality ( addr.locality() );
    + address.setPostOfficeBox ( addr.postOfficeBox() );
    + address.setPostalCode ( addr.postalCode() );
    + address.setRegion ( addr.region() );
    +
    + QString key = AddressTypeNames[i];
    + map[ key ] = address;
    + }
    + }
    +
    + return map;
    +}
    +
    +QStringList KPKabContact::emailAddresses() const
    +{
    + if (isEmpty()) return QStringList();
    +
    + return m_addr->emails();
    +}
    +
    +QStringMap KPKabContact::phoneNumbers() const
    +{
    + if (isEmpty()) return QStringMap();
    +
    + QStringMap map;
    + PhoneNumber phone;
    +
    + for (int i=0;i<numPhoneTypes;i++)
    + {
    + phone = m_addr->phoneNumber( PhoneTypes[i] );
    + if (!phone.number().isEmpty())
    + {
    + QString key = PhoneTypeNames[i];
    + map[ key ] = phone.number();
    + }
    + }
    +
    + return map;
    +}
    +
    +QStringList KPKabContact::categories() const
    +{
    + if (isEmpty()) return QStringList();
    +
    + QStringList list = m_addr->categories();
    +
    + return m_addr->categories();
    +}
    +
    +void KPKabContact::setCategories ( QStringList list )
    +{
    + m_addr->setCategories( list );
    +}
    +
    +QDate KPKabContact::birthday() const
    +{
    + if (isEmpty()) return QDate(99,99,99); // invalid date
    + return m_addr->birthday().date();
    +}
    +
    +#include <kmessagebox.h>
    +
    +QDate KPKabContact::anniversary() const
    +{
    + if (isEmpty()) return QDate(99,99,99); // invalid date
    +
    + QString dateStr = m_addr->custom( "KADDRESSBOOK" ,
    "X-Anniversary" );
    +
    + return QDate::fromString( dateStr, Qt::ISODate );
    +}
    +
    +QStringMap KPKabContact::webpageURLs() const
    +{
    + if (isEmpty()) return QStringMap();
    + return QStringMap();
    +}
    +
    +QString KPKabContact::note() const
    +{
    + if (isEmpty()) return QString();
    + return m_addr->note();
    +}
    +
    +void KPKabContact::setName(QString name, QString key)
    +{
    + if (!m_addr) return;
    +
    + if (key==QString("formattedName"))
    m_addr->setFormattedName(name);
    + else if (key==QString("familyName"))
    m_addr->setFamilyName(name);
    + else if (key==QString("givenName"))
    m_addr->setGivenName(name);
    + else if (key==QString("nickName"))
    m_addr->setNickName(name);
    + else if (key==QString("organizationName"))
    m_addr->setOrganization(name);
    +}
    +
    +bool KPKabContact::setNote(QString& note)
    +{
    + if (!m_addr) return false;
    +
    + m_addr->setNote(note);
    +
    + return true;
    +}
    +
    +
    +void KPKabContact::clearEmailAddresses()
    +{
    + if (!m_addr) return;
    + QStringList list = m_addr->emails();
    + QStringList::iterator itor = list.begin();
    + while ( itor != list.end() )
    + {
    + m_addr->removeEmail( *itor );
    + ++itor;
    + }
    +}
    +
    +void KPKabContact::addEmailAddress(QString emailAddr, bool
    preferred)
    +{
    + if (m_addr && !emailAddr.isEmpty())
    + {
    + m_addr->insertEmail(emailAddr, preferred);
    + }
    +}
    +
    +
    +
    +void KPKabContact::clearPhoneNumbers()
    +{
    + if (!m_addr) return;
    + PhoneNumber::List list = m_addr->phoneNumbers();
    + PhoneNumber::List::iterator itor = list.begin();
    + while ( itor != list.end() )
    + {
    + m_addr->removePh

     

Log in to post a comment.