Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Akonadi Contacts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Akonadi Contacts
Commits
57fd315f
Commit
57fd315f
authored
Apr 21, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now editor doesn't depend against akonadi
parent
0cebc5cc
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
161 additions
and
53 deletions
+161
-53
CMakeLists.txt
CMakeLists.txt
+1
-1
src/CMakeLists.txt
src/CMakeLists.txt
+2
-1
src/abstractcontacteditorwidget_p.h
src/abstractcontacteditorwidget_p.h
+4
-4
src/contacteditor.cpp
src/contacteditor.cpp
+6
-6
src/contactmetadataakonadi.cpp
src/contactmetadataakonadi.cpp
+53
-0
src/contactmetadataakonadi_p.h
src/contactmetadataakonadi_p.h
+62
-0
src/contactmetadatabase.cpp
src/contactmetadatabase.cpp
+12
-22
src/contactmetadatabase_p.h
src/contactmetadatabase_p.h
+10
-9
src/contactviewer.cpp
src/contactviewer.cpp
+2
-2
src/editor/contacteditorwidget.cpp
src/editor/contacteditorwidget.cpp
+3
-3
src/editor/contacteditorwidget.h
src/editor/contacteditorwidget.h
+2
-2
src/editor/generalinfoeditor/messaging/messagingwidget.h
src/editor/generalinfoeditor/messaging/messagingwidget.h
+2
-1
src/editor/generalinfoeditor/tests/CMakeLists.txt
src/editor/generalinfoeditor/tests/CMakeLists.txt
+0
-1
src/editor/im/imaddress.h
src/editor/im/imaddress.h
+2
-1
No files found.
CMakeLists.txt
View file @
57fd315f
cmake_minimum_required
(
VERSION 3.0
)
set
(
PIM_VERSION
"5.5.4
0
"
)
set
(
PIM_VERSION
"5.5.4
1
"
)
project
(
Akonadi-Contact VERSION
${
PIM_VERSION
}
)
...
...
src/CMakeLists.txt
View file @
57fd315f
...
...
@@ -149,7 +149,8 @@ set(akonadicontact_LIB_SRC
contactgroupmodel.cpp
contactgroupviewer.cpp
contactgroupviewerdialog.cpp
contactmetadata.cpp
contactmetadataakonadi.cpp
contactmetadatabase.cpp
contactparts.cpp
contactsfilterproxymodel.cpp
contactstreemodel.cpp
...
...
src/abstractcontacteditorwidget_p.h
View file @
57fd315f
...
...
@@ -32,7 +32,7 @@ class Addressee;
namespace
Akonadi
{
class
ContactMetaData
;
class
ContactMetaData
Base
;
class
AbstractContactEditorWidget
:
public
QWidget
{
...
...
@@ -42,7 +42,7 @@ public:
*
* @param parent The parent widget.
*/
AbstractContactEditorWidget
(
QWidget
*
parent
=
0
)
explicit
AbstractContactEditorWidget
(
QWidget
*
parent
=
nullptr
)
:
QWidget
(
parent
)
{
}
...
...
@@ -57,12 +57,12 @@ public:
/**
* @param contact loads the given contact into the editor widget
*/
virtual
void
loadContact
(
const
KContacts
::
Addressee
&
contact
,
const
Akonadi
::
ContactMetaData
&
metaData
)
=
0
;
virtual
void
loadContact
(
const
KContacts
::
Addressee
&
contact
,
const
Akonadi
::
ContactMetaData
Base
&
metaData
)
=
0
;
/**
* @param contact store the given contact into the editor widget
*/
virtual
void
storeContact
(
KContacts
::
Addressee
&
contact
,
Akonadi
::
ContactMetaData
&
metaData
)
const
=
0
;
virtual
void
storeContact
(
KContacts
::
Addressee
&
contact
,
Akonadi
::
ContactMetaData
Base
&
metaData
)
const
=
0
;
/**
* @param readOnly set read-only mode
...
...
src/contacteditor.cpp
View file @
57fd315f
...
...
@@ -23,7 +23,7 @@
#include "abstractcontacteditorwidget_p.h"
#include "autoqpointer_p.h"
#include "contactmetadata_p.h"
#include "contactmetadata
akonadi
_p.h"
#include "attributes/contactmetadataattribute_p.h"
#include "editor/contacteditorwidget.h"
...
...
@@ -75,14 +75,14 @@ public:
void
storeDone
(
KJob
*
job
);
void
itemChanged
(
const
Akonadi
::
Item
&
item
,
const
QSet
<
QByteArray
>
&
);
void
loadContact
(
const
KContacts
::
Addressee
&
addr
,
const
ContactMetaData
&
metaData
);
void
storeContact
(
KContacts
::
Addressee
&
addr
,
ContactMetaData
&
metaData
);
void
loadContact
(
const
KContacts
::
Addressee
&
addr
,
const
ContactMetaData
Akonadi
&
metaData
);
void
storeContact
(
KContacts
::
Addressee
&
addr
,
ContactMetaData
Akonadi
&
metaData
);
void
setupMonitor
();
ContactEditor
*
mParent
;
ContactEditor
::
Mode
mMode
;
Akonadi
::
Item
mItem
;
Akonadi
::
ContactMetaData
mContactMetaData
;
Akonadi
::
ContactMetaData
Akonadi
mContactMetaData
;
Akonadi
::
Monitor
*
mMonitor
;
Akonadi
::
Collection
mDefaultCollection
;
AbstractContactEditorWidget
*
mEditorWidget
;
...
...
@@ -183,12 +183,12 @@ void ContactEditor::Private::itemChanged(const Akonadi::Item &item, const QSet<Q
delete
dlg
;
}
void
ContactEditor
::
Private
::
loadContact
(
const
KContacts
::
Addressee
&
addr
,
const
ContactMetaData
&
metaData
)
void
ContactEditor
::
Private
::
loadContact
(
const
KContacts
::
Addressee
&
addr
,
const
ContactMetaData
Akonadi
&
metaData
)
{
mEditorWidget
->
loadContact
(
addr
,
metaData
);
}
void
ContactEditor
::
Private
::
storeContact
(
KContacts
::
Addressee
&
addr
,
ContactMetaData
&
metaData
)
void
ContactEditor
::
Private
::
storeContact
(
KContacts
::
Addressee
&
addr
,
ContactMetaData
Akonadi
&
metaData
)
{
mEditorWidget
->
storeContact
(
addr
,
metaData
);
}
...
...
src/contactmetadataakonadi.cpp
0 → 100644
View file @
57fd315f
/*
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.
*/
#include "contactmetadataakonadi_p.h"
#include "attributes/contactmetadataattribute_p.h"
#include <item.h>
using
namespace
Akonadi
;
ContactMetaDataAkonadi
::
ContactMetaDataAkonadi
()
{
}
ContactMetaDataAkonadi
::~
ContactMetaDataAkonadi
()
{
}
void
ContactMetaDataAkonadi
::
load
(
const
Akonadi
::
Item
&
contact
)
{
if
(
!
contact
.
hasAttribute
(
"contactmetadata"
))
{
return
;
}
ContactMetaDataAttribute
*
attribute
=
contact
.
attribute
<
ContactMetaDataAttribute
>
();
const
QVariantMap
metaData
=
attribute
->
metaData
();
loadMetaData
(
metaData
);
}
void
ContactMetaDataAkonadi
::
store
(
Akonadi
::
Item
&
contact
)
{
ContactMetaDataAttribute
*
attribute
=
contact
.
attribute
<
ContactMetaDataAttribute
>
(
Item
::
AddIfMissing
);
attribute
->
setMetaData
(
storeMetaData
());
}
src/contactmetadataakonadi_p.h
0 → 100644
View file @
57fd315f
/*
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_CONTACTMETADATA_P_H
#define AKONADI_CONTACTMETADATA_P_H
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include "contactmetadatabase_p.h"
namespace
Akonadi
{
class
Item
;
/**
* @short A helper class for storing contact specific settings.
*/
class
ContactMetaDataAkonadi
:
public
ContactMetaDataBase
{
public:
/**
* Creates a contact meta data object.
*/
ContactMetaDataAkonadi
();
/**
* Destroys the contact meta data object.
*/
~
ContactMetaDataAkonadi
();
/**
* Loads the meta data for the given @p contact.
*/
void
load
(
const
Akonadi
::
Item
&
contact
);
/**
* Stores the meta data to the given @p contact.
*/
void
store
(
Akonadi
::
Item
&
contact
);
};
}
#endif
src/contactmetadata.cpp
→
src/contactmetadata
base
.cpp
View file @
57fd315f
/*
This file is part of Akonadi Contact.
Copyright (c) 20
09 Tobias Koenig <tokoe
@kde.org>
Copyright (c) 20
17 Laurent Montel <montel
@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
...
...
@@ -19,7 +19,7 @@
02110-1301, USA.
*/
#include "contactmetadata_p.h"
#include "contactmetadata
base
_p.h"
#include "attributes/contactmetadataattribute_p.h"
...
...
@@ -27,7 +27,7 @@
using
namespace
Akonadi
;
class
Q_DECL_HIDDEN
ContactMetaData
::
Private
class
Q_DECL_HIDDEN
ContactMetaData
Base
::
Private
{
public:
Private
()
...
...
@@ -39,34 +39,25 @@ public:
QVariantList
mCustomFieldDescriptions
;
};
ContactMetaData
::
ContactMetaData
()
ContactMetaData
Base
::
ContactMetaDataBase
()
:
d
(
new
Private
)
{
}
ContactMetaData
::~
ContactMetaData
()
ContactMetaData
Base
::~
ContactMetaDataBase
()
{
delete
d
;
}
void
ContactMetaData
::
load
(
const
Akonadi
::
Item
&
contact
)
void
ContactMetaData
Base
::
loadMetaData
(
const
QVariantMap
&
metaData
)
{
if
(
!
contact
.
hasAttribute
(
"contactmetadata"
))
{
return
;
}
ContactMetaDataAttribute
*
attribute
=
contact
.
attribute
<
ContactMetaDataAttribute
>
();
const
QVariantMap
metaData
=
attribute
->
metaData
();
d
->
mDisplayNameMode
=
metaData
.
value
(
QStringLiteral
(
"DisplayNameMode"
),
-
1
).
toInt
();
d
->
mCustomFieldDescriptions
=
metaData
.
value
(
QStringLiteral
(
"CustomFieldDescriptions"
)).
toList
();
}
void
ContactMetaData
::
store
(
Akonadi
::
Item
&
contact
)
QVariantMap
ContactMetaDataBase
::
storeMetaData
()
const
{
ContactMetaDataAttribute
*
attribute
=
contact
.
attribute
<
ContactMetaDataAttribute
>
(
Item
::
AddIfMissing
);
QVariantMap
metaData
;
if
(
d
->
mDisplayNameMode
!=
-
1
)
{
metaData
.
insert
(
QStringLiteral
(
"DisplayNameMode"
),
QVariant
(
d
->
mDisplayNameMode
));
...
...
@@ -75,26 +66,25 @@ void ContactMetaData::store(Akonadi::Item &contact)
if
(
!
d
->
mCustomFieldDescriptions
.
isEmpty
())
{
metaData
.
insert
(
QStringLiteral
(
"CustomFieldDescriptions"
),
d
->
mCustomFieldDescriptions
);
}
attribute
->
setMetaData
(
metaData
);
return
metaData
;
}
void
ContactMetaData
::
setDisplayNameMode
(
int
mode
)
void
ContactMetaData
Base
::
setDisplayNameMode
(
int
mode
)
{
d
->
mDisplayNameMode
=
mode
;
}
int
ContactMetaData
::
displayNameMode
()
const
int
ContactMetaData
Base
::
displayNameMode
()
const
{
return
d
->
mDisplayNameMode
;
}
void
ContactMetaData
::
setCustomFieldDescriptions
(
const
QVariantList
&
descriptions
)
void
ContactMetaData
Base
::
setCustomFieldDescriptions
(
const
QVariantList
&
descriptions
)
{
d
->
mCustomFieldDescriptions
=
descriptions
;
}
QVariantList
ContactMetaData
::
customFieldDescriptions
()
const
QVariantList
ContactMetaData
Base
::
customFieldDescriptions
()
const
{
return
d
->
mCustomFieldDescriptions
;
}
src/contactmetadata_p.h
→
src/contactmetadata
base
_p.h
View file @
57fd315f
/*
This file is part of Akonadi Contact.
Copyright (c) 20
09 Tobias Koenig <tokoe
@kde.org>
Copyright (c) 20
17 Laurent Montel <montel
@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
...
...
@@ -19,8 +19,8 @@
02110-1301, USA.
*/
#ifndef AKONADI_CONTACTMETADATA_P_H
#define AKONADI_CONTACTMETADATA_P_H
#ifndef AKONADI_CONTACTMETADATA
BASE
_P_H
#define AKONADI_CONTACTMETADATA
BASE
_P_H
#include <QtCore/QStringList>
#include <QtCore/QVariant>
...
...
@@ -33,28 +33,29 @@ class Item;
/**
* @short A helper class for storing contact specific settings.
*/
class
ContactMetaData
class
ContactMetaData
Base
{
public:
/**
* Creates a contact meta data object.
*/
ContactMetaData
();
ContactMetaData
Base
();
/**
* Destroys the contact meta data object.
*/
~
ContactMetaData
();
~
ContactMetaData
Base
();
/**
* Loads the meta data for the given @p contact.
*/
void
load
(
const
Akonadi
::
Item
&
contact
);
void
load
MetaData
(
const
QVariantMap
&
metaData
);
/**
* Stores the meta data to the given @p contact.
*/
void
store
(
Akonadi
::
Item
&
contact
);
QVariantMap
storeMetaData
()
const
;
/**
* Sets the mode that is used for the display
...
...
@@ -93,7 +94,7 @@ public:
private:
//@cond PRIVATE
Q_DISABLE_COPY
(
ContactMetaData
)
Q_DISABLE_COPY
(
ContactMetaData
Base
)
class
Private
;
Private
*
const
d
;
...
...
src/contactviewer.cpp
View file @
57fd315f
...
...
@@ -21,7 +21,7 @@
#include "contactviewer.h"
#include "contactmetadata_p.h"
#include "contactmetadata
akonadi
_p.h"
#include "attributes/contactmetadataattribute_p.h"
#include "customfieldmanager_p.h"
#include "standardcontactformatter.h"
...
...
@@ -257,7 +257,7 @@ public:
}
// load the local meta data of the item
ContactMetaData
metaData
;
ContactMetaData
Akonadi
metaData
;
metaData
.
load
(
mCurrentItem
);
updateView
(
metaData
.
customFieldDescriptions
(),
addressBookName
);
...
...
src/editor/contacteditorwidget.cpp
View file @
57fd315f
...
...
@@ -24,7 +24,7 @@
#include "personaleditor/personaleditorwidget.h"
#include "contacteditorpageplugin.h"
#include "contactmetadata_p.h"
#include "contactmetadata
akonadi
_p.h"
#include <kconfig.h>
...
...
@@ -208,7 +208,7 @@ ContactEditorWidget::~ContactEditorWidget()
delete
d
;
}
void
ContactEditorWidget
::
loadContact
(
const
KContacts
::
Addressee
&
contact
,
const
Akonadi
::
ContactMetaData
&
metaData
)
void
ContactEditorWidget
::
loadContact
(
const
KContacts
::
Addressee
&
contact
,
const
Akonadi
::
ContactMetaData
Base
&
metaData
)
{
d
->
mGeneralInfoWidget
->
loadContact
(
contact
);
...
...
@@ -234,7 +234,7 @@ void ContactEditorWidget::loadContact(const KContacts::Addressee &contact, const
}
}
void
ContactEditorWidget
::
storeContact
(
KContacts
::
Addressee
&
contact
,
Akonadi
::
ContactMetaData
&
metaData
)
const
void
ContactEditorWidget
::
storeContact
(
KContacts
::
Addressee
&
contact
,
Akonadi
::
ContactMetaData
Base
&
metaData
)
const
{
d
->
mGeneralInfoWidget
->
storeContact
(
contact
);
...
...
src/editor/contacteditorwidget.h
View file @
57fd315f
...
...
@@ -60,13 +60,13 @@ public:
* Initializes the fields of the contact editor
* with the values from a @p contact.
*/
void
loadContact
(
const
KContacts
::
Addressee
&
contact
,
const
Akonadi
::
ContactMetaData
&
metaData
)
Q_DECL_OVERRIDE
;
void
loadContact
(
const
KContacts
::
Addressee
&
contact
,
const
Akonadi
::
ContactMetaData
Base
&
metaData
)
Q_DECL_OVERRIDE
;
/**
* Stores back the fields of the contact editor
* into the given @p contact.
*/
void
storeContact
(
KContacts
::
Addressee
&
contact
,
Akonadi
::
ContactMetaData
&
metaData
)
const
Q_DECL_OVERRIDE
;
void
storeContact
(
KContacts
::
Addressee
&
contact
,
Akonadi
::
ContactMetaData
Base
&
metaData
)
const
Q_DECL_OVERRIDE
;
/**
* Sets whether the contact in the editor allows
...
...
src/editor/generalinfoeditor/messaging/messagingwidget.h
View file @
57fd315f
...
...
@@ -26,12 +26,13 @@
#include <QWidget>
#include <editor/im/imaddress.h>
#include "akonadicontact_private_export.h"
class
QToolButton
;
namespace
Akonadi
{
class
PreferredLineEditWidget
;
class
AkonadiContactComboBox
;
class
MessagingWidget
:
public
QWidget
class
AKONADI_CONTACTS_TESTS_EXPORT
MessagingWidget
:
public
QWidget
{
Q_OBJECT
public:
...
...
src/editor/generalinfoeditor/tests/CMakeLists.txt
View file @
57fd315f
...
...
@@ -40,6 +40,5 @@ target_link_libraries(generalinfoeditortest
KF5::IconThemes
KF5::WidgetsAddons
KF5::KIOCore
KF5::AkonadiWidgets
)
src/editor/im/imaddress.h
View file @
57fd315f
...
...
@@ -24,8 +24,9 @@
#include <QVector>
#include <QString>
#include "akonadicontact_private_export.h"
class
IMAddress
class
AKONADI_CONTACTS_TESTS_EXPORT
IMAddress
{
public:
typedef
QVector
<
IMAddress
>
List
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment