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
16ec1da9
Commit
16ec1da9
authored
Oct 09, 2012
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to show just "vcard" page (not custom page) need by kmail
parent
ec35e6f3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
33 deletions
+101
-33
akonadi/contact/contacteditor.cpp
akonadi/contact/contacteditor.cpp
+10
-4
akonadi/contact/contacteditor.h
akonadi/contact/contacteditor.h
+17
-0
akonadi/contact/contacteditordialog.cpp
akonadi/contact/contacteditordialog.cpp
+9
-4
akonadi/contact/contacteditordialog.h
akonadi/contact/contacteditordialog.h
+15
-0
akonadi/contact/editor/contacteditorwidget.cpp
akonadi/contact/editor/contacteditorwidget.cpp
+43
-24
akonadi/contact/editor/contacteditorwidget.h
akonadi/contact/editor/contacteditorwidget.h
+7
-1
No files found.
akonadi/contact/contacteditor.cpp
View file @
16ec1da9
...
...
@@ -47,14 +47,14 @@ using namespace Akonadi;
class
ContactEditor
::
Private
{
public:
Private
(
ContactEditor
::
Mode
mode
,
AbstractContactEditorWidget
*
editorWidget
,
ContactEditor
*
parent
)
Private
(
ContactEditor
::
Mode
mode
,
ContactEditor
::
DisplayMode
displayMode
,
AbstractContactEditorWidget
*
editorWidget
,
ContactEditor
*
parent
)
:
mParent
(
parent
),
mMode
(
mode
),
mMonitor
(
0
),
mReadOnly
(
false
)
{
if
(
editorWidget
)
{
mEditorWidget
=
editorWidget
;
#ifndef DISABLE_EDITOR_WIDGETS
}
else
{
mEditorWidget
=
new
ContactEditorWidget
();
mEditorWidget
=
new
ContactEditorWidget
(
displayMode
==
FullMode
?
ContactEditorWidget
::
FullMode
:
ContactEditorWidget
::
VCardMode
,
0
);
#endif
}
...
...
@@ -201,15 +201,21 @@ void ContactEditor::Private::setupMonitor()
ContactEditor
::
ContactEditor
(
Mode
mode
,
QWidget
*
parent
)
:
QWidget
(
parent
),
d
(
new
Private
(
mode
,
0
,
this
)
)
:
QWidget
(
parent
),
d
(
new
Private
(
mode
,
FullMode
,
0
,
this
)
)
{
}
ContactEditor
::
ContactEditor
(
Mode
mode
,
AbstractContactEditorWidget
*
editorWidget
,
QWidget
*
parent
)
:
QWidget
(
parent
),
d
(
new
Private
(
mode
,
editorWidget
,
this
)
)
:
QWidget
(
parent
),
d
(
new
Private
(
mode
,
FullMode
,
editorWidget
,
this
)
)
{
}
ContactEditor
::
ContactEditor
(
Mode
mode
,
DisplayMode
displayMode
,
QWidget
*
parent
)
:
QWidget
(
parent
),
d
(
new
Private
(
mode
,
displayMode
,
0
,
this
)
)
{
}
ContactEditor
::~
ContactEditor
()
{
delete
d
;
...
...
akonadi/contact/contacteditor.h
View file @
16ec1da9
...
...
@@ -93,6 +93,11 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
EditMode
///< Edits an existing contact
};
enum
DisplayMode
{
FullMode
,
//Show all pages
VCardMode
//Show just pages with elements stored in vcard.
};
/**
* Creates a new contact editor with the standard editor widget.
*
...
...
@@ -110,6 +115,18 @@ class AKONADI_CONTACT_EXPORT ContactEditor : public QWidget
*/
ContactEditor
(
Mode
mode
,
AbstractContactEditorWidget
*
editorWidget
,
QWidget
*
parent
=
0
);
/**
* Creates a new contact editor dialog with a custom editor widget.
*
* @param mode The mode of the dialog.
* @param editorWidget The contact editor widget that shall be used for editing.
* @param parent The parent widget of the dialog.
* @since 4.10
*/
ContactEditor
(
Mode
mode
,
DisplayMode
displayMode
,
QWidget
*
parent
=
0
);
/**
* Destroys the contact editor.
*/
...
...
akonadi/contact/contacteditordialog.cpp
View file @
16ec1da9
...
...
@@ -38,7 +38,7 @@ using namespace Akonadi;
class
ContactEditorDialog
::
Private
{
public:
Private
(
ContactEditorDialog
::
Mode
mode
,
AbstractContactEditorWidget
*
editorWidget
,
Private
(
ContactEditorDialog
::
Mode
mode
,
ContactEditorDialog
::
DisplayMode
displaymode
,
AbstractContactEditorWidget
*
editorWidget
,
ContactEditorDialog
*
parent
)
:
q
(
parent
),
mAddressBookBox
(
0
),
mMode
(
mode
)
{
...
...
@@ -54,7 +54,7 @@ class ContactEditorDialog::Private
if
(
editorWidget
)
{
mEditor
=
new
ContactEditor
(
mode
==
ContactEditorDialog
::
CreateMode
?
ContactEditor
::
CreateMode
:
ContactEditor
::
EditMode
,
editorWidget
,
q
);
}
else
{
mEditor
=
new
ContactEditor
(
mode
==
ContactEditorDialog
::
CreateMode
?
ContactEditor
::
CreateMode
:
ContactEditor
::
EditMode
,
q
);
mEditor
=
new
ContactEditor
(
mode
==
ContactEditorDialog
::
CreateMode
?
ContactEditor
::
CreateMode
:
ContactEditor
::
EditMode
,
displaymode
==
ContactEditorDialog
::
FullMode
?
ContactEditor
::
FullMode
:
ContactEditor
::
VCardMode
,
q
);
}
if
(
mode
==
ContactEditorDialog
::
CreateMode
)
{
...
...
@@ -103,12 +103,17 @@ class ContactEditorDialog::Private
};
ContactEditorDialog
::
ContactEditorDialog
(
Mode
mode
,
QWidget
*
parent
)
:
KDialog
(
parent
),
d
(
new
Private
(
mode
,
0
,
this
)
)
:
KDialog
(
parent
),
d
(
new
Private
(
mode
,
FullMode
,
0
,
this
)
)
{
}
ContactEditorDialog
::
ContactEditorDialog
(
Mode
mode
,
AbstractContactEditorWidget
*
editorWidget
,
QWidget
*
parent
)
:
KDialog
(
parent
),
d
(
new
Private
(
mode
,
editorWidget
,
this
)
)
:
KDialog
(
parent
),
d
(
new
Private
(
mode
,
FullMode
,
editorWidget
,
this
)
)
{
}
ContactEditorDialog
::
ContactEditorDialog
(
Mode
mode
,
DisplayMode
displayMode
,
QWidget
*
parent
)
:
KDialog
(
parent
),
d
(
new
Private
(
mode
,
displayMode
,
0
,
this
)
)
{
}
...
...
akonadi/contact/contacteditordialog.h
View file @
16ec1da9
...
...
@@ -87,6 +87,11 @@ class AKONADI_CONTACT_EXPORT ContactEditorDialog : public KDialog
EditMode
///< Edits an existing contact
};
enum
DisplayMode
{
FullMode
,
//Show all pages
VCardMode
//Show just pages with elements stored in vcard.
};
/**
* Creates a new contact editor dialog with the standard editor widget.
*
...
...
@@ -104,6 +109,16 @@ class AKONADI_CONTACT_EXPORT ContactEditorDialog : public KDialog
*/
ContactEditorDialog
(
Mode
mode
,
AbstractContactEditorWidget
*
editorWidget
,
QWidget
*
parent
=
0
);
/**
* Creates a new contact editor dialog with a custom editor widget.
*
* @param mode The mode of the dialog.
* @param editorWidget The contact editor widget that shall be used for editing.
* @param parent The parent widget of the dialog.
* @since 4.10
*/
ContactEditorDialog
(
Mode
mode
,
DisplayMode
displayMode
,
QWidget
*
parent
=
0
);
/**
* Destroys the contact editor dialog.
*/
...
...
akonadi/contact/editor/contacteditorwidget.cpp
View file @
16ec1da9
...
...
@@ -58,8 +58,8 @@
class
ContactEditorWidget
::
Private
{
public:
Private
(
ContactEditorWidget
*
parent
)
:
m
Parent
(
parent
)
Private
(
ContactEditorWidget
::
DisplayMode
displayMode
,
ContactEditorWidget
*
parent
)
:
m
DisplayMode
(
displayMode
),
mParent
(
parent
),
mCustomFieldsWidget
(
0
)
{
}
...
...
@@ -76,6 +76,7 @@ class ContactEditorWidget::Private
QString
loadCustom
(
const
KABC
::
Addressee
&
contact
,
const
QString
&
key
)
const
;
void
storeCustom
(
KABC
::
Addressee
&
contact
,
const
QString
&
key
,
const
QString
&
value
)
const
;
ContactEditorWidget
::
DisplayMode
mDisplayMode
;
ContactEditorWidget
*
mParent
;
KTabWidget
*
mTabWidget
;
...
...
@@ -150,9 +151,10 @@ void ContactEditorWidget::Private::initGui()
initGuiBusinessTab
();
initGuiPersonalTab
();
initGuiNotesTab
();
initGuiCustomFieldsTab
();
loadCustomPages
();
if
(
mDisplayMode
==
FullMode
)
{
initGuiCustomFieldsTab
();
loadCustomPages
();
}
}
void
ContactEditorWidget
::
Private
::
initGuiContactTab
()
...
...
@@ -519,7 +521,18 @@ void ContactEditorWidget::Private::storeCustom( KABC::Addressee &contact, const
}
ContactEditorWidget
::
ContactEditorWidget
(
QWidget
*
)
:
d
(
new
Private
(
this
)
)
:
d
(
new
Private
(
FullMode
,
this
)
)
{
d
->
initGui
();
connect
(
d
->
mNameWidget
,
SIGNAL
(
nameChanged
(
KABC
::
Addressee
)),
d
->
mDisplayNameWidget
,
SLOT
(
changeName
(
KABC
::
Addressee
))
);
connect
(
d
->
mOrganizationWidget
,
SIGNAL
(
textChanged
(
QString
)),
d
->
mDisplayNameWidget
,
SLOT
(
changeOrganization
(
QString
))
);
}
ContactEditorWidget
::
ContactEditorWidget
(
ContactEditorWidget
::
DisplayMode
displayMode
,
QWidget
*
)
:
d
(
new
Private
(
displayMode
,
this
)
)
{
d
->
initGui
();
...
...
@@ -602,13 +615,15 @@ void ContactEditorWidget::loadContact( const KABC::Addressee &contact, const Ako
d
->
mDisplayNameWidget
->
setDisplayType
(
(
DisplayNameEditWidget
::
DisplayType
)
metaData
.
displayNameMode
()
);
// custom fields group
d
->
mCustomFieldsWidget
->
setLocalCustomFieldDescriptions
(
metaData
.
customFieldDescriptions
()
);
d
->
mCustomFieldsWidget
->
loadContact
(
contact
);
if
(
d
->
mDisplayMode
==
FullMode
)
{
// custom fields group
d
->
mCustomFieldsWidget
->
setLocalCustomFieldDescriptions
(
metaData
.
customFieldDescriptions
()
);
d
->
mCustomFieldsWidget
->
loadContact
(
contact
);
// custom pages
foreach
(
Akonadi
::
ContactEditorPagePlugin
*
plugin
,
d
->
mCustomPages
)
{
plugin
->
loadContact
(
contact
);
// custom pages
foreach
(
Akonadi
::
ContactEditorPagePlugin
*
plugin
,
d
->
mCustomPages
)
{
plugin
->
loadContact
(
contact
);
}
}
}
...
...
@@ -686,15 +701,17 @@ void ContactEditorWidget::storeContact( KABC::Addressee &contact, Akonadi::Conta
// family group
d
->
storeCustom
(
contact
,
QLatin1String
(
"X-SpousesName"
),
d
->
mPartnerWidget
->
text
().
trimmed
()
);
// custom fields group
d
->
mCustomFieldsWidget
->
storeContact
(
contact
);
metaData
.
setCustomFieldDescriptions
(
d
->
mCustomFieldsWidget
->
localCustomFieldDescriptions
()
);
if
(
d
->
mDisplayMode
==
FullMode
)
{
// custom fields group
d
->
mCustomFieldsWidget
->
storeContact
(
contact
);
metaData
.
setCustomFieldDescriptions
(
d
->
mCustomFieldsWidget
->
localCustomFieldDescriptions
()
);
metaData
.
setDisplayNameMode
(
d
->
mDisplayNameWidget
->
displayType
()
);
metaData
.
setDisplayNameMode
(
d
->
mDisplayNameWidget
->
displayType
()
);
// custom pages
foreach
(
Akonadi
::
ContactEditorPagePlugin
*
plugin
,
d
->
mCustomPages
)
{
plugin
->
storeContact
(
contact
);
// custom pages
foreach
(
Akonadi
::
ContactEditorPagePlugin
*
plugin
,
d
->
mCustomPages
)
{
plugin
->
storeContact
(
contact
);
}
}
}
...
...
@@ -752,11 +769,13 @@ void ContactEditorWidget::setReadOnly( bool readOnly )
// widgets from family group
d
->
mPartnerWidget
->
setReadOnly
(
readOnly
);
// widgets from custom fields group
d
->
mCustomFieldsWidget
->
setReadOnly
(
readOnly
);
if
(
d
->
mDisplayMode
==
FullMode
)
{
// widgets from custom fields group
d
->
mCustomFieldsWidget
->
setReadOnly
(
readOnly
);
// custom pages
foreach
(
Akonadi
::
ContactEditorPagePlugin
*
plugin
,
d
->
mCustomPages
)
{
plugin
->
setReadOnly
(
readOnly
);
// custom pages
foreach
(
Akonadi
::
ContactEditorPagePlugin
*
plugin
,
d
->
mCustomPages
)
{
plugin
->
setReadOnly
(
readOnly
);
}
}
}
akonadi/contact/editor/contacteditorwidget.h
View file @
16ec1da9
...
...
@@ -42,7 +42,13 @@ class ContactEditorWidget : public Akonadi::AbstractContactEditorWidget
*
* @param parent The parent widget.
*/
ContactEditorWidget
(
QWidget
*
parent
=
0
);
enum
DisplayMode
{
FullMode
,
//Show all pages
VCardMode
//Show just pages with elements stored in vcard.
};
explicit
ContactEditorWidget
(
QWidget
*
parent
=
0
);
ContactEditorWidget
(
DisplayMode
displayMode
,
QWidget
*
parent
);
/**
* Destroys the contact editor widget.
...
...
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