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

2. Port libkopete to KF5

Tries to fix some KABC -> Kcontacts and other KMD -> QCryptographicHash issues.
parent 89260dc4
......@@ -164,6 +164,8 @@ set(libkopete_kf5_link_libs
KF5::KArchive
KF5::ConfigCore
KF5::ConfigGui
KF5::Parts
KF5::Wallet
KF5::KDELibs4Support
)
......@@ -173,8 +175,6 @@ target_link_libraries(kopete
${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)
......
......@@ -17,13 +17,10 @@
#include "kabcpersistence.h"
#include <qstring.h>
#include <qtimer.h>
#include <QString>
#include <QTimer>
#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 <QDialog>
......@@ -71,7 +68,8 @@ public:
bool addrBookWritePending;
// FIXME: Try to remove that static variable !
static KContacts::AddressBook* s_addressBook;
// UPDATE : Deprecated in KF5, Fuck off !
//static KContacts::AddressBook* s_addressBook;
};
KContacts::AddressBook* KABCPersistence::Private::s_addressBook = 0L;
......
......@@ -32,8 +32,10 @@
namespace KContacts
{
/* Deprecated in KF5
class AddressBook;
class Resource;
*/
}
namespace Kopete
......@@ -61,7 +63,8 @@ class KOPETE_EXPORT KABCPersistence : public QObject
/**
* @brief Access Kopete's KDE address book instance
*/
static KContacts::AddressBook* addressBook();
//FIXME : Deprecated in KF5
//static KContacts::AddressBook* addressBook();
/**
* @brief Change the KABC data associated with this metacontact
*
......@@ -85,7 +88,8 @@ class KOPETE_EXPORT KABCPersistence : public QObject
/**
* Request an address book write, will be delayed to bundle any others happening around the same time
*/
void writeAddressBook( KContacts::Resource * res );
//FIXME: Deprecated in KF5
//void writeAddressBook( KContacts::Resource * res );
protected:
static void splitField( const QString &str, QString &app, QString &name, QString &value );
......
......@@ -27,7 +27,7 @@
#include <QtCore/QTextStream>
// KDE includes
#include <kcontacts/stdaddressbook.h>
//#include <kcontacts/stdaddressbook.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kglobal.h>
......
......@@ -24,10 +24,13 @@
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QDialog>
#include <QDebug>
#include <k3activelabel.h>
#include <KGlobal>
#include <kconfig.h>
#include <kdebug.h>
#include <QDialog>
#include <klocale.h>
#include <kmessagebox.h>
#include <kiconloader.h>
......
......@@ -16,14 +16,14 @@
*/
#include "kopetepicture.h"
#include <qbuffer.h>
#include <kcontacts/picture.h>
#include <kcodecs.h>
#include <kdebug.h>
#include <qbuffer.h>
#include <QStandardPaths>
#include <QCryptographicHash>
namespace Kopete
......@@ -119,9 +119,10 @@ QString Picture::path()
QBuffer tempBuffer(&tempArray);
tempBuffer.open( QIODevice::WriteOnly );
image().save(&tempBuffer, "PNG");
KMD5 context(tempArray);
QCryptographicHash context(QCryptographicHash::Md5);
context.addData(tempArray);
// Save the image to a file.
localPhotoPath = context.hexDigest() + ".png";
localPhotoPath = context.result() + QLatin1String(".png");
localPhotoPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QString::fromUtf8("metacontactpicturecache/%1").arg( localPhotoPath) ;
if( image().save(localPhotoPath, "PNG") )
{
......
......@@ -25,21 +25,20 @@
#include <valgrind/valgrind.h>
#endif
#include <QApplication>
#include <QUrl>
#include <QFile>
#include <QRegExp>
#include <QTimer>
#include <QStack>
#include <QRegExp>
#include <QApplication>
#include <ksharedconfig.h>
#include <kdebug.h>
#include <kparts/componentfactory.h>
#include <kplugininfo.h>
#include <kconfig.h>
#include <QUrl>
#include <kservicetypetrader.h>
#include <KDebug>
#include <KConfig>
#include <KGlobal>
#include <KPluginInfo>
#include <KSharedConfig>
#include <kparts/part.h>
#include <kservicetypetrader.h>
#include "kopeteplugin.h"
#include "kopeteprotocol.h"
......@@ -248,9 +247,6 @@ void PluginManager::slotShutdownDone()
{
qCDebug(LIBKOPETE_LOG) ;
if (QTextCodec::codecForCStrings())
qCWarning(LIBKOPETE_LOG) << "WARNING: Some plugin set QTextCodec::setCodecForCStrings this may break protocols!!!";
_kpmp->shutdownMode = PluginManagerPrivate::DoneShutdown;
KGlobal::deref();
......
......@@ -390,9 +390,10 @@ void StatusManager::askAndSetActive()
mainLayout->addWidget(buttonBox);
// Set the Text in the Dialog
KMessageBox::createKMessageBox(dialog, QMessageBox::Question,
KMessageBox::createKMessageBox( dialog, buttonBox, QMessageBox::Question,
i18n("Do You Want to Change Status to Available?"),
QStringList(), QString(), NULL, KMessageBox::NoExec);
QStringList(), QString(), NULL, KMessageBox::NoExec
);
// If yes is clicked, go online
connect(dialog, SIGNAL(yesClicked()), this, SLOT(setActive()));
......
......@@ -17,11 +17,12 @@
#ifndef KOPETEWALLETMANAGER_H
#define KOPETEWALLETMANAGER_H
#include <qobject.h>
#include <QObject>
#include <kdemacros.h>
#include "kopete_export.h"
#include "libkopete_debug.h"
namespace KWallet { class Wallet; }
......
......@@ -17,7 +17,6 @@
*/
#include "addressbookselectordialog.h"
#include "addressbookselectorwidget.h"
#include <qdialog.h>
#include <QTreeWidget>
......@@ -26,6 +25,7 @@
#include <QVBoxLayout>
#include <klocale.h>
#include <QDialog>
#include <QPointer>
#include <ktreewidgetsearchline.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
......@@ -36,6 +36,8 @@ namespace Kopete
namespace UI
{
QPushButton *okButton;
AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const QString &message, const QString &preSelectUid, QWidget *parent )
: QDialog( parent )
{
......@@ -45,7 +47,7 @@ AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
......@@ -66,7 +68,7 @@ AddressBookSelectorDialog::AddressBookSelectorDialog(const QString &title, const
mainLayout->addWidget(vbox);
okButton->setEnabled(false);
//setHelp("linkaddressbook");
setHelp(QString(), "kopete");
//setHelp(QString(), "kopete");
connect(m_addressBookSelectorWidget, SIGNAL(addresseeListClicked(QTreeWidgetItem*)), SLOT(slotWidgetAddresseeListClicked(QTreeWidgetItem*)));
if ( !preSelectUid.isEmpty() )
......
......@@ -19,6 +19,8 @@
#ifndef ADDRESSBOOKSELECTORDIALOG_H
#define ADDRESSBOOKSELECTORDIALOG_H
#include "addressbookselectorwidget.h"
#include <kdemacros.h>
#include <ktreewidgetsearchline.h>
......@@ -28,11 +30,6 @@
#include "kopete_export.h"
namespace KContacts
{
class AddressBook;
class Addressee;
}
namespace Kopete
{
......
......@@ -59,7 +59,7 @@ AddressBookSelectorWidget::AddressBookSelectorWidget( QWidget *parent, const cha
setObjectName(name);
setupUi(this);
m_addressBook = Kopete::KABCPersistence::self()->addressBook();
//m_addressBook = Kopete::KABCPersistence::self()->addressBook();
// Addressee validation connections
connect( addAddresseeButton, SIGNAL(clicked()), SLOT(slotAddAddresseeClicked()) );
......@@ -73,7 +73,7 @@ AddressBookSelectorWidget::AddressBookSelectorWidget( QWidget *parent, const cha
connect( addresseeListView, SIGNAL(itemPressed(QTreeWidgetItem*,int)),
SIGNAL(addresseeListClicked(QTreeWidgetItem*)) );
connect( m_addressBook, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotLoadAddressees()) );
//connect( m_addressBook, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotLoadAddressees()) );
//We should add a clear QAction here. But we can't really do that with a designer file :\ this sucks
......@@ -91,7 +91,7 @@ AddressBookSelectorWidget::AddressBookSelectorWidget( QWidget *parent, const cha
AddressBookSelectorWidget::~AddressBookSelectorWidget()
{
disconnect( m_addressBook, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotLoadAddressees()) );
//disconnect( m_addressBook, SIGNAL(addressBookChanged(AddressBook*)), this, SLOT(slotLoadAddressees()) );
}
......@@ -132,11 +132,11 @@ bool AddressBookSelectorWidget::addresseeSelected()
void AddressBookSelectorWidget::slotLoadAddressees()
{
addresseeListView->clear();
KContacts::AddressBook::Iterator it;
/*KContacts::AddressBook::Iterator it;
for( it = m_addressBook->begin(); it != m_addressBook->end(); ++it )
{
new AddresseeItem( addresseeListView, (*it));
}
}*/
}
......@@ -155,8 +155,8 @@ void AddressBookSelectorWidget::slotAddAddresseeClicked()
{
KContacts::Addressee addr;
addr.setNameFromString( addresseeName );
m_addressBook->insertAddressee(addr);
Kopete::KABCPersistence::self()->writeAddressBook( 0 );
//m_addressBook->insertAddressee(addr);
//Kopete::KABCPersistence::self()->writeAddressBook( 0 );
slotLoadAddressees();
// select the addressee we just added
QList<QTreeWidgetItem *> added = addresseeListView->findItems( addresseeName, 0, 1 );
......
......@@ -27,7 +27,9 @@
#ifndef AddressBookSelectorWidget_H
#define AddressBookSelectorWidget_H
#include <kcontacts/addressbook.h>
#include <kcontacts/address.h>
#include <kcontacts/addressee.h>
#include <kcontacts/addresseelist.h>
#include <kdemacros.h>
#include "kopete_export.h"
......@@ -35,8 +37,10 @@
#include "ui_addressbookselectorwidget_base.h"
namespace KContacts {
class AddressBook;
class Addressee;
class Picture;
class Address;
class Addressee;
class AddresseeList;
}
namespace Kopete
......@@ -67,7 +71,7 @@ public:
bool addresseeSelected();
private:
KContacts::AddressBook * m_addressBook;
//KContacts::AddressBook * m_addressBook;
KContacts::Addressee m_addressee;
protected slots:
......
......@@ -21,7 +21,6 @@
#include <qlayout.h>
#include <qpushbutton.h>
#include <q3groupbox.h>
#include <qregexp.h>
#include <QPixmap>
#include <QIcon>
......@@ -36,7 +35,7 @@ AddresseeItem::AddresseeItem( QTreeWidget *parent, const KContacts::Addressee &a
//We can't save showphoto because we don't have a d pointer
KContacts::Picture pic = mAddressee.photo();
if(!pic.isIntern())
pic = mAddressee.logo();
pic = mAddressee.logo();
if(pic.isIntern())
{
QPixmap qpixmap = QPixmap::fromImage( pic.data().scaledToWidth(60) ); //60 pixels seems okay.. kmail uses 60 btw
......
......@@ -24,7 +24,7 @@
#include <klineedit.h>
#include <QTreeWidget>
#include <kcontacts/addressbook.h>
#include "addressbookselectorwidget.h"
/**
@short Special ListViewItem
......@@ -46,12 +46,12 @@ class AddresseeItem : public QTreeWidgetItem
@param parent The parent listview.
@param addressee The associated addressee.
*/
AddresseeItem( QTreeWidget *parent, const KContacts::Addressee &addressee );
AddresseeItem(QTreeWidget *parent, const KContacts::Addressee &addressee );
/**
Returns the addressee.
*/
KContacts::Addressee addressee() const { return mAddressee; }
KContacts::Addressee addressee() const { return mAddressee; }
/**
Method used by QListView to sort the items.
......@@ -59,7 +59,7 @@ class AddresseeItem : public QTreeWidgetItem
virtual QString key( int column, bool ascending ) const;
private:
KContacts::Addressee mAddressee;
KContacts::Addressee mAddressee;
};
#endif // ADDRESSEEITEM_H
......@@ -78,7 +78,7 @@ void InfoDialog::initialize(QWidget *parent)
QVBoxLayout *mainLayout = new QVBoxLayout;
mainWidget->setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
layout = new QVBoxLayout(mainWidget);
d->layout = new QVBoxLayout(mainWidget);
d->title = new KTitleWidget();
d->layout->addWidget( d->title );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment