Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
Akonadi Contacts
Commits
a8059a80
Commit
a8059a80
authored
Feb 20, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract default selectionmodel
parent
4b7d90fa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
19 deletions
+114
-19
CMakeLists.txt
CMakeLists.txt
+1
-1
src/CMakeLists.txt
src/CMakeLists.txt
+2
-0
src/emailaddressselectionmodel.cpp
src/emailaddressselectionmodel.cpp
+63
-0
src/emailaddressselectionmodel.h
src/emailaddressselectionmodel.h
+45
-0
src/emailaddressselectionwidget.cpp
src/emailaddressselectionwidget.cpp
+3
-18
No files found.
CMakeLists.txt
View file @
a8059a80
cmake_minimum_required
(
VERSION 3.0
)
set
(
PIM_VERSION
"5.4.4
0
"
)
set
(
PIM_VERSION
"5.4.4
1
"
)
project
(
Akonadi-Contact VERSION
${
PIM_VERSION
}
)
...
...
src/CMakeLists.txt
View file @
a8059a80
...
...
@@ -161,6 +161,7 @@ set(akonadicontact_LIB_SRC
emailaddressselectionproxymodel.cpp
emailaddressselectionwidget.cpp
emailaddressrequester.cpp
emailaddressselectionmodel.cpp
textbrowser.cpp
leafextensionproxymodel.cpp
standardcontactactionmanager.cpp
...
...
@@ -277,6 +278,7 @@ ecm_generate_headers(AkonadiContact_CamelCase_HEADERS
EmailAddressSelection
EmailAddressSelectionDialog
EmailAddressSelectionWidget
EmailAddressSelectionModel
EmailAddressRequester
StandardContactActionManager
StandardContactFormatter
...
...
src/emailaddressselectionmodel.cpp
0 → 100644
View file @
a8059a80
/*
This file is part of Akonadi Contact.
Copyright (C) 2017 Laurent Montel <laurent.montel@kdab.com>
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 "emailaddressselectionmodel.h"
#include <AkonadiCore/Session>
#include <AkonadiCore/ItemFetchScope>
#include <AkonadiCore/EntityDisplayAttribute>
#include <AkonadiCore/ChangeRecorder>
#include <Akonadi/Contact/ContactsTreeModel>
#include <KContacts/Addressee>
#include <KContacts/ContactGroup>
using
namespace
Akonadi
;
EmailAddressSelectionModel
::
EmailAddressSelectionModel
(
QObject
*
parent
)
:
QObject
(
parent
)
{
Akonadi
::
Session
*
session
=
new
Akonadi
::
Session
(
"InternalEmailAddressSelectionWidgetModel"
,
this
);
Akonadi
::
ItemFetchScope
scope
;
scope
.
fetchFullPayload
(
true
);
scope
.
fetchAttribute
<
Akonadi
::
EntityDisplayAttribute
>
();
Akonadi
::
ChangeRecorder
*
changeRecorder
=
new
Akonadi
::
ChangeRecorder
(
this
);
changeRecorder
->
setSession
(
session
);
changeRecorder
->
fetchCollection
(
true
);
changeRecorder
->
setItemFetchScope
(
scope
);
changeRecorder
->
setCollectionMonitored
(
Akonadi
::
Collection
::
root
());
changeRecorder
->
setMimeTypeMonitored
(
KContacts
::
Addressee
::
mimeType
(),
true
);
changeRecorder
->
setMimeTypeMonitored
(
KContacts
::
ContactGroup
::
mimeType
(),
true
);
mModel
=
new
Akonadi
::
ContactsTreeModel
(
changeRecorder
,
this
);
}
EmailAddressSelectionModel
::~
EmailAddressSelectionModel
()
{
}
Akonadi
::
ContactsTreeModel
*
EmailAddressSelectionModel
::
model
()
const
{
return
mModel
;
}
src/emailaddressselectionmodel.h
0 → 100644
View file @
a8059a80
/*
This file is part of Akonadi Contact.
Copyright (C) 2017 Laurent Montel <laurent.montel@kdab.com>
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 EMAILADDRESSSELECTIONMODEL_H
#define EMAILADDRESSSELECTIONMODEL_H
#include <QObject>
#include "akonadi-contact_export.h"
namespace
Akonadi
{
class
ContactsTreeModel
;
class
AKONADI_CONTACT_EXPORT
EmailAddressSelectionModel
:
public
QObject
{
Q_OBJECT
public:
explicit
EmailAddressSelectionModel
(
QObject
*
parent
=
nullptr
);
~
EmailAddressSelectionModel
();
Akonadi
::
ContactsTreeModel
*
model
()
const
;
private:
Akonadi
::
ContactsTreeModel
*
mModel
;
};
}
#endif // EMAILADDRESSSELECTIONMODEL_H
src/emailaddressselectionwidget.cpp
View file @
a8059a80
...
...
@@ -23,6 +23,7 @@
#include "emailaddressselectionwidget.h"
#include "emailaddressselection_p.h"
#include "emailaddressselectionmodel.h"
#include "emailaddressselectionproxymodel_p.h"
#include <changerecorder.h>
...
...
@@ -104,24 +105,8 @@ void EmailAddressSelectionWidget::Private::init()
{
// setup internal model if needed
if
(
!
mModel
)
{
Akonadi
::
Session
*
session
=
new
Akonadi
::
Session
(
"InternalEmailAddressSelectionWidgetModel"
,
q
);
Akonadi
::
ItemFetchScope
scope
;
scope
.
fetchFullPayload
(
true
);
scope
.
fetchAttribute
<
Akonadi
::
EntityDisplayAttribute
>
();
Akonadi
::
ChangeRecorder
*
changeRecorder
=
new
Akonadi
::
ChangeRecorder
(
q
);
changeRecorder
->
setSession
(
session
);
changeRecorder
->
fetchCollection
(
true
);
changeRecorder
->
setItemFetchScope
(
scope
);
changeRecorder
->
setCollectionMonitored
(
Akonadi
::
Collection
::
root
());
changeRecorder
->
setMimeTypeMonitored
(
KContacts
::
Addressee
::
mimeType
(),
true
);
changeRecorder
->
setMimeTypeMonitored
(
KContacts
::
ContactGroup
::
mimeType
(),
true
);
Akonadi
::
ContactsTreeModel
*
model
=
new
Akonadi
::
ContactsTreeModel
(
changeRecorder
,
q
);
// model->setCollectionFetchStrategy( Akonadi::ContactsTreeModel::InvisibleFetch );
mModel
=
model
;
Akonadi
::
EmailAddressSelectionModel
*
model
=
new
Akonadi
::
EmailAddressSelectionModel
(
q
);
mModel
=
model
->
model
();
}
// setup ui
...
...
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