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
PIM EventViews
Commits
3ee125b5
Commit
3ee125b5
authored
May 01, 2021
by
Laurent Montel
😁
Browse files
Modernize code
parent
e97017be
Pipeline
#60368
passed with stage
in 6 minutes and 4 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/agenda/agendaview.cpp
View file @
3ee125b5
...
...
@@ -1145,7 +1145,7 @@ void AgendaView::createDayLabels(bool force)
d
->
mLayoutTopDayLabels
->
setSpacing
(
1
);
// this spacer moves the day labels over to line up with the day columns
auto
*
spacer
=
auto
spacer
=
new
QSpacerItem
((
!
d
->
mIsSideBySide
?
d
->
mTimeLabelsZone
->
width
()
:
0
)
+
SPACING
+
d
->
mAllDayAgenda
->
scrollArea
()
->
frameWidth
(),
1
,
QSizePolicy
::
Fixed
);
d
->
mLayoutTopDayLabels
->
addSpacerItem
(
spacer
);
...
...
@@ -1980,7 +1980,7 @@ void AgendaView::slotIncidencesDropped(const KCalendarCore::Incidence::List &inc
const
bool
existsInSameCollection
=
existingItem
.
isValid
()
&&
(
existingItem
.
storageCollectionId
()
==
collectionId
()
||
collectionId
()
==
-
1
);
if
(
existingItem
.
isValid
()
&&
existsInSameCollection
)
{
KCalendarCore
::
Incidence
::
Ptr
newIncidence
=
existingItem
.
payload
<
KCalendarCore
::
Incidence
::
Ptr
>
();
auto
newIncidence
=
existingItem
.
payload
<
KCalendarCore
::
Incidence
::
Ptr
>
();
if
(
newIncidence
->
dtStart
()
==
newTime
&&
newIncidence
->
allDay
()
==
allDay
)
{
// Nothing changed
...
...
src/agenda/timescaleconfigdialog.cpp
View file @
3ee125b5
...
...
@@ -50,12 +50,12 @@ TimeScaleConfigDialog::TimeScaleConfigDialog(const PrefsPtr &preferences, QWidge
auto
mainLayout
=
new
QVBoxLayout
(
this
);
setModal
(
true
);
QWidget
*
mainwidget
=
new
QWidget
(
this
);
auto
mainwidget
=
new
QWidget
(
this
);
setupUi
(
mainwidget
);
mainLayout
->
addWidget
(
mainwidget
);
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
);
...
...
@@ -137,7 +137,7 @@ void TimeScaleConfigDialog::add()
}
}
QListWidgetItem
*
item
=
new
QListWidgetItem
(
zoneCombo
->
currentText
());
auto
item
=
new
QListWidgetItem
(
zoneCombo
->
currentText
());
item
->
setData
(
TimeZoneNameRole
,
zoneCombo
->
itemData
(
zoneCombo
->
currentIndex
(),
TimeZoneNameRole
).
toString
());
listWidget
->
addItem
(
item
);
zoneCombo
->
removeItem
(
zoneCombo
->
currentIndex
());
...
...
src/helper.cpp
View file @
3ee125b5
...
...
@@ -38,7 +38,7 @@ void EventViews::setResourceColor(const Akonadi::Collection &coll, const QColor
// Save the color in akonadi (so the resource can even save it server-side)
Akonadi
::
Collection
collection
=
coll
;
auto
*
colorAttr
=
collection
.
attribute
<
Akonadi
::
CollectionColorAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
auto
colorAttr
=
collection
.
attribute
<
Akonadi
::
CollectionColorAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
colorAttr
->
setColor
(
color
);
auto
job
=
new
Akonadi
::
CollectionModifyJob
(
collection
,
nullptr
);
QObject
::
connect
(
job
,
&
Akonadi
::
CollectionModifyJob
::
result
,
[
=
]()
{
...
...
@@ -64,7 +64,7 @@ QColor EventViews::resourceColor(const Akonadi::Collection &coll, const PrefsPtr
}
// Color stored in akonadi
if
(
coll
.
hasAttribute
<
Akonadi
::
CollectionColorAttribute
>
())
{
const
auto
*
colorAttr
=
coll
.
attribute
<
Akonadi
::
CollectionColorAttribute
>
();
const
auto
colorAttr
=
coll
.
attribute
<
Akonadi
::
CollectionColorAttribute
>
();
if
(
colorAttr
&&
colorAttr
->
color
().
isValid
())
{
return
colorAttr
->
color
();
}
...
...
src/prefs.cpp
View file @
3ee125b5
...
...
@@ -170,8 +170,8 @@ void BaseConfig::usrRead()
KConfigGroup
monthViewConfig
(
config
(),
"Month View"
);
KConfigGroup
agendaViewConfig
(
config
(),
"Agenda View"
);
const
QByteArray
agendaIconArray
=
agendaViewConfig
.
readEntry
<
QByteArray
>
(
"agendaViewItemIcons"
,
agendaViewIconDefaults
());
const
QByteArray
monthIconArray
=
monthViewConfig
.
readEntry
<
QByteArray
>
(
"monthViewItemIcons"
,
monthViewIconDefaults
());
const
auto
agendaIconArray
=
agendaViewConfig
.
readEntry
<
QByteArray
>
(
"agendaViewItemIcons"
,
agendaViewIconDefaults
());
const
auto
monthIconArray
=
monthViewConfig
.
readEntry
<
QByteArray
>
(
"monthViewItemIcons"
,
monthViewIconDefaults
());
mAgendaViewIcons
=
iconArrayToSet
(
agendaIconArray
);
mMonthViewIcons
=
iconArrayToSet
(
monthIconArray
);
...
...
@@ -271,7 +271,7 @@ void Prefs::Private::setBool(KCoreConfigSkeleton::ItemBool *baseConfigItem, bool
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemBool
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemBool
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
}
else
{
...
...
@@ -286,7 +286,7 @@ bool Prefs::Private::getBool(const KCoreConfigSkeleton::ItemBool *baseConfigItem
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemBool
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemBool
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
}
...
...
@@ -299,7 +299,7 @@ void Prefs::Private::setInt(KCoreConfigSkeleton::ItemInt *baseConfigItem, int va
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemInt
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemInt
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
}
else
{
...
...
@@ -314,7 +314,7 @@ int Prefs::Private::getInt(const KCoreConfigSkeleton::ItemInt *baseConfigItem) c
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemInt
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemInt
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
}
...
...
@@ -327,7 +327,7 @@ void Prefs::Private::setString(KCoreConfigSkeleton::ItemString *baseConfigItem,
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemString
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemString
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
...
...
@@ -343,7 +343,7 @@ QString Prefs::Private::getString(const KCoreConfigSkeleton::ItemString *baseCon
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemString
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemString
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
...
...
@@ -357,7 +357,7 @@ void Prefs::Private::setDateTime(KCoreConfigSkeleton::ItemDateTime *baseConfigIt
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemDateTime
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemDateTime
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
...
...
@@ -373,7 +373,7 @@ QDateTime Prefs::Private::getDateTime(const KCoreConfigSkeleton::ItemDateTime *b
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemDateTime
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemDateTime
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
...
...
@@ -387,7 +387,7 @@ void Prefs::Private::setStringList(KCoreConfigSkeleton::ItemStringList *baseConf
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemStringList
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemStringList
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
...
...
@@ -403,7 +403,7 @@ QStringList Prefs::Private::getStringList(const KCoreConfigSkeleton::ItemStringL
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemStringList
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KCoreConfigSkeleton
::
ItemStringList
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
...
...
@@ -417,7 +417,7 @@ void Prefs::Private::setColor(KConfigSkeleton::ItemColor *baseConfigItem, const
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemColor
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemColor
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
}
else
{
...
...
@@ -432,7 +432,7 @@ QColor Prefs::Private::getColor(const KConfigSkeleton::ItemColor *baseConfigItem
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemColor
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemColor
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
}
...
...
@@ -445,7 +445,7 @@ void Prefs::Private::setFont(KConfigSkeleton::ItemFont *baseConfigItem, const QF
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemFont
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemFont
*>
(
appItem
);
if
(
item
)
{
item
->
setValue
(
value
);
}
else
{
...
...
@@ -460,7 +460,7 @@ QFont Prefs::Private::getFont(const KConfigSkeleton::ItemFont *baseConfigItem) c
{
KConfigSkeletonItem
*
appItem
=
appConfigItem
(
baseConfigItem
);
if
(
appItem
)
{
auto
*
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemFont
*>
(
appItem
);
auto
item
=
dynamic_cast
<
KConfigSkeleton
::
ItemFont
*>
(
appItem
);
if
(
item
)
{
return
item
->
value
();
}
...
...
src/timeline/timelineview.cpp
View file @
3ee125b5
...
...
@@ -409,7 +409,7 @@ bool TimelineView::eventFilter(QObject *object, QEvent *event)
auto
itemModel
=
qobject_cast
<
QStandardItemModel
*>
(
d
->
mGantt
->
model
());
auto
*
timelineItem
=
dynamic_cast
<
TimelineSubItem
*>
(
itemModel
->
item
(
itemIndex
.
row
(),
itemIndex
.
column
()));
auto
timelineItem
=
dynamic_cast
<
TimelineSubItem
*>
(
itemModel
->
item
(
itemIndex
.
row
(),
itemIndex
.
column
()));
if
(
timelineItem
)
{
timelineItem
->
updateToolTip
();
...
...
src/timeline/timelineview_p.cpp
View file @
3ee125b5
...
...
@@ -41,7 +41,7 @@ void TimelineView::Private::splitterMoved()
void
TimelineView
::
Private
::
itemSelected
(
const
QModelIndex
&
index
)
{
auto
*
tlitem
=
dynamic_cast
<
TimelineSubItem
*>
(
static_cast
<
QStandardItemModel
*>
(
mGantt
->
model
())
->
item
(
index
.
row
(),
index
.
column
()));
auto
tlitem
=
dynamic_cast
<
TimelineSubItem
*>
(
static_cast
<
QStandardItemModel
*>
(
mGantt
->
model
())
->
item
(
index
.
row
(),
index
.
column
()));
if
(
tlitem
)
{
Q_EMIT
q
->
incidenceSelected
(
tlitem
->
incidence
(),
tlitem
->
originalStart
().
date
());
}
...
...
@@ -49,7 +49,7 @@ void TimelineView::Private::itemSelected(const QModelIndex &index)
void
TimelineView
::
Private
::
itemDoubleClicked
(
const
QModelIndex
&
index
)
{
auto
*
tlitem
=
dynamic_cast
<
TimelineSubItem
*>
(
static_cast
<
QStandardItemModel
*>
(
mGantt
->
model
())
->
item
(
index
.
row
(),
index
.
column
()));
auto
tlitem
=
dynamic_cast
<
TimelineSubItem
*>
(
static_cast
<
QStandardItemModel
*>
(
mGantt
->
model
())
->
item
(
index
.
row
(),
index
.
column
()));
if
(
tlitem
)
{
Q_EMIT
q
->
editIncidenceSignal
(
tlitem
->
incidence
());
}
...
...
@@ -59,7 +59,7 @@ void TimelineView::Private::contextMenuRequested(const QPoint &point)
{
QPersistentModelIndex
index
=
mGantt
->
indexAt
(
point
);
// mHintDate = QDateTime( mGantt->getDateTimeForCoordX( QCursor::pos().x(), true ) );
auto
*
tlitem
=
dynamic_cast
<
TimelineSubItem
*>
(
static_cast
<
QStandardItemModel
*>
(
mGantt
->
model
())
->
item
(
index
.
row
(),
index
.
column
()));
auto
tlitem
=
dynamic_cast
<
TimelineSubItem
*>
(
static_cast
<
QStandardItemModel
*>
(
mGantt
->
model
())
->
item
(
index
.
row
(),
index
.
column
()));
if
(
!
tlitem
)
{
Q_EMIT
q
->
showNewEventPopupSignal
();
mSelectedItemList
=
Akonadi
::
Item
::
List
();
...
...
@@ -165,7 +165,7 @@ void TimelineView::Private::removeIncidence(const Akonadi::Item &incidence)
void
TimelineView
::
Private
::
itemChanged
(
QStandardItem
*
item
)
{
auto
*
tlit
=
dynamic_cast
<
TimelineSubItem
*>
(
item
);
auto
tlit
=
dynamic_cast
<
TimelineSubItem
*>
(
item
);
if
(
!
tlit
)
{
return
;
}
...
...
src/todo/incidencetreemodel.cpp
View file @
3ee125b5
...
...
@@ -167,7 +167,7 @@ void IncidenceTreeModel::Private::onDataChanged(const QModelIndex &begin, const
Node
::
Ptr
node
=
m_uidMap
.
value
(
rawNode
->
uid
);
// Looks hackish but it's safe
Q_ASSERT
(
node
);
Node
::
Ptr
oldParentNode
=
node
->
parentNode
;
Akonadi
::
Item
item
=
q
->
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
auto
item
=
q
->
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
Q_ASSERT
(
item
.
isValid
());
KCalendarCore
::
Incidence
::
Ptr
incidence
=
!
item
.
hasPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
()
?
KCalendarCore
::
Incidence
::
Ptr
()
:
item
.
payload
<
KCalendarCore
::
Incidence
::
Ptr
>
();
...
...
@@ -268,7 +268,7 @@ PreNode::Ptr IncidenceTreeModel::Private::prenodeFromSourceRow(int row) const
node
->
sourceIndex
=
q
->
sourceModel
()
->
index
(
row
,
0
,
QModelIndex
());
Q_ASSERT
(
node
->
sourceIndex
.
isValid
());
Q_ASSERT
(
node
->
sourceIndex
.
model
()
==
q
->
sourceModel
());
const
Akonadi
::
Item
item
=
node
->
sourceIndex
.
data
(
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
node
->
sourceIndex
.
data
(
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
!
item
.
isValid
())
{
// It's a Collection, ignore that, we only want items.
...
...
src/todo/todomodel.cpp
View file @
3ee125b5
...
...
@@ -217,7 +217,7 @@ QVariant TodoModel::data(const QModelIndex &index, int role) const
return
QVariant
();
}
Q_ASSERT
(
sourceIndex
.
isValid
());
const
Akonadi
::
Item
item
=
sourceIndex
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
sourceIndex
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
!
item
.
isValid
())
{
qCWarning
(
CALENDARVIEW_LOG
)
<<
"Invalid index: "
<<
sourceIndex
;
// Q_ASSERT( false );
...
...
@@ -227,7 +227,7 @@ QVariant TodoModel::data(const QModelIndex &index, int role) const
if
(
!
todo
)
{
qCCritical
(
CALENDARVIEW_LOG
)
<<
"item.hasPayload()"
<<
item
.
hasPayload
();
if
(
item
.
hasPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
())
{
KCalendarCore
::
Incidence
::
Ptr
incidence
=
item
.
payload
<
KCalendarCore
::
Incidence
::
Ptr
>
();
auto
incidence
=
item
.
payload
<
KCalendarCore
::
Incidence
::
Ptr
>
();
if
(
incidence
)
{
qCCritical
(
CALENDARVIEW_LOG
)
<<
"It's actually "
<<
incidence
->
type
();
}
...
...
@@ -397,7 +397,7 @@ bool TodoModel::setData(const QModelIndex &index, const QVariant &value, int rol
return
true
;
}
const
Akonadi
::
Item
item
=
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
item
);
if
(
!
item
.
isValid
()
||
!
todo
)
{
...
...
@@ -628,7 +628,7 @@ QMimeData *TodoModel::mimeData(const QModelIndexList &indexes) const
{
Akonadi
::
Item
::
List
items
;
for
(
const
QModelIndex
&
index
:
indexes
)
{
const
Akonadi
::
Item
item
=
this
->
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
this
->
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
item
.
isValid
()
&&
!
items
.
contains
(
item
))
{
items
.
push_back
(
item
);
}
...
...
@@ -658,7 +658,7 @@ bool TodoModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
item
);
KCalendarCore
::
Todo
::
Ptr
destTodo
;
if
(
parent
.
isValid
())
{
const
Akonadi
::
Item
parentItem
=
this
->
data
(
parent
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
parentItem
=
this
->
data
(
parent
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
parentItem
.
isValid
())
{
destTodo
=
CalendarSupport
::
todo
(
parentItem
);
}
...
...
@@ -698,7 +698,7 @@ bool TodoModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int r
return
false
;
}
const
Akonadi
::
Item
parentItem
=
this
->
data
(
parent
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
parentItem
=
this
->
data
(
parent
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
KCalendarCore
::
Todo
::
Ptr
destTodo
=
CalendarSupport
::
todo
(
parentItem
);
if
(
data
->
hasText
())
{
...
...
@@ -734,7 +734,7 @@ Qt::ItemFlags TodoModel::flags(const QModelIndex &index) const
Qt
::
ItemFlags
ret
=
QAbstractItemModel
::
flags
(
index
);
const
Akonadi
::
Item
item
=
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
item
=
data
(
index
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
!
item
.
isValid
())
{
Q_ASSERT
(
mapToSource
(
index
).
isValid
());
...
...
src/todo/todoview.cpp
View file @
3ee125b5
...
...
@@ -643,7 +643,7 @@ void TodoView::addQuickTodo(Qt::KeyboardModifiers modifiers)
}
const
QModelIndex
idx
=
mProxyModel
->
mapToSource
(
selection
[
0
]);
mView
->
expand
(
selection
[
0
]);
const
Akonadi
::
Item
parent
=
sModels
->
todoModel
->
data
(
idx
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
parent
=
sModels
->
todoModel
->
data
(
idx
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
addTodo
(
mQuickAdd
->
text
(),
parent
,
mProxyModel
->
categories
());
}
else
{
return
;
...
...
@@ -725,7 +725,7 @@ void TodoView::selectionChanged(const QItemSelection &selected, const QItemSelec
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
if
(
selectedIncidenceDates
().
isEmpty
())
{
Q_EMIT
incidenceSelected
(
todoItem
,
QDate
());
...
...
@@ -741,7 +741,7 @@ void TodoView::showTodo()
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
Q_EMIT
showIncidenceSignal
(
todoItem
);
}
...
...
@@ -753,7 +753,7 @@ void TodoView::editTodo()
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
Q_EMIT
editIncidenceSignal
(
todoItem
);
}
...
...
@@ -761,7 +761,7 @@ void TodoView::deleteTodo()
{
QModelIndexList
selection
=
mView
->
selectionModel
()
->
selectedRows
();
if
(
selection
.
size
()
==
1
)
{
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
if
(
!
changer
()
->
deletedRecently
(
todoItem
.
id
()))
{
Q_EMIT
deleteIncidenceSignal
(
todoItem
);
...
...
@@ -778,7 +778,7 @@ void TodoView::newSubTodo()
{
QModelIndexList
selection
=
mView
->
selectionModel
()
->
selectedRows
();
if
(
selection
.
size
()
==
1
)
{
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
Q_EMIT
newSubTodoSignal
(
todoItem
);
}
else
{
...
...
@@ -801,7 +801,7 @@ void TodoView::copyTodoToDate(const QDate &date)
const
QModelIndex
origIndex
=
mProxyModel
->
mapToSource
(
selection
[
0
]);
Q_ASSERT
(
origIndex
.
isValid
());
const
Akonadi
::
Item
origItem
=
sModels
->
todoModel
->
data
(
origIndex
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
auto
origItem
=
sModels
->
todoModel
->
data
(
origIndex
,
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
const
KCalendarCore
::
Todo
::
Ptr
orig
=
CalendarSupport
::
todo
(
origItem
);
if
(
!
orig
)
{
...
...
@@ -846,7 +846,7 @@ QMenu *TodoView::createCategoryPopupMenu()
return
tempMenu
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
todoItem
);
Q_ASSERT
(
todo
);
...
...
@@ -870,7 +870,7 @@ void TodoView::onTagsFetched(KJob *job)
}
auto
fetchJob
=
static_cast
<
Akonadi
::
TagFetchJob
*>
(
job
);
const
QStringList
checkedCategories
=
job
->
property
(
"checkedCategories"
).
toStringList
();
QPointer
<
QMenu
>
menu
=
job
->
property
(
"menu"
).
value
<
QPointer
<
QMenu
>>
();
auto
menu
=
job
->
property
(
"menu"
).
value
<
QPointer
<
QMenu
>>
();
if
(
menu
)
{
const
auto
lst
=
fetchJob
->
tags
();
for
(
const
Akonadi
::
Tag
&
tag
:
lst
)
{
...
...
@@ -892,7 +892,7 @@ void TodoView::setNewDate(const QDate &date)
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
todoItem
);
Q_ASSERT
(
todo
);
...
...
@@ -919,7 +919,7 @@ void TodoView::setNewPercentage(QAction *action)
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
todoItem
);
Q_ASSERT
(
todo
);
...
...
@@ -949,7 +949,7 @@ void TodoView::setNewPriority(QAction *action)
if
(
selection
.
size
()
!=
1
)
{
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
todoItem
);
if
(
calendar
()
->
hasRight
(
todoItem
,
Akonadi
::
Collection
::
CanChangeItem
))
{
KCalendarCore
::
Todo
::
Ptr
oldTodo
(
todo
->
clone
());
...
...
@@ -966,7 +966,7 @@ void TodoView::changedCategories(QAction *action)
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
KCalendarCore
::
Todo
::
Ptr
todo
=
CalendarSupport
::
todo
(
todoItem
);
Q_ASSERT
(
todo
);
if
(
calendar
()
->
hasRight
(
todoItem
,
Akonadi
::
Collection
::
CanChangeItem
))
{
...
...
@@ -1039,7 +1039,7 @@ void TodoView::onRowsInserted(const QModelIndex &parent, int start, int end)
return
;
}
Akonadi
::
Item
item
=
v
.
value
<
Akonadi
::
Item
>
();
auto
item
=
v
.
value
<
Akonadi
::
Item
>
();
if
(
!
item
.
isValid
())
{
return
;
}
...
...
@@ -1187,7 +1187,7 @@ void TodoView::createEvent()
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
Q_EMIT
createEvent
(
todoItem
);
}
...
...
@@ -1199,7 +1199,7 @@ void TodoView::createNote()
return
;
}
const
Akonadi
::
Item
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
const
auto
todoItem
=
selection
[
0
].
data
(
TodoModel
::
TodoRole
).
value
<
Akonadi
::
Item
>
();
Q_EMIT
createNote
(
todoItem
);
}
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