Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
3fedf9f7
Commit
3fedf9f7
authored
9 years ago
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
contact: Add CategorizedContactModel singleton
Refs #70196
parent
4a6c3961
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/categorizedcontactmodel.cpp
+12
-1
12 additions, 1 deletion
src/categorizedcontactmodel.cpp
src/categorizedcontactmodel.h
+3
-0
3 additions, 0 deletions
src/categorizedcontactmodel.h
with
15 additions
and
1 deletion
src/categorizedcontactmodel.cpp
+
12
−
1
View file @
3fedf9f7
...
...
@@ -71,7 +71,6 @@ public:
void
slotContactMethodCountChanged
(
int
,
int
);
void
slotContactMethodCountAboutToChange
(
int
,
int
);
};
class
CategorizedContactModelPrivate
:
public
QObject
{
Q_OBJECT
...
...
@@ -94,6 +93,9 @@ public:
ContactTreeNode
*
getContactTopLevelItem
(
const
QString
&
category
);
QModelIndex
getIndex
(
int
row
,
int
column
,
ContactTreeNode
*
parent
);
//Singleton
static
CategorizedContactModel
*
m_spInstance
;
private:
CategorizedContactModel
*
q_ptr
;
...
...
@@ -102,6 +104,8 @@ public Q_SLOTS:
void
slotContactAdded
(
const
Person
*
c
);
};
CategorizedContactModel
*
CategorizedContactModelPrivate
::
m_spInstance
=
nullptr
;
ContactTreeNode
::
ContactTreeNode
(
const
Person
*
ct
,
CategorizedContactModel
*
parent
)
:
CategorizedCompositeNode
(
CategorizedCompositeNode
::
Type
::
CONTACT
),
m_pContact
(
ct
),
m_Index
(
-
1
),
m_pContactMethod
(
nullptr
),
m_Type
(
ContactTreeNode
::
NodeType
::
PERSON
),
m_pParent
(
nullptr
),
m_pModel
(
parent
)
{
...
...
@@ -204,6 +208,13 @@ CategorizedContactModel::~CategorizedContactModel()
}
}
CategorizedContactModel
*
CategorizedContactModel
::
instance
()
{
if
(
!
CategorizedContactModelPrivate
::
m_spInstance
)
CategorizedContactModelPrivate
::
m_spInstance
=
new
CategorizedContactModel
();
return
CategorizedContactModelPrivate
::
m_spInstance
;
}
QHash
<
int
,
QByteArray
>
CategorizedContactModel
::
roleNames
()
const
{
static
QHash
<
int
,
QByteArray
>
roles
=
QAbstractItemModel
::
roleNames
();
...
...
This diff is collapsed.
Click to expand it.
src/categorizedcontactmodel.h
+
3
−
0
View file @
3fedf9f7
...
...
@@ -68,6 +68,9 @@ public:
bool
isSortAlphabetical
()
const
;
QString
defaultCategory
()
const
;
//Singleton
static
CategorizedContactModel
*
instance
();
private:
QScopedPointer
<
CategorizedContactModelPrivate
>
d_ptr
;
Q_DECLARE_PRIVATE
(
CategorizedContactModel
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment