Commit 7bd16644 authored by Laurent Montel's avatar Laurent Montel 😁

Create contacteditor lib

parent 03067153
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.5.41") set(PIM_VERSION "5.5.42")
project(Akonadi-Contact VERSION ${PIM_VERSION}) project(Akonadi-Contact VERSION ${PIM_VERSION})
......
...@@ -27,13 +27,10 @@ install(FILES ...@@ -27,13 +27,10 @@ install(FILES
COMPONENT Devel COMPONENT Devel
) )
install(EXPORT KF5AkonadiContactTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5AkonadiContactTargets.cmake NAMESPACE KF5::)
set( AKONADI_PHONE_DIAL_DEFAULT "UseSkype" ) set( AKONADI_PHONE_DIAL_DEFAULT "UseSkype" )
set( AKONADI_SEND_SMS_DEFAULT "UseSkypeSms" ) set( AKONADI_SEND_SMS_DEFAULT "UseSkypeSms" )
add_subdirectory(editor/im)
########### next target ############### ########### next target ###############
set(akonadicontact_actions_SRCS set(akonadicontact_actions_SRCS
...@@ -52,101 +49,6 @@ configure_file(config-akonadi-contact.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config ...@@ -52,101 +49,6 @@ configure_file(config-akonadi-contact.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config
configure_file( actions/contactactionssettings.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/contactactionssettings.kcfg @ONLY) configure_file( actions/contactactionssettings.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/contactactionssettings.kcfg @ONLY)
kconfig_add_kcfg_files(akonadicontact_actions_SRCS actions/contactactionssettings.kcfgc) kconfig_add_kcfg_files(akonadicontact_actions_SRCS actions/contactactionssettings.kcfgc)
set(akonadicontact_customfieldseditor_SRCS
editor/customfieldeditor/customfieldswidget.cpp
editor/customfieldeditor/customfieldeditorwidget.cpp
editor/customfieldeditor/customfieldslistwidget.cpp
editor/customfieldeditor/customfieldslistdelegate.cpp
editor/customfieldeditor/customfieldsmodel.cpp
)
set(akonadicontact_editor_utils_SRCS
editor/utils/utils.cpp
)
set(akonadicontact_editor_widgets_SRCS
editor/widgets/kwidgetlister.cpp
editor/widgets/akonadicontactcombobox.cpp
)
set(akonadicontact_editor_generalinfo_phone_SRCS
editor/generalinfoeditor/phone/phonewidgetlister.cpp
editor/generalinfoeditor/phone/phonewidget.cpp
editor/generalinfoeditor/phone/phonelistwidget.cpp
editor/generalinfoeditor/phone/phonecomboboxtype.cpp
editor/generalinfoeditor/phone/phonetypedialog.cpp
)
set(akonadicontact_editor_generalinfo_web_SRCS
editor/generalinfoeditor/web/webwidgetlister.cpp
editor/generalinfoeditor/web/weblistwidget.cpp
editor/generalinfoeditor/web/webwidget.cpp
)
set(akonadicontact_editor_generalinfo_mail_SRCS
editor/generalinfoeditor/mail/maillistwidget.cpp
editor/generalinfoeditor/mail/mailwidget.cpp
editor/generalinfoeditor/mail/mailwidgetlister.cpp
)
set(akonadicontact_editor_generalinfo_messaging_SRCS
editor/generalinfoeditor/messaging/messaginglistwidget.cpp
editor/generalinfoeditor/messaging/messagingwidget.cpp
editor/generalinfoeditor/messaging/messagingwidgetlister.cpp
)
set(akonadicontact_editor_generalinfo_SRCS
editor/generalinfoeditor/generalinfowidget.cpp
editor/generalinfoeditor/namewidget.cpp
editor/generalinfoeditor/nicknamewidget.cpp
editor/generalinfoeditor/categorieseditwidget.cpp
editor/generalinfoeditor/nameeditdialog.cpp
editor/generalinfoeditor/displaynameeditwidget.cpp
editor/generalinfoeditor/akonadicontactselecttypecombobox.cpp
editor/generalinfoeditor/messageformattingwidget.cpp
${akonadicontact_editor_generalinfo_messaging_SRCS}
${akonadicontact_editor_generalinfo_phone_SRCS}
${akonadicontact_editor_generalinfo_web_SRCS}
${akonadicontact_editor_generalinfo_mail_SRCS}
)
set(akonadicontact_addresslocation_web_editor_SRCS
editor/addresseditor/webengine/addresseslocationengineviewer.cpp
editor/addresseditor/webengine/addresseslocationenginepage.cpp
)
set(akonadicontact_addresslocation_editor_SRCS
${akonadicontact_addresslocation_web_editor_SRCS}
editor/addresseditor/addresslocationwidget.cpp
editor/addresseditor/addresseslocationgrantleeformater.cpp
editor/addresseditor/addressgrantleeobject.cpp
editor/addresseditor/iconnamecache.cpp
editor/addresseditor/addresseslocationwidget.cpp
editor/addresseditor/selectaddresstypecombobox.cpp
editor/addresseditor/addresstypedialog.cpp
)
set(akonadicontact_personal_editor_SRCS
editor/personaleditor/personaleditorwidget.cpp
editor/personaleditor/dateeditwidget.cpp
editor/personaleditor/kdatepickerpopup.cpp
)
set(akonadicontact_business_editor_SRCS
editor/businesseditor/businesseditorwidget.cpp
editor/businesseditor/freebusyeditwidget.cpp
)
set(akonadicontact_editor_SRCS
${akonadicontact_personal_editor_SRCS}
${akonadicontact_editor_utils_SRCS}
${akonadicontact_business_editor_SRCS}
editor/contacteditorwidget.cpp
editor/im/imaddress.cpp
editor/im/improtocols.cpp
editor/widgets/imagewidget.cpp
editor/widgets/preferredlineeditwidget.cpp
)
set(akonadicontact_attributes_SRCS set(akonadicontact_attributes_SRCS
attributes/contactmetadataattribute.cpp attributes/contactmetadataattribute.cpp
...@@ -160,9 +62,6 @@ set(akonadicontact_job_SRCS ...@@ -160,9 +62,6 @@ set(akonadicontact_job_SRCS
) )
set(akonadicontact_LIB_SRC set(akonadicontact_LIB_SRC
${akonadicontact_addresslocation_editor_SRCS}
${akonadicontact_editor_widgets_SRCS}
${akonadicontact_editor_generalinfo_SRCS}
${akonadicontact_customfieldseditor_SRCS} ${akonadicontact_customfieldseditor_SRCS}
${akonadicontact_attributes_SRCS} ${akonadicontact_attributes_SRCS}
${akonadicontact_job_SRCS} ${akonadicontact_job_SRCS}
...@@ -180,14 +79,11 @@ set(akonadicontact_LIB_SRC ...@@ -180,14 +79,11 @@ set(akonadicontact_LIB_SRC
contactgroupviewer.cpp contactgroupviewer.cpp
contactgroupviewerdialog.cpp contactgroupviewerdialog.cpp
contactmetadataakonadi.cpp contactmetadataakonadi.cpp
contactmetadatabase.cpp
contactparts.cpp contactparts.cpp
contactsfilterproxymodel.cpp contactsfilterproxymodel.cpp
contactstreemodel.cpp contactstreemodel.cpp
contactviewer.cpp contactviewer.cpp
contactviewerdialog.cpp contactviewerdialog.cpp
customfields.cpp
customfieldmanager.cpp
emailaddressselection.cpp emailaddressselection.cpp
emailaddressselectiondialog.cpp emailaddressselectiondialog.cpp
emailaddressselectionproxymodel.cpp emailaddressselectionproxymodel.cpp
...@@ -208,7 +104,6 @@ ecm_qt_declare_logging_category(akonadicontact_LIB_SRC HEADER akonadi_contact_de ...@@ -208,7 +104,6 @@ ecm_qt_declare_logging_category(akonadicontact_LIB_SRC HEADER akonadi_contact_de
set(akonadicontact_LIB_SRC set(akonadicontact_LIB_SRC
${akonadicontact_LIB_SRC} ${akonadicontact_LIB_SRC}
${akonadicontact_editor_SRCS}
) )
ki18n_wrap_ui(akonadicontact_LIB_SRC contactgroupeditor.ui) ki18n_wrap_ui(akonadicontact_LIB_SRC contactgroupeditor.ui)
...@@ -247,6 +142,7 @@ target_link_libraries(KF5AkonadiContact ...@@ -247,6 +142,7 @@ target_link_libraries(KF5AkonadiContact
Grantlee5::Templates Grantlee5::Templates
Qt5::WebEngine Qt5::WebEngine
Qt5::WebEngineWidgets Qt5::WebEngineWidgets
KF5::ContactEditor
) )
if(KF5Prison_FOUND) if(KF5Prison_FOUND)
...@@ -332,21 +228,9 @@ install( FILES ...@@ -332,21 +228,9 @@ install( FILES
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel
) )
if (BUILD_TESTING)
add_subdirectory(editor/addresseditor/autotests/)
add_subdirectory(editor/addresseditor/tests)
add_subdirectory(editor/generalinfoeditor/autotests/)
add_subdirectory(editor/generalinfoeditor/tests)
add_subdirectory(editor/customfieldeditor/autotests/)
add_subdirectory(editor/customfieldeditor/tests)
add_subdirectory(editor/widgets/autotests/)
endif()
if (BUILD_TESTING) if (BUILD_TESTING)
add_subdirectory(autotests) add_subdirectory(autotests)
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
add_subdirectory(editor/addresseditor/html)
add_definitions(-DTRANSLATION_DOMAIN=\"akonadicontact5\")
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5ContactEditor")
ecm_setup_version(PROJECT VARIABLE_PREFIX CONTACTEDITOR
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/contact-editor_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfigVersion.cmake"
SOVERSION 5
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5ContactEditorConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KF5ContactEditorTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5ContactEditorTargets.cmake NAMESPACE KF5::)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5ContactEditorConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
set( AKONADI_PHONE_DIAL_DEFAULT "UseSkype" )
set( AKONADI_SEND_SMS_DEFAULT "UseSkypeSms" )
configure_file(config-contact-editor.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-contact-editor.h)
add_subdirectory(editor/im)
set(contacteditor_customfieldseditor_SRCS
editor/customfieldeditor/customfieldswidget.cpp
editor/customfieldeditor/customfieldeditorwidget.cpp
editor/customfieldeditor/customfieldslistwidget.cpp
editor/customfieldeditor/customfieldslistdelegate.cpp
editor/customfieldeditor/customfieldsmodel.cpp
)
set(contacteditor_editor_utils_SRCS
editor/utils/utils.cpp
)
set(contacteditor_editor_widgets_SRCS
editor/widgets/kwidgetlister.cpp
editor/widgets/akonadicontactcombobox.cpp
)
set(contacteditor_editor_generalinfo_phone_SRCS
editor/generalinfoeditor/phone/phonewidgetlister.cpp
editor/generalinfoeditor/phone/phonewidget.cpp
editor/generalinfoeditor/phone/phonelistwidget.cpp
editor/generalinfoeditor/phone/phonecomboboxtype.cpp
editor/generalinfoeditor/phone/phonetypedialog.cpp
)
set(contacteditor_editor_generalinfo_web_SRCS
editor/generalinfoeditor/web/webwidgetlister.cpp
editor/generalinfoeditor/web/weblistwidget.cpp
editor/generalinfoeditor/web/webwidget.cpp
)
set(contacteditor_editor_generalinfo_mail_SRCS
editor/generalinfoeditor/mail/maillistwidget.cpp
editor/generalinfoeditor/mail/mailwidget.cpp
editor/generalinfoeditor/mail/mailwidgetlister.cpp
)
set(contacteditor_editor_generalinfo_messaging_SRCS
editor/generalinfoeditor/messaging/messaginglistwidget.cpp
editor/generalinfoeditor/messaging/messagingwidget.cpp
editor/generalinfoeditor/messaging/messagingwidgetlister.cpp
)
set(contacteditor_editor_generalinfo_SRCS
editor/generalinfoeditor/generalinfowidget.cpp
editor/generalinfoeditor/namewidget.cpp
editor/generalinfoeditor/nicknamewidget.cpp
editor/generalinfoeditor/categorieseditwidget.cpp
editor/generalinfoeditor/nameeditdialog.cpp
editor/generalinfoeditor/displaynameeditwidget.cpp
editor/generalinfoeditor/akonadicontactselecttypecombobox.cpp
editor/generalinfoeditor/messageformattingwidget.cpp
${contacteditor_editor_generalinfo_messaging_SRCS}
${contacteditor_editor_generalinfo_phone_SRCS}
${contacteditor_editor_generalinfo_web_SRCS}
${contacteditor_editor_generalinfo_mail_SRCS}
)
set(contacteditor_addresslocation_web_editor_SRCS
editor/addresseditor/webengine/addresseslocationengineviewer.cpp
editor/addresseditor/webengine/addresseslocationenginepage.cpp
)
set(contacteditor_addresslocation_editor_SRCS
${contacteditor_addresslocation_web_editor_SRCS}
editor/addresseditor/addresslocationwidget.cpp
editor/addresseditor/addresseslocationgrantleeformater.cpp
editor/addresseditor/addressgrantleeobject.cpp
editor/addresseditor/iconnamecache.cpp
editor/addresseditor/addresseslocationwidget.cpp
editor/addresseditor/selectaddresstypecombobox.cpp
editor/addresseditor/addresstypedialog.cpp
)
set(contacteditor_personal_editor_SRCS
editor/personaleditor/personaleditorwidget.cpp
editor/personaleditor/dateeditwidget.cpp
editor/personaleditor/kdatepickerpopup.cpp
)
set(contacteditor_business_editor_SRCS
editor/businesseditor/businesseditorwidget.cpp
editor/businesseditor/freebusyeditwidget.cpp
)
set(contacteditor_editor_SRCS
${contacteditor_personal_editor_SRCS}
${contacteditor_editor_utils_SRCS}
${contacteditor_business_editor_SRCS}
editor/contacteditorwidget.cpp
editor/im/imaddress.cpp
editor/im/improtocols.cpp
editor/widgets/imagewidget.cpp
editor/widgets/preferredlineeditwidget.cpp
customfields.cpp
customfieldmanager.cpp
contactmetadatabase.cpp
)
set(contacteditor_LIB_SRC
${contacteditor_addresslocation_editor_SRCS}
${contacteditor_editor_widgets_SRCS}
${contacteditor_editor_generalinfo_SRCS}
${contacteditor_customfieldseditor_SRCS}
${contacteditor_attributes_SRCS}
${contacteditor_job_SRCS}
)
ecm_qt_declare_logging_category(contacteditor_LIB_SRC HEADER akonadi_contact_debug.h IDENTIFIER AKONADICONTACT_LOG CATEGORY_NAME org.kde.pim.akonadicontact)
set(contacteditor_LIB_SRC
${contacteditor_LIB_SRC}
${contacteditor_editor_SRCS}
)
add_library(KF5ContactEditor ${contacteditor_LIB_SRC})
generate_export_header(KF5ContactEditor BASE_NAME contacteditor)
add_library(KF5::ContactEditor ALIAS KF5ContactEditor)
target_include_directories(KF5ContactEditor INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/ContactEditor;${KDE_INSTALL_INCLUDEDIR_KF5}>")
target_include_directories(KF5ContactEditor INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/contacteditor>")
target_include_directories(KF5ContactEditor PUBLIC "$<BUILD_INTERFACE:${Akonadi-Contact_SOURCE_DIR}/src/contact-editor;${Akonadi-Contact_BINARY_DIR}/src/contact-editor>")
target_link_libraries(KF5ContactEditor
PUBLIC
KF5::AkonadiCore
KF5::Contacts
KF5::AkonadiWidgets
Qt5::Widgets
PRIVATE
KF5::Completion
KF5::ConfigCore
KF5::ConfigWidgets
KF5::IconThemes
KF5::KIOWidgets
KF5::Mime
KF5::Codecs
KF5::DBusAddons
KF5::I18n
KF5::Service
KF5::TextWidgets
KF5::WidgetsAddons
KF5::XmlGui
Grantlee5::Templates
Qt5::WebEngine
Qt5::WebEngineWidgets
)
if(KF5Prison_FOUND)
target_link_libraries(KF5ContactEditor PRIVATE KF5::Prison)
endif()
set_target_properties(KF5ContactEditor PROPERTIES
VERSION ${AKONADICONTACT_VERSION_STRING}
SOVERSION ${AKONADICONTACT_SOVERSION}
EXPORT_NAME ContactEditor
)
install(TARGETS
KF5ContactEditor
EXPORT KF5ContactEditorTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}
)
ecm_generate_pri_file(BASE_NAME ContactEditor
LIB_NAME KF5ContactEditor
DEPS "AkonadiCore Contacts" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/Akonadi/Contact
)
install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
ecm_generate_headers(ContactEditor_CamelCase_HEADERS
HEADER_NAMES
ContactEditorPagePlugin
REQUIRED_HEADERS ContactEditor_HEADERS
PREFIX ContactEditor
)
install( FILES
${ContactEditor_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/ContactEditor COMPONENT Devel
)
install( FILES
${ContactEditor_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/contacteditor_export.h
editor/im/improtocols.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/contacteditor COMPONENT Devel
)
install( FILES
${CMAKE_CURRENT_BINARY_DIR}/akonadi-contact_export.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/akonadi/contact COMPONENT Devel
)
if (BUILD_TESTING)
add_subdirectory(editor/addresseditor/autotests/)
add_subdirectory(editor/addresseditor/tests)
add_subdirectory(editor/generalinfoeditor/autotests/)
add_subdirectory(editor/generalinfoeditor/tests)
#Laurent reactivate it
#add_subdirectory(editor/customfieldeditor/autotests/)
#add_subdirectory(editor/customfieldeditor/tests)
add_subdirectory(editor/widgets/autotests/)
endif()
add_subdirectory(editor/addresseditor/html)
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(KF5Akonadi "@AKONADI_VERSION@")
find_dependency(KF5Contacts "@KCONTACTS_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KF5ContactEditorTargets.cmake")
/*
This file is part of Akonadi Contact.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_ABSTRACTCONTACTEDITORWIDGET_P_H
#define AKONADI_ABSTRACTCONTACTEDITORWIDGET_P_H
#include <QWidget>
namespace KContacts
{
class Addressee;
}
namespace Akonadi
{
class ContactMetaDataBase;
class AbstractContactEditorWidget : public QWidget
{
public:
/**
* Creates a new abstract contact editor widget.
*
* @param parent The parent widget.
*/
explicit AbstractContactEditorWidget(QWidget *parent = nullptr)
: QWidget(parent)
{
}
/**
* Destroys the abstract contact editor widget.
*/
~AbstractContactEditorWidget()
{
}
/**
* @param contact loads the given contact into the editor widget
*/
virtual void loadContact(const KContacts::Addressee &contact, const Akonadi::ContactMetaDataBase &metaData) = 0;
/**
* @param contact store the given contact into the editor widget
*/
virtual void storeContact(KContacts::Addressee &contact, Akonadi::ContactMetaDataBase &metaData) const = 0;
/**
* @param readOnly set read-only mode
*/
virtual void setReadOnly(bool readOnly) = 0;
};
}
#endif
/*
* autoqpointer.h - QPointer which on destruction deletes object
* This is a (mostly) verbatim, private copy of kdepim/kalarm/lib/autoqpointer.h
*
* Copyright © 2009 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
* License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to the