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
KAlarm
Commits
038128b7
Commit
038128b7
authored
Feb 09, 2022
by
David Jarvie
Browse files
Code quality fixes
parent
a9b7c466
Pipeline
#135475
passed with stage
in 1 minute and 26 seconds
Changes
21
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/commandoptions.cpp
View file @
038128b7
/*
* commandoptions.cpp - extract command line options
* Program: kalarm
* SPDX-FileCopyrightText: 2001-202
1
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2001-202
2
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -489,7 +489,6 @@ void CommandOptions::process()
{
count
=
0
;
const
QByteArray
dateTime
=
mParser
->
value
(
*
mOptions
.
at
(
UNTIL
)).
toLocal8Bit
();
bool
ok
;
if
(
mParser
->
isSet
(
*
mOptions
.
at
(
TIME
)))
ok
=
KAlarm
::
convertTimeString
(
dateTime
,
endTime
,
mAlarmTime
);
else
...
...
@@ -738,8 +737,7 @@ bool CommandOptions::checkCommand(Option command, Command code, EditAlarmDlg::Ty
||
!
mParser
->
isSet
(
*
mOptions
.
at
(
command
)))
return
false
;
if
(
mCommand
!=
NONE
&&
(
allowedEditType
==
EditAlarmDlg
::
NO_TYPE
||
(
allowedEditType
!=
EditAlarmDlg
::
NO_TYPE
&&
(
mCommand
!=
NEW
||
mEditType
!=
allowedEditType
))))
&&
(
allowedEditType
==
EditAlarmDlg
::
NO_TYPE
||
(
mCommand
!=
NEW
||
mEditType
!=
allowedEditType
)))
setErrorIncompatible
(
mCommandOpt
,
command
);
qCDebug
(
KALARM_LOG
).
nospace
()
<<
"CommandOptions::checkCommand: "
<<
optionName
(
command
);
mCommand
=
code
;
...
...
src/deferdlg.cpp
View file @
038128b7
...
...
@@ -60,7 +60,7 @@ DeferAlarmDlg::DeferAlarmDlg(const DateTime& initialDT, bool anyTimeOption, bool
QPushButton
*
deferButton
=
mButtonBox
->
addButton
(
i18nc
(
"@action:button"
,
"Cancel Deferral"
),
QDialogButtonBox
::
ActionRole
);
deferButton
->
setWhatsThis
(
i18nc
(
"@info:whatsthis"
,
"Cancel the deferred alarm. This does not affect future recurrences."
));
connect
(
mButtonBox
,
&
QDialogButtonBox
::
clicked
,
this
,
[
this
,
deferButton
](
QAbstractButton
*
btn
)
[
this
,
deferButton
](
const
QAbstractButton
*
btn
)
{
if
(
btn
==
deferButton
)
slotCancelDeferral
();
...
...
src/editdlg.cpp
View file @
038128b7
...
...
@@ -266,9 +266,9 @@ void EditAlarmDlg::init(const KAEvent& event)
// Controls specific to the alarm type
QGroupBox
*
actionBox
=
new
QGroupBox
(
i18nc
(
"@title:group"
,
"Action"
),
mainPage
);
topLayout
->
addWidget
(
actionBox
,
1
);
auto
layout
=
new
QVBoxLayout
(
actionBox
);
auto
v
layout
=
new
QVBoxLayout
(
actionBox
);
type_init
(
actionBox
,
layout
);
type_init
(
actionBox
,
v
layout
);
if
(
!
mTemplate
)
{
...
...
src/kalarmapp.cpp
View file @
038128b7
/*
* kalarmapp.cpp - the KAlarm application object
* Program: kalarm
* SPDX-FileCopyrightText: 2001-202
1
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2001-202
2
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -405,8 +405,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
static
bool
firstInstance
=
true
;
bool
dontRedisplay
=
false
;
CommandOptions
::
Command
command
=
CommandOptions
::
NONE
;
const
bool
processOptions
=
(
!
firstInstance
||
!
isSessionRestored
());
if
(
processOptions
)
if
(
!
firstInstance
||
!
isSessionRestored
())
{
options
->
process
();
#ifndef NDEBUG
...
...
@@ -440,10 +439,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
default:
break
;
}
}
if
(
processOptions
)
{
switch
(
command
)
{
case
CommandOptions
::
TRIGGER_EVENT
:
...
...
@@ -549,7 +545,7 @@ int KAlarmApp::activateInstance(const QStringList& args, const QString& workingD
const
Preferences
::
SoundType
type
=
(
flags
&
KAEvent
::
BEEP
)
?
Preferences
::
Sound_Beep
:
(
flags
&
KAEvent
::
SPEAK
)
?
Preferences
::
Sound_Speak
:
Preferences
::
Sound_File
;
dlg
->
setAudio
(
type
,
options
->
audioFile
(),
options
->
audioVolume
(),
(
flags
&
KAEvent
::
REPEAT_SOUND
?
0
:
-
1
));
dlg
->
setAudio
(
type
,
options
->
audioFile
(),
options
->
audioVolume
(),
(
(
flags
&
KAEvent
::
REPEAT_SOUND
)
?
0
:
-
1
));
}
if
(
options
->
reminderMinutes
())
dlg
->
setReminder
(
options
->
reminderMinutes
(),
(
options
->
flags
()
&
KAEvent
::
REMINDER_ONCE
));
...
...
src/kalarmapp.h
View file @
038128b7
/*
* kalarmapp.h - the KAlarm application object
* Program: kalarm
* SPDX-FileCopyrightText: 2001-202
1
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2001-202
2
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -210,7 +210,7 @@ private:
{
ActionQEntry
(
QueuedAction
a
,
const
EventId
&
id
)
:
action
(
a
),
eventId
(
id
)
{
}
ActionQEntry
(
QueuedAction
a
,
const
EventId
&
id
,
const
QString
&
resId
)
:
action
(
a
),
eventId
(
id
),
resourceId
(
resId
)
{
}
ActionQEntry
(
const
KAEvent
&
e
,
QueuedAction
a
=
QueuedAction
::
Handle
)
:
action
(
a
),
event
(
e
)
{
}
explicit
ActionQEntry
(
const
KAEvent
&
e
,
QueuedAction
a
=
QueuedAction
::
Handle
)
:
action
(
a
),
event
(
e
)
{
}
ActionQEntry
()
=
default
;
QueuedAction
action
;
EventId
eventId
;
...
...
src/kamail.cpp
View file @
038128b7
...
...
@@ -299,9 +299,9 @@ void KAMail::slotEmailSent(KJob* job)
if
(
!
mJobs
.
isEmpty
())
{
// Send the next queued email
auto
job
=
mJobs
.
head
();
connect
(
job
,
&
KJob
::
result
,
instance
(),
&
KAMail
::
slotEmailSent
);
job
->
start
();
auto
job
1
=
mJobs
.
head
();
connect
(
job
1
,
&
KJob
::
result
,
instance
(),
&
KAMail
::
slotEmailSent
);
job
1
->
start
();
}
}
...
...
src/lib/spinbox2.h
View file @
038128b7
...
...
@@ -306,7 +306,7 @@ private:
class
MainSpinBox
:
public
SpinBox
{
public:
MainSpinBox
(
SpinBox2
*
parent
)
explicit
MainSpinBox
(
SpinBox2
*
parent
)
:
SpinBox
(
parent
),
owner
(
parent
)
{
}
MainSpinBox
(
int
minValue
,
int
maxValue
,
SpinBox2
*
parent
)
:
SpinBox
(
minValue
,
maxValue
,
parent
),
owner
(
parent
)
{
}
...
...
src/lib/stackedwidgets.cpp
View file @
038128b7
...
...
@@ -146,16 +146,16 @@ QSize StackedScrollGroup::adjustSize(bool force)
}
}
mSized
=
true
;
QSize
s
=
mWidgets
.
at
(
0
)
->
parentWidget
()
->
sizeHint
();
if
(
s
.
height
()
<
mMinHeight
)
s
.
setHeight
(
mMinHeight
);
mWidgets
.
at
(
0
)
->
parentWidget
()
->
resize
(
s
);
QSize
s
z
=
mWidgets
.
at
(
0
)
->
parentWidget
()
->
sizeHint
();
if
(
s
z
.
height
()
<
mMinHeight
)
s
z
.
setHeight
(
mMinHeight
);
mWidgets
.
at
(
0
)
->
parentWidget
()
->
resize
(
s
z
);
for
(
QWidget
*
w
=
mWidgets
.
at
(
0
)
->
parentWidget
();
w
&&
w
!=
mDialog
;
w
=
w
->
parentWidget
())
w
->
setMinimumHeight
(
qMin
(
w
->
minimumSizeHint
().
height
(),
w
->
sizeHint
().
height
()));
dlgsize
.
setHeight
(
dlgsize
.
height
()
-
mHeightReduction
);
s
=
mDialog
->
QDialog
::
minimumSizeHint
();
if
(
s
.
height
()
>
dlgsize
.
height
())
dlgsize
.
setHeight
(
s
.
height
());
s
z
=
mDialog
->
QDialog
::
minimumSizeHint
();
if
(
s
z
.
height
()
>
dlgsize
.
height
())
dlgsize
.
setHeight
(
s
z
.
height
());
mDialog
->
setMinimumHeight
(
dlgsize
.
height
());
}
mSized
=
true
;
...
...
src/mainwindow.cpp
View file @
038128b7
...
...
@@ -1092,14 +1092,11 @@ void MainWindow::arrangePanel()
else
{
int
minWidth
=
0
;
if
(
top
)
{
top
->
show
();
mPanelLayout
->
addWidget
(
top
);
mPanelLayout
->
addStretch
();
mPanel
->
show
();
minWidth
=
top
->
minimumSizeHint
().
width
();
}
top
->
show
();
mPanelLayout
->
addWidget
(
top
);
mPanelLayout
->
addStretch
();
mPanel
->
show
();
minWidth
=
top
->
minimumSizeHint
().
width
();
if
(
bottom
)
{
bottom
->
show
();
...
...
src/messagedisplay.h
View file @
038128b7
...
...
@@ -51,6 +51,9 @@ public:
static
void
showError
(
const
KAEvent
&
event
,
const
DateTime
&
alarmDateTime
,
const
QStringList
&
errmsgs
,
const
QString
&
dontShowAgain
=
QString
());
MessageDisplay
(
const
MessageDisplay
&
)
=
delete
;
MessageDisplay
&
operator
=
(
const
MessageDisplay
&
)
=
delete
;
virtual
~
MessageDisplay
();
bool
isValid
()
const
{
return
mHelper
->
isValid
();
}
...
...
src/prefdlg.cpp
View file @
038128b7
...
...
@@ -687,8 +687,8 @@ TimePrefTab::TimePrefTab(StackedScrollGroup* scrollGroup)
{
const
QString
name
=
HolidayRegion
::
name
(
regionCode
);
const
QString
languageName
=
QLocale
::
languageToString
(
QLocale
(
HolidayRegion
::
languageCode
(
regionCode
)).
language
());
const
QString
label
=
languageName
.
isEmpty
()
?
name
:
i18nc
(
"Holiday region, region language"
,
"%1 (%2)"
,
name
,
languageName
);
regionsMap
.
insert
(
label
,
regionCode
);
const
QString
label
Text
=
languageName
.
isEmpty
()
?
name
:
i18nc
(
"Holiday region, region language"
,
"%1 (%2)"
,
name
,
languageName
);
regionsMap
.
insert
(
label
Text
,
regionCode
);
}
mHolidays
->
addItem
(
i18nc
(
"No holiday region"
,
"None"
),
QString
());
...
...
@@ -801,8 +801,8 @@ void TimePrefTab::restore(bool, bool)
{
KADateTime
::
Spec
timeSpec
=
Preferences
::
timeSpec
();
mTimeZone
->
setTimeZone
(
timeSpec
.
type
()
==
KADateTime
::
TimeZone
?
timeSpec
.
timeZone
()
:
QTimeZone
());
const
int
i
=
Preferences
::
holidays
().
isValid
()
?
mHolidays
->
findData
(
Preferences
::
holidays
().
regionCode
())
:
0
;
mHolidays
->
setCurrentIndex
(
i
);
const
int
i
x
=
Preferences
::
holidays
().
isValid
()
?
mHolidays
->
findData
(
Preferences
::
holidays
().
regionCode
())
:
0
;
mHolidays
->
setCurrentIndex
(
i
x
);
mStartOfDay
->
setValue
(
Preferences
::
startOfDay
());
mWorkStart
->
setValue
(
Preferences
::
workDayStart
());
mWorkEnd
->
setValue
(
Preferences
::
workDayEnd
());
...
...
src/resources/fileresource.cpp
View file @
038128b7
...
...
@@ -368,7 +368,7 @@ void FileResource::loaded(bool success, QHash<QString, KAEvent>& newEvents, cons
// This is only done when a delayed load fails.
// If the resource previously loaded successfully, leave its events (in
// mEvents) unchanged.
if
(
!
success
&&
!
errorMessage
.
isEmpty
())
if
(
!
errorMessage
.
isEmpty
())
Resources
::
notifyResourceMessage
(
this
,
MessageType
::
Error
,
xi18nc
(
"@info"
,
"Error loading calendar <resource>%1</resource>."
,
displayName
()),
errorMessage
);
return
;
}
...
...
src/resources/fileresourceconfigmanager.h
View file @
038128b7
/*
* fileresourceconfigmanager.h - config manager for resources accessed via file system
* Program: kalarm
* SPDX-FileCopyrightText: 2020 David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2020
-2022
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -29,6 +29,9 @@ public:
*/
static
FileResourceConfigManager
*
instance
();
FileResourceConfigManager
(
const
FileResourceConfigManager
&
)
=
delete
;
FileResourceConfigManager
&
operator
=
(
const
FileResourceConfigManager
&
)
=
delete
;
/** Destructor.
* Writes the 'kalarmresources' config file.
*/
...
...
src/resources/fileresourcedatamodel.cpp
View file @
038128b7
/*
* fileresourcedatamodel.cpp - model containing file system resources and their events
* Program: kalarm
* SPDX-FileCopyrightText: 2007-202
1
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2007-202
2
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -29,7 +29,7 @@ private:
public:
Type
type
;
Node
(
Resource
&
r
)
:
ritem
(
r
),
type
(
Type
::
Resource
)
{}
explicit
Node
(
Resource
&
r
)
:
ritem
(
r
),
type
(
Type
::
Resource
)
{}
Node
(
KAEvent
*
e
,
Resource
&
r
)
:
eitem
(
e
),
owner
(
r
),
type
(
Type
::
Event
)
{}
~
Node
()
{
...
...
@@ -835,7 +835,7 @@ QModelIndex FileResourceDataModel::index(int row, int column, const QModelIndex&
if
(
!
column
)
{
const
QVector
<
Node
*>&
nodes
=
mResourceNodes
.
value
(
Resource
());
if
(
row
>=
0
&&
row
<
nodes
.
count
())
if
(
row
<
nodes
.
count
())
return
createIndex
(
row
,
column
,
nodes
[
row
]);
}
}
...
...
@@ -945,9 +945,9 @@ QVariant FileResourceDataModel::data(const QModelIndex& ix, int role) const
// This is an Event row
if
(
role
==
ParentResourceIdRole
)
return
node
->
parent
().
id
();
const
Resource
res
=
node
->
parent
();
const
Resource
res
p
=
node
->
parent
();
bool
handled
;
const
QVariant
value
=
eventData
(
role
,
ix
.
column
(),
*
event
,
res
,
handled
);
const
QVariant
value
=
eventData
(
role
,
ix
.
column
(),
*
event
,
res
p
,
handled
);
if
(
handled
)
return
value
;
}
...
...
src/resources/fileresourcemigrator.cpp
View file @
038128b7
...
...
@@ -58,7 +58,7 @@ struct CollectionProperties
bool
readOnly
;
// Fetch the properties of a collection which has been fetched by CollectionFetchJob.
CollectionProperties
(
const
Akonadi
::
Collection
&
);
explicit
CollectionProperties
(
const
Akonadi
::
Collection
&
);
};
const
Akonadi
::
Collection
::
Rights
WritableRights
=
Akonadi
::
Collection
::
CanChangeItem
|
Akonadi
::
Collection
::
CanCreateItem
|
Akonadi
::
Collection
::
CanDeleteItem
;
...
...
src/resources/fileresourcesettings.cpp
View file @
038128b7
...
...
@@ -101,10 +101,10 @@ bool FileResourceSettings::readConfig()
mStandard
=
readAlarmTypes
(
KEY_STANDARD
);
// Read storage type and validate against location.
const
QString
t
ype
=
mConfigGroup
->
readEntry
(
KEY_TYPE
,
QString
());
if
(
t
ype
==
STORAGE_FILE
)
const
QString
storageT
ype
=
mConfigGroup
->
readEntry
(
KEY_TYPE
,
QString
());
if
(
storageT
ype
==
STORAGE_FILE
)
mStorageType
=
File
;
else
if
(
t
ype
==
STORAGE_DIR
)
else
if
(
storageT
ype
==
STORAGE_DIR
)
mStorageType
=
Directory
;
else
{
...
...
src/resources/fileresourcesettings.h
View file @
038128b7
/*
* fileresourcesettings.h - settings for calendar resource accessed via file system
* Program: kalarm
* SPDX-FileCopyrightText: 2020
,
202
1
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2020
-
202
2
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -51,6 +51,9 @@ public:
CalEvent
::
Types
enabledTypes
,
CalEvent
::
Types
standardTypes
,
bool
readOnly
);
FileResourceSettings
(
const
FileResourceSettings
&
)
=
delete
;
FileResourceSettings
&
operator
=
(
const
FileResourceSettings
&
)
=
delete
;
~
FileResourceSettings
();
/** Reads the settings from the resource's config file section.
...
...
src/resources/resourcedatamodelbase.cpp
View file @
038128b7
...
...
@@ -721,10 +721,10 @@ QString ResourceDataModelBase::alarmTimeText(const DateTime& dateTime, char lead
const
QTime
t
(
1
,
30
,
30
);
const
QString
nozero
=
locale
.
toString
(
t
,
timeFormat
);
const
QString
zero
=
locale
.
toString
(
t
,
timeFullFormat
);
for
(
int
i
=
0
;
i
<
nozero
.
size
();
++
i
)
if
(
nozero
[
i
]
!=
zero
[
i
])
for
(
int
j
=
0
;
j
<
nozero
.
size
();
++
j
)
if
(
nozero
[
j
]
!=
zero
[
j
])
{
hourOffset
=
i
;
hourOffset
=
j
;
break
;
}
}
...
...
src/traywindow.cpp
View file @
038128b7
...
...
@@ -324,7 +324,6 @@ void TrayWindow::updateIcon()
*/
QString
TrayWindow
::
tooltipAlarmText
()
const
{
KAEvent
event
;
const
QString
&
prefix
=
Preferences
::
tooltipTimeToPrefix
();
int
maxCount
=
Preferences
::
tooltipAlarmCount
();
const
KADateTime
now
=
KADateTime
::
currentLocalDateTime
();
...
...
src/undo.cpp
View file @
038128b7
/*
* undo.cpp - undo/redo facility
* Program: kalarm
* SPDX-FileCopyrightText: 2005-202
0
David Jarvie <djarvie@kde.org>
* SPDX-FileCopyrightText: 2005-202
2
David Jarvie <djarvie@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -77,6 +77,8 @@ class UndoMultiBase : public UndoItem
:
UndoItem
(
t
,
name
),
mUndos
(
new
Undo
::
List
)
{}
UndoMultiBase
(
Undo
::
Type
t
,
Undo
::
List
*
undos
,
const
QString
&
name
)
:
UndoItem
(
t
,
name
),
mUndos
(
undos
)
{}
UndoMultiBase
(
const
UndoMultiBase
&
)
=
delete
;
UndoMultiBase
&
operator
=
(
const
UndoMultiBase
&
)
=
delete
;
~
UndoMultiBase
()
override
{
delete
mUndos
;
}
const
Undo
::
List
*
undos
()
const
{
return
mUndos
;
}
protected:
...
...
@@ -125,6 +127,8 @@ class UndoEdit : public UndoItem
public:
UndoEdit
(
Undo
::
Type
,
const
KAEvent
&
oldEvent
,
const
QString
&
newEventID
,
const
Resource
&
,
const
QStringList
&
dontShowErrors
,
const
QString
&
description
);
UndoEdit
(
const
UndoEdit
&
)
=
delete
;
UndoEdit
&
operator
=
(
const
UndoEdit
&
)
=
delete
;
~
UndoEdit
()
override
;
Operation
operation
()
const
override
{
return
EDIT
;
}
QString
defaultActionText
()
const
override
;
...
...
@@ -150,6 +154,8 @@ class UndoDelete : public UndoItem
public:
UndoDelete
(
Undo
::
Type
,
const
Undo
::
Event
&
,
const
QString
&
name
=
QString
());
UndoDelete
(
Undo
::
Type
,
const
KAEvent
&
,
const
Resource
&
,
const
QStringList
&
dontShowErrors
,
const
QString
&
name
=
QString
());
UndoDelete
(
const
UndoDelete
&
)
=
delete
;
UndoDelete
&
operator
=
(
const
UndoDelete
&
)
=
delete
;
~
UndoDelete
()
override
;
Operation
operation
()
const
override
{
return
DELETE
;
}
QString
defaultActionText
()
const
override
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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