Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Calindori
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma Mobile
Calindori
Commits
05b294b4
Commit
05b294b4
authored
Apr 01, 2019
by
Dimitris Kardarakos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better handling of null dates. Show calendar name in global "Show>Tasks" action.
parent
d1c32570
Pipeline
#2190
failed with stage
in 12 minutes and 28 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
38 deletions
+24
-38
src/contents/ui/Main.qml
src/contents/ui/Main.qml
+3
-3
src/contents/ui/TodosView.qml
src/contents/ui/TodosView.qml
+3
-5
src/plugins/localcalendar.cpp
src/plugins/localcalendar.cpp
+6
-0
src/plugins/localcalendar.h
src/plugins/localcalendar.h
+8
-7
src/plugins/todosmodel.cpp
src/plugins/todosmodel.cpp
+4
-18
src/plugins/todosmodel.h
src/plugins/todosmodel.h
+0
-5
No files found.
src/contents/ui/Main.qml
View file @
05b294b4
...
...
@@ -72,11 +72,11 @@ Kirigami.ApplicationWindow {
}
Kirigami.Action
{
text
:
"
Tasks
"
text
:
"
Tasks
"
+
"
(
"
+
localCalendar
.
name
+
"
)
"
iconName
:
"
view-calendar-tasks
"
onTriggered
:
{
pageStack
.
clear
();
pageStack
.
push
(
todosView
,
{
filtered
:
false
,
todoDt
:
null
});
pageStack
.
push
(
todosView
,
{
todoDt
:
localCalendar
.
nulldate
});
}
}
}
...
...
@@ -162,7 +162,7 @@ Kirigami.ApplicationWindow {
onTriggered
:
{
if
(
localCalendar
.
todosCount
(
calendarMonthView
.
selectedDate
)
>
0
)
{
root
.
pageStack
.
push
(
todosView
,
{
filtered
:
true
,
todoDt
:
calendarMonthView
.
selectedDate
});
root
.
pageStack
.
push
(
todosView
,
{
todoDt
:
calendarMonthView
.
selectedDate
});
}
else
{
showPassiveNotification
(
i18n
(
"
There is no task for the day selected
"
));
...
...
src/contents/ui/TodosView.qml
View file @
05b294b4
...
...
@@ -26,9 +26,8 @@ import org.kde.phone.calindori 0.1 as Calindori
Kirigami.Page
{
id
:
root
property
var
todoDt
property
date
todoDt
property
var
calendar
property
bool
filtered
signal
editTask
(
var
modelData
)
signal
tasksUpdated
...
...
@@ -43,7 +42,7 @@ Kirigami.Page {
actions.main
:
Kirigami.Action
{
icon.name
:
"
resource-calendar-insert
"
text
:
qsTr
(
"
Add task
"
)
onTriggered
:
pageStack
.
push
(
todoPage
,
{
startdt
:
todoDt
}
)
onTriggered
:
pageStack
.
push
(
todoPage
,
{
startdt
:
todoDt
}
)
}
...
...
@@ -64,8 +63,7 @@ Kirigami.Page {
anchors.fill
:
parent
model
:
Calindori.TodosModel
{
filtered
:
root
.
filtered
filterdt
:
root
.
todoDt
!=
null
&&
!
isNaN
(
root
.
todoDt
)
?
root
.
todoDt
:
new
Date
(
"
No Date
"
)
filterdt
:
root
.
todoDt
memorycalendar
:
root
.
calendar
.
memorycalendar
}
...
...
src/plugins/localcalendar.cpp
View file @
05b294b4
...
...
@@ -162,3 +162,9 @@ void LocalCalendar::deleteCalendar()
calendarFile
.
remove
();
}
}
QDateTime
LocalCalendar
::
nulldate
()
const
{
return
QDateTime
();
}
src/plugins/localcalendar.h
View file @
05b294b4
...
...
@@ -31,15 +31,16 @@ class LocalCalendar : public QObject
Q_PROPERTY
(
QString
name
READ
name
WRITE
setName
NOTIFY
nameChanged
)
Q_PROPERTY
(
QSharedPointer
<
MemoryCalendar
>
memorycalendar
READ
memorycalendar
WRITE
setMemorycalendar
NOTIFY
memorycalendarChanged
)
Q_PROPERTY
(
QSharedPointer
<
FileStorage
>
calendarstorage
READ
calendarstorage
WRITE
setCalendarstorage
NOTIFY
calendarstorageChanged
)
Q_PROPERTY
(
QDateTime
nulldate
READ
nulldate
CONSTANT
)
public:
explicit
LocalCalendar
(
QObject
*
parent
=
nullptr
);
~
LocalCalendar
()
override
;
MemoryCalendar
::
Ptr
memorycalendar
()
const
;
FileStorage
::
Ptr
calendarstorage
()
const
;
QString
name
()
const
;
QDateTime
nulldate
()
const
;
void
setMemorycalendar
(
MemoryCalendar
::
Ptr
memoryCalendar
);
void
setCalendarstorage
(
FileStorage
::
Ptr
calendarStorage
);
...
...
src/plugins/todosmodel.cpp
View file @
05b294b4
...
...
@@ -26,7 +26,6 @@ TodosModel::TodosModel(QObject* parent)
{
connect
(
this
,
&
TodosModel
::
memorycalendarChanged
,
this
,
&
TodosModel
::
loadTasks
);
connect
(
this
,
&
TodosModel
::
filterdtChanged
,
this
,
&
TodosModel
::
loadTasks
);
connect
(
this
,
&
TodosModel
::
filteredChanged
,
this
,
&
TodosModel
::
loadTasks
);
}
TodosModel
::~
TodosModel
()
=
default
;
...
...
@@ -101,10 +100,8 @@ QDate TodosModel::filterdt() const
void
TodosModel
::
setFilterdt
(
QDate
filterDate
)
{
if
(
filterDate
.
isValid
())
{
m_filterdt
=
filterDate
;
emit
filterdtChanged
();
}
}
int
TodosModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
...
...
@@ -118,22 +115,11 @@ void TodosModel::loadTasks()
{
beginResetModel
();
m_todos
.
clear
();
if
(
m_calendar
!=
nullptr
&&
m_filterdt
.
isValid
()
&&
filtered
()
)
{
if
(
m_calendar
!=
nullptr
&&
m_filterdt
.
isValid
())
{
m_todos
=
m_calendar
->
rawTodos
(
m_filterdt
,
m_filterdt
);
}
if
(
m_calendar
!=
nullptr
&&
!
(
filtered
()
))
{
if
(
m_calendar
!=
nullptr
&&
m_filterdt
.
isNull
(
))
{
m_todos
=
m_calendar
->
rawTodos
();
}
endResetModel
();
}
void
TodosModel
::
setFiltered
(
bool
hasFilter
)
{
m_filtered
=
hasFilter
;
emit
filteredChanged
();
}
bool
TodosModel
::
filtered
()
const
{
return
m_filtered
;
}
src/plugins/todosmodel.h
View file @
05b294b4
...
...
@@ -31,7 +31,6 @@ class TodosModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY
(
bool
filtered
READ
filtered
WRITE
setFiltered
NOTIFY
filteredChanged
)
Q_PROPERTY
(
QDate
filterdt
READ
filterdt
WRITE
setFilterdt
NOTIFY
filterdtChanged
)
Q_PROPERTY
(
QSharedPointer
<
MemoryCalendar
>
memorycalendar
READ
memorycalendar
WRITE
setMemorycalendar
NOTIFY
memorycalendarChanged
)
Q_PROPERTY
(
int
count
READ
rowCount
NOTIFY
rowsChanged
)
...
...
@@ -61,9 +60,6 @@ public:
QDate
filterdt
()
const
;
void
setFilterdt
(
QDate
filterDate
);
bool
filtered
()
const
;
void
setFiltered
(
bool
hasFilter
);
QHash
<
int
,
QByteArray
>
roleNames
()
const
override
;
public
Q_SLOTS
:
...
...
@@ -73,7 +69,6 @@ Q_SIGNALS:
void
rowsChanged
();
void
memorycalendarChanged
();
void
filterdtChanged
();
void
filteredChanged
();
private:
...
...
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