Commit ec28ac89 authored by Laurent Montel's avatar Laurent Montel 😁

Fix namespace. Rename etc.

parent ad454cba
...@@ -126,22 +126,15 @@ target_link_libraries(KF5AkonadiContact ...@@ -126,22 +126,15 @@ target_link_libraries(KF5AkonadiContact
KF5::AkonadiWidgets KF5::AkonadiWidgets
Qt5::Widgets Qt5::Widgets
PRIVATE PRIVATE
KF5::Completion
KF5::ConfigCore KF5::ConfigCore
KF5::ConfigWidgets KF5::ConfigWidgets
KF5::IconThemes KF5::IconThemes
KF5::KIOWidgets KF5::KIOWidgets
KF5::Mime KF5::Mime
KF5::Codecs
KF5::DBusAddons KF5::DBusAddons
KF5::I18n KF5::I18n
KF5::Service
KF5::TextWidgets KF5::TextWidgets
KF5::WidgetsAddons
KF5::XmlGui KF5::XmlGui
Grantlee5::Templates
Qt5::WebEngine
Qt5::WebEngineWidgets
KF5::ContactEditor KF5::ContactEditor
) )
...@@ -161,9 +154,6 @@ install(TARGETS ...@@ -161,9 +154,6 @@ install(TARGETS
EXPORT KF5AkonadiContactTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} EXPORT KF5AkonadiContactTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}
) )
install(FILES editor/pics/world.jpg DESTINATION ${KDE_INSTALL_DATADIR_KF5}/akonadi/contact/pics)
install(FILES editor/data/zone.tab DESTINATION ${KDE_INSTALL_DATADIR_KF5}/akonadi/contact/data)
ecm_generate_pri_file(BASE_NAME AkonadiContact ecm_generate_pri_file(BASE_NAME AkonadiContact
LIB_NAME KF5AkonadiContact LIB_NAME KF5AkonadiContact
DEPS "AkonadiCore Contacts" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/Akonadi/Contact DEPS "AkonadiCore Contacts" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/Akonadi/Contact
...@@ -224,7 +214,6 @@ install( FILES ...@@ -224,7 +214,6 @@ install( FILES
${AkonadiContact_HEADERS} ${AkonadiContact_HEADERS}
${AkonadiContactJob_HEADERS} ${AkonadiContactJob_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/akonadi-contact_export.h ${CMAKE_CURRENT_BINARY_DIR}/akonadi-contact_export.h
editor/im/improtocols.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel
) )
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
include(CMakeFindDependencyMacro) include(CMakeFindDependencyMacro)
find_dependency(KF5Akonadi "@AKONADI_VERSION@") find_dependency(KF5Akonadi "@AKONADI_VERSION@")
find_dependency(KF5Contacts "@KCONTACTS_VERSION@") find_dependency(KF5Contacts "@KCONTACTS_VERSION@")
find_dependency(KF5ContactEditor "@PIM_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KF5AkonadiContactTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/KF5AkonadiContactTargets.cmake")
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
using namespace Akonadi; using namespace Akonadi;
class Q_DECL_HIDDEN ContactEditor::Private class Q_DECL_HIDDEN Akonadi::AkonadiContactEditor::Private
{ {
public: public:
Private(ContactEditor::Mode mode, ContactEditor::DisplayMode displayMode, AbstractContactEditorWidget *editorWidget, ContactEditor *parent) Private(AkonadiContactEditor::Mode mode, AkonadiContactEditor::DisplayMode displayMode, ContactEditor::AbstractContactEditorWidget *editorWidget, AkonadiContactEditor *parent)
: mParent(parent) : mParent(parent)
, mMode(mode) , mMode(mode)
, mMonitor(nullptr) , mMonitor(nullptr)
...@@ -79,17 +79,17 @@ public: ...@@ -79,17 +79,17 @@ public:
void storeContact(KContacts::Addressee &addr, ContactMetaDataAkonadi &metaData); void storeContact(KContacts::Addressee &addr, ContactMetaDataAkonadi &metaData);
void setupMonitor(); void setupMonitor();
ContactEditor *mParent; AkonadiContactEditor *mParent;
ContactEditor::Mode mMode; AkonadiContactEditor::Mode mMode;
Akonadi::Item mItem; Akonadi::Item mItem;
Akonadi::ContactMetaDataAkonadi mContactMetaData; Akonadi::ContactMetaDataAkonadi mContactMetaData;
Akonadi::Monitor *mMonitor; Akonadi::Monitor *mMonitor;
Akonadi::Collection mDefaultCollection; Akonadi::Collection mDefaultCollection;
AbstractContactEditorWidget *mEditorWidget; ContactEditor::AbstractContactEditorWidget *mEditorWidget;
bool mReadOnly; bool mReadOnly;
}; };
void ContactEditor::Private::itemFetchDone(KJob *job) void Akonadi::AkonadiContactEditor::Private::itemFetchDone(KJob *job)
{ {
if (job->error() != KJob::NoError) { if (job->error() != KJob::NoError) {
return; return;
...@@ -107,7 +107,7 @@ void ContactEditor::Private::itemFetchDone(KJob *job) ...@@ -107,7 +107,7 @@ void ContactEditor::Private::itemFetchDone(KJob *job)
mItem = fetchJob->items().at(0); mItem = fetchJob->items().at(0);
mReadOnly = false; mReadOnly = false;
if (mMode == ContactEditor::EditMode) { if (mMode == AkonadiContactEditor::EditMode) {
// if in edit mode we have to fetch the parent collection to find out // if in edit mode we have to fetch the parent collection to find out
// about the modify rights of the item // about the modify rights of the item
...@@ -123,7 +123,7 @@ void ContactEditor::Private::itemFetchDone(KJob *job) ...@@ -123,7 +123,7 @@ void ContactEditor::Private::itemFetchDone(KJob *job)
} }
} }
void ContactEditor::Private::parentCollectionFetchDone(KJob *job) void Akonadi::AkonadiContactEditor::Private::parentCollectionFetchDone(KJob *job)
{ {
if (job->error()) { if (job->error()) {
return; return;
...@@ -146,7 +146,7 @@ void ContactEditor::Private::parentCollectionFetchDone(KJob *job) ...@@ -146,7 +146,7 @@ void ContactEditor::Private::parentCollectionFetchDone(KJob *job)
loadContact(addr, mContactMetaData); loadContact(addr, mContactMetaData);
} }
void ContactEditor::Private::storeDone(KJob *job) void Akonadi::AkonadiContactEditor::Private::storeDone(KJob *job)
{ {
if (job->error() != KJob::NoError) { if (job->error() != KJob::NoError) {
Q_EMIT mParent->error(job->errorString()); Q_EMIT mParent->error(job->errorString());
...@@ -162,7 +162,7 @@ void ContactEditor::Private::storeDone(KJob *job) ...@@ -162,7 +162,7 @@ void ContactEditor::Private::storeDone(KJob *job)
Q_EMIT mParent->finished(); Q_EMIT mParent->finished();
} }
void ContactEditor::Private::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &) void Akonadi::AkonadiContactEditor::Private::itemChanged(const Akonadi::Item &item, const QSet<QByteArray> &)
{ {
Q_UNUSED(item); Q_UNUSED(item);
QPointer<QMessageBox> dlg = new QMessageBox(mParent); //krazy:exclude=qclasses QPointer<QMessageBox> dlg = new QMessageBox(mParent); //krazy:exclude=qclasses
...@@ -183,17 +183,17 @@ void ContactEditor::Private::itemChanged(const Akonadi::Item &item, const QSet<Q ...@@ -183,17 +183,17 @@ void ContactEditor::Private::itemChanged(const Akonadi::Item &item, const QSet<Q
delete dlg; delete dlg;
} }
void ContactEditor::Private::loadContact(const KContacts::Addressee &addr, const ContactMetaDataAkonadi &metaData) void Akonadi::AkonadiContactEditor::Private::loadContact(const KContacts::Addressee &addr, const ContactMetaDataAkonadi &metaData)
{ {
mEditorWidget->loadContact(addr, metaData); mEditorWidget->loadContact(addr, metaData);
} }
void ContactEditor::Private::storeContact(KContacts::Addressee &addr, ContactMetaDataAkonadi &metaData) void Akonadi::AkonadiContactEditor::Private::storeContact(KContacts::Addressee &addr, ContactMetaDataAkonadi &metaData)
{ {
mEditorWidget->storeContact(addr, metaData); mEditorWidget->storeContact(addr, metaData);
} }
void ContactEditor::Private::setupMonitor() void Akonadi::AkonadiContactEditor::Private::setupMonitor()
{ {
delete mMonitor; delete mMonitor;
mMonitor = new Akonadi::Monitor; mMonitor = new Akonadi::Monitor;
...@@ -202,30 +202,30 @@ void ContactEditor::Private::setupMonitor() ...@@ -202,30 +202,30 @@ void ContactEditor::Private::setupMonitor()
connect(mMonitor, SIGNAL(itemChanged(Akonadi::Item,QSet<QByteArray>)), mParent, SLOT(itemChanged(Akonadi::Item,QSet<QByteArray>))); connect(mMonitor, SIGNAL(itemChanged(Akonadi::Item,QSet<QByteArray>)), mParent, SLOT(itemChanged(Akonadi::Item,QSet<QByteArray>)));
} }
ContactEditor::ContactEditor(Mode mode, QWidget *parent) Akonadi::AkonadiContactEditor::AkonadiContactEditor(Mode mode, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, d(new Private(mode, FullMode, nullptr, this)) , d(new Private(mode, FullMode, nullptr, this))
{ {
} }
ContactEditor::ContactEditor(Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent) Akonadi::AkonadiContactEditor::AkonadiContactEditor(Mode mode, ContactEditor::AbstractContactEditorWidget *editorWidget, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, d(new Private(mode, FullMode, editorWidget, this)) , d(new Private(mode, FullMode, editorWidget, this))
{ {
} }
ContactEditor::ContactEditor(Mode mode, DisplayMode displayMode, QWidget *parent) Akonadi::AkonadiContactEditor::AkonadiContactEditor(Mode mode, DisplayMode displayMode, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, d(new Private(mode, displayMode, nullptr, this)) , d(new Private(mode, displayMode, nullptr, this))
{ {
} }
ContactEditor::~ContactEditor() Akonadi::AkonadiContactEditor::~AkonadiContactEditor()
{ {
delete d; delete d;
} }
void ContactEditor::loadContact(const Akonadi::Item &item) void Akonadi::AkonadiContactEditor::loadContact(const Akonadi::Item &item)
{ {
if (d->mMode == CreateMode) { if (d->mMode == CreateMode) {
Q_ASSERT_X(false, "ContactEditor::loadContact", "You are calling loadContact in CreateMode!"); Q_ASSERT_X(false, "ContactEditor::loadContact", "You are calling loadContact in CreateMode!");
...@@ -242,14 +242,14 @@ void ContactEditor::loadContact(const Akonadi::Item &item) ...@@ -242,14 +242,14 @@ void ContactEditor::loadContact(const Akonadi::Item &item)
d->mMonitor->setItemMonitored(item); d->mMonitor->setItemMonitored(item);
} }
KContacts::Addressee ContactEditor::contact() KContacts::Addressee Akonadi::AkonadiContactEditor::contact()
{ {
KContacts::Addressee addr; KContacts::Addressee addr;
d->storeContact(addr, d->mContactMetaData); d->storeContact(addr, d->mContactMetaData);
return addr; return addr;
} }
void ContactEditor::saveContactInAddressBook() void Akonadi::AkonadiContactEditor::saveContactInAddressBook()
{ {
if (d->mMode == EditMode) { if (d->mMode == EditMode) {
if (!d->mItem.isValid() || d->mReadOnly) { if (!d->mItem.isValid() || d->mReadOnly) {
...@@ -297,12 +297,12 @@ void ContactEditor::saveContactInAddressBook() ...@@ -297,12 +297,12 @@ void ContactEditor::saveContactInAddressBook()
} }
} }
void ContactEditor::setContactTemplate(const KContacts::Addressee &contact) void Akonadi::AkonadiContactEditor::setContactTemplate(const KContacts::Addressee &contact)
{ {
d->loadContact(contact, d->mContactMetaData); d->loadContact(contact, d->mContactMetaData);
} }
void ContactEditor::setDefaultAddressBook(const Akonadi::Collection &collection) void Akonadi::AkonadiContactEditor::setDefaultAddressBook(const Akonadi::Collection &collection)
{ {
d->mDefaultCollection = collection; d->mDefaultCollection = collection;
} }
......
...@@ -30,11 +30,13 @@ namespace KContacts ...@@ -30,11 +30,13 @@ namespace KContacts
{ {
class Addressee; class Addressee;
} }
namespace ContactEditor
{
class AbstractContactEditorWidget;
}
namespace Akonadi namespace Akonadi
{ {
class AbstractContactEditorWidget;
class Collection; class Collection;
class Item; class Item;
...@@ -79,7 +81,7 @@ class Item; ...@@ -79,7 +81,7 @@ class Item;
* @author Tobias Koenig <tokoe@kde.org> * @author Tobias Koenig <tokoe@kde.org>
* @since 4.4 * @since 4.4
*/ */
class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget class AKONADI_CONTACT_EXPORT AkonadiContactEditor : public QWidget
{ {
Q_OBJECT Q_OBJECT
...@@ -103,7 +105,7 @@ public: ...@@ -103,7 +105,7 @@ public:
* @param mode The mode of the editor. * @param mode The mode of the editor.
* @param parent The parent widget of the editor. * @param parent The parent widget of the editor.
*/ */
explicit ContactEditor(Mode mode, QWidget *parent = nullptr); explicit AkonadiContactEditor(Mode mode, QWidget *parent = nullptr);
/** /**
* Creates a new contact editor with a custom editor widget. * Creates a new contact editor with a custom editor widget.
...@@ -112,7 +114,7 @@ public: ...@@ -112,7 +114,7 @@ public:
* @param editorWidget The contact editor widget that shall be used for editing. * @param editorWidget The contact editor widget that shall be used for editing.
* @param parent The parent widget of the editor. * @param parent The parent widget of the editor.
*/ */
ContactEditor(Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent = nullptr); AkonadiContactEditor(Mode mode, ContactEditor::AbstractContactEditorWidget *editorWidget, QWidget *parent = nullptr);
/** /**
* Creates a new contact editor dialog with a custom editor widget. * Creates a new contact editor dialog with a custom editor widget.
...@@ -122,12 +124,12 @@ public: ...@@ -122,12 +124,12 @@ public:
* @param parent The parent widget of the dialog. * @param parent The parent widget of the dialog.
* @since 4.10 * @since 4.10
*/ */
ContactEditor(Mode mode, DisplayMode displayMode, QWidget *parent = nullptr); AkonadiContactEditor(Mode mode, DisplayMode displayMode, QWidget *parent = nullptr);
/** /**
* Destroys the contact editor. * Destroys the contact editor.
*/ */
virtual ~ContactEditor(); virtual ~AkonadiContactEditor();
/** /**
* Sets a @p contact that is used as template in create mode. * Sets a @p contact that is used as template in create mode.
......
...@@ -43,7 +43,7 @@ using namespace Akonadi; ...@@ -43,7 +43,7 @@ using namespace Akonadi;
class Q_DECL_HIDDEN ContactEditorDialog::Private class Q_DECL_HIDDEN ContactEditorDialog::Private
{ {
public: public:
Private(ContactEditorDialog::Mode mode, ContactEditorDialog::DisplayMode displaymode, AbstractContactEditorWidget *editorWidget, Private(ContactEditorDialog::Mode mode, ContactEditorDialog::DisplayMode displaymode, ContactEditor::AbstractContactEditorWidget *editorWidget,
ContactEditorDialog *parent) ContactEditorDialog *parent)
: q(parent) : q(parent)
, mAddressBookBox(nullptr) , mAddressBookBox(nullptr)
...@@ -63,9 +63,9 @@ public: ...@@ -63,9 +63,9 @@ public:
layout->setMargin(0); layout->setMargin(0);
if (editorWidget) { if (editorWidget) {
mEditor = new ContactEditor(mode == ContactEditorDialog::CreateMode ? ContactEditor::CreateMode : ContactEditor::EditMode, editorWidget, q); mEditor = new AkonadiContactEditor(mode == ContactEditorDialog::CreateMode ? AkonadiContactEditor::CreateMode : AkonadiContactEditor::EditMode, editorWidget, q);
} else { } else {
mEditor = new ContactEditor(mode == ContactEditorDialog::CreateMode ? ContactEditor::CreateMode : ContactEditor::EditMode, displaymode == ContactEditorDialog::FullMode ? ContactEditor::FullMode : ContactEditor::VCardMode, q); mEditor = new AkonadiContactEditor(mode == ContactEditorDialog::CreateMode ? AkonadiContactEditor::CreateMode : AkonadiContactEditor::EditMode, displaymode == ContactEditorDialog::FullMode ? AkonadiContactEditor::FullMode : AkonadiContactEditor::VCardMode, q);
} }
if (mode == ContactEditorDialog::CreateMode) { if (mode == ContactEditorDialog::CreateMode) {
...@@ -82,10 +82,10 @@ public: ...@@ -82,10 +82,10 @@ public:
layout->addWidget(mEditor, 1, 0, 1, 2); layout->addWidget(mEditor, 1, 0, 1, 2);
layout->setColumnStretch(1, 1); layout->setColumnStretch(1, 1);
connect(mEditor, &ContactEditor::contactStored, connect(mEditor, &AkonadiContactEditor::contactStored,
q, &ContactEditorDialog::contactStored); q, &ContactEditorDialog::contactStored);
connect(mEditor, &ContactEditor::error, connect(mEditor, &AkonadiContactEditor::error,
q, &ContactEditorDialog::error); q, &ContactEditorDialog::error);
connect(mEditor, SIGNAL(finished()), q, SLOT(slotFinish())); connect(mEditor, SIGNAL(finished()), q, SLOT(slotFinish()));
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
ContactEditorDialog *q; ContactEditorDialog *q;
CollectionComboBox *mAddressBookBox; CollectionComboBox *mAddressBookBox;
ContactEditorDialog::Mode mMode; ContactEditorDialog::Mode mMode;
ContactEditor *mEditor; AkonadiContactEditor *mEditor;
}; };
ContactEditorDialog::ContactEditorDialog(Mode mode, QWidget *parent) ContactEditorDialog::ContactEditorDialog(Mode mode, QWidget *parent)
...@@ -141,7 +141,7 @@ ContactEditorDialog::ContactEditorDialog(Mode mode, QWidget *parent) ...@@ -141,7 +141,7 @@ ContactEditorDialog::ContactEditorDialog(Mode mode, QWidget *parent)
{ {
} }
ContactEditorDialog::ContactEditorDialog(Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent) ContactEditorDialog::ContactEditorDialog(Mode mode, ContactEditor::AbstractContactEditorWidget *editorWidget, QWidget *parent)
: QDialog(parent) : QDialog(parent)
, d(new Private(mode, FullMode, editorWidget, this)) , d(new Private(mode, FullMode, editorWidget, this))
{ {
...@@ -173,7 +173,7 @@ void ContactEditorDialog::setDefaultAddressBook(const Akonadi::Collection &addre ...@@ -173,7 +173,7 @@ void ContactEditorDialog::setDefaultAddressBook(const Akonadi::Collection &addre
d->mAddressBookBox->setDefaultCollection(addressbook); d->mAddressBookBox->setDefaultCollection(addressbook);
} }
ContactEditor *ContactEditorDialog::editor() const AkonadiContactEditor *ContactEditorDialog::editor() const
{ {
return d->mEditor; return d->mEditor;
} }
......
...@@ -26,11 +26,14 @@ ...@@ -26,11 +26,14 @@
#include <QDialog> #include <QDialog>
namespace ContactEditor
{
class AbstractContactEditorWidget;
}
namespace Akonadi namespace Akonadi
{ {
class AbstractContactEditorWidget; class AkonadiContactEditor;
class ContactEditor;
class Collection; class Collection;
class Item; class Item;
...@@ -106,7 +109,7 @@ public: ...@@ -106,7 +109,7 @@ public:
* @param editorWidget The contact editor widget that shall be used for editing. * @param editorWidget The contact editor widget that shall be used for editing.
* @param parent The parent widget of the dialog. * @param parent The parent widget of the dialog.
*/ */
ContactEditorDialog(Mode mode, AbstractContactEditorWidget *editorWidget, QWidget *parent = nullptr); ContactEditorDialog(Mode mode, ContactEditor::AbstractContactEditorWidget *editorWidget, QWidget *parent = nullptr);
/** /**
* Creates a new contact editor dialog with a custom editor widget. * Creates a new contact editor dialog with a custom editor widget.
...@@ -139,7 +142,7 @@ public: ...@@ -139,7 +142,7 @@ public:
/** /**
* Returns the ContactEditor that is used by this dialog. * Returns the ContactEditor that is used by this dialog.
*/ */
ContactEditor *editor() const; AkonadiContactEditor *editor() const;
Q_SIGNALS: Q_SIGNALS:
/** /**
......
...@@ -33,7 +33,7 @@ class Item; ...@@ -33,7 +33,7 @@ class Item;
/** /**
* @short A helper class for storing contact specific settings. * @short A helper class for storing contact specific settings.
*/ */
class ContactMetaDataAkonadi : public ContactMetaDataBase class ContactMetaDataAkonadi : public ContactEditor::ContactMetaDataBase
{ {
public: public:
/** /**
......
add_definitions(-DTRANSLATION_DOMAIN=\"akonadicontact5\") add_definitions(-DTRANSLATION_DOMAIN=\"akonadicontact5\")
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5ContactEditor") set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5ContactEditor")
ecm_setup_version(PROJECT VARIABLE_PREFIX CONTACTEDITOR ecm_setup_version(PROJECT VARIABLE_PREFIX AKONADICONTACT
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/contact-editor_version.h" VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/contact-editor_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfigVersion.cmake" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfigVersion.cmake"
SOVERSION 5