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
KDE PIM Add-ons
Commits
eac7e8f9
Commit
eac7e8f9
authored
May 01, 2021
by
Laurent Montel
😁
Browse files
Use auto directly
parent
ace2e365
Changes
198
Hide whitespace changes
Inline
Side-by-side
kaddressbook/editorpages/cryptopageplugin.cpp
View file @
eac7e8f9
...
...
@@ -35,8 +35,8 @@ CryptoPagePlugin::CryptoPagePlugin()
topLayout
->
setColumnStretch
(
1
,
1
);
topLayout
->
setRowStretch
(
4
,
1
);
QGroupBox
*
protGB
=
new
QGroupBox
(
i18n
(
"Allowed Protocols"
),
this
);
QLayout
*
protGBLayout
=
new
QVBoxLayout
;
auto
protGB
=
new
QGroupBox
(
i18n
(
"Allowed Protocols"
),
this
);
auto
protGBLayout
=
new
QVBoxLayout
;
topLayout
->
addWidget
(
protGB
,
0
,
0
,
1
,
2
);
uint
msgFormat
=
1
;
...
...
@@ -50,7 +50,7 @@ CryptoPagePlugin::CryptoPagePlugin()
}
protGB
->
setLayout
(
protGBLayout
);
QLabel
*
l
=
new
QLabel
(
i18n
(
"Preferred OpenPGP encryption key:"
),
this
);
auto
l
=
new
QLabel
(
i18n
(
"Preferred OpenPGP encryption key:"
),
this
);
topLayout
->
addWidget
(
l
,
1
,
0
);
mPgpKey
=
new
Kleo
::
EncryptionKeyRequester
(
true
,
Kleo
::
EncryptionKeyRequester
::
OpenPGP
,
this
);
...
...
@@ -62,12 +62,12 @@ CryptoPagePlugin::CryptoPagePlugin()
mSmimeCert
=
new
Kleo
::
EncryptionKeyRequester
(
true
,
Kleo
::
EncryptionKeyRequester
::
SMIME
,
this
);
topLayout
->
addWidget
(
mSmimeCert
,
2
,
1
);
QGroupBox
*
box
=
new
QGroupBox
(
i18n
(
"Message Preference"
),
this
);
auto
box
=
new
QGroupBox
(
i18n
(
"Message Preference"
),
this
);
QLayout
*
boxLayout
=
new
QVBoxLayout
;
topLayout
->
addWidget
(
box
,
3
,
0
,
1
,
2
);
// Send preferences/sign (see kleo/kleo/enum.h)
QWidget
*
hbox
=
new
QWidget
(
box
);
auto
hbox
=
new
QWidget
(
box
);
auto
hboxHBoxLayout
=
new
QHBoxLayout
(
hbox
);
hboxHBoxLayout
->
setContentsMargins
({});
...
...
kaddressbook/importexportplugins/csv/import/csvimportdialog.cpp
View file @
eac7e8f9
...
...
@@ -267,10 +267,10 @@ KContacts::AddresseeList CSVImportDialog::contacts() const
void
CSVImportDialog
::
initGUI
()
{
QWidget
*
page
=
new
QWidget
(
this
);
auto
page
=
new
QWidget
(
this
);
auto
mainLayout
=
new
QVBoxLayout
(
this
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
mainLayout
->
addWidget
(
page
);
mOkButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
...
...
@@ -291,7 +291,7 @@ void CSVImportDialog::initGUI()
auto
hbox
=
new
QHBoxLayout
;
QLabel
*
label
=
new
QLabel
(
i18nc
(
"@label"
,
"File to import:"
),
page
);
auto
label
=
new
QLabel
(
i18nc
(
"@label"
,
"File to import:"
),
page
);
mainLayout
->
addWidget
(
label
);
hbox
->
addWidget
(
label
);
...
...
@@ -308,7 +308,7 @@ void CSVImportDialog::initGUI()
layout
->
addLayout
(
hbox
,
0
,
0
,
1
,
5
);
// Delimiter: comma, semicolon, tab, space, other
QGroupBox
*
group
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Delimiter"
),
page
);
auto
group
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Delimiter"
),
page
);
mainLayout
->
addWidget
(
group
);
auto
delimiterLayout
=
new
QGridLayout
;
group
->
setLayout
(
delimiterLayout
);
...
...
@@ -318,7 +318,7 @@ void CSVImportDialog::initGUI()
mDelimiterGroup
=
new
QButtonGroup
(
this
);
mDelimiterGroup
->
setExclusive
(
true
);
QRadioButton
*
button
=
new
QRadioButton
(
i18nc
(
"@option:radio Field separator"
,
"Comma"
));
auto
button
=
new
QRadioButton
(
i18nc
(
"@option:radio Field separator"
,
"Comma"
));
button
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Set the field separator to a comma"
));
button
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Select this option if your csv file uses the comma as a field separator."
));
button
->
setChecked
(
true
);
...
...
kaddressbook/importexportplugins/csv/import/templateselectiondialog.cpp
View file @
eac7e8f9
...
...
@@ -198,7 +198,7 @@ TemplateSelectionDialog::TemplateSelectionDialog(QWidget *parent)
setWindowTitle
(
i18nc
(
"@title:window"
,
"Template Selection"
));
auto
mainLayout
=
new
QVBoxLayout
(
this
);
QLabel
*
lab
=
new
QLabel
(
i18nc
(
"@info"
,
"Please select a template, that matches the CSV file:"
),
this
);
auto
lab
=
new
QLabel
(
i18nc
(
"@info"
,
"Please select a template, that matches the CSV file:"
),
this
);
mainLayout
->
addWidget
(
lab
);
mView
=
new
QListView
(
this
);
...
...
@@ -208,7 +208,7 @@ TemplateSelectionDialog::TemplateSelectionDialog(QWidget *parent)
mView
->
setItemDelegate
(
new
TemplateSelectionDelegate
(
this
));
connect
(
mView
->
selectionModel
(),
&
QItemSelectionModel
::
selectionChanged
,
this
,
&
TemplateSelectionDialog
::
updateButtons
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
mOkButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
mOkButton
->
setDefault
(
true
);
mOkButton
->
setShortcut
(
Qt
::
CTRL
|
Qt
::
Key_Return
);
...
...
kaddressbook/importexportplugins/vcards/engine/vcardexportselectionwidget.cpp
View file @
eac7e8f9
...
...
@@ -19,7 +19,7 @@ VCardExportSelectionWidget::VCardExportSelectionWidget(QWidget *parent)
{
auto
mainLayout
=
new
QVBoxLayout
(
this
);
mainLayout
->
setContentsMargins
({});
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
);
...
...
kaddressbook/importexportplugins/vcards/engine/vcardviewerdialog.cpp
View file @
eac7e8f9
...
...
@@ -21,7 +21,7 @@ VCardViewerDialog::VCardViewerDialog(const KContacts::Addressee::List &list, QWi
{
setWindowTitle
(
i18nc
(
"@title:window"
,
"Import vCard"
));
auto
mainLayout
=
new
QVBoxLayout
(
this
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Cancel
|
QDialogButtonBox
::
Apply
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Cancel
|
QDialogButtonBox
::
Apply
,
this
);
auto
user1Button
=
new
QPushButton
(
this
);
buttonBox
->
addButton
(
user1Button
,
QDialogButtonBox
::
ActionRole
);
...
...
@@ -36,13 +36,13 @@ VCardViewerDialog::VCardViewerDialog(const KContacts::Addressee::List &list, QWi
user1Button
->
setDefault
(
true
);
setModal
(
true
);
QFrame
*
page
=
new
QFrame
(
this
);
auto
page
=
new
QFrame
(
this
);
mainLayout
->
addWidget
(
page
);
mainLayout
->
addWidget
(
buttonBox
);
auto
layout
=
new
QVBoxLayout
(
page
);
QLabel
*
label
=
new
QLabel
(
i18nc
(
"@info"
,
"Do you want to import this contact into your address book?"
),
page
);
auto
label
=
new
QLabel
(
i18nc
(
"@info"
,
"Do you want to import this contact into your address book?"
),
page
);
QFont
font
=
label
->
font
();
font
.
setBold
(
true
);
label
->
setFont
(
font
);
...
...
kaddressbook/plugins/checkgravatar/checkgravatarplugininterface.cpp
View file @
eac7e8f9
...
...
@@ -65,7 +65,7 @@ void CheckGravatarPluginInterface::exec()
if
(
mListItems
.
count
()
==
1
)
{
Akonadi
::
Item
item
=
mListItems
.
constFirst
();
if
(
item
.
hasPayload
<
KContacts
::
Addressee
>
())
{
KContacts
::
Addressee
address
=
item
.
payload
<
KContacts
::
Addressee
>
();
auto
address
=
item
.
payload
<
KContacts
::
Addressee
>
();
const
QString
email
=
address
.
preferredEmail
();
if
(
email
.
isEmpty
())
{
KMessageBox
::
error
(
parentWidget
(),
i18n
(
"No email found for this contact."
));
...
...
kaddressbook/plugins/checkgravatar/gravatar/autotests/gravatarupdatedialogtest.cpp
View file @
eac7e8f9
...
...
@@ -22,10 +22,10 @@ GravatarUpdateDialogTest::~GravatarUpdateDialogTest()
void
GravatarUpdateDialogTest
::
shouldHaveDefaultValue
()
{
KABGravatar
::
GravatarUpdateDialog
dlg
;
KABGravatar
::
GravatarUpdateWidget
*
w
=
dlg
.
findChild
<
KABGravatar
::
GravatarUpdateWidget
*>
(
QStringLiteral
(
"gravatarupdatewidget"
));
auto
w
=
dlg
.
findChild
<
KABGravatar
::
GravatarUpdateWidget
*>
(
QStringLiteral
(
"gravatarupdatewidget"
));
QVERIFY
(
w
);
QDialogButtonBox
*
buttonBox
=
dlg
.
findChild
<
QDialogButtonBox
*>
(
QStringLiteral
(
"buttonbox"
));
auto
buttonBox
=
dlg
.
findChild
<
QDialogButtonBox
*>
(
QStringLiteral
(
"buttonbox"
));
QVERIFY
(
buttonBox
);
QVERIFY
(
!
dlg
.
saveUrl
());
...
...
kaddressbook/plugins/checkgravatar/gravatar/autotests/gravatarupdatewidgettest.cpp
View file @
eac7e8f9
...
...
@@ -23,27 +23,27 @@ void GravatarUpdateWidgetTest::shouldHaveDefaultValue()
{
KABGravatar
::
GravatarUpdateWidget
widget
;
widget
.
show
();
QLabel
*
lab
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"emaillabel"
));
auto
lab
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"emaillabel"
));
QVERIFY
(
lab
);
QLabel
*
emaillabel
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"email"
));
auto
emaillabel
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"email"
));
QVERIFY
(
emaillabel
);
QCheckBox
*
useLibravatar
=
widget
.
findChild
<
QCheckBox
*>
(
QStringLiteral
(
"uselibravatar"
));
auto
useLibravatar
=
widget
.
findChild
<
QCheckBox
*>
(
QStringLiteral
(
"uselibravatar"
));
QVERIFY
(
useLibravatar
);
QVERIFY
(
!
useLibravatar
->
isChecked
());
QVERIFY
(
useLibravatar
->
isEnabled
());
QCheckBox
*
useFallbackGravatar
=
widget
.
findChild
<
QCheckBox
*>
(
QStringLiteral
(
"fallbackgravatar"
));
auto
useFallbackGravatar
=
widget
.
findChild
<
QCheckBox
*>
(
QStringLiteral
(
"fallbackgravatar"
));
QVERIFY
(
useFallbackGravatar
);
QVERIFY
(
!
useFallbackGravatar
->
isChecked
());
QVERIFY
(
!
useFallbackGravatar
->
isEnabled
());
QPushButton
*
searchGravatar
=
widget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"search"
));
auto
searchGravatar
=
widget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"search"
));
QVERIFY
(
searchGravatar
);
QVERIFY
(
!
searchGravatar
->
isEnabled
());
QLabel
*
resultGravatar
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"result"
));
auto
resultGravatar
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"result"
));
QVERIFY
(
resultGravatar
);
QVERIFY
(
widget
.
pixmap
().
isNull
());
...
...
@@ -54,9 +54,9 @@ void GravatarUpdateWidgetTest::shouldAffectEmail()
{
KABGravatar
::
GravatarUpdateWidget
widget
;
QLabel
*
emaillabel
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"email"
));
auto
emaillabel
=
widget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"email"
));
QPushButton
*
searchGravatar
=
widget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"search"
));
auto
searchGravatar
=
widget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"search"
));
const
QString
newEmail
(
QStringLiteral
(
"foo@kde.org"
));
widget
.
setEmail
(
newEmail
);
...
...
kaddressbook/plugins/checkgravatar/gravatar/job/gravatarupdatejob.cpp
View file @
eac7e8f9
...
...
@@ -80,7 +80,7 @@ void GravatarUpdateJob::slotGravatarResolvUrlFinished(Gravatar::GravatarResolvUr
void
GravatarUpdateJob
::
updatePixmap
(
const
QPixmap
&
pix
)
{
if
(
mItem
.
hasPayload
<
KContacts
::
Addressee
>
())
{
KContacts
::
Addressee
contact
=
mItem
.
payload
<
KContacts
::
Addressee
>
();
auto
contact
=
mItem
.
payload
<
KContacts
::
Addressee
>
();
KContacts
::
Picture
pic
=
contact
.
photo
();
pic
.
setData
(
pix
.
toImage
());
contact
.
setPhoto
(
pic
);
...
...
kaddressbook/plugins/checkgravatar/gravatar/widgets/gravatarupdatedialog.cpp
View file @
eac7e8f9
...
...
@@ -27,7 +27,7 @@ GravatarUpdateDialog::GravatarUpdateDialog(QWidget *parent)
connect
(
mGravatarUpdateWidget
,
&
GravatarUpdateWidget
::
activateDialogButton
,
this
,
&
GravatarUpdateDialog
::
slotActivateButton
);
mGravatarUpdateWidget
->
setObjectName
(
QStringLiteral
(
"gravatarupdatewidget"
));
mainLayout
->
addWidget
(
mGravatarUpdateWidget
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Cancel
,
this
);
auto
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Cancel
,
this
);
buttonBox
->
setObjectName
(
QStringLiteral
(
"buttonbox"
));
mSaveImageButton
=
new
QPushButton
(
i18n
(
"Save Image"
),
this
);
mSaveImageButton
->
setEnabled
(
false
);
...
...
kaddressbook/plugins/checkgravatar/gravatar/widgets/gravatarupdatewidget.cpp
View file @
eac7e8f9
...
...
@@ -25,7 +25,7 @@ GravatarUpdateWidget::GravatarUpdateWidget(QWidget *parent)
auto
hboxEmail
=
new
QHBoxLayout
;
QLabel
*
lab
=
new
QLabel
(
i18n
(
"Email:"
));
auto
lab
=
new
QLabel
(
i18n
(
"Email:"
));
lab
->
setObjectName
(
QStringLiteral
(
"emaillabel"
));
hboxEmail
->
addWidget
(
lab
);
...
...
kaddressbook/plugins/mergelib/autotests/mergecontactinfowidgettest.cpp
View file @
eac7e8f9
...
...
@@ -24,7 +24,7 @@ void MergeContactInfoWidgetTest::initTestCase()
void
MergeContactInfoWidgetTest
::
shouldHaveDefaultValueOnCreation
()
{
MergeContactInfoWidget
infoWidget
;
QStackedWidget
*
stackedWidget
=
infoWidget
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
infoWidget
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QVERIFY
(
stackedWidget
);
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"nocontact"
));
}
...
...
@@ -34,7 +34,7 @@ void MergeContactInfoWidgetTest::shouldHaveActivateDisplayWidgetWhenSelectOneCon
MergeContactInfoWidget
infoWidget
;
Akonadi
::
Item
item
(
4
);
infoWidget
.
setContact
(
item
);
QStackedWidget
*
stackedWidget
=
infoWidget
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
infoWidget
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"contactwidget"
));
}
...
...
@@ -43,7 +43,7 @@ void MergeContactInfoWidgetTest::shouldHaveActivateNoWidgetWhenSelectNoContact()
MergeContactInfoWidget
infoWidget
;
Akonadi
::
Item
item
(
4
);
infoWidget
.
setContact
(
item
);
QStackedWidget
*
stackedWidget
=
infoWidget
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
infoWidget
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"contactwidget"
));
infoWidget
.
setContact
(
Akonadi
::
Item
());
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"nocontact"
));
...
...
kaddressbook/plugins/mergelib/autotests/mergecontactloseinformationwarningtest.cpp
View file @
eac7e8f9
...
...
@@ -21,9 +21,9 @@ void MergeContactLoseInformationWarningTest::shouldHaveDefaultValue()
KABMergeContacts
::
MergeContactLoseInformationWarning
w
;
QVERIFY
(
!
w
.
isCloseButtonVisible
());
QVERIFY
(
!
w
.
isVisible
());
auto
*
customize
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"customize"
));
auto
customize
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"customize"
));
QVERIFY
(
customize
);
auto
*
automatic
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"automatic"
));
auto
automatic
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"automatic"
));
QVERIFY
(
automatic
);
}
...
...
@@ -33,8 +33,8 @@ void MergeContactLoseInformationWarningTest::shouldEmitSignals()
w
.
show
();
QVERIFY
(
QTest
::
qWaitForWindowExposed
(
&
w
));
QVERIFY
(
w
.
isVisible
());
auto
*
customize
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"customize"
));
auto
*
automatic
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"automatic"
));
auto
customize
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"customize"
));
auto
automatic
=
w
.
findChild
<
QAction
*>
(
QStringLiteral
(
"automatic"
));
QSignalSpy
spy1
(
&
w
,
&
KABMergeContacts
::
MergeContactLoseInformationWarning
::
continueMerging
);
QSignalSpy
spy2
(
&
w
,
&
KABMergeContacts
::
MergeContactLoseInformationWarning
::
customizeMergingContacts
);
customize
->
trigger
();
...
...
kaddressbook/plugins/mergelib/autotests/mergecontactsdialogtest.cpp
View file @
eac7e8f9
...
...
@@ -32,10 +32,10 @@ void MergeContactsDialogTest::shouldHaveDefaultValue()
KABMergeContacts
::
MergeContactsDialog
dlg
;
dlg
.
show
();
QDialogButtonBox
*
buttonBox
=
dlg
.
findChild
<
QDialogButtonBox
*>
(
QStringLiteral
(
"buttonbox"
));
auto
buttonBox
=
dlg
.
findChild
<
QDialogButtonBox
*>
(
QStringLiteral
(
"buttonbox"
));
QVERIFY
(
buttonBox
);
QStackedWidget
*
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QVERIFY
(
stackedWidget
);
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"nocontactselected"
));
...
...
@@ -53,7 +53,7 @@ void MergeContactsDialogTest::shouldSwithStackedWidget()
{
KABMergeContacts
::
MergeContactsDialog
dlg
;
dlg
.
show
();
QStackedWidget
*
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
Akonadi
::
Item
::
List
lst
;
// Empty
dlg
.
setContacts
(
lst
);
...
...
kaddressbook/plugins/mergelib/autotests/mergecontactselectinformationscrollareatest.cpp
View file @
eac7e8f9
...
...
@@ -25,16 +25,15 @@ MergeContactSelectInformationScrollAreaTest::~MergeContactSelectInformationScrol
void
MergeContactSelectInformationScrollAreaTest
::
shouldHaveDefaultValue
()
{
KABMergeContacts
::
MergeContactSelectInformationScrollArea
w
;
QScrollArea
*
area
=
w
.
findChild
<
QScrollArea
*>
(
QStringLiteral
(
"scrollarea"
));
auto
area
=
w
.
findChild
<
QScrollArea
*>
(
QStringLiteral
(
"scrollarea"
));
QVERIFY
(
area
);
QPushButton
*
mergeButton
=
w
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"merge"
));
auto
mergeButton
=
w
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"merge"
));
QVERIFY
(
mergeButton
);
QStackedWidget
*
stackedwidget
=
w
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackwidget"
));
auto
stackedwidget
=
w
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackwidget"
));
QVERIFY
(
stackedwidget
);
KABMergeContacts
::
MergeContactSelectInformationWidget
*
widget
=
w
.
findChild
<
KABMergeContacts
::
MergeContactSelectInformationWidget
*>
(
QStringLiteral
(
"selectinformationwidget"
));
auto
widget
=
w
.
findChild
<
KABMergeContacts
::
MergeContactSelectInformationWidget
*>
(
QStringLiteral
(
"selectinformationwidget"
));
QVERIFY
(
widget
);
for
(
int
i
=
0
;
i
<
stackedwidget
->
count
();
++
i
)
{
...
...
kaddressbook/plugins/mergelib/autotests/mergecontactselectlistwidgettest.cpp
View file @
eac7e8f9
...
...
@@ -24,9 +24,9 @@ void MergeContactSelectListWidgetTest::shouldHaveDefaultValue()
{
KABMergeContacts
::
MergeContactSelectListWidget
selectListWidget
;
QLabel
*
title
=
selectListWidget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"title"
));
auto
title
=
selectListWidget
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"title"
));
QVERIFY
(
title
);
QListWidget
*
listWidget
=
selectListWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listwidget"
));
auto
listWidget
=
selectListWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listwidget"
));
QVERIFY
(
listWidget
);
QCOMPARE
(
selectListWidget
.
selectedContact
(),
-
1
);
QCOMPARE
(
selectListWidget
.
conflictType
(),
KABMergeContacts
::
MergeContacts
::
None
);
...
...
kaddressbook/plugins/mergelib/autotests/mergecontactwidgettest.cpp
View file @
eac7e8f9
...
...
@@ -31,14 +31,14 @@ MergeContactWidgetTest::MergeContactWidgetTest()
qRegisterMetaType
<
Akonadi
::
Item
>
();
qRegisterMetaType
<
Akonadi
::
Collection
>
();
QStandardItemModel
*
model
=
new
QStandardItemModel
;
auto
model
=
new
QStandardItemModel
;
for
(
int
id
=
42
;
id
<
51
;
++
id
)
{
Akonadi
::
Collection
collection
(
id
);
collection
.
setRights
(
Akonadi
::
Collection
::
AllRights
);
collection
.
setName
(
QString
::
number
(
id
));
collection
.
setContentMimeTypes
(
QStringList
()
<<
KContacts
::
Addressee
::
mimeType
());
QStandardItem
*
item
=
new
QStandardItem
(
collection
.
name
());
auto
item
=
new
QStandardItem
(
collection
.
name
());
item
->
setData
(
QVariant
::
fromValue
(
collection
),
Akonadi
::
EntityTreeModel
::
CollectionRole
);
item
->
setData
(
QVariant
::
fromValue
(
collection
.
id
()),
Akonadi
::
EntityTreeModel
::
CollectionIdRole
);
...
...
@@ -63,17 +63,17 @@ Akonadi::Item::List MergeContactWidgetTest::createItems()
void
MergeContactWidgetTest
::
shouldHaveDefaultValueOnCreation
()
{
MergeContactWidget
mergeWidget
;
QListWidget
*
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
auto
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
QVERIFY
(
listWidget
);
QCOMPARE
(
listWidget
->
count
(),
0
);
QPushButton
*
button
=
mergeWidget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"mergebutton"
));
auto
button
=
mergeWidget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"mergebutton"
));
QVERIFY
(
button
);
QCOMPARE
(
button
->
isEnabled
(),
false
);
MergeContactLoseInformationWarning
*
warningWidget
=
mergeWidget
.
findChild
<
MergeContactLoseInformationWarning
*>
(
QStringLiteral
(
"mergecontactwarning"
));
auto
warningWidget
=
mergeWidget
.
findChild
<
MergeContactLoseInformationWarning
*>
(
QStringLiteral
(
"mergecontactwarning"
));
QVERIFY
(
warningWidget
);
QVERIFY
(
warningWidget
->
isHidden
());
QSplitter
*
splitter
=
mergeWidget
.
findChild
<
QSplitter
*>
(
QStringLiteral
(
"splitter"
));
auto
splitter
=
mergeWidget
.
findChild
<
QSplitter
*>
(
QStringLiteral
(
"splitter"
));
QVERIFY
(
splitter
);
QVERIFY
(
!
splitter
->
childrenCollapsible
());
for
(
int
i
=
0
;
i
<
splitter
->
count
();
++
i
)
{
...
...
@@ -88,10 +88,10 @@ void MergeContactWidgetTest::shouldFillList()
{
MergeContactWidget
mergeWidget
;
mergeWidget
.
setContacts
(
createItems
());
QListWidget
*
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
auto
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
QCOMPARE
(
listWidget
->
count
(),
10
);
QCOMPARE
(
listWidget
->
selectedItems
().
count
(),
0
);
QPushButton
*
button
=
mergeWidget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"mergebutton"
));
auto
button
=
mergeWidget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"mergebutton"
));
QCOMPARE
(
button
->
isEnabled
(),
false
);
}
...
...
@@ -102,7 +102,7 @@ void MergeContactWidgetTest::shouldFillListWithValidItem()
lst
.
append
(
Akonadi
::
Item
(
25
));
MergeContactWidget
mergeWidget
;
mergeWidget
.
setContacts
(
lst
);
QListWidget
*
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
auto
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
QCOMPARE
(
listWidget
->
count
(),
10
);
}
...
...
@@ -110,8 +110,8 @@ void MergeContactWidgetTest::shouldEnableButton()
{
MergeContactWidget
mergeWidget
;
mergeWidget
.
setContacts
(
createItems
());
QListWidget
*
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
QPushButton
*
button
=
mergeWidget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"mergebutton"
));
auto
listWidget
=
mergeWidget
.
findChild
<
QListWidget
*>
(
QStringLiteral
(
"listcontact"
));
auto
button
=
mergeWidget
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"mergebutton"
));
mergeWidget
.
show
();
QVERIFY
(
QTest
::
qWaitForWindowExposed
(
&
mergeWidget
));
listWidget
->
item
(
0
)
->
setCheckState
(
Qt
::
Checked
);
...
...
kaddressbook/plugins/mergelib/autotests/resultduplicatetreewidgettest.cpp
View file @
eac7e8f9
...
...
@@ -111,7 +111,7 @@ void ResultDuplicateTreeWidgetTest::shouldReturnNotEmptyContactList()
const
int
childCount
=
item
->
childCount
();
if
(
childCount
>
0
)
{
for
(
int
child
=
0
;
child
<
childCount
;
++
child
)
{
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
auto
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
childItem
->
setCheckState
(
0
,
Qt
::
Checked
);
}
}
...
...
@@ -139,7 +139,7 @@ void ResultDuplicateTreeWidgetTest::shouldNotReturnListWhenJustOneChildSelected(
const
int
childCount
=
item
->
childCount
();
if
(
childCount
>
0
)
{
for
(
int
child
=
0
;
child
<
childCount
;
++
child
)
{
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
auto
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
childItem
->
setCheckState
(
0
,
child
==
0
?
Qt
::
Checked
:
Qt
::
Unchecked
);
}
}
...
...
@@ -168,7 +168,7 @@ void ResultDuplicateTreeWidgetTest::shouldReturnTwoLists()
const
int
childCount
=
item
->
childCount
();
if
(
childCount
>
0
)
{
for
(
int
child
=
0
;
child
<
childCount
;
++
child
)
{
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
auto
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
childItem
->
setCheckState
(
0
,
Qt
::
Checked
);
QVERIFY
(
childItem
->
item
().
isValid
());
}
...
...
@@ -199,7 +199,7 @@ void ResultDuplicateTreeWidgetTest::shouldReturnJustOnList()
const
int
childCount
=
item
->
childCount
();
if
(
childCount
>
0
)
{
for
(
int
child
=
0
;
child
<
childCount
;
++
child
)
{
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
auto
childItem
=
static_cast
<
KABMergeContacts
::
ResultDuplicateTreeWidgetItem
*>
(
item
->
child
(
child
));
childItem
->
setCheckState
(
0
,
firstList
?
Qt
::
Checked
:
Qt
::
Unchecked
);
}
}
...
...
kaddressbook/plugins/mergelib/autotests/searchandmergecontactduplicatecontactdialogtest.cpp
View file @
eac7e8f9
...
...
@@ -28,7 +28,7 @@ void SearchAndMergeContactDuplicateContactDialogTest::shouldHaveDefaultValueOnCr
{
SearchAndMergeContactDuplicateContactDialog
dlg
;
dlg
.
show
();
QStackedWidget
*
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QVERIFY
(
stackedWidget
);
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"nocontactselected"
));
...
...
@@ -49,7 +49,7 @@ void SearchAndMergeContactDuplicateContactDialogTest::shouldShowNoEnoughPageWhen
lst
<<
Akonadi
::
Item
(
42
);
dlg
.
searchPotentialDuplicateContacts
(
lst
);
dlg
.
show
();
QStackedWidget
*
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QVERIFY
(
stackedWidget
);
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"noenoughcontactselected"
));
}
...
...
@@ -60,7 +60,7 @@ void SearchAndMergeContactDuplicateContactDialogTest::shouldShowNoContactWhenLis
Akonadi
::
Item
::
List
lst
;
dlg
.
searchPotentialDuplicateContacts
(
lst
);
dlg
.
show
();
QStackedWidget
*
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
auto
stackedWidget
=
dlg
.
findChild
<
QStackedWidget
*>
(
QStringLiteral
(
"stackedwidget"
));
QVERIFY
(
stackedWidget
);
QCOMPARE
(
stackedWidget
->
currentWidget
()
->
objectName
(),
QStringLiteral
(
"nocontactselected"
));
}
...
...
kaddressbook/plugins/mergelib/autotests/searchduplicateresultwidgettest.cpp
View file @
eac7e8f9
...
...
@@ -28,14 +28,14 @@ QAbstractItemModel *_k_searchDuplicateResultStubModel = nullptr;
SearchDuplicateResultWidgetTest
::
SearchDuplicateResultWidgetTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
QStandardItemModel
*
model
=
new
QStandardItemModel
;
auto
model
=
new
QStandardItemModel
;
for
(
int
id
=
42
;
id
<
51
;
++
id
)
{
Akonadi
::
Collection
collection
(
id
);
collection
.
setRights
(
Akonadi
::
Collection
::
AllRights
);
collection
.
setName
(
QString
::
number
(
id
));
collection
.
setContentMimeTypes
(
QStringList
()
<<
Addressee
::
mimeType
());
QStandardItem
*
item
=
new
QStandardItem
(
collection
.
name
());
auto
item
=
new
QStandardItem
(
collection
.
name
());
item
->
setData
(
QVariant
::
fromValue
(
collection
),
Akonadi
::
EntityTreeModel
::
CollectionRole
);
item
->
setData
(
QVariant
::
fromValue
(
collection
.
id
()),
Akonadi
::
EntityTreeModel
::
CollectionIdRole
);
...
...
@@ -53,32 +53,31 @@ void SearchDuplicateResultWidgetTest::shouldHaveDefaultValue()
KABMergeContacts
::
SearchDuplicateResultWidget
w
;
QCOMPARE
(
w
.
layout
()
->
contentsMargins
(),
QMargins
(
0
,
0
,
0
,
0
));
KABMergeContacts
::
ResultDuplicateTreeWidget
*
tree
=
w
.
findChild
<
KABMergeContacts
::
ResultDuplicateTreeWidget
*>
(
QStringLiteral
(
"result_treewidget"
));
auto
tree
=
w
.
findChild
<
KABMergeContacts
::
ResultDuplicateTreeWidget
*>
(
QStringLiteral
(
"result_treewidget"
));
QVERIFY
(
tree
);
QCOMPARE
(
tree
->
topLevelItemCount
(),
0
);
QSplitter
*
splitter
=
w
.
findChild
<
QSplitter
*>
(
QStringLiteral
(
"splitter"
));
auto
splitter
=
w
.
findChild
<
QSplitter
*>
(
QStringLiteral
(
"splitter"
));
QVERIFY
(
splitter
);
QVERIFY
(
!
splitter
->
childrenCollapsible
());
KAddressBookGrantlee
::
GrantleeContactViewer
*
viewer
=
w
.
findChild
<
KAddressBookGrantlee
::
GrantleeContactViewer
*>
(
QStringLiteral
(
"contact_viewer"
));
auto
viewer
=
w
.
findChild
<
KAddressBookGrantlee
::
GrantleeContactViewer
*>
(
QStringLiteral
(
"contact_viewer"
));
QVERIFY
(
viewer
);
QLabel
*
lab
=
w
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"select_addressbook_label"
));
auto
lab
=
w
.
findChild
<
QLabel
*>
(
QStringLiteral
(
"select_addressbook_label"
));
lab
->
setObjectName
(
QStringLiteral
(
"select_addressbook_label"
));
QPushButton
*
pushButton
=
w
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"merge_contact_button"
));
auto
pushButton
=
w
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"merge_contact_button"
));
QVERIFY
(
pushButton
);
QVERIFY
(
!
pushButton
->
isEnabled
());
KABMergeContacts
::
MergeContactLoseInformationWarning
*
warning
=
w
.
findChild
<
KABMergeContacts
::
MergeContactLoseInformationWarning
*>
(
QStringLiteral
(
"mergecontactwarning"
));
auto
warning
=
w
.
findChild
<
KABMergeContacts
::
MergeContactLoseInformationWarning
*>
(
QStringLiteral
(
"mergecontactwarning"
));
QVERIFY
(
warning
);
Akonadi
::
CollectionComboBox
*
combobox
=
w
.
findChild
<
Akonadi
::
CollectionComboBox
*>
(
QStringLiteral
(
"akonadicombobox"
));
auto
combobox
=
w
.
findChild
<
Akonadi
::
CollectionComboBox
*>
(
QStringLiteral
(
"akonadicombobox"
));
QVERIFY
(
combobox
);
}
void
SearchDuplicateResultWidgetTest
::
shouldHaveMergeButtonEnabled
()
{
KABMergeContacts
::
SearchDuplicateResultWidget
w
;
KABMergeContacts
::
ResultDuplicateTreeWidget
*
tree
=
w
.
findChild
<
KABMergeContacts
::
ResultDuplicateTreeWidget
*>
(
QStringLiteral
(
"result_treewidget"
));
auto
tree
=
w
.
findChild
<
KABMergeContacts
::
ResultDuplicateTreeWidget
*>
(
QStringLiteral
(
"result_treewidget"
));
QVERIFY
(
tree
);
QCOMPARE
(
tree
->
topLevelItemCount
(),
0
);
Akonadi
::
Item
::
List
lst
;
...
...
Prev
1
2
3
4
5
…
10
Next
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