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
PIM Calendar Support
Commits
3f2865bf
Commit
3f2865bf
authored
Nov 02, 2020
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modernize code
parent
84cd8233
Pipeline
#39281
passed with stage
in 11 minutes and 16 seconds
Changes
18
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
83 additions
and
83 deletions
+83
-83
src/archivedialog.cpp
src/archivedialog.cpp
+6
-6
src/attachmenthandler.cpp
src/attachmenthandler.cpp
+4
-4
src/autotests/noteeditdialogtest.cpp
src/autotests/noteeditdialogtest.cpp
+24
-24
src/eventarchiver.cpp
src/eventarchiver.cpp
+1
-1
src/freebusymodel/autotests/testfreebusyitemmodel.cpp
src/freebusymodel/autotests/testfreebusyitemmodel.cpp
+3
-3
src/freebusymodel/autotests/testfreeperiodmodel.cpp
src/freebusymodel/autotests/testfreeperiodmodel.cpp
+2
-2
src/freebusymodel/freebusyitemmodel.cpp
src/freebusymodel/freebusyitemmodel.cpp
+5
-5
src/incidenceattachmentmodel.cpp
src/incidenceattachmentmodel.cpp
+1
-1
src/kcalprefs.cpp
src/kcalprefs.cpp
+2
-2
src/messagewidget.cpp
src/messagewidget.cpp
+1
-1
src/next/incidenceviewer.cpp
src/next/incidenceviewer.cpp
+2
-2
src/noteeditdialog.cpp
src/noteeditdialog.cpp
+3
-3
src/printing/calprintdefaultplugins.cpp
src/printing/calprintdefaultplugins.cpp
+13
-13
src/printing/calprinter.cpp
src/printing/calprinter.cpp
+4
-4
src/printing/calprintpluginbase.cpp
src/printing/calprintpluginbase.cpp
+4
-4
src/printing/journalprint.cpp
src/printing/journalprint.cpp
+3
-3
src/printing/yearprint.cpp
src/printing/yearprint.cpp
+3
-3
src/tagcache.cpp
src/tagcache.cpp
+2
-2
No files found.
src/archivedialog.cpp
View file @
3f2865bf
...
...
@@ -40,7 +40,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
:
QDialog
(
parent
)
{
setWindowTitle
(
i18nc
(
"@title:window"
,
"Archive/Delete Past Events and To-dos"
));
QVBoxLayo
ut
*
mainLayout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
mainLayout
=
new
QVBoxLayout
(
this
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Cancel
,
this
);
mUser1Button
=
new
QPushButton
;
buttonBox
->
addButton
(
mUser1Button
,
QDialogButtonBox
::
ActionRole
);
...
...
@@ -55,7 +55,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
mainLayout
->
addWidget
(
topFrame
);
mainLayout
->
addWidget
(
buttonBox
);
QVBoxLayo
ut
*
topLayout
=
new
QVBoxLayout
(
topFrame
);
a
ut
o
*
topLayout
=
new
QVBoxLayout
(
topFrame
);
topLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QLabel
*
descLabel
=
new
QLabel
(
topFrame
);
descLabel
->
setText
(
...
...
@@ -78,11 +78,11 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
topLayout
->
addWidget
(
descLabel
);
connect
(
descLabel
,
&
QLabel
::
linkActivated
,
this
,
&
ArchiveDialog
::
showWhatsThis
);
QButtonGroup
*
radioBG
=
new
QButtonGroup
(
this
);
auto
*
radioBG
=
new
QButtonGroup
(
this
);
connect
(
radioBG
,
QOverload
<
QAbstractButton
*>::
of
(
&
QButtonGroup
::
buttonClicked
),
this
,
&
ArchiveDialog
::
slotActionChanged
);
QHBoxLayo
ut
*
dateLayout
=
new
QHBoxLayout
();
a
ut
o
*
dateLayout
=
new
QHBoxLayout
();
dateLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
mArchiveOnceRB
=
new
QRadioButton
(
i18nc
(
"@option:radio"
,
"Archive now items older than:"
),
...
...
@@ -114,7 +114,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
// Checkbox, numinput and combo for auto-archiving (similar to kmail's
// mExpireFolderCheckBox/mReadExpiryTimeNumInput in kmfolderdia.cpp)
QWidget
*
autoArchiveHBox
=
new
QWidget
(
topFrame
);
QHBoxLayo
ut
*
autoArchiveHBoxHBoxLayout
=
new
QHBoxLayout
(
autoArchiveHBox
);
a
ut
o
*
autoArchiveHBoxHBoxLayout
=
new
QHBoxLayout
(
autoArchiveHBox
);
autoArchiveHBoxHBoxLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
topLayout
->
addWidget
(
autoArchiveHBox
);
mAutoArchiveRB
=
new
QRadioButton
(
i18nc
(
"@option:radio"
,
...
...
@@ -163,7 +163,7 @@ ArchiveDialog::ArchiveDialog(const Akonadi::ETMCalendar::Ptr &cal, Akonadi::Inci
i18nc
(
"@item:inlistbox expiration in monthly units"
,
"Month(s)"
));
mExpiryUnitsComboBox
->
setEnabled
(
false
);
QHBoxLayo
ut
*
fileLayout
=
new
QHBoxLayout
();
a
ut
o
*
fileLayout
=
new
QHBoxLayout
();
fileLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QLabel
*
l
=
new
QLabel
(
i18nc
(
"@label"
,
"Archive &file:"
),
topFrame
);
fileLayout
->
addWidget
(
l
);
...
...
src/attachmenthandler.cpp
View file @
3f2865bf
...
...
@@ -200,7 +200,7 @@ void AttachmentHandler::view(const QString &attachmentName, const QString &uid)
{
Item
item
;
item
.
setGid
(
uid
);
ItemFetchJob
*
job
=
new
ItemFetchJob
(
item
);
auto
*
job
=
new
ItemFetchJob
(
item
);
connect
(
job
,
&
ItemFetchJob
::
result
,
this
,
&
AttachmentHandler
::
slotFinishView
);
ReceivedInfo
info
;
info
.
attachmentName
=
attachmentName
;
...
...
@@ -258,7 +258,7 @@ void AttachmentHandler::saveAs(const QString &attachmentName, const QString &uid
{
Item
item
;
item
.
setGid
(
uid
);
ItemFetchJob
*
job
=
new
ItemFetchJob
(
item
);
auto
*
job
=
new
ItemFetchJob
(
item
);
connect
(
job
,
&
ItemFetchJob
::
result
,
this
,
&
AttachmentHandler
::
slotFinishView
);
ReceivedInfo
info
;
...
...
@@ -278,7 +278,7 @@ void AttachmentHandler::slotFinishSaveAs(KJob *job)
bool
success
=
false
;
if
(
job
->
error
()
!=
0
)
{
ItemFetchJob
*
fetchJob
=
qobject_cast
<
ItemFetchJob
*>
(
job
);
auto
*
fetchJob
=
qobject_cast
<
ItemFetchJob
*>
(
job
);
const
Item
::
List
items
=
fetchJob
->
items
();
if
(
!
items
.
isEmpty
())
{
Incidence
::
Ptr
incidence
=
CalendarSupport
::
incidence
(
items
.
first
());
...
...
@@ -300,7 +300,7 @@ void AttachmentHandler::slotFinishView(KJob *job)
bool
success
=
false
;
if
(
job
->
error
())
{
ItemFetchJob
*
fetchJob
=
qobject_cast
<
ItemFetchJob
*>
(
job
);
auto
*
fetchJob
=
qobject_cast
<
ItemFetchJob
*>
(
job
);
const
Item
::
List
items
=
fetchJob
->
items
();
if
(
!
items
.
isEmpty
())
{
Incidence
::
Ptr
incidence
=
CalendarSupport
::
incidence
(
items
.
first
());
...
...
src/autotests/noteeditdialogtest.cpp
View file @
3f2865bf
...
...
@@ -30,7 +30,7 @@ NoteEditDialogTest::NoteEditDialogTest()
qRegisterMetaType
<
Akonadi
::
Item
>
();
qRegisterMetaType
<
KMime
::
Message
::
Ptr
>
();
QStandardItemModel
*
model
=
new
QStandardItemModel
;
auto
*
model
=
new
QStandardItemModel
;
for
(
int
id
=
42
;
id
<
51
;
++
id
)
{
Akonadi
::
Collection
collection
(
id
);
collection
.
setRights
(
Akonadi
::
Collection
::
AllRights
);
...
...
@@ -52,10 +52,10 @@ void NoteEditDialogTest::shouldHaveDefaultValuesOnCreation()
{
NoteEditDialog
edit
;
QVERIFY
(
!
edit
.
note
());
QLineEdit
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
KPIMTextEdit
::
RichTextEditorWidget
*
notetext
auto
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
auto
*
notetext
=
edit
.
findChild
<
KPIMTextEdit
::
RichTextEditorWidget
*>
(
QStringLiteral
(
"notetext"
));
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QVERIFY
(
notetitle
);
QCOMPARE
(
notetitle
->
text
(),
QString
());
QVERIFY
(
notetext
);
...
...
@@ -112,8 +112,8 @@ void NoteEditDialogTest::shouldHaveFilledText()
item
.
setPayload
(
note
.
message
());
edit
.
load
(
item
);
QLineEdit
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
KPIMTextEdit
::
RichTextEditorWidget
*
notetext
auto
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
auto
*
notetext
=
edit
.
findChild
<
KPIMTextEdit
::
RichTextEditorWidget
*>
(
QStringLiteral
(
"notetext"
));
QCOMPARE
(
notetitle
->
text
(),
title
);
QCOMPARE
(
notetext
->
toPlainText
(),
text
);
...
...
@@ -133,7 +133,7 @@ void NoteEditDialogTest::shouldHaveRichText()
item
.
setPayload
(
note
.
message
());
edit
.
load
(
item
);
KPIMTextEdit
::
RichTextEditorWidget
*
notetext
auto
*
notetext
=
edit
.
findChild
<
KPIMTextEdit
::
RichTextEditorWidget
*>
(
QStringLiteral
(
"notetext"
));
QCOMPARE
(
notetext
->
toPlainText
(),
text
);
QVERIFY
(
notetext
->
editor
()
->
acceptRichText
());
...
...
@@ -142,7 +142,7 @@ void NoteEditDialogTest::shouldHaveRichText()
void
NoteEditDialogTest
::
shouldDefaultCollectionIsValid
()
{
NoteEditDialog
edit
;
Akonadi
::
CollectionComboBox
*
akonadicombobox
=
auto
*
akonadicombobox
=
edit
.
findChild
<
Akonadi
::
CollectionComboBox
*>
(
QStringLiteral
(
"akonadicombobox"
));
QVERIFY
(
akonadicombobox
);
QVERIFY
(
akonadicombobox
->
currentCollection
().
isValid
());
...
...
@@ -151,7 +151,7 @@ void NoteEditDialogTest::shouldDefaultCollectionIsValid()
void
NoteEditDialogTest
::
shouldEmitCollectionChangedWhenCurrentCollectionWasChanged
()
{
NoteEditDialog
edit
;
Akonadi
::
CollectionComboBox
*
akonadicombobox
=
auto
*
akonadicombobox
=
edit
.
findChild
<
Akonadi
::
CollectionComboBox
*>
(
QStringLiteral
(
"akonadicombobox"
));
akonadicombobox
->
setCurrentIndex
(
0
);
QCOMPARE
(
akonadicombobox
->
currentIndex
(),
0
);
...
...
@@ -164,7 +164,7 @@ void NoteEditDialogTest::shouldEmitCollectionChangedWhenCurrentCollectionWasChan
void
NoteEditDialogTest
::
shouldEmitCorrectCollection
()
{
NoteEditDialog
edit
;
Akonadi
::
CollectionComboBox
*
akonadicombobox
=
auto
*
akonadicombobox
=
edit
.
findChild
<
Akonadi
::
CollectionComboBox
*>
(
QStringLiteral
(
"akonadicombobox"
));
Akonadi
::
NoteUtils
::
NoteMessageWrapper
note
;
...
...
@@ -180,7 +180,7 @@ void NoteEditDialogTest::shouldEmitCorrectCollection()
akonadicombobox
->
setCurrentIndex
(
3
);
Akonadi
::
Collection
col
=
akonadicombobox
->
currentCollection
();
QSignalSpy
spy
(
&
edit
,
&
NoteEditDialog
::
createNote
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
1
);
QCOMPARE
(
spy
.
at
(
0
).
at
(
1
).
value
<
Akonadi
::
Collection
>
(),
col
);
...
...
@@ -196,9 +196,9 @@ void NoteEditDialogTest::shouldNotEmitNoteWhenTitleIsEmpty()
edit
.
load
(
item
);
QSignalSpy
spy
(
&
edit
,
&
NoteEditDialog
::
createNote
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QLineEdit
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
auto
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
notetitle
->
setText
(
QString
());
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
0
);
...
...
@@ -217,15 +217,15 @@ void NoteEditDialogTest::shouldNotEmitNoteWhenTextIsEmpty()
edit
.
load
(
item
);
QSignalSpy
spy
(
&
edit
,
&
NoteEditDialog
::
createNote
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
//Need to set title to empty, 'cause NoteUtils uses default title: "New Note"
QLineEdit
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
auto
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
notetitle
->
setText
(
QString
());
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
0
);
KPIMTextEdit
::
RichTextEditorWidget
*
notetext
auto
*
notetext
=
edit
.
findChild
<
KPIMTextEdit
::
RichTextEditorWidget
*>
(
QStringLiteral
(
"notetext"
));
notetext
->
editor
()
->
setText
(
QStringLiteral
(
"F"
));
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
...
...
@@ -244,14 +244,14 @@ void NoteEditDialogTest::shouldNoteHasCorrectText()
edit
.
load
(
item
);
QSignalSpy
spy
(
&
edit
,
&
NoteEditDialog
::
createNote
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
1
);
Akonadi
::
NoteUtils
::
NoteMessageWrapper
rNote
(
spy
.
at
(
0
).
at
(
0
).
value
<
Akonadi
::
Item
>
().
payload
<
KMime
::
Message
::
Ptr
>
());
QCOMPARE
(
rNote
.
text
(),
text
);
KPIMTextEdit
::
RichTextEditorWidget
*
notetext
auto
*
notetext
=
edit
.
findChild
<
KPIMTextEdit
::
RichTextEditorWidget
*>
(
QStringLiteral
(
"notetext"
));
QString
text2
=
QStringLiteral
(
"F"
);
notetext
->
editor
()
->
setText
(
text2
);
...
...
@@ -274,14 +274,14 @@ void NoteEditDialogTest::shouldNoteHasCorrectTitle()
edit
.
load
(
item
);
QSignalSpy
spy
(
&
edit
,
&
NoteEditDialog
::
createNote
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
1
);
Akonadi
::
NoteUtils
::
NoteMessageWrapper
rNote
(
spy
.
at
(
0
).
at
(
0
).
value
<
Akonadi
::
Item
>
().
payload
<
KMime
::
Message
::
Ptr
>
());
QCOMPARE
(
rNote
.
title
(),
text
);
QLineEdit
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
auto
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
QString
text2
=
QStringLiteral
(
"F"
);
notetitle
->
setText
(
text2
);
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
...
...
@@ -303,14 +303,14 @@ void NoteEditDialogTest::shouldNoteHasCorrectTextFormat()
edit
.
load
(
item
);
QSignalSpy
spy
(
&
edit
,
&
NoteEditDialog
::
createNote
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
1
);
Akonadi
::
NoteUtils
::
NoteMessageWrapper
rNote
(
spy
.
at
(
0
).
at
(
0
).
value
<
Akonadi
::
Item
>
().
payload
<
KMime
::
Message
::
Ptr
>
());
QCOMPARE
(
rNote
.
textFormat
(),
Qt
::
PlainText
);
KPIMTextEdit
::
RichTextEditorWidget
*
notetext
auto
*
notetext
=
edit
.
findChild
<
KPIMTextEdit
::
RichTextEditorWidget
*>
(
QStringLiteral
(
"notetext"
));
notetext
->
editor
()
->
setAcceptRichText
(
true
);
QTest
::
mouseClick
(
ok
,
Qt
::
LeftButton
);
...
...
@@ -332,8 +332,8 @@ void NoteEditDialogTest::shouldShouldEnabledSaveEditorButton()
edit
.
load
(
item
);
QPushBut
to
n
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
QLineEdit
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
au
to
*
ok
=
edit
.
findChild
<
QPushButton
*>
(
QStringLiteral
(
"save-button"
));
auto
*
notetitle
=
edit
.
findChild
<
QLineEdit
*>
(
QStringLiteral
(
"notetitle"
));
QCOMPARE
(
ok
->
isEnabled
(),
true
);
notetitle
->
clear
();
...
...
src/eventarchiver.cpp
View file @
3f2865bf
...
...
@@ -197,7 +197,7 @@ void EventArchiver::archiveIncidences(const Akonadi::ETMCalendar::Ptr &calendar,
FileStorage
archiveStore
(
archiveCalendar
);
archiveStore
.
setFileName
(
tmpFileName
);
ICalFormat
*
format
=
new
ICalFormat
();
auto
*
format
=
new
ICalFormat
();
archiveStore
.
setSaveFormat
(
format
);
if
(
!
archiveStore
.
load
())
{
qCDebug
(
CALENDARSUPPORT_LOG
)
<<
"Can't load calendar from temp file"
;
...
...
src/freebusymodel/autotests/testfreebusyitemmodel.cpp
View file @
3f2865bf
...
...
@@ -22,7 +22,7 @@ QTEST_GUILESS_MAIN(FreeBusyItemModelTest)
void
FreeBusyItemModelTest
::
testModelValidity
()
{
FreeBusyItemModel
*
model
=
new
FreeBusyItemModel
(
this
);
auto
*
model
=
new
FreeBusyItemModel
(
this
);
new
QAbstractItemModelTester
(
model
,
this
);
QVERIFY
(
model
->
rowCount
()
==
0
);
...
...
@@ -75,7 +75,7 @@ void FreeBusyItemModelTest::testModelValidity()
void
FreeBusyItemModelTest
::
testModelValidity2
()
{
FreeBusyItemModel
*
model
=
new
FreeBusyItemModel
(
this
);
auto
*
model
=
new
FreeBusyItemModel
(
this
);
new
QAbstractItemModelTester
(
model
,
this
);
const
QDateTime
dt1
(
QDate
(
2010
,
7
,
24
),
QTime
(
7
,
0
,
0
),
Qt
::
UTC
);
...
...
@@ -198,7 +198,7 @@ void FreeBusyItemModelTest::testModelValidity2()
void
FreeBusyItemModelTest
::
testInsertFreeBusy
()
{
FreeBusyItemModel
*
model
=
new
FreeBusyItemModel
(
this
);
auto
*
model
=
new
FreeBusyItemModel
(
this
);
new
QAbstractItemModelTester
(
model
,
this
);
const
QDateTime
dt1
(
QDate
(
2010
,
7
,
24
),
QTime
(
7
,
0
,
0
),
Qt
::
UTC
);
...
...
src/freebusymodel/autotests/testfreeperiodmodel.cpp
View file @
3f2865bf
...
...
@@ -22,7 +22,7 @@ QTEST_GUILESS_MAIN(FreePeriodModelTest)
void
FreePeriodModelTest
::
testModelValidity
()
{
FreePeriodModel
*
model
=
new
FreePeriodModel
(
this
);
auto
*
model
=
new
FreePeriodModel
(
this
);
new
QAbstractItemModelTester
(
model
,
this
);
const
QDateTime
dt1
(
QDate
(
2010
,
7
,
24
),
QTime
(
7
,
0
,
0
),
Qt
::
UTC
);
...
...
@@ -40,7 +40,7 @@ void FreePeriodModelTest::testModelValidity()
void
FreePeriodModelTest
::
testSplitByDay
()
{
FreePeriodModel
*
model
=
new
FreePeriodModel
(
this
);
auto
*
model
=
new
FreePeriodModel
(
this
);
new
QAbstractItemModelTester
(
model
,
this
);
const
QDateTime
startDt
(
QDate
(
2010
,
7
,
24
),
QTime
(
8
,
0
,
0
),
Qt
::
UTC
);
...
...
src/freebusymodel/freebusyitemmodel.cpp
View file @
3f2865bf
...
...
@@ -109,7 +109,7 @@ QVariant FreeBusyItemModel::data(const QModelIndex &index, int role) const
return
QVariant
();
}
ItemPrivateData
*
data
=
(
ItemPrivateData
*
)
index
.
internalPointer
();
auto
*
data
=
(
ItemPrivateData
*
)
index
.
internalPointer
();
if
(
data
->
parent
()
==
d
->
mRootData
)
{
int
row
=
index
.
row
();
...
...
@@ -200,7 +200,7 @@ QModelIndex FreeBusyItemModel::parent(const QModelIndex &child) const
return
QModelIndex
();
}
ItemPrivateData
*
childData
=
static_cast
<
ItemPrivateData
*>
(
child
.
internalPointer
());
auto
*
childData
=
static_cast
<
ItemPrivateData
*>
(
child
.
internalPointer
());
ItemPrivateData
*
parentData
=
childData
->
parent
();
if
(
parentData
==
d
->
mRootData
)
{
return
QModelIndex
();
...
...
@@ -222,7 +222,7 @@ void FreeBusyItemModel::addItem(const FreeBusyItem::Ptr &freebusy)
int
row
=
d
->
mFreeBusyItems
.
size
();
beginInsertRows
(
QModelIndex
(),
row
,
row
);
d
->
mFreeBusyItems
.
append
(
freebusy
);
ItemPrivateData
*
data
=
new
ItemPrivateData
(
d
->
mRootData
);
auto
*
data
=
new
ItemPrivateData
(
d
->
mRootData
);
d
->
mRootData
->
appendChild
(
data
);
endInsertRows
();
...
...
@@ -239,7 +239,7 @@ void FreeBusyItemModel::setFreeBusyPeriods(const QModelIndex &parent, const KCal
return
;
}
ItemPrivateData
*
parentData
=
static_cast
<
ItemPrivateData
*>
(
parent
.
internalPointer
());
auto
*
parentData
=
static_cast
<
ItemPrivateData
*>
(
parent
.
internalPointer
());
int
fb_count
=
list
.
size
();
int
childCount
=
parentData
->
childCount
();
QModelIndex
first
=
index
(
0
,
0
,
parent
);
...
...
@@ -258,7 +258,7 @@ void FreeBusyItemModel::setFreeBusyPeriods(const QModelIndex &parent, const KCal
}
else
if
(
fb_count
>
childCount
)
{
beginInsertRows
(
parent
,
childCount
,
fb_count
-
1
);
for
(
int
i
=
childCount
;
i
<
fb_count
;
++
i
)
{
ItemPrivateData
*
childData
=
new
ItemPrivateData
(
parentData
);
auto
*
childData
=
new
ItemPrivateData
(
parentData
);
parentData
->
appendChild
(
childData
);
}
endInsertRows
();
...
...
src/incidenceattachmentmodel.cpp
View file @
3f2865bf
...
...
@@ -133,7 +133,7 @@ void IncidenceAttachmentModel::setItem(const Akonadi::Item &item)
{
Q_D
(
IncidenceAttachmentModel
);
if
(
!
item
.
hasPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
())
{
ItemFetchJob
*
job
=
new
ItemFetchJob
(
item
);
auto
*
job
=
new
ItemFetchJob
(
item
);
job
->
fetchScope
().
fetchFullPayload
(
true
);
connect
(
job
,
SIGNAL
(
itemsReceived
(
Akonadi
::
Item
::
List
)),
SLOT
(
itemFetched
(
Akonadi
::
Item
::
List
)));
...
...
src/kcalprefs.cpp
View file @
3f2865bf
...
...
@@ -265,7 +265,7 @@ bool KCalPrefs::thatIsMe(const QString &_email)
void
KCalPrefs
::
setCategoryColor
(
const
QString
&
cat
,
const
QColor
&
color
)
{
Akonadi
::
Tag
tag
=
d
->
mTagCache
.
getTagByName
(
cat
);
Akonadi
::
TagAttrib
ut
e
*
attr
=
tag
.
attribute
<
Akonadi
::
TagAttribute
>
(
Akonadi
::
Tag
::
AddIfMissing
);
a
ut
o
*
attr
=
tag
.
attribute
<
Akonadi
::
TagAttribute
>
(
Akonadi
::
Tag
::
AddIfMissing
);
attr
->
setBackgroundColor
(
color
);
new
Akonadi
::
TagModifyJob
(
tag
);
}
...
...
@@ -276,7 +276,7 @@ QColor KCalPrefs::categoryColor(const QString &cat) const
if
(
!
cat
.
isEmpty
())
{
const
Akonadi
::
Tag
&
tag
=
d
->
mTagCache
.
getTagByName
(
cat
);
if
(
const
Akonadi
::
TagAttrib
ut
e
*
attr
=
tag
.
attribute
<
Akonadi
::
TagAttribute
>
())
{
if
(
const
a
ut
o
*
attr
=
tag
.
attribute
<
Akonadi
::
TagAttribute
>
())
{
color
=
attr
->
backgroundColor
();
}
}
...
...
src/messagewidget.cpp
View file @
3f2865bf
...
...
@@ -45,7 +45,7 @@ bool MessageWidget::eventFilter(QObject *, QEvent *event)
}
if
(
event
->
type
()
==
QEvent
::
KeyPress
)
{
QKeyEvent
*
ev
=
static_cast
<
QKeyEvent
*>
(
event
);
auto
*
ev
=
static_cast
<
QKeyEvent
*>
(
event
);
hide
();
if
(
ev
->
key
()
==
Qt
::
Key_Escape
)
{
return
true
;
// We eat this one, it's for us
...
...
src/next/incidenceviewer.cpp
View file @
3f2865bf
...
...
@@ -89,7 +89,7 @@ public:
mParentCollection
=
Akonadi
::
Collection
();
if
(
!
job
->
error
())
{
Akonadi
::
CollectionFetchJob
*
fetchJob
auto
*
fetchJob
=
qobject_cast
<
Akonadi
::
CollectionFetchJob
*>
(
job
);
if
(
!
fetchJob
->
collections
().
isEmpty
())
{
mParentCollection
=
fetchJob
->
collections
().
at
(
0
);
...
...
@@ -138,7 +138,7 @@ IncidenceViewer::IncidenceViewer(QWidget *parent)
void
IncidenceViewer
::
init
()
{
QVBoxLayo
ut
*
layout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
layout
=
new
QVBoxLayout
(
this
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
d
->
mBrowser
->
setOpenLinks
(
true
);
...
...
src/noteeditdialog.cpp
View file @
3f2865bf
...
...
@@ -34,7 +34,7 @@ NoteEditDialog::NoteEditDialog(QWidget *parent)
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
QWidget
*
mainWidget
=
new
QWidget
(
this
);
QVBoxLayo
ut
*
mainLayout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
mainLayout
=
new
QVBoxLayout
(
this
);
mainLayout
->
addWidget
(
mainWidget
);
connect
(
buttonBox
,
&
QDialogButtonBox
::
accepted
,
this
,
&
NoteEditDialog
::
accept
);
connect
(
buttonBox
,
&
QDialogButtonBox
::
rejected
,
this
,
&
QDialog
::
reject
);
...
...
@@ -51,9 +51,9 @@ NoteEditDialog::NoteEditDialog(QWidget *parent)
mOkButton
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"view-pim-notes"
)));
mOkButton
->
setEnabled
(
false
);
QGridLayo
ut
*
layout
=
new
QGridLayout
(
mainWidget
);
a
ut
o
*
layout
=
new
QGridLayout
(
mainWidget
);
layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
QHBoxLayo
ut
*
hbox
=
new
QHBoxLayout
;
a
ut
o
*
hbox
=
new
QHBoxLayout
;
hbox
->
setContentsMargins
(
0
,
0
,
0
,
0
);
hbox
->
setSpacing
(
2
);
...
...
src/printing/calprintdefaultplugins.cpp
View file @
3f2865bf
...
...
@@ -52,7 +52,7 @@ QWidget *CalPrintIncidence::createConfigWidget(QWidget *w)
void
CalPrintIncidence
::
readSettingsWidget
()
{
CalPrintIncidenceConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintIncidenceConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
mUseColors
=
cfg
->
mColors
->
isChecked
();
...
...
@@ -67,7 +67,7 @@ void CalPrintIncidence::readSettingsWidget()
void
CalPrintIncidence
::
setSettingsWidget
()
{
CalPrintIncidenceConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintIncidenceConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mColors
->
setChecked
(
mUseColors
);
...
...
@@ -671,7 +671,7 @@ QWidget *CalPrintDay::createConfigWidget(QWidget *w)
void
CalPrintDay
::
readSettingsWidget
()
{
CalPrintDayConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintDayConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
mFromDate
=
cfg
->
mFromDate
->
date
();
...
...
@@ -703,7 +703,7 @@ void CalPrintDay::readSettingsWidget()
void
CalPrintDay
::
setSettingsWidget
()
{
CalPrintDayConfig
*
cfg
=
dynamic_cast
<
CalPrintDayConfig
*>
((
QWidget
*
)
mConfigWidget
);
auto
*
cfg
=
dynamic_cast
<
CalPrintDayConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mFromDate
->
setDate
(
mFromDate
);
cfg
->
mToDate
->
setDate
(
mToDate
);
...
...
@@ -776,7 +776,7 @@ void CalPrintDay::saveConfig()
void
CalPrintDay
::
setDateRange
(
const
QDate
&
from
,
const
QDate
&
to
)
{
CalPrintPluginBase
::
setDateRange
(
from
,
to
);
CalPrintDayConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintDayConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mFromDate
->
setDate
(
from
);
...
...
@@ -950,7 +950,7 @@ QWidget *CalPrintWeek::createConfigWidget(QWidget *w)
void
CalPrintWeek
::
readSettingsWidget
()
{
CalPrintWeekConfig
*
cfg
=
dynamic_cast
<
CalPrintWeekConfig
*>
((
QWidget
*
)
mConfigWidget
);
auto
*
cfg
=
dynamic_cast
<
CalPrintWeekConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
mFromDate
=
cfg
->
mFromDate
->
date
();
mToDate
=
cfg
->
mToDate
->
date
();
...
...
@@ -982,7 +982,7 @@ void CalPrintWeek::readSettingsWidget()
void
CalPrintWeek
::
setSettingsWidget
()
{
CalPrintWeekConfig
*
cfg
=
dynamic_cast
<
CalPrintWeekConfig
*>
((
QWidget
*
)
mConfigWidget
);
auto
*
cfg
=
dynamic_cast
<
CalPrintWeekConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mFromDate
->
setDate
(
mFromDate
);
cfg
->
mToDate
->
setDate
(
mToDate
);
...
...
@@ -1063,7 +1063,7 @@ QPageLayout::Orientation CalPrintWeek::defaultOrientation() const
void
CalPrintWeek
::
setDateRange
(
const
QDate
&
from
,
const
QDate
&
to
)
{
CalPrintPluginBase
::
setDateRange
(
from
,
to
);
CalPrintWeekConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintWeekConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mFromDate
->
setDate
(
from
);
...
...
@@ -1211,7 +1211,7 @@ QWidget *CalPrintMonth::createConfigWidget(QWidget *w)
void
CalPrintMonth
::
readSettingsWidget
()
{
CalPrintMonthConfig
*
cfg
=
dynamic_cast
<
CalPrintMonthConfig
*>
((
QWidget
*
)
mConfigWidget
);
auto
*
cfg
=
dynamic_cast
<
CalPrintMonthConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
mFromDate
=
QDate
(
cfg
->
mFromYear
->
value
(),
cfg
->
mFromMonth
->
currentIndex
()
+
1
,
1
);
...
...
@@ -1233,7 +1233,7 @@ void CalPrintMonth::readSettingsWidget()
void
CalPrintMonth
::
setSettingsWidget
()
{
CalPrintMonthConfig
*
cfg
=
dynamic_cast
<
CalPrintMonthConfig
*>
((
QWidget
*
)
mConfigWidget
);
auto
*
cfg
=
dynamic_cast
<
CalPrintMonthConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
setDateRange
(
mFromDate
,
mToDate
);
...
...
@@ -1289,7 +1289,7 @@ void CalPrintMonth::saveConfig()
void
CalPrintMonth
::
setDateRange
(
const
QDate
&
from
,
const
QDate
&
to
)
{
CalPrintPluginBase
::
setDateRange
(
from
,
to
);
CalPrintMonthConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintMonthConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mFromMonth
->
clear
();
...
...
@@ -1372,7 +1372,7 @@ QWidget *CalPrintTodos::createConfigWidget(QWidget *w)
void
CalPrintTodos
::
readSettingsWidget
()
{
CalPrintTodoConfig
*
cfg
=
dynamic_cast
<
CalPrintTodoConfig
*>
((
QWidget
*
)
mConfigWidget
);
auto
*
cfg
=
dynamic_cast
<
CalPrintTodoConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
mPageTitle
=
cfg
->
mTitle
->
text
();
...
...
@@ -1408,7 +1408,7 @@ void CalPrintTodos::readSettingsWidget()
void
CalPrintTodos
::
setSettingsWidget
()
{
CalPrintTodoConfig
*
cfg
auto
*
cfg
=
dynamic_cast
<
CalPrintTodoConfig
*>
((
QWidget
*
)
mConfigWidget
);
if
(
cfg
)
{
cfg
->
mTitle
->
setText
(
mPageTitle
);
...
...
src/printing/calprinter.cpp
View file @
3f2865bf
...
...
@@ -165,7 +165,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
setWindowTitle
(
i18nc
(
"@title:window"
,
"Print"
));
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
,
this
);
QVBoxLayo
ut
*
mainLayout
=
new
QVBoxLayout
(
this
);
a
ut
o
*
mainLayout
=
new
QVBoxLayout
(
this
);
mOkButton
=
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
mOkButton
->
setDefault
(
true
);
mOkButton
->
setShortcut
(
Qt
::
CTRL
|
Qt
::
Key_Return
);
...
...
@@ -173,12 +173,12 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
connect
(
buttonBox
,
&
QDialogButtonBox
::
rejected
,
this
,
&
CalPrintDialog
::
reject
);
setModal
(
true
);
QWidget
*
page
=
new
QWidget
(
this
);
QVBoxLayo
ut
*
pageVBoxLayout
=
new
QVBoxLayout
(
page
);
a
ut
o
*
pageVBoxLayout
=
new
QVBoxLayout
(
page
);
pageVBoxLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
mainLayout
->
addWidget
(
page
);
mainLayout
->
addWidget
(
buttonBox
);
QSplitter
*
splitter
=
new
QSplitter
(
page
);
auto
*
splitter
=
new
QSplitter
(
page
);
pageVBoxLayout
->
addWidget
(
splitter
);
splitter
->
setOrientation
(
Qt
::
Horizontal
);
splitter
->
setChildrenCollapsible
(
false
);
...
...
@@ -187,7 +187,7 @@ CalPrintDialog::CalPrintDialog(int initialPrintType, const PrintPlugin::List &pl
mTypeGroup
=
new
QButtonGroup
(
typeBox
);
QWidget
*
splitterRight
=
new
QWidget
(
splitter
);
QGridLayo
ut
*
splitterRightLayout
=
new
QGridLayout
(
splitterRight
);
a
ut
o
*
splitterRightLayout
=
new
QGridLayout
(
splitterRight
);
splitterRightLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
//splitterRightLayout->setMargin( marginHint() );
//splitterRightLayout->setSpacing( spacingHint() );
...
...
src/printing/calprintpluginbase.cpp
View file @
3f2865bf
...
...
@@ -95,7 +95,7 @@ public:
happens on the given day */
bool
overlaps
(
CellItem
*
o
)
const
override
{
PrintCellItem
*
other
=
static_cast
<
PrintCellItem
*>
(
o
);
auto
*
other
=
static_cast
<
PrintCellItem
*>
(
o
);
return
!
(
other
->
start
()
>=
end
()
||
other
->
end
()
<=
start
());
}
...
...
@@ -127,7 +127,7 @@ CalPrintPluginBase::~CalPrintPluginBase()
QWidget
*
CalPrintPluginBase
::
createConfigWidget
(
QWidget
*
w
)
{
QFrame
*
wdg
=
new
QFrame
(
w
);
QVBoxLayo
ut
*
layout
=
new
QVBoxLayout
(
wdg
);
a
ut
o
*
layout
=
new
QVBoxLayout
(
wdg
);
QLabel
*
title
=
new
QLabel
(
description
(),
wdg
);
QFont
titleFont
(
title
->
font
());
...
...
@@ -944,7 +944,7 @@ void CalPrintPluginBase::drawAgendaDayBox(QPainter &p, const KCalendarCore::Even