Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KAddressBook
Commits
01707d13
Commit
01707d13
authored
May 02, 2021
by
Laurent Montel
😁
Browse files
Modernize code
parent
63f06a01
Pipeline
#60421
passed with stage
in 5 minutes and 39 seconds
Changes
17
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
01707d13
...
...
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set
(
PIM_VERSION
"5.17.40"
)
project
(
kaddressbook VERSION
${
PIM_VERSION
}
)
set
(
RELEASE_SERVICE_VERSION
"20.07.90"
)
set
(
KF5_MIN_VERSION
"5.
7
1.0"
)
set
(
KF5_MIN_VERSION
"5.
8
1.0"
)
find_package
(
ECM
${
KF5_MIN_VERSION
}
CONFIG REQUIRED
)
set
(
CMAKE_MODULE_PATH
${
ECM_MODULE_PATH
}
)
...
...
kontactplugin/kaddressbook_plugin.cpp
View file @
01707d13
...
...
@@ -30,7 +30,7 @@ KAddressBookPlugin::KAddressBookPlugin(KontactInterface::Core *core, const QVari
{
setComponentName
(
QStringLiteral
(
"kaddressbook"
),
i18n
(
"KAddressBook"
));
QAction
*
action
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"contact-new"
)),
i18nc
(
"@action:inmenu"
,
"New Contact..."
),
this
);
auto
action
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"contact-new"
)),
i18nc
(
"@action:inmenu"
,
"New Contact..."
),
this
);
actionCollection
()
->
addAction
(
QStringLiteral
(
"new_contact"
),
action
);
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
KAddressBookPlugin
::
slotNewContact
);
actionCollection
()
->
setDefaultShortcut
(
action
,
QKeySequence
(
Qt
::
CTRL
|
Qt
::
SHIFT
|
Qt
::
Key_C
));
...
...
src/categoryfilterproxymodel.cpp
View file @
01707d13
...
...
@@ -56,7 +56,7 @@ bool CategoryFilterProxyModel::filterAcceptsRow(int row, const QModelIndex &pare
Q_D
(
const
CategoryFilterProxyModel
);
const
QModelIndex
index
=
sourceModel
()
->
index
(
row
,
0
,
parent
);
const
Akonadi
::
Item
item
=
index
.
data
(
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
index
.
data
(
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
!
d
->
filterEnabled
)
{
return
true
;
// filter not enabled
...
...
@@ -70,7 +70,7 @@ bool CategoryFilterProxyModel::filterAcceptsRow(int row, const QModelIndex &pare
}
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
())
{
const
KContacts
::
Addressee
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
const
auto
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
const
QStringList
categories
=
contact
.
categories
();
...
...
src/categoryselectwidget.cpp
View file @
01707d13
...
...
@@ -101,7 +101,7 @@ void CategorySelectWidgetPrivate::init()
connect
(
but
,
&
QToolButton
::
clicked
,
this
,
&
CategorySelectWidgetPrivate
::
slotSelectNone
);
hbox
->
addWidget
(
but
);
QStandardItem
*
item
=
new
QStandardItem
(
i18n
(
"(Untagged)"
));
auto
item
=
new
QStandardItem
(
i18n
(
"(Untagged)"
));
item
->
setCheckState
(
Qt
::
Checked
);
item
->
setData
(
CategorySelectWidget
::
FilterUntagged
,
FILTER_ROLE
);
itemModel
()
->
appendRow
(
item
);
...
...
@@ -152,7 +152,7 @@ void CategorySelectWidgetPrivate::slotTagsInserted(const QModelIndex &parent, in
<< "tag" << tagModel->data(idx, TagModel::TagRole)
<< "id" << tagModel->data(idx, TagModel::IdRole).toInt();
#endif
QStandardItem
*
it
=
new
QStandardItem
(
tagModel
->
data
(
idx
,
TagModel
::
NameRole
).
toString
());
auto
it
=
new
QStandardItem
(
tagModel
->
data
(
idx
,
TagModel
::
NameRole
).
toString
());
it
->
setIcon
(
tagModel
->
data
(
idx
,
Qt
::
DecorationRole
).
value
<
QIcon
>
());
it
->
setData
(
tagModel
->
data
(
idx
,
TagModel
::
IdRole
),
FILTER_ROLE
);
it
->
setCheckState
(
Qt
::
Checked
);
...
...
src/configuration/kaddressbook_config_plugins.cpp
View file @
01707d13
...
...
@@ -23,10 +23,12 @@ KCMKaddressbookPluginsConfig::KCMKaddressbookPluginsConfig(QWidget *parent, cons
auto
lay
=
new
QHBoxLayout
(
this
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
KAboutData
*
about
=
new
KAboutData
(
QStringLiteral
(
"kcmakrpluginsconfig"
),
i18n
(
"Configure Plugins"
),
QString
(),
QString
(),
KAboutLicense
::
GPL
,
i18n
(
"(c), 2016-2021 Laurent Montel"
));
auto
about
=
new
KAboutData
(
QStringLiteral
(
"kcmakrpluginsconfig"
),
i18n
(
"Configure Plugins"
),
QString
(),
QString
(),
KAboutLicense
::
GPL
,
i18n
(
"(c), 2016-2021 Laurent Montel"
));
about
->
addAuthor
(
i18n
(
"Laurent Montel"
),
QString
(),
QStringLiteral
(
"montel@kde.org"
));
...
...
src/configuration/kaddressbook_config_userfeedback.cpp
View file @
01707d13
...
...
@@ -24,10 +24,12 @@ KCMKaddressbookUserFeedBackConfig::KCMKaddressbookUserFeedBackConfig(QWidget *pa
auto
lay
=
new
QHBoxLayout
(
this
);
lay
->
setContentsMargins
(
0
,
0
,
0
,
0
);
KAboutData
*
about
=
new
KAboutData
(
QStringLiteral
(
"kcmaddressbookuserfeedbackconfig"
),
i18n
(
"Configure User FeedBack"
),
QString
(),
QString
(),
KAboutLicense
::
GPL
,
i18n
(
"(c), 2020-2021 Laurent Montel"
));
auto
about
=
new
KAboutData
(
QStringLiteral
(
"kcmaddressbookuserfeedbackconfig"
),
i18n
(
"Configure User FeedBack"
),
QString
(),
QString
(),
KAboutLicense
::
GPL
,
i18n
(
"(c), 2020-2021 Laurent Montel"
));
about
->
addAuthor
(
i18n
(
"Laurent Montel"
),
QString
(),
QStringLiteral
(
"montel@kde.org"
));
...
...
src/configuration/kaddressbookconfigpluginlistwidget.cpp
View file @
01707d13
...
...
@@ -88,7 +88,7 @@ void KAddressBookConfigPluginListWidget::slotConfigureClicked(const QString &con
PimCommon
::
GenericPlugin
*
plugin
=
KAddressBookPluginInterface
::
self
()
->
pluginFromIdentifier
(
identifier
);
plugin
->
showConfigureDialog
(
this
);
}
else
if
(
configureGroupName
==
kaddressbookImportExportGroupName
())
{
auto
*
plugin
=
KAddressBookImportExport
::
PluginManager
::
self
()
->
pluginFromIdentifier
(
identifier
);
auto
plugin
=
KAddressBookImportExport
::
PluginManager
::
self
()
->
pluginFromIdentifier
(
identifier
);
plugin
->
showConfigureDialog
(
this
);
}
else
{
qCWarning
(
KADDRESSBOOK_CONFIGURE_LOG
)
<<
"Unknown configureGroupName"
<<
configureGroupName
;
...
...
src/contactinfoproxymodel.cpp
View file @
01707d13
...
...
@@ -37,10 +37,10 @@ QVariant ContactInfoProxyModel::data(const QModelIndex &index, int role) const
qCWarning
(
KADDRESSBOOK_LOG
)
<<
"invalid index!"
;
}
if
(
role
>=
Roles
::
PictureRole
&&
role
<=
Roles
::
DescriptionRole
)
{
const
Akonadi
::
Item
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
Q_ASSERT
(
item
.
isValid
());
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
())
{
const
KContacts
::
Addressee
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
const
auto
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
switch
(
role
)
{
case
Roles
::
PictureRole
:
return
contact
.
photo
().
data
();
...
...
@@ -50,7 +50,7 @@ QVariant ContactInfoProxyModel::data(const QModelIndex &index, int role) const
return
getDescription
(
contact
);
}
}
else
if
(
item
.
hasPayload
<
KContacts
::
ContactGroup
>
())
{
const
KContacts
::
ContactGroup
groupContacts
=
item
.
payload
<
KContacts
::
ContactGroup
>
();
const
auto
groupContacts
=
item
.
payload
<
KContacts
::
ContactGroup
>
();
if
(
!
mPendingGroupItems
.
contains
(
item
.
id
()))
{
if
(
!
mGroupsCache
.
contains
(
item
.
id
()))
{
mMonitor
->
setItemMonitored
(
item
);
...
...
@@ -282,7 +282,7 @@ void ContactInfoProxyModel::slotFetchJobFinished(KJob *job)
}
auto
fetchJob
=
qobject_cast
<
Akonadi
::
ItemFetchJob
*>
(
job
);
const
Akonadi
::
Item
::
Id
groupItemId
=
job
->
property
(
"groupItemId"
).
value
<
Akonadi
::
Item
::
Id
>
();
const
auto
groupItemId
=
job
->
property
(
"groupItemId"
).
value
<
Akonadi
::
Item
::
Id
>
();
const
auto
items
=
fetchJob
->
items
();
for
(
const
Akonadi
::
Item
&
item
:
items
)
{
...
...
@@ -324,7 +324,7 @@ void ContactInfoProxyModel::slotItemChanged(const Akonadi::Item &item, const QSe
}
}
else
if
(
item
.
hasPayload
<
KContacts
::
ContactGroup
>
())
{
if
(
mGroupsCache
.
contains
(
item
.
id
()))
{
const
KContacts
::
ContactGroup
groupContacts
=
item
.
payload
<
KContacts
::
ContactGroup
>
();
const
auto
groupContacts
=
item
.
payload
<
KContacts
::
ContactGroup
>
();
mGroupsCache
[
item
.
id
()].
clear
();
if
(
groupContacts
.
contactReferenceCount
()
>
0
&&
isCacheItemToFetch
(
item
.
id
(),
groupContacts
))
{
resolveGroup
(
item
.
id
(),
groupContacts
);
...
...
@@ -338,7 +338,7 @@ void ContactInfoProxyModel::slotItemChanged(const Akonadi::Item &item, const QSe
void
ContactInfoProxyModel
::
slotRowsAboutToBeRemoved
(
const
QModelIndex
&
parent
,
int
first
,
int
last
)
{
for
(
int
idx
=
first
;
idx
<=
last
;
idx
++
)
{
const
Akonadi
::
Item
item
=
this
->
index
(
idx
,
0
,
parent
).
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
this
->
index
(
idx
,
0
,
parent
).
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
Q_ASSERT
(
item
.
isValid
());
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
())
{
QMapIterator
<
Akonadi
::
Item
::
Id
,
ContactCacheData
::
List
>
it_group
(
mGroupsCache
);
...
...
@@ -361,7 +361,7 @@ bool ContactInfoProxyModel::ContactCacheData::setData(const Akonadi::Item &item)
{
bool
result
(
false
);
if
(
validateItem
(
item
))
{
const
KContacts
::
Addressee
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
const
auto
contact
=
item
.
payload
<
KContacts
::
Addressee
>
();
mName
=
contact
.
realName
();
mEmail
=
contact
.
preferredEmail
();
result
=
true
;
...
...
src/importexport/contactselectiondialog.cpp
View file @
01707d13
...
...
@@ -30,7 +30,7 @@ ContactSelectionDialog::ContactSelectionDialog(QItemSelectionModel *selectionMod
mainLayout
->
addWidget
(
mSelectionWidget
);
}
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
QPushButton
*
okButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
okButton
->
setDefault
(
true
);
okButton
->
setShortcut
(
Qt
::
CTRL
|
Qt
::
Key_Return
);
...
...
src/importexport/contactselectionwidget.cpp
View file @
01707d13
...
...
@@ -164,7 +164,7 @@ void ContactSelectionWidget::initGui()
Akonadi
::
Item
::
List
ContactSelectionWidget
::
collectAllItems
()
const
{
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
Akonadi
::
Collection
::
root
(),
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
auto
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
Akonadi
::
Collection
::
root
(),
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
job
->
fetchScope
().
fetchFullPayload
();
QProgressDialog
progressDialog
(
nullptr
);
progressDialog
.
setWindowTitle
(
i18nc
(
"@title:window"
,
"Collect Contacts"
));
...
...
@@ -185,7 +185,7 @@ Akonadi::Item::List ContactSelectionWidget::collectAllItems() const
ContactList
ContactSelectionWidget
::
collectAllContacts
()
const
{
ContactList
contacts
;
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
Akonadi
::
Collection
::
root
(),
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
auto
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
Akonadi
::
Collection
::
root
(),
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
job
->
fetchScope
().
fetchFullPayload
();
if
(
!
job
->
exec
())
{
...
...
@@ -211,7 +211,7 @@ Akonadi::Item::List ContactSelectionWidget::collectSelectedItems() const
for
(
int
i
=
0
,
total
=
indexes
.
count
();
i
<
total
;
++
i
)
{
const
QModelIndex
index
=
indexes
.
at
(
i
);
if
(
index
.
isValid
())
{
const
Akonadi
::
Item
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
item
.
isValid
())
{
items
.
append
(
item
);
}
...
...
@@ -229,7 +229,7 @@ ContactList ContactSelectionWidget::collectSelectedContacts() const
for
(
int
i
=
0
,
total
=
indexes
.
count
();
i
<
total
;
++
i
)
{
const
QModelIndex
index
=
indexes
.
at
(
i
);
if
(
index
.
isValid
())
{
const
Akonadi
::
Item
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
item
.
isValid
())
{
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
())
{
contacts
.
append
(
item
.
payload
<
KContacts
::
Addressee
>
());
...
...
@@ -251,7 +251,7 @@ Akonadi::Item::List ContactSelectionWidget::collectAddressBookItems() const
}
if
(
mAddressBookSelectionRecursive
->
isChecked
())
{
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
collection
,
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
auto
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
collection
,
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
job
->
fetchScope
().
fetchFullPayload
();
if
(
!
job
->
exec
())
{
...
...
@@ -282,7 +282,7 @@ ContactList ContactSelectionWidget::collectAddressBookContacts() const
}
if
(
mAddressBookSelectionRecursive
->
isChecked
())
{
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
collection
,
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
auto
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
collection
,
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
job
->
fetchScope
().
fetchFullPayload
();
if
(
!
job
->
exec
())
{
...
...
src/importexport/exportselectionwidget.cpp
View file @
01707d13
...
...
@@ -21,7 +21,7 @@ ExportSelectionWidget::ExportSelectionWidget(QWidget *parent)
{
auto
mainLayout
=
new
QVBoxLayout
(
this
);
mainLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QGroupBox
*
gbox
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Fields to be exported"
),
this
);
auto
gbox
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Fields to be exported"
),
this
);
mainLayout
->
addWidget
(
gbox
);
auto
layout
=
new
QGridLayout
;
gbox
->
setLayout
(
layout
);
...
...
src/kaddressbookpart.cpp
View file @
01707d13
...
...
@@ -34,7 +34,7 @@ KAddressBookPart::KAddressBookPart(QWidget *parentWidget, QObject *parent, const
#endif
// create a canvas to insert our widget
QWidget
*
canvas
=
new
QWidget
(
parentWidget
);
auto
canvas
=
new
QWidget
(
parentWidget
);
canvas
->
setFocusPolicy
(
Qt
::
ClickFocus
);
setWidget
(
canvas
);
auto
topLayout
=
new
QVBoxLayout
(
canvas
);
...
...
@@ -54,7 +54,7 @@ void KAddressBookPart::updateQuickSearchText()
void
KAddressBookPart
::
initAction
()
{
QAction
*
action
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"configure"
)),
i18n
(
"&Configure KAddressBook..."
),
this
);
auto
action
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"configure"
)),
i18n
(
"&Configure KAddressBook..."
),
this
);
actionCollection
()
->
addAction
(
QStringLiteral
(
"kaddressbook_configure"
),
action
);
connect
(
action
,
&
QAction
::
triggered
,
mMainWidget
,
&
MainWidget
::
configure
);
}
...
...
src/mainwidget.cpp
View file @
01707d13
...
...
@@ -119,7 +119,7 @@ public:
if
(
role
==
Qt
::
CheckStateRole
)
{
// Don't show the checkbox if the collection can't contain incidences
const
Akonadi
::
Collection
collection
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
CollectionRole
).
value
<
Akonadi
::
Collection
>
();
const
auto
collection
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
CollectionRole
).
value
<
Akonadi
::
Collection
>
();
if
(
collection
.
isValid
()
&&
isStructuralCollection
(
collection
))
{
return
QVariant
();
}
...
...
@@ -332,14 +332,14 @@ void MainWidget::initializeImportExportPlugin(KActionCollection *collection)
}
if
(
!
importActions
.
isEmpty
())
{
KActionMenu
*
importMenu
=
new
KActionMenu
(
i18n
(
"Import"
),
this
);
auto
importMenu
=
new
KActionMenu
(
i18n
(
"Import"
),
this
);
collection
->
addAction
(
QStringLiteral
(
"import_menu"
),
importMenu
);
for
(
QAction
*
act
:
qAsConst
(
importActions
))
{
importMenu
->
addAction
(
act
);
}
}
if
(
!
exportActions
.
isEmpty
())
{
KActionMenu
*
exportMenu
=
new
KActionMenu
(
i18n
(
"Export"
),
this
);
auto
exportMenu
=
new
KActionMenu
(
i18n
(
"Export"
),
this
);
collection
->
addAction
(
QStringLiteral
(
"export_menu"
),
exportMenu
);
for
(
QAction
*
act
:
qAsConst
(
exportActions
))
{
exportMenu
->
addAction
(
act
);
...
...
@@ -613,7 +613,7 @@ void MainWidget::setupActions(KActionCollection *collection)
connect
(
mGrantleeThemeManager
,
&
GrantleeTheme
::
ThemeManager
::
grantleeThemeSelected
,
this
,
&
MainWidget
::
slotGrantleeThemeSelected
);
connect
(
mGrantleeThemeManager
,
&
GrantleeTheme
::
ThemeManager
::
updateThemes
,
this
,
&
MainWidget
::
slotGrantleeThemesUpdated
);
KActionMenu
*
themeMenu
=
new
KActionMenu
(
i18n
(
"&Themes"
),
this
);
auto
themeMenu
=
new
KActionMenu
(
i18n
(
"&Themes"
),
this
);
collection
->
addAction
(
QStringLiteral
(
"theme_menu"
),
themeMenu
);
initGrantleeThemeName
();
...
...
@@ -642,14 +642,14 @@ void MainWidget::setupActions(KActionCollection *collection)
action
->
setWhatsThis
(
i18n
(
"Select all contacts in the current address book view."
));
connect
(
action
,
&
QAction
::
triggered
,
mItemView
,
&
Akonadi
::
EntityTreeView
::
selectAll
);
auto
*
qrtoggleAction
=
collection
->
add
<
KToggleAction
>
(
QStringLiteral
(
"options_show_qrcodes"
));
auto
qrtoggleAction
=
collection
->
add
<
KToggleAction
>
(
QStringLiteral
(
"options_show_qrcodes"
));
qrtoggleAction
->
setText
(
i18n
(
"Show QR Codes"
));
qrtoggleAction
->
setWhatsThis
(
i18n
(
"Show QR Codes in the contact."
));
connect
(
qrtoggleAction
,
&
KToggleAction
::
toggled
,
this
,
&
MainWidget
::
setQRCodeShow
);
mViewModeGroup
=
new
QActionGroup
(
this
);
QAction
*
act
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Simple (one column)"
),
mViewModeGroup
);
auto
act
=
new
QAction
(
i18nc
(
"@action:inmenu"
,
"Simple (one column)"
),
mViewModeGroup
);
act
->
setCheckable
(
true
);
act
->
setData
(
1
);
collection
->
setDefaultShortcut
(
act
,
QKeySequence
(
Qt
::
CTRL
|
Qt
::
SHIFT
|
Qt
::
Key_1
));
...
...
@@ -829,7 +829,7 @@ Akonadi::Collection MainWidget::currentAddressBook() const
{
if
(
mCollectionView
->
selectionModel
()
&&
mCollectionView
->
selectionModel
()
->
hasSelection
())
{
const
QModelIndex
index
=
mCollectionView
->
selectionModel
()
->
selectedIndexes
().
first
();
const
Akonadi
::
Collection
collection
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
CollectionRole
).
value
<
Akonadi
::
Collection
>
();
const
auto
collection
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
CollectionRole
).
value
<
Akonadi
::
Collection
>
();
return
collection
;
}
...
...
@@ -1017,7 +1017,7 @@ const Akonadi::Item::List MainWidget::collectSelectedAllContactsItem(QItemSelect
for
(
int
i
=
0
;
i
<
indexes
.
count
();
++
i
)
{
const
QModelIndex
index
=
indexes
.
at
(
i
);
if
(
index
.
isValid
())
{
const
Akonadi
::
Item
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
item
.
isValid
())
{
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
()
||
item
.
hasPayload
<
KContacts
::
ContactGroup
>
())
{
lst
.
append
(
item
);
...
...
@@ -1041,7 +1041,7 @@ void MainWidget::slotServerSideSubscription()
void
MainWidget
::
slotCurrentCollectionChanged
(
const
Akonadi
::
Collection
&
col
)
{
for
(
auto
*
interface
:
qAsConst
(
mImportExportPluginInterfaceList
))
{
for
(
auto
interface
:
qAsConst
(
mImportExportPluginInterfaceList
))
{
interface
->
setDefaultCollection
(
col
);
}
bool
isOnline
;
...
...
src/manageshowcollectionproperties.cpp
View file @
01707d13
...
...
@@ -61,7 +61,7 @@ void ManageShowCollectionProperties::slotCollectionPropertiesContinued(KJob *job
return
;
}
}
Akonadi
::
CollectionFetchJob
*
fetch
=
new
Akonadi
::
CollectionFetchJob
(
mMainWidget
->
currentAddressBook
(),
Akonadi
::
CollectionFetchJob
::
Base
);
auto
fetch
=
new
Akonadi
::
CollectionFetchJob
(
mMainWidget
->
currentAddressBook
(),
Akonadi
::
CollectionFetchJob
::
Base
);
fetch
->
fetchScope
().
setIncludeStatistics
(
true
);
connect
(
fetch
,
&
KJob
::
result
,
this
,
&
ManageShowCollectionProperties
::
slotCollectionPropertiesFinished
);
}
...
...
src/printing/printingwizard.cpp
View file @
01707d13
...
...
@@ -45,7 +45,7 @@ PrintingWizard::PrintingWizard(QPrinter *printer, QItemSelectionModel *selection
mSelectionPage
=
new
KAddressBookImportExport
::
ContactSelectionWidget
(
selectionModel
,
this
);
mSelectionPage
->
setMessageText
(
i18n
(
"Which contacts do you want to print?"
));
KPageWidgetItem
*
mSelectionPageItem
=
new
KPageWidgetItem
(
mSelectionPage
,
i18n
(
"Choose Contacts to Print"
));
auto
mSelectionPageItem
=
new
KPageWidgetItem
(
mSelectionPage
,
i18n
(
"Choose Contacts to Print"
));
addPage
(
mSelectionPageItem
);
setAppropriate
(
mSelectionPageItem
,
true
);
...
...
@@ -198,7 +198,7 @@ void PrintingWizard::print()
{
// create and show print progress widget:
mProgress
=
new
PrintProgress
(
this
);
KPageWidgetItem
*
progressItem
=
new
KPageWidgetItem
(
mProgress
,
i18n
(
"Print Progress"
));
auto
progressItem
=
new
KPageWidgetItem
(
mProgress
,
i18n
(
"Print Progress"
));
addPage
(
progressItem
);
setCurrentPage
(
progressItem
);
qApp
->
processEvents
();
...
...
src/printing/stylepage.cpp
View file @
01707d13
...
...
@@ -112,14 +112,15 @@ void StylePage::initGUI()
auto
topLayout
=
new
QGridLayout
(
this
);
QLabel
*
label
=
new
QLabel
(
i18nc
(
"@label:textbox"
,
"What should the print look like?
\n
"
"KAddressBook has several printing styles, designed for different purposes.
\n
"
"Choose the style that suits your needs below."
),
this
);
auto
label
=
new
QLabel
(
i18nc
(
"@label:textbox"
,
"What should the print look like?
\n
"
"KAddressBook has several printing styles, designed "
"for different purposes.
\n
"
"Choose the style that suits your needs below."
),
this
);
topLayout
->
addWidget
(
label
,
0
,
0
,
1
,
2
);
QGroupBox
*
group
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Sorting"
),
this
);
auto
group
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Sorting"
),
this
);
auto
sortLayout
=
new
QGridLayout
();
group
->
setLayout
(
sortLayout
);
sortLayout
->
setAlignment
(
Qt
::
AlignTop
);
...
...
src/stylecontactlistdelegate.cpp
View file @
01707d13
...
...
@@ -75,9 +75,9 @@ void StyleContactListDelegate::paint(QPainter *painter, const QStyleOptionViewIt
painter
->
drawPath
(
path
);
painter
->
setFont
(
QFont
(
option
.
font
.
family
(),
12
,
QFont
::
Bold
,
true
));
QImage
image
(
index
.
data
(
ContactInfoProxyModel
::
Roles
::
PictureRole
).
value
<
QImage
>
());
auto
image
(
index
.
data
(
ContactInfoProxyModel
::
Roles
::
PictureRole
).
value
<
QImage
>
());
if
(
image
.
isNull
())
{
const
QString
initials
=
index
.
data
(
ContactInfoProxyModel
::
Roles
::
InitialsRole
).
value
<
QString
>
();
const
auto
initials
=
index
.
data
(
ContactInfoProxyModel
::
Roles
::
InitialsRole
).
value
<
QString
>
();
painter
->
drawText
(
pictureRect
,
Qt
::
AlignCenter
,
painter
->
fontMetrics
().
elidedText
(
initials
,
Qt
::
ElideRight
,
pictureRect
.
width
()
-
qreal
(
10
)));
}
else
{
const
qreal
dpr
=
qApp
->
devicePixelRatio
();
...
...
@@ -88,13 +88,13 @@ void StyleContactListDelegate::paint(QPainter *painter, const QStyleOptionViewIt
painter
->
restore
();
const
QString
name
=
index
.
data
(
Qt
::
DisplayRole
).
value
<
QString
>
();
const
auto
name
=
index
.
data
(
Qt
::
DisplayRole
).
value
<
QString
>
();
if
(
!
name
.
isEmpty
())
{
painter
->
setFont
(
QFont
(
option
.
font
.
family
(),
11
));
painter
->
drawText
(
nameTextRect
,
Qt
::
AlignLeft
|
Qt
::
AlignVCenter
,
painter
->
fontMetrics
().
elidedText
(
name
,
Qt
::
ElideRight
,
nameTextRect
.
width
()));
}
const
QString
description
=
index
.
data
(
ContactInfoProxyModel
::
Roles
::
DescriptionRole
).
value
<
QString
>
();
const
auto
description
=
index
.
data
(
ContactInfoProxyModel
::
Roles
::
DescriptionRole
).
value
<
QString
>
();
if
(
!
description
.
isEmpty
())
{
painter
->
setFont
(
QFont
(
option
.
font
.
family
(),
8
,
-
1
,
true
));
painter
->
drawText
(
descriptionTextRect
,
...
...
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