Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KAddressBook
Commits
13827680
Commit
13827680
authored
Sep 28, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Astylekdelibs
parent
1801d658
Changes
123
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
123 changed files
with
4484 additions
and
4552 deletions
+4484
-4552
aboutdata.cpp
aboutdata.cpp
+5
-5
autotests/contactfieldstest.cpp
autotests/contactfieldstest.cpp
+150
-150
categoryfilterproxymodel.cpp
categoryfilterproxymodel.cpp
+20
-23
categoryfilterproxymodel.h
categoryfilterproxymodel.h
+2
-3
categoryselectwidget.cpp
categoryselectwidget.cpp
+25
-41
categoryselectwidget.h
categoryselectwidget.h
+6
-7
contactfields.cpp
contactfields.cpp
+262
-303
contactfields.h
contactfields.h
+3
-3
contactselectiondialog.cpp
contactselectiondialog.cpp
+11
-12
contactselectiondialog.h
contactselectiondialog.h
+3
-3
contactselectionwidget.cpp
contactselectionwidget.cpp
+106
-108
contactselectionwidget.h
contactselectionwidget.h
+5
-4
contactsorter.cpp
contactsorter.cpp
+24
-24
contactsorter.h
contactsorter.h
+3
-3
contactswitcher.cpp
contactswitcher.cpp
+37
-37
contactswitcher.h
contactswitcher.h
+2
-2
globalcontactmodel.cpp
globalcontactmodel.cpp
+9
-10
globalcontactmodel.h
globalcontactmodel.h
+2
-1
kaddressbook_options.h
kaddressbook_options.h
+6
-6
kaddressbookpart.cpp
kaddressbookpart.cpp
+26
-26
kaddressbookpart.h
kaddressbookpart.h
+2
-2
main.cpp
main.cpp
+4
-4
mainwidget.cpp
mainwidget.cpp
+610
-609
mainwidget.h
mainwidget.h
+14
-11
mainwindow.cpp
mainwindow.cpp
+19
-19
merge/autotests/mergecontactduplicatecontactdialogtest.cpp
merge/autotests/mergecontactduplicatecontactdialogtest.cpp
+0
-1
merge/autotests/mergecontactduplicatecontactdialogtest.h
merge/autotests/mergecontactduplicatecontactdialogtest.h
+0
-1
merge/autotests/mergecontactinfowidgettest.cpp
merge/autotests/mergecontactinfowidgettest.cpp
+1
-2
merge/autotests/mergecontactinfowidgettest.h
merge/autotests/mergecontactinfowidgettest.h
+0
-1
merge/autotests/mergecontactselectinformationdialogtest.cpp
merge/autotests/mergecontactselectinformationdialogtest.cpp
+1
-2
merge/autotests/mergecontactshowresultdialogtest.cpp
merge/autotests/mergecontactshowresultdialogtest.cpp
+4
-4
merge/autotests/mergecontacttest.cpp
merge/autotests/mergecontacttest.cpp
+4
-6
merge/autotests/mergecontacttest.h
merge/autotests/mergecontacttest.h
+0
-1
merge/autotests/mergecontactwidgettest.cpp
merge/autotests/mergecontactwidgettest.cpp
+4
-5
merge/autotests/mergecontactwidgettest.h
merge/autotests/mergecontactwidgettest.h
+0
-1
merge/autotests/searchpotentialduplicatecontactjobtest.cpp
merge/autotests/searchpotentialduplicatecontactjobtest.cpp
+2
-2
merge/mergecontactduplicatecontactdialog.cpp
merge/mergecontactduplicatecontactdialog.cpp
+8
-12
merge/mergecontactduplicatecontactdialog.h
merge/mergecontactduplicatecontactdialog.h
+3
-2
merge/mergecontactinfowidget.cpp
merge/mergecontactinfowidget.cpp
+0
-2
merge/mergecontactinfowidget.h
merge/mergecontactinfowidget.h
+5
-3
merge/mergecontacts.cpp
merge/mergecontacts.cpp
+4
-2
merge/mergecontacts.h
merge/mergecontacts.h
+2
-1
merge/mergecontactsdialog.cpp
merge/mergecontactsdialog.cpp
+8
-9
merge/mergecontactsdialog.h
merge/mergecontactsdialog.h
+3
-3
merge/mergecontactselectinformationdialog.cpp
merge/mergecontactselectinformationdialog.cpp
+1
-2
merge/mergecontactselectinformationdialog.h
merge/mergecontactselectinformationdialog.h
+3
-3
merge/mergecontactshowresultdialog.cpp
merge/mergecontactshowresultdialog.cpp
+7
-9
merge/mergecontactshowresultdialog.h
merge/mergecontactshowresultdialog.h
+2
-2
merge/mergecontactshowresulttabwidget.cpp
merge/mergecontactshowresulttabwidget.cpp
+2
-3
merge/mergecontactshowresulttabwidget.h
merge/mergecontactshowresulttabwidget.h
+3
-3
merge/mergecontactsjob.cpp
merge/mergecontactsjob.cpp
+4
-4
merge/mergecontactsjob.h
merge/mergecontactsjob.h
+3
-2
merge/mergecontactutil.h
merge/mergecontactutil.h
+2
-2
merge/mergecontactwidget.cpp
merge/mergecontactwidget.cpp
+4
-4
merge/mergecontactwidget.h
merge/mergecontactwidget.h
+5
-3
merge/mergecontactwidgetlist.cpp
merge/mergecontactwidgetlist.cpp
+14
-16
merge/mergecontactwidgetlist.h
merge/mergecontactwidgetlist.h
+3
-3
merge/searchpotentialduplicatecontactjob.cpp
merge/searchpotentialduplicatecontactjob.cpp
+2
-3
merge/searchpotentialduplicatecontactjob.h
merge/searchpotentialduplicatecontactjob.h
+3
-3
modelcolumnmanager.cpp
modelcolumnmanager.cpp
+73
-73
modelcolumnmanager.h
modelcolumnmanager.h
+3
-3
printing/compact/compactstyle.cpp
printing/compact/compactstyle.cpp
+60
-59
printing/compact/compactstyle.h
printing/compact/compactstyle.h
+6
-5
printing/detailled/detailledstyle.cpp
printing/detailled/detailledstyle.cpp
+90
-92
printing/detailled/detailledstyle.h
printing/detailled/detailledstyle.h
+5
-4
printing/grantlee/contactgrantleeprintaddressobject.cpp
printing/grantlee/contactgrantleeprintaddressobject.cpp
+1
-1
printing/grantlee/contactgrantleeprintaddressobject.h
printing/grantlee/contactgrantleeprintaddressobject.h
+3
-2
printing/grantlee/contactgrantleeprintcryptoobject.cpp
printing/grantlee/contactgrantleeprintcryptoobject.cpp
+4
-4
printing/grantlee/contactgrantleeprintcryptoobject.h
printing/grantlee/contactgrantleeprintcryptoobject.h
+3
-2
printing/grantlee/contactgrantleeprintgeoobject.cpp
printing/grantlee/contactgrantleeprintgeoobject.cpp
+4
-5
printing/grantlee/contactgrantleeprintgeoobject.h
printing/grantlee/contactgrantleeprintgeoobject.h
+3
-4
printing/grantlee/contactgrantleeprintimobject.h
printing/grantlee/contactgrantleeprintimobject.h
+3
-2
printing/grantlee/contactgrantleeprintobject.cpp
printing/grantlee/contactgrantleeprintobject.cpp
+38
-39
printing/grantlee/contactgrantleeprintobject.h
printing/grantlee/contactgrantleeprintobject.h
+9
-9
printing/grantlee/contactgrantleeprintphoneobject.h
printing/grantlee/contactgrantleeprintphoneobject.h
+3
-2
printing/grantlee/grantleeprintstyle.cpp
printing/grantlee/grantleeprintstyle.cpp
+48
-48
printing/grantlee/grantleeprintstyle.h
printing/grantlee/grantleeprintstyle.h
+8
-6
printing/mike/mikesstyle.cpp
printing/mike/mikesstyle.cpp
+35
-35
printing/mike/mikesstyle.h
printing/mike/mikesstyle.h
+5
-5
printing/printingwizard.cpp
printing/printingwizard.cpp
+83
-83
printing/printingwizard.h
printing/printingwizard.h
+10
-8
printing/printprogress.cpp
printing/printprogress.cpp
+21
-21
printing/printprogress.h
printing/printprogress.h
+5
-4
printing/printstyle.cpp
printing/printstyle.cpp
+25
-25
printing/printstyle.h
printing/printstyle.h
+12
-11
printing/ringbinder/ringbinderstyle.cpp
printing/ringbinder/ringbinderstyle.cpp
+139
-138
printing/ringbinder/ringbinderstyle.h
printing/ringbinder/ringbinderstyle.h
+5
-5
printing/stylepage.cpp
printing/stylepage.cpp
+80
-80
printing/stylepage.h
printing/stylepage.h
+7
-7
quicksearchwidget.cpp
quicksearchwidget.cpp
+40
-40
quicksearchwidget.h
quicksearchwidget.h
+8
-8
sendmail/autotests/mailsenderjobtest.cpp
sendmail/autotests/mailsenderjobtest.cpp
+17
-17
sendmail/mailsenderjob.cpp
sendmail/mailsenderjob.cpp
+12
-12
sendmail/mailsenderjob.h
sendmail/mailsenderjob.h
+4
-3
utils.cpp
utils.cpp
+15
-16
utils.h
utils.h
+2
-2
xxport/csv/csv_xxport.cpp
xxport/csv/csv_xxport.cpp
+40
-40
xxport/csv/csv_xxport.h
xxport/csv/csv_xxport.h
+3
-3
xxport/csv/csvimportdialog.cpp
xxport/csv/csvimportdialog.cpp
+540
-540
xxport/csv/csvimportdialog.h
xxport/csv/csvimportdialog.h
+11
-11
xxport/csv/dateparser.cpp
xxport/csv/dateparser.cpp
+42
-42
xxport/csv/dateparser.h
xxport/csv/dateparser.h
+2
-2
xxport/csv/qcsvmodel.cpp
xxport/csv/qcsvmodel.cpp
+81
-81
xxport/csv/qcsvmodel.h
xxport/csv/qcsvmodel.h
+15
-15
xxport/csv/qcsvmodel_p.h
xxport/csv/qcsvmodel_p.h
+15
-14
xxport/csv/qcsvreader.cpp
xxport/csv/qcsvreader.cpp
+112
-112
xxport/csv/qcsvreader.h
xxport/csv/qcsvreader.h
+15
-15
xxport/csv/templateselectiondialog.cpp
xxport/csv/templateselectiondialog.cpp
+138
-138
xxport/csv/templateselectiondialog.h
xxport/csv/templateselectiondialog.h
+1
-1
xxport/gmx/gmx_xxport.cpp
xxport/gmx/gmx_xxport.cpp
+494
-491
xxport/gmx/gmx_xxport.h
xxport/gmx/gmx_xxport.h
+3
-3
xxport/ldap/ldap_xxport.cpp
xxport/ldap/ldap_xxport.cpp
+5
-5
xxport/ldap/ldap_xxport.h
xxport/ldap/ldap_xxport.h
+2
-2
xxport/ldif/ldif_xxport.cpp
xxport/ldif/ldif_xxport.cpp
+32
-32
xxport/ldif/ldif_xxport.h
xxport/ldif/ldif_xxport.h
+2
-2
xxport/shared/xxport.cpp
xxport/shared/xxport.cpp
+13
-13
xxport/shared/xxport.h
xxport/shared/xxport.h
+5
-5
xxport/vcard/vcard_xxport.cpp
xxport/vcard/vcard_xxport.cpp
+468
-473
xxport/vcard/vcard_xxport.h
xxport/vcard/vcard_xxport.h
+6
-6
xxport/xxportfactory.cpp
xxport/xxportfactory.cpp
+17
-17
xxport/xxportfactory.h
xxport/xxportfactory.h
+1
-1
xxportmanager.cpp
xxportmanager.cpp
+60
-60
xxportmanager.h
xxportmanager.h
+9
-10
No files found.
aboutdata.cpp
View file @
13827680
...
...
@@ -25,13 +25,13 @@
#include <KLocalizedString>
AboutData
::
AboutData
()
:
K4AboutData
(
"kaddressbook"
,
0
,
ki18n
(
"KAddressBook"
),
KDEPIM_VERSION
,
ki18n
(
"The KDE Address Book Application"
),
:
K4AboutData
(
"kaddressbook"
,
0
,
ki18n
(
"KAddressBook"
),
KDEPIM_VERSION
,
ki18n
(
"The KDE Address Book Application"
),
K4AboutData
::
License_GPL_V2
,
ki18n
(
"Copyright © 2007–2014 KAddressBook authors"
)
)
ki18n
(
"Copyright © 2007–2014 KAddressBook authors"
)
)
{
addAuthor
(
ki18n
(
"Laurent Montel"
),
ki18n
(
"Current maintainer"
),
"montel@kde.org"
);
addAuthor
(
ki18n
(
"Tobias Koenig"
),
ki18n
(
"Previous maintainer"
),
"tokoe@kde.org"
);
addAuthor
(
ki18n
(
"Laurent Montel"
),
ki18n
(
"Current maintainer"
),
"montel@kde.org"
);
addAuthor
(
ki18n
(
"Tobias Koenig"
),
ki18n
(
"Previous maintainer"
),
"tokoe@kde.org"
);
}
AboutData
::~
AboutData
()
...
...
autotests/contactfieldstest.cpp
View file @
13827680
This diff is collapsed.
Click to expand it.
categoryfilterproxymodel.cpp
View file @
13827680
...
...
@@ -32,7 +32,6 @@
using
namespace
Akonadi
;
class
CategoryFilterProxyModelPrivate
:
public
QObject
{
Q_OBJECT
...
...
@@ -48,7 +47,6 @@ private:
CategoryFilterProxyModel
*
q_ptr
;
};
CategoryFilterProxyModelPrivate
::
CategoryFilterProxyModelPrivate
(
CategoryFilterProxyModel
*
parent
)
:
QObject
(),
filterEnabled
(
false
),
...
...
@@ -56,7 +54,6 @@ CategoryFilterProxyModelPrivate::CategoryFilterProxyModelPrivate(CategoryFilterP
{
}
CategoryFilterProxyModel
::
CategoryFilterProxyModel
(
QObject
*
parent
)
:
QSortFilterProxyModel
(
parent
),
d_ptr
(
new
CategoryFilterProxyModelPrivate
(
this
))
...
...
@@ -64,13 +61,11 @@ CategoryFilterProxyModel::CategoryFilterProxyModel(QObject *parent)
setDynamicSortFilter
(
true
);
}
CategoryFilterProxyModel
::~
CategoryFilterProxyModel
()
{
delete
d_ptr
;
}
bool
CategoryFilterProxyModel
::
filterAcceptsRow
(
int
row
,
const
QModelIndex
&
parent
)
const
{
Q_D
(
const
CategoryFilterProxyModel
);
...
...
@@ -78,10 +73,16 @@ bool CategoryFilterProxyModel::filterAcceptsRow(int row, const QModelIndex &pare
const
QModelIndex
index
=
sourceModel
()
->
index
(
row
,
0
,
parent
);
const
Akonadi
::
Item
item
=
index
.
data
(
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
!
d
->
filterEnabled
)
return
true
;
// filter not enabled
if
(
d
->
filterIdList
.
isEmpty
())
return
false
;
// nothing accepted
// all accepted
if
(
d
->
filterIdList
.
first
()
==
CategorySelectWidget
::
FilterAll
)
return
true
;
if
(
!
d
->
filterEnabled
)
{
return
true
;
// filter not enabled
}
if
(
d
->
filterIdList
.
isEmpty
())
{
return
false
;
// nothing accepted
}
// all accepted
if
(
d
->
filterIdList
.
first
()
==
CategorySelectWidget
::
FilterAll
)
{
return
true
;
}
//qDebug() << "for row" << row << "item" << item.url() << "filter" << d->filterIdList;
if
(
item
.
hasPayload
<
KABC
::
Addressee
>
())
{
...
...
@@ -92,59 +93,55 @@ bool CategoryFilterProxyModel::filterAcceptsRow(int row, const QModelIndex &pare
int
validCategories
=
0
;
int
count
=
categories
.
count
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
const
QString
cat
=
categories
.
at
(
i
);
if
(
cat
.
startsWith
(
QLatin1String
(
"akonadi:"
)))
{
const
int
idx
=
cat
.
indexOf
(
QLatin1String
(
"?tag="
));
if
(
idx
>=
0
)
{
if
(
idx
>=
0
)
{
++
validCategories
;
Tag
::
Id
id
=
cat
.
mid
(
idx
+
5
).
toInt
();
Tag
::
Id
id
=
cat
.
mid
(
idx
+
5
).
toInt
();
if
(
d
->
filterIdList
.
contains
(
id
))
{
//qDebug() << "matches category" << cat;
return
true
;
// a category matches filter
return
true
;
// a category matches filter
}
}
}
}
if
(
validCategories
>
0
)
{
if
(
validCategories
>
0
)
{
//qDebug() << "valid item but no match";
return
false
;
// categorised but no match
return
false
;
// categorised but no match
}
else
{
//qDebug() << "item with no categories";
return
d
->
filterIdList
.
contains
(
CategorySelectWidget
::
FilterUntagged
);
}
}
else
if
(
item
.
hasPayload
<
KABC
::
ContactGroup
>
())
{
// a contact group item
}
else
if
(
item
.
hasPayload
<
KABC
::
ContactGroup
>
())
{
// a contact group item
return
d
->
filterIdList
.
contains
(
CategorySelectWidget
::
FilterGroups
);
}
return
true
;
// not a recognised item
return
true
;
// not a recognised item
}
void
CategoryFilterProxyModel
::
setFilterCategories
(
const
QList
<
Akonadi
::
Tag
::
Id
>
&
idList
)
{
Q_D
(
CategoryFilterProxyModel
);
if
(
idList
!=
d
->
filterIdList
)
{
if
(
idList
!=
d
->
filterIdList
)
{
//qDebug() << idList;
d
->
filterIdList
=
idList
;
invalidateFilter
();
}
}
void
CategoryFilterProxyModel
::
setFilterEnabled
(
bool
enable
)
{
Q_D
(
CategoryFilterProxyModel
);
if
(
enable
!=
d
->
filterEnabled
)
{
if
(
enable
!=
d
->
filterEnabled
)
{
//qDebug() << enable;
d
->
filterEnabled
=
enable
;
invalidateFilter
();
}
}
#include "categoryfilterproxymodel.moc"
categoryfilterproxymodel.h
View file @
13827680
...
...
@@ -26,7 +26,6 @@
class
CategoryFilterProxyModelPrivate
;
/**
* @short A proxy model to filter contacts by categories (tags).
*
...
...
@@ -80,7 +79,7 @@ protected:
virtual
bool
filterAcceptsRow
(
int
row
,
const
QModelIndex
&
parent
)
const
;
private:
CategoryFilterProxyModelPrivate
*
const
d_ptr
;
CategoryFilterProxyModelPrivate
*
const
d_ptr
;
};
#endif
// CATEGORYFILTERPROXYMODEL_H
#endif
// CATEGORYFILTERPROXYMODEL_H
categoryselectwidget.cpp
View file @
13827680
...
...
@@ -33,9 +33,7 @@
using
namespace
Akonadi
;
static
const
int
FILTER_ROLE
=
Qt
::
UserRole
+
1
;
static
const
int
FILTER_ROLE
=
Qt
::
UserRole
+
1
;
class
CategorySelectWidgetPrivate
:
public
QObject
{
...
...
@@ -70,7 +68,6 @@ private:
CategorySelectWidget
*
q_ptr
;
};
CategorySelectWidgetPrivate
::
CategorySelectWidgetPrivate
(
CategorySelectWidget
*
parent
)
:
QObject
(),
tagModel
(
0
),
...
...
@@ -81,7 +78,6 @@ CategorySelectWidgetPrivate::CategorySelectWidgetPrivate(CategorySelectWidget *p
{
}
void
CategorySelectWidgetPrivate
::
init
()
{
Q_Q
(
CategorySelectWidget
);
...
...
@@ -141,26 +137,23 @@ void CategorySelectWidgetPrivate::init()
rowOffset
=
itemModel
()
->
rowCount
();
}
QStandardItemModel
*
CategorySelectWidgetPrivate
::
itemModel
()
const
{
QStandardItemModel
*
m
=
qobject_cast
<
QStandardItemModel
*>
(
checkCombo
->
model
());
Q_ASSERT
(
m
!=
NULL
);
Q_ASSERT
(
m
!=
NULL
);
return
m
;
}
void
CategorySelectWidgetPrivate
::
slotTagsRemoved
(
const
QModelIndex
&
parent
,
int
start
,
int
end
)
{
itemModel
()
->
removeRows
(
start
+
rowOffset
,
end
+
rowOffset
,
parent
);
itemModel
()
->
removeRows
(
start
+
rowOffset
,
end
+
rowOffset
,
parent
);
}
void
CategorySelectWidgetPrivate
::
slotTagsChanged
(
const
QModelIndex
&
topLeft
,
const
QModelIndex
&
bottomRight
)
{
for
(
int
row
=
topLeft
.
row
();
row
<=
bottomRight
.
row
();
++
row
)
{
QStandardItem
*
it
=
itemModel
()
->
item
(
row
+
rowOffset
);
Q_ASSERT
(
it
!=
NULL
);
for
(
int
row
=
topLeft
.
row
();
row
<=
bottomRight
.
row
();
++
row
)
{
QStandardItem
*
it
=
itemModel
()
->
item
(
row
+
rowOffset
);
Q_ASSERT
(
it
!=
NULL
);
QModelIndex
idx
=
tagModel
->
index
(
row
,
0
);
it
->
setText
(
tagModel
->
data
(
idx
,
TagModel
::
NameRole
).
toString
());
...
...
@@ -169,16 +162,15 @@ void CategorySelectWidgetPrivate::slotTagsChanged(const QModelIndex &topLeft, co
}
}
void
CategorySelectWidgetPrivate
::
slotTagsInserted
(
const
QModelIndex
&
parent
,
int
start
,
int
end
)
{
for
(
int
row
=
start
;
row
<=
end
;
++
row
)
{
for
(
int
row
=
start
;
row
<=
end
;
++
row
)
{
QModelIndex
idx
=
tagModel
->
index
(
row
,
0
,
parent
);
#if 0
qDebug() << "idx" << idx << "=" << tagModel->data(idx, Qt::DisplayRole).toString()
<< "name" << tagModel->data(idx, TagModel::NameRole).toString()
<< "tag" << tagModel->data(idx, TagModel::TagRole)
<< "id" << tagModel->data(idx, TagModel::IdRole).toInt();
<< "name" << tagModel->data(idx, TagModel::NameRole).toString()
<< "tag" << tagModel->data(idx, TagModel::TagRole)
<< "id" << tagModel->data(idx, TagModel::IdRole).toInt();
#endif
QStandardItem
*
it
=
new
QStandardItem
(
tagModel
->
data
(
idx
,
TagModel
::
NameRole
).
toString
());
it
->
setIcon
(
tagModel
->
data
(
idx
,
Qt
::
DecorationRole
).
value
<
QIcon
>
());
...
...
@@ -190,61 +182,56 @@ void CategorySelectWidgetPrivate::slotTagsInserted(const QModelIndex &parent, in
// tags, as is required in Akonadi::TagModel.
//
// FIXME: not tested (no way to create hierarchial tags at present)
if
(
parent
!=
QModelIndex
())
{
if
(
parent
!=
QModelIndex
())
{
const
Tag
::
Id
parentId
=
tagModel
->
data
(
idx
,
TagModel
::
IdRole
).
value
<
Tag
::
Id
>
();
QModelIndexList
matchList
=
itemModel
()
->
match
(
itemModel
()
->
index
(
0
,
0
),
FILTER_ROLE
,
parentId
,
1
,
Qt
::
MatchExactly
|
Qt
::
MatchRecursive
);
if
(
matchList
.
count
()
==
1
)
{
// found the parent tag
parentId
,
1
,
Qt
::
MatchExactly
|
Qt
::
MatchRecursive
);
if
(
matchList
.
count
()
==
1
)
{
// found the parent tag
QModelIndex
parentIndex
=
matchList
.
first
();
itemModel
()
->
itemFromIndex
(
parentIndex
)
->
appendRow
(
it
);
}
else
{
qWarning
()
<<
"Cannot find parent with ID"
<<
parentId
;
itemModel
()
->
insertRow
(
row
+
rowOffset
,
it
);
itemModel
()
->
insertRow
(
row
+
rowOffset
,
it
);
}
}
else
{
itemModel
()
->
insertRow
(
row
+
rowOffset
,
it
);
itemModel
()
->
insertRow
(
row
+
rowOffset
,
it
);
}
}
}
void
CategorySelectWidgetPrivate
::
selectAll
(
Qt
::
CheckState
state
)
const
{
for
(
int
row
=
0
;
row
<
itemModel
()
->
rowCount
();
++
row
)
{
for
(
int
row
=
0
;
row
<
itemModel
()
->
rowCount
();
++
row
)
{
QStandardItem
*
it
=
itemModel
()
->
item
(
row
);
it
->
setCheckState
(
state
);
}
}
void
CategorySelectWidgetPrivate
::
slotSelectAll
()
{
selectAll
(
Qt
::
Checked
);
}
void
CategorySelectWidgetPrivate
::
slotSelectNone
()
{
selectAll
(
Qt
::
Unchecked
);
}
void
CategorySelectWidgetPrivate
::
slotCheckedItemsChanged
()
{
updateTimer
->
start
();
}
void
CategorySelectWidgetPrivate
::
slotCheckedItemsTimer
()
{
Q_Q
(
CategorySelectWidget
);
bool
allOn
=
true
;
for
(
int
row
=
0
;
row
<
itemModel
()
->
rowCount
();
++
row
)
{
for
(
int
row
=
0
;
row
<
itemModel
()
->
rowCount
();
++
row
)
{
const
QStandardItem
*
it
=
itemModel
()
->
item
(
row
);
Qt
::
CheckState
rowState
=
static_cast
<
Qt
::
CheckState
>
(
it
->
data
(
Qt
::
CheckStateRole
).
toInt
());
if
(
rowState
!=
Qt
::
Checked
)
{
if
(
rowState
!=
Qt
::
Checked
)
{
allOn
=
false
;
break
;
}
...
...
@@ -268,17 +255,18 @@ void CategorySelectWidgetPrivate::slotCheckedItemsTimer()
emit
q
->
filterChanged
(
filterTags
());
}
QList
<
Akonadi
::
Tag
::
Id
>
CategorySelectWidgetPrivate
::
filterTags
()
const
{
QList
<
Tag
::
Id
>
filter
;
bool
allOn
=
true
;
for
(
int
row
=
0
;
row
<
itemModel
()
->
rowCount
();
++
row
)
{
for
(
int
row
=
0
;
row
<
itemModel
()
->
rowCount
();
++
row
)
{
const
QStandardItem
*
it
=
itemModel
()
->
item
(
row
);
Q_ASSERT
(
it
!=
NULL
);
if
(
it
->
checkState
()
==
Qt
::
Checked
)
{
Q_ASSERT
(
it
!=
NULL
);
if
(
it
->
checkState
()
==
Qt
::
Checked
)
{
Tag
::
Id
id
=
it
->
data
(
FILTER_ROLE
).
toInt
();
if
(
id
!=
0
)
filter
.
append
(
id
);
if
(
id
!=
0
)
{
filter
.
append
(
id
);
}
}
else
{
allOn
=
false
;
}
...
...
@@ -293,7 +281,6 @@ QList<Akonadi::Tag::Id> CategorySelectWidgetPrivate::filterTags() const
return
filter
;
}
CategorySelectWidget
::
CategorySelectWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
d_ptr
(
new
CategorySelectWidgetPrivate
(
this
))
...
...
@@ -302,18 +289,15 @@ CategorySelectWidget::CategorySelectWidget(QWidget *parent)
d
->
init
();
}
CategorySelectWidget
::~
CategorySelectWidget
()
{
delete
d_ptr
;
}
QList
<
Akonadi
::
Tag
::
Id
>
CategorySelectWidget
::
filterTags
()
const
{
Q_D
(
const
CategorySelectWidget
);
return
d
->
filterTags
();
}
#include "categoryselectwidget.moc"
categoryselectwidget.h
View file @
13827680
...
...
@@ -53,11 +53,10 @@ public:
/**
* Special @c Akonadi::Tag::Id values for filtering.
**/
enum
FilterTag
{
FilterAll
=
-
2
,
/**< All items */
FilterUntagged
=
-
3
,
/**< Untagged items */
FilterGroups
=
-
4
/**< Contact groups */
enum
FilterTag
{
FilterAll
=
-
2
,
/**< All items */
FilterUntagged
=
-
3
,
/**< Untagged items */
FilterGroups
=
-
4
/**< Contact groups */
};
/**
...
...
@@ -81,7 +80,7 @@ signals:
void
filterChanged
(
const
QList
<
Akonadi
::
Tag
::
Id
>
&
idList
);
private:
CategorySelectWidgetPrivate
*
const
d_ptr
;
CategorySelectWidgetPrivate
*
const
d_ptr
;
};
#endif
// CATEGORYSELECTWIDGET_H
#endif
// CATEGORYSELECTWIDGET_H
contactfields.cpp
View file @
13827680
This diff is collapsed.
Click to expand it.
contactfields.h
View file @
13827680
...
...
@@ -97,7 +97,7 @@ public:
/**
* Returns the i18n label for the @p field.
*/
static
QString
label
(
Field
field
);
static
QString
label
(
Field
field
);
/**
* Returns a list of all available fields.
...
...
@@ -107,12 +107,12 @@ public:
/**
* Sets the @p value of the @p field for the @p contact.
*/
static
void
setValue
(
Field
field
,
const
QString
&
value
,
KABC
::
Addressee
&
contact
);
static
void
setValue
(
Field
field
,
const
QString
&
value
,
KABC
::
Addressee
&
contact
);
/**
* Returns the value for the @p field of the @p contact.
*/
static
QString
value
(
Field
field
,
const
KABC
::
Addressee
&
contact
);
static
QString
value
(
Field
field
,
const
KABC
::
Addressee
&
contact
);
};
#endif
contactselectiondialog.cpp
View file @
13827680
...
...
@@ -25,13 +25,13 @@
#include <QPushButton>
#include <QVBoxLayout>
ContactSelectionDialog
::
ContactSelectionDialog
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
:
QDialog
(
parent
)
ContactSelectionDialog
::
ContactSelectionDialog
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
:
QDialog
(
parent
)
{
setWindowTitle
(
i18n
(
"Select Contacts"
)
);
setWindowTitle
(
i18n
(
"Select Contacts"
)
);
//PORTING SCRIPT: Move QDialogButtonBox at the end of init of widget to add it in layout.
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
);
QWidget
*
mainWidget
=
new
QWidget
(
this
);
QVBoxLayout
*
mainLayout
=
new
QVBoxLayout
;
setLayout
(
mainLayout
);
...
...
@@ -42,22 +42,21 @@ ContactSelectionDialog::ContactSelectionDialog( QItemSelectionModel *selectionMo
connect
(
buttonBox
,
&
QDialogButtonBox
::
accepted
,
this
,
&
ContactSelectionDialog
::
accept
);
connect
(
buttonBox
,
&
QDialogButtonBox
::
rejected
,
this
,
&
ContactSelectionDialog
::
reject
);
mSelectionWidget
=
new
ContactSelectionWidget
(
selectionModel
,
this
);
mSelectionWidget
=
new
ContactSelectionWidget
(
selectionModel
,
this
);
mainLayout
->
addWidget
(
mSelectionWidget
);
mainLayout
->
addWidget
(
buttonBox
);
resize
(
QSize
(
450
,
220
)
);
resize
(
QSize
(
450
,
220
));
}
void
ContactSelectionDialog
::
setMessageText
(
const
QString
&
message
)
void
ContactSelectionDialog
::
setMessageText
(
const
QString
&
message
)
{
mSelectionWidget
->
setMessageText
(
message
);
mSelectionWidget
->
setMessageText
(
message
);
}
void
ContactSelectionDialog
::
setDefaultAddressBook
(
const
Akonadi
::
Collection
&
addressBook
)
void
ContactSelectionDialog
::
setDefaultAddressBook
(
const
Akonadi
::
Collection
&
addressBook
)
{
mSelectionWidget
->
setDefaultAddressBook
(
addressBook
);
mSelectionWidget
->
setDefaultAddressBook
(
addressBook
);
}
KABC
::
Addressee
::
List
ContactSelectionDialog
::
selectedContacts
()
const
...
...
contactselectiondialog.h
View file @
13827680
...
...
@@ -48,17 +48,17 @@ public:
* @param selectionModel The model that contains the currently selected contacts.
* @param parent The parent widget.
*/
explicit
ContactSelectionDialog
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
=
0
);
explicit
ContactSelectionDialog
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
=
0
);
/**
* Sets the @p message text.
*/
void
setMessageText
(
const
QString
&
message
);
void
setMessageText
(
const
QString
&
message
);
/**
* Sets the default addressbook.
*/
void
setDefaultAddressBook
(
const
Akonadi
::
Collection
&
addressBook
);
void
setDefaultAddressBook
(
const
Akonadi
::
Collection
&
addressBook
);
/**
* Returns the list of selected contacts.
...
...
contactselectionwidget.cpp
View file @
13827680
...
...
@@ -37,44 +37,44 @@
#include <QRadioButton>
#include <QVBoxLayout>
ContactSelectionWidget
::
ContactSelectionWidget
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
:
QWidget
(
parent
),
mSelectionModel
(
selectionModel
)
ContactSelectionWidget
::
ContactSelectionWidget
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
:
QWidget
(
parent
),
mSelectionModel
(
selectionModel
)
{
initGui
();
mSelectedContactsButton
->
setEnabled
(
mSelectionModel
->
hasSelection
()
);
mAddressBookSelection
->
setEnabled
(
false
);
mAddressBookSelectionRecursive
->
setEnabled
(
false
);
mSelectedContactsButton
->
setEnabled
(
mSelectionModel
->
hasSelection
());
mAddressBookSelection
->
setEnabled
(
false
);
mAddressBookSelectionRecursive
->
setEnabled
(
false
);
connect
(
mAddressBookContactsButton
,
&
QRadioButton
::
toggled
,
mAddressBookSelection
,
&
Akonadi
::
CollectionComboBox
::
setEnabled
);
connect
(
mAddressBookContactsButton
,
&
QRadioButton
::
toggled
,
mAddressBookSelectionRecursive
,
&
QCheckBox
::
setEnabled
);
// apply default configuration
if
(
mSelectionModel
->
hasSelection
()
)
{
mSelectedContactsButton
->
setChecked
(
true
);
if
(
mSelectionModel
->
hasSelection
())
{
mSelectedContactsButton
->
setChecked
(
true
);
}
else
{
mAllContactsButton
->
setChecked
(
true
);
mAllContactsButton
->
setChecked
(
true
);
}
}
void
ContactSelectionWidget
::
setMessageText
(
const
QString
&
message
)
void
ContactSelectionWidget
::
setMessageText
(
const
QString
&
message
)
{
mMessageLabel
->
setText
(
message
);
mMessageLabel
->
setText
(
message
);
}
void
ContactSelectionWidget
::
setDefaultAddressBook
(
const
Akonadi
::
Collection
&
addressBook
)
void
ContactSelectionWidget
::
setDefaultAddressBook
(
const
Akonadi
::
Collection
&
addressBook
)
{
mAddressBookSelection
->
setDefaultCollection
(
addressBook
);
mAddressBookSelection
->
setDefaultCollection
(
addressBook
);
}
KABC
::
Addressee
::
List
ContactSelectionWidget
::
selectedContacts
()
const
{
if
(
mAllContactsButton
->
isChecked
()
)
{
if
(
mAllContactsButton
->
isChecked
())
{
return
collectAllContacts
();
}
else
if
(
mSelectedContactsButton
->
isChecked
()
)
{
}
else
if
(
mSelectedContactsButton
->
isChecked
())
{
return
collectSelectedContacts
();
}
else
if
(
mAddressBookContactsButton
->
isChecked
()
)
{
}
else
if
(
mAddressBookContactsButton
->
isChecked
())
{
return
collectAddressBookContacts
();
}
...
...
@@ -83,105 +83,104 @@ KABC::Addressee::List ContactSelectionWidget::selectedContacts() const
Akonadi
::
Item
::
List
ContactSelectionWidget
::
selectedContactsItem
()
const
{
if
(
mAllContactsButton
->
isChecked
()
)
{
if
(
mAllContactsButton
->
isChecked
())
{
return
collectAllContactsItem
();
}
else
if
(
mSelectedContactsButton
->
isChecked
()
)
{
}
else
if
(
mSelectedContactsButton
->
isChecked
())
{
return
collectSelectedContactsItem
();
}
else
if
(
mAddressBookContactsButton
->
isChecked
()
)
{
}
else
if
(
mAddressBookContactsButton
->
isChecked
())
{
return
collectAddressBookContactsItem
();
}
return
Akonadi
::
Item
::
List
();
}
void
ContactSelectionWidget
::
initGui
()
{