summaryrefslogtreecommitdiffabout
path: root/libkabcwrap/kabcaddressbookplugin.cpp
blob: 25f51d31fe58163938f1732be2bf59411128d9d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*US
#include <qwidget.h>
#include <qlayout.h>
#include <qlistbox.h>
#include <opie/ocontact.h>
#include <opie/orecordlist.h>
#include "opieaddressee.h"
*/
#include <stdio.h>
#include "kabcaddressbookplugin.h"

KABCAddressBookPlugin::KABCAddressBookPlugin() : ref(0) {

//US  access = new OContactAccess("OpieAddressBookPlugin");
  
}

KABC::Addressee::List KABCAddressBookPlugin::getAddressees() {
    KABC::Addressee::List results;


/*US    
    OContactAccess access("OpieAddressBookPlugin");
    OContactAccess::List::Iterator it;
    ORecordList<OContact> accessList = access.sorted(true,0,0,0);
    for(it = accessList.begin(); it != accessList.end(); ++it ) {
        OpieAddressee addressee( *it );
        results.append(addressee);
    }
*/
  qDebug("KABCAddressBookPlugin::getAddressees has to be implemented");
    
    return results;
}

QString KABCAddressBookPlugin::name() {
  return QString::QString("KABCAddressBookPlugin");
}


KABC::Addressee::List KABCAddressBookPlugin::findByEmail(const QString &email) {

printf("KABCAddressBookPlugin::findByEmail: email=%s\n", email.ascii());
  KABC::Addressee::List results;
/*US
  
  ORecordList<OContact> accessList = access->sorted(true,0,0,0);
  OContactAccess::List::Iterator it;
  for(it = accessList.begin(); it != accessList.end(); ++it ) {
    OContact contact = *it;
    QStringList emailList = contact.emailList();
    QStringList foundEmails = emailList.grep(email,false);
    if (foundEmails.count() >= 1) {
      OpieAddressee a(contact);
  printf("Found Contact %s\n", a.formattedName().ascii());
      results.append(a);
    }
  }
*/
  qDebug("KABCAddressBookPlugin::findByEmail has to be implemented");
  
  return results;
  
}

QRESULT KABCAddressBookPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
{
printf("Start: KABCAddressBookPlugin::queryInterface\n");
    *iface = 0;
    if ( uuid == IID_QUnknown )
      *iface = this;
    else if ( uuid == IID_KOAddressBookInterface )
      *iface = this;
    if ( *iface )
      (*iface)->addRef();
    return QS_OK;
printf("End:   KABCAddressBookPlugin::queryInterface\n");
}

Q_EXPORT_INTERFACE()
{
    Q_CREATE_INSTANCE( KABCAddressBookPlugin )
}