Commit 89260dc4 authored by R. Harish Navnit's avatar R. Harish Navnit Committed by Pali Rohár

1. Port libkopete to KF5

This is the initial commit in the series of commits that deal with porting libkopete to kf5.
Does not touch/modify the kabc dependencies.
parent f9f8d4b8
......@@ -13,13 +13,16 @@ set(REQUIRED_QT_VERSION "5.2.0")
find_package(ECM 1.7 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_MODULE_DIR} ${ECM_KDE_MODULE_DIR} ${KOPETE_SOURCE_DIR}/cmake)
find_package(Phonon4Qt5 REQUIRED NO_MODULE)
find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Core)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Widgets Xml Sql Test)
#find_package(KF5Abc ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
#find_package(KF5Contacts ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5DBusAddons ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS
CoreAddons I18n DocTools KCMUtils KHtml NotifyConfig #[[Phonon PimIdentities]]
KDELibs4Support)
Wallet KDELibs4Support)
include(KDEInstallDirs)
include(KDECompilerSettings)
......@@ -28,6 +31,7 @@ include(FeatureSummary)
include(ECMAddTests)
include(ECMAddAppIcon)
include(ECMInstallIcons)
include_directories(${PHONON_INCLUDES})
if(WIN32)
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
......
......@@ -128,6 +128,7 @@ set(kopete_LIB_SRCS
kopeteinfoevent.cpp
kopeteaddedinfoevent.cpp
kopetesockettimeoutwatcher.cpp
libkopete_debug.cpp
# REMOVED FOR NOW
# connectionmanager.cpp
# managedconnectionaccount.cpp
......@@ -150,18 +151,30 @@ kconfig_add_kcfg_files(kopete_LIB_SRCS GENERATE_MOC
kopetestatussettings.kcfgc
)
find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
add_library(kopete SHARED ${kopete_LIB_SRCS})
target_link_libraries(kopete
${QT_QTXML_LIBRARIES}
KF5::KIOCore
KF5::KIOWidgets
set(libkopete_kf5_link_libs
KF5::Contacts
KF5::Solid
KF5::Emoticons
KF5::KCMUtils
KF5::I18n
KF5::KIOCore
KF5::KIOWidgets
KF5::KArchive
KF5::ConfigCore
KF5::ConfigGui
KF5::KDELibs4Support
)
target_link_libraries(kopete
${QT_QTXML_LIBRARIES}
${KDE4_KEMOTICONS_LIBS}
${libkopete_kf5_link_libs}
)
target_link_libraries(kopete ${libkopete_kf5_link_libs} ${KDE4_KDE3SUPPORT_LIBS} ${KDE4_KABC_LIBS} )
if(NOT DISABLE_VIDEOSUPPORT)
target_link_libraries(kopete kopete_videodevice)
endif(NOT DISABLE_VIDEOSUPPORT)
......
......@@ -35,7 +35,8 @@
#include <solid/device.h>
#include <solid/devicenotifier.h>
#include <solid/deviceinterface.h>
#include <solid/video.h>
//#include <solid/video.h>
#include <KSharedConfig>
#include "videodevice.h"
......@@ -79,8 +80,8 @@ VideoDevicePool::VideoDevicePool()
/* NOTE: No locking needed as long as we don't connect with Qt::ConnectionType = Qt::DirectConnection
while the signals are emitted by other threads
*/
foreach( Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::Video, QString()) )
registerDevice( device );
/*foreach( Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::Video, QString()) )
registerDevice( device );*/
}
/*!
......@@ -570,7 +571,7 @@ int VideoDevicePool::getSavedDevice()
kDebug() << "called";
if (m_videodevices.size())
{
KConfigGroup config(KGlobal::config(), "Video Device Settings");
KConfigGroup config(KSharedConfig::openConfig(), "Video Device Settings");
QString currentdevice = config.readEntry("Current Device", QString());
kDebug() << "Device name:" << config.readEntry( QString::fromLocal8Bit( "Device %1 Name" ).arg( currentdevice ), QString("NOT SAVED") );
if (!currentdevice.isEmpty())
......@@ -605,7 +606,7 @@ void VideoDevicePool::loadDeviceConfig()
kDebug() << "called";
if ((m_current_device >= 0) && (m_current_device < m_videodevices.size()))
{
KConfigGroup config(KGlobal::config(), "Video Device Settings");
KConfigGroup config(KSharedConfig::openConfig(), "Video Device Settings");
// Load input and apply
const QString key_currentinput = QString::fromLocal8Bit( "Device %1 Current Input" ).arg( m_videodevices[m_current_device]->udi() );
const int currentinput = config.readEntry(key_currentinput, 0);
......@@ -657,7 +658,7 @@ void VideoDevicePool::saveCurrentDeviceConfig()
kDebug() << "called";
if ((m_current_device >= 0) && (m_current_device < m_videodevices.size()))
{
KConfigGroup config(KGlobal::config(), "Video Device Settings");
KConfigGroup config(KSharedConfig::openConfig(), "Video Device Settings");
// Save current device:
kDebug() << "Current device:" << m_videodevices[m_current_device]->udi();
config.writeEntry( "Current Device", m_videodevices[m_current_device]->udi() );
......@@ -762,13 +763,13 @@ void VideoDevicePool::deviceAdded( const QString & udi )
{
kDebug() << "called with UDI" << udi;
Solid::Device dev( udi );
if ( dev.is<Solid::Video>() )
/*if ( dev.is<Solid::Video>() )
{
kDebug() << "Device is a video device, trying to register it.";
if ( registerDevice( dev ) )
emit deviceRegistered( udi );
}
else
else*/
kDebug() << "Device is not a video device";
}
......@@ -829,7 +830,7 @@ bool VideoDevicePool::registerDevice( Solid::Device & device )
else
kDebug() << "vendor:" << device.vendor() << ", product:" << device.product();
if (device.isValid())
/*if (device.isValid())
{
Solid::Video * solidVideoDevice = device.as<Solid::Video>();
if (solidVideoDevice)
......@@ -868,7 +869,7 @@ bool VideoDevicePool::registerDevice( Solid::Device & device )
else
kDebug() << "Device is not a video device.";
}
else
else*/
kDebug() << "Not a valid Solid device: device is not available in the system.";
return false;
}
......
......@@ -145,7 +145,7 @@ void ChatSessionMembersListModel::setChatSession(ChatSession *session)
Kopete::Contact * ChatSessionMembersListModel::contactAt( const QModelIndex &index ) const
{
kDebug( 14010 ) << "memberslistmodel contactat";
qCDebug(LIBKOPETE_LOG) << "memberslistmodel contactat";
if ( d->session )
{
if (!index.isValid())
......@@ -206,7 +206,7 @@ QVariant ChatSessionMembersListModel::headerData(int section, Qt::Orientation or
void ChatSessionMembersListModel::slotContactAdded( const Kopete::Contact *contact )
{
kDebug( 14010 ) << "memberslistmodel contact added "<< contact->displayName();
qCDebug(LIBKOPETE_LOG) << "memberslistmodel contact added "<< contact->displayName();
int index = d->getInsertIndex(contact);
beginInsertRows(QModelIndex(),index,index);
d->contacts.insert(index,(Contact*)contact);
......@@ -215,10 +215,10 @@ void ChatSessionMembersListModel::slotContactAdded( const Kopete::Contact *conta
void ChatSessionMembersListModel::slotContactRemoved( const Kopete::Contact *contact )
{
kDebug( 14010 ) << "memberslistmodel contact removed "<< contact->displayName();
qCDebug(LIBKOPETE_LOG) << "memberslistmodel contact removed "<< contact->displayName();
int index = d->contacts.indexOf((Contact*)contact);
if (index == -1) {
kDebug( 14010 ) << "Trying to remove contact '" << contact->displayName() << "' which isn't in members list model!!!";
qCDebug(LIBKOPETE_LOG) << "Trying to remove contact '" << contact->displayName() << "' which isn't in members list model!!!";
return;
}
......@@ -230,20 +230,20 @@ void ChatSessionMembersListModel::slotContactRemoved( const Kopete::Contact *con
void ChatSessionMembersListModel::slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &status )
{
Q_UNUSED(status)
kDebug( 14010 ) << "memberslistmodel contact status changed "<< contact->displayName();
qCDebug(LIBKOPETE_LOG) << "memberslistmodel contact status changed "<< contact->displayName();
slotContactRemoved(contact);
slotContactAdded(contact);
}
void ChatSessionMembersListModel::slotSessionChanged()
{
kDebug( 14010 );
qCDebug(LIBKOPETE_LOG);
reset();
}
void ChatSessionMembersListModel::slotContactNickNameChanged( Kopete::Contact *contact)
{
kDebug( 14010 ) << "memberslistmodel nickname changed to "<< contact->displayName();
qCDebug(LIBKOPETE_LOG) << "memberslistmodel nickname changed to "<< contact->displayName();
slotContactRemoved(contact);
slotContactAdded(contact);
}
......
......@@ -22,20 +22,20 @@
#endif
// Qt includes
#include <QtCore/QFile>
#include <QtCore/QUuid>
#include <QtCore/QRegExp>
#include <QtCore/QLatin1String>
#include <QtCore/QTextCodec>
#include <QtCore/QTextStream>
#include <QtXml/QDomDocument>
#include <QtXml/QDomElement>
// KDE includes
#include <kdebug.h>
#include <kstandarddirs.h>
#include <klocale.h>
#include <ksavefile.h>
#include <QFile>
#include <QUuid>
#include <QRegExp>
#include <QLocale>
#include <QSaveFile>
#include <QTextCodec>
#include <QTextStream>
#include <QLatin1String>
#include <QStandardPaths>
#include <QDomDocument>
#include <QDomElement>
//KDE includes
#include <KLocalizedString>
// Kopete includes
#include "kopetecontactlist.h"
......@@ -122,7 +122,7 @@ void XmlContactStorage::load()
}
else
{
filename = KStandardDirs::locateLocal( "appdata", QLatin1String( "contactlist.xml" ) );
filename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/contactlist.xml" ) ;
}
if( filename.isEmpty() )
......@@ -160,7 +160,7 @@ void XmlContactStorage::load()
if ( d->version < Private::ContactListVersion )
{
contactListFile.close();
kWarning(14010) << "The contact list on disk is older than expected or cannot be updated!"
qCWarning(LIBKOPETE_LOG) << "The contact list on disk is older than expected or cannot be updated!"
<< "No contact list will be loaded";
d->isValid = false;
d->isBusy = false;
......@@ -210,7 +210,7 @@ void XmlContactStorage::load()
}
else if( element.tagName() != QString::fromLatin1("kopete-group") )
{
kWarning(14010) << "Unknown element '" << element.tagName() << "' in XML contact list storage!" << endl;
qCWarning(LIBKOPETE_LOG) << "Unknown element '" << element.tagName() << "' in XML contact list storage!" << endl;
}
element = element.nextSibling().toElement();
}
......@@ -236,11 +236,11 @@ void XmlContactStorage::save()
}
else
{
filename = KStandardDirs::locateLocal( "appdata", QLatin1String( "contactlist.xml" ) );
filename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/contactlist.xml" ) ;
}
KSaveFile contactListFile( filename );
if( !contactListFile.open() )
QSaveFile contactListFile( filename );
if( !contactListFile.open(QIODevice::WriteOnly) )
{
d->isValid = false;
d->errorMessage = i18n( "Could not open contact list file." );
......@@ -279,7 +279,7 @@ void XmlContactStorage::save()
doc.documentElement().save( stream, 4 ); // QDomDocument::save() override stream codec to UTF-8
contactListFile.write( buf.toUtf8() );
if ( !contactListFile.finalize() )
if ( !contactListFile.commit() )
{
d->isValid = false;
d->errorMessage = i18n( "Could not write contact list to a file." );
......@@ -327,7 +327,7 @@ bool XmlContactStorage::parseMetaContact( Kopete::MetaContact *metaContact, cons
if ( contactElement.hasAttribute(NSCID_ELEM) && contactElement.hasAttribute(NSPID_ELEM) && contactElement.hasAttribute(NSAID_ELEM))
{
oldNameTracking = true;
//kDebug(14010) << "old name tracking";
//qCDebug(LIBKOPETE_LOG) << "old name tracking";
// retrieve deprecated data (now stored in property-sources)
// save temporarely, we will find a Contact* with this later
nameSourceCID = contactElement.attribute( NSCID_ELEM );
......@@ -338,7 +338,7 @@ bool XmlContactStorage::parseMetaContact( Kopete::MetaContact *metaContact, cons
else if( contactElement.tagName() == QString::fromUtf8( "photo" ) )
{
// custom photo, used for custom photo source
metaContact->setPhoto( KUrl(contactElement.text()) );
metaContact->setPhoto( QUrl(contactElement.text()) );
bool photoSyncedWithKABC = (contactElement.attribute(QString::fromUtf8("syncWithKABC")) == QString::fromUtf8("1")) || (contactElement.attribute(QString::fromUtf8("syncWithKABC")) == QString::fromUtf8("true"));
metaContact->setPhotoSyncedWithKABC( photoSyncedWithKABC );
......@@ -348,13 +348,13 @@ bool XmlContactStorage::parseMetaContact( Kopete::MetaContact *metaContact, cons
if ( contactElement.hasAttribute(PSCID_ELEM) && contactElement.hasAttribute(PSPID_ELEM) && contactElement.hasAttribute(PSAID_ELEM))
{
oldPhotoTracking = true;
// kDebug(14010) << "old photo tracking";
// qCDebug(LIBKOPETE_LOG) << "old photo tracking";
photoSourceCID = contactElement.attribute( PSCID_ELEM );
photoSourcePID = contactElement.attribute( PSPID_ELEM );
photoSourceAID = contactElement.attribute( PSAID_ELEM );
}
// else
// kDebug(14010) << "no old photo tracking";
// qCDebug(LIBKOPETE_LOG) << "no old photo tracking";
}
else if( contactElement.tagName() == QString::fromUtf8( "property-sources" ) )
{
......@@ -442,7 +442,7 @@ bool XmlContactStorage::parseMetaContact( Kopete::MetaContact *metaContact, cons
/* if (displayNameSourceContact() ) <- doesn't work because the contact is only set up when all plugin are loaded (BUG 111956) */
if ( !nameSourceCID.isEmpty() )
{
// kDebug(14010) << "Converting old name source";
// qCDebug(LIBKOPETE_LOG) << "Converting old name source";
// even if the old tracking attributes exists, they could have been null, that means custom
metaContact->setDisplayNameSource( Kopete::MetaContact::SourceContact );
}
......@@ -459,7 +459,7 @@ bool XmlContactStorage::parseMetaContact( Kopete::MetaContact *metaContact, cons
if ( oldPhotoTracking )
{
// kDebug(14010) << "Converting old photo source";
// qCDebug(LIBKOPETE_LOG) << "Converting old photo source";
if ( !photoSourceCID.isEmpty() )
{
metaContact->setPhotoSource( Kopete::MetaContact::SourceContact );
......@@ -672,7 +672,7 @@ const QDomElement XmlContactStorage::storeMetaContact( Kopete::MetaContact *meta
QDomDocument metaContactDoc;
metaContactDoc.appendChild( metaContactDoc.createElement( QString::fromUtf8( "meta-contact" ) ) );
metaContactDoc.documentElement().setAttribute( QString::fromUtf8( "contactId" ), metaContact->metaContactId() );
metaContactDoc.documentElement().setAttribute( QString::fromUtf8( "contactId" ), metaContact->metaContactId().toString() );
metaContactDoc.documentElement().setAttribute( QString::fromUtf8( "kabcId" ), metaContact->kabcId() );
// the custom display name, used for the custom name source
......@@ -710,7 +710,7 @@ const QDomElement XmlContactStorage::storeMetaContact( Kopete::MetaContact *meta
if( metaContact->photoSourceContact() )
{
//kDebug(14010) << "serializing photo source " << nameFromContact(photoSourceContact());
//qCDebug(LIBKOPETE_LOG) << "serializing photo source " << nameFromContact(photoSourceContact());
// set contact source metadata for photo
QDomElement contactPhotoSource = metaContactDoc.createElement( QString::fromUtf8("contact-source") );
contactPhotoSource.setAttribute( NSCID_ELEM, metaContact->photoSourceContact()->contactId() );
......
......@@ -20,15 +20,19 @@
#include <qstring.h>
#include <qtimer.h>
#include <kabc/addressbook.h>
#include <kabc/addressee.h>
#include <kabc/resource.h>
#include <kabc/stdaddressbook.h>
#include <kcontacts/addressbook.h>
#include <kcontacts/addressee.h>
#include <kcontacts/resource.h>
#include <kcontacts/stdaddressbook.h>
// UI related includes used for importing from KABC
#include <kdialog.h>
#include <QDialog>
#include <klocale.h>
#include <kmessagebox.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
#include "accountselector.h"
#include "kopeteuiglobal.h"
......@@ -63,14 +67,14 @@ public:
Private()
: addrBookWritePending(false)
{}
QList<KABC::Resource *> pendingResources;
QList<KContacts::Resource *> pendingResources;
bool addrBookWritePending;
// FIXME: Try to remove that static variable !
static KABC::AddressBook* s_addressBook;
static KContacts::AddressBook* s_addressBook;
};
KABC::AddressBook* KABCPersistence::Private::s_addressBook = 0L;
KContacts::AddressBook* KABCPersistence::Private::s_addressBook = 0L;
KABCPersistence::KABCPersistence( QObject * parent, const char * name )
: QObject( parent), d(new Private())
......@@ -89,12 +93,12 @@ KABCPersistence *KABCPersistence::self()
return &s;
}
KABC::AddressBook* KABCPersistence::addressBook()
KContacts::AddressBook* KABCPersistence::addressBook()
{
if ( Private::s_addressBook == 0L )
{
Private::s_addressBook = KABC::StdAddressBook::self();
KABC::StdAddressBook::setAutomaticSave( false );
Private::s_addressBook = KContacts::StdAddressBook::self();
KContacts::StdAddressBook::setAutomaticSave( false );
}
return Private::s_addressBook;
}
......@@ -102,11 +106,11 @@ KABC::AddressBook* KABCPersistence::addressBook()
void KABCPersistence::write( MetaContact * mc )
{
// Save any changes in each contact's addressBookFields to KABC
KABC::AddressBook* ab = addressBook();
KContacts::AddressBook* ab = addressBook();
kDebug( 14010 ) << "looking up Addressee for " << mc->displayName() << "...";
qCDebug(LIBKOPETE_LOG) << "looking up Addressee for " << mc->displayName() << "...";
// Look up the address book entry
KABC::Addressee theAddressee = ab->findByUid( mc->kabcId() );
KContacts::Addressee theAddressee = ab->findByUid( mc->kabcId() );
// Check that if addressee is not deleted or if the link is spurious
// (inherited from Kopete < 0.8, where all metacontacts had random ids)
if ( theAddressee.isEmpty() )
......@@ -137,7 +141,7 @@ void KABCPersistence::write( MetaContact * mc )
// merge without duplicating
const QString toWrite = unionContents( currentCustomForProtocol, it.value().join( QString( QChar( 0xE000 ) ) ) );
// Note if nothing ends up in the KABC data, this is because insertCustom does nothing if any param is empty.
kDebug( 14010 ) << "Writing: " << it.key() << ", " << "All" << ", " << toWrite;
qCDebug(LIBKOPETE_LOG) << "Writing: " << it.key() << ", " << "All" << ", " << toWrite;
theAddressee.insertCustom( it.key(), QLatin1String( "All" ), toWrite );
const QString check = theAddressee.custom( it.key(), QLatin1String( "All" ) );
}
......@@ -151,7 +155,7 @@ void KABCPersistence::write( MetaContact * mc )
// This causes each Kopete::Protocol subclass to serialise its contacts' data into the metacontact's plugin data and address book data
emit aboutToSave(this);
kDebug( 14010 ) << "...FOUND ONE!";
qCDebug(LIBKOPETE_LOG) << "...FOUND ONE!";
// Store address book fields
QMap<QString, QMap<QString, QString> >::ConstIterator appIt = d->addressBook.begin();
for( ; appIt != d->addressBook.end(); ++appIt )
......@@ -165,7 +169,7 @@ void KABCPersistence::write( MetaContact * mc )
QString toWrite = unionContents( currentCustom, addrIt.data() );
// write the result
// Note if nothing ends up in the KABC data, this is because insertCustom does nothing if any param is empty.
kDebug( 14010 ) << "Writing: " << appIt.key() << ", " << addrIt.key() << ", " << toWrite;
qCDebug(LIBKOPETE_LOG) << "Writing: " << appIt.key() << ", " << addrIt.key() << ", " << toWrite;
theAddressee.insertCustom( appIt.key(), addrIt.key(), toWrite );
}
}
......@@ -174,7 +178,7 @@ void KABCPersistence::write( MetaContact * mc )
}*/
}
void KABCPersistence::writeAddressBook( KABC::Resource * res)
void KABCPersistence::writeAddressBook( KContacts::Resource * res)
{
if ( !d->pendingResources.count( res ) )
d->pendingResources.append( res );
......@@ -187,24 +191,24 @@ void KABCPersistence::writeAddressBook( KABC::Resource * res)
void KABCPersistence::slotWriteAddressBook()
{
//kDebug( 14010 ) ;
KABC::AddressBook* ab = addressBook();
QListIterator<KABC::Resource *> it( d->pendingResources );
//qCDebug(LIBKOPETE_LOG) ;
KContacts::AddressBook* ab = addressBook();
QListIterator<KContacts::Resource *> it( d->pendingResources );
while ( it.hasNext() )
{
//kDebug( 14010 ) << "Writing resource " << it.current()->resourceName();
KABC::Ticket *ticket = ab->requestSaveTicket( it.next() );
//qCDebug(LIBKOPETE_LOG) << "Writing resource " << it.current()->resourceName();
KContacts::Ticket *ticket = ab->requestSaveTicket( it.next() );
if ( !ticket )
kWarning( 14010 ) << "WARNING: Resource is locked by other application!";
qCWarning(LIBKOPETE_LOG) << "WARNING: Resource is locked by other application!";
else
{
if ( !ab->save( ticket ) )
{
kWarning( 14010 ) << "ERROR: Saving failed!";
qCWarning(LIBKOPETE_LOG) << "ERROR: Saving failed!";
ab->releaseSaveTicket( ticket );
}
}
//kDebug( 14010 ) << "Finished writing KABC";
//qCDebug(LIBKOPETE_LOG) << "Finished writing KABC";
}
d->pendingResources.clear();
d->addrBookWritePending = false;
......@@ -214,7 +218,7 @@ void KABCPersistence::removeKABC( MetaContact *)
{
/* // remove any data this KMC has written to the KDE address book
// Save any changes in each contact's addressBookFields to KABC
KABC::AddressBook* ab = addressBook();
KContacts::AddressBook* ab = addressBook();
// Wipe out the existing addressBook entries
d->addressBook.clear();
......@@ -224,19 +228,19 @@ void KABCPersistence::removeKABC( MetaContact *)
// If the metacontact is linked to a kabc entry
if ( !d->kabcId().isEmpty() )
{
//kDebug( 14010 ) << "looking up Addressee for " << displayName() << "...";
//qCDebug(LIBKOPETE_LOG) << "looking up Addressee for " << displayName() << "...";
// Look up the address book entry
KABC::Addressee theAddressee = ab->findByUid( d->kabcId() );
KContacts::Addressee theAddressee = ab->findByUid( d->kabcId() );
if ( theAddressee.isEmpty() )
{
// remove the link
//kDebug( 14010 ) << "...not found.";
//qCDebug(LIBKOPETE_LOG) << "...not found.";
d->kabcId.clear();
}
else
{
//kDebug( 14010 ) << "...FOUND ONE!";
//qCDebug(LIBKOPETE_LOG) << "...FOUND ONE!";
// Remove address book fields
QMap<QString, QMap<QString, QString> >::ConstIterator appIt = d->addressBook.begin();
for( ; appIt != d->addressBook.end(); ++appIt )
......@@ -245,7 +249,7 @@ void KABCPersistence::removeKABC( MetaContact *)
for( ; addrIt != appIt.data().end(); ++addrIt )
{
// FIXME: This assumes Kopete is the only app writing these fields
kDebug( 14010 ) << "Removing: " << appIt.key() << ", " << addrIt.key();
qCDebug(LIBKOPETE_LOG) << "Removing: " << appIt.key() << ", " << addrIt.key();
theAddressee.removeCustom( appIt.key(), addrIt.key() );
}
}
......@@ -254,16 +258,16 @@ void KABCPersistence::removeKABC( MetaContact *)
writeAddressBook();
}
}
// kDebug(14010) << kBacktrace();*/
// qCDebug(LIBKOPETE_LOG) << kBacktrace();*/
}
bool KABCPersistence::syncWithKABC( MetaContact * mc )
{
kDebug(14010) ;
qCDebug(LIBKOPETE_LOG) ;
bool contactAdded = false;
// check whether the dontShowAgain was checked
KABC::AddressBook* ab = addressBook();
KABC::Addressee addr = ab->findByUid( mc->kabcId() );
KContacts::AddressBook* ab = addressBook();
KContacts::Addressee addr = ab->findByUid( mc->kabcId() );
if ( !addr.isEmpty() ) // if we are associated with KABC
{
......@@ -275,13 +279,13 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc )
{
QString app, name, value;
splitField( *it, app, name, value );
kDebug( 14010 ) << "app=" << app << " name=" << name << " value=" << value;
qCDebug(LIBKOPETE_LOG) << "app=" << app << " name=" << name << " value=" << value;
if ( app.startsWith( QLatin1String( "messaging/" ) ) )
{
if ( name == QLatin1String( "All" ) )
{
kDebug( 14010 ) << " syncing \"" << app << ":" << name << " with contact list ";
qCDebug(LIBKOPETE_LOG) << " syncing \"" << app << ":" << name << " with contact list ";
// Get the protocol name from the custom field
// by chopping the 'messaging/' prefix from the custom field app name
QString protocolName = app.right( app.length() - 10 );
......@@ -330,17 +334,17 @@ bool KABCPersistence::syncWithKABC( MetaContact * mc )
// Is it already in this metacontact? If so, we needn't do anything
if ( otherMc == mc )
{
kDebug( 14010 ) << *it << " already a child of this metacontact.";
qCDebug(LIBKOPETE_LOG) << *it << " already a child of this metacontact.";
continue;
}
kDebug( 14010 ) << *it << " already exists in OTHER metacontact, move here?";
qCDebug(LIBKOPETE_LOG) << *it << " already exists in OTHER metacontact, move here?";
// find the Kopete::Contact and attempt to move it to this metacontact.
otherMc->findContact( proto->pluginId(), QString(), *it )->setMetaContact( mc );
}
else
{
// if not, prompt to add it
kDebug( 14010 ) << proto->pluginId() << "://" << *it << " was not found in the contact list. Prompting to add...";
qCDebug(LIBKOPETE_LOG) << proto->pluginId() << "://" << *it << " was not found in the contact list. Prompting to add...";
if ( KMessageBox::Yes == KMessageBox::questionYesNo( Kopete::UI::Global::mainWidget(),
i18n( "<qt>An address was added to this contact by another application.<br />Would you like to use it in Kopete?<br />