Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kalendar
Commits
afd4fff5
Commit
afd4fff5
authored
Nov 20, 2021
by
Claudio Cambra
Browse files
Added menu entries to refresh all calendars, including an F5 shortcut. Fixes
#83
parent
16e03ba2
Pipeline
#99406
failed with stage
in 2 minutes and 22 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/calendarmanager.cpp
View file @
afd4fff5
...
...
@@ -816,6 +816,14 @@ void CalendarManager::redoAction()
m_changer
->
history
()
->
redo
();
}
void
CalendarManager
::
updateAllCollections
()
{
for
(
int
i
=
0
;
i
<
collections
()
->
rowCount
();
i
++
)
{
auto
collection
=
collections
()
->
data
(
collections
()
->
index
(
i
,
0
),
Akonadi
::
EntityTreeModel
::
CollectionRole
).
value
<
Akonadi
::
Collection
>
();
Akonadi
::
AgentManager
::
self
()
->
synchronizeCollection
(
collection
,
true
);
}
}
void
CalendarManager
::
updateCollection
(
qint64
collectionId
)
{
auto
collection
=
m_calendar
->
collection
(
collectionId
);
...
...
src/calendarmanager.h
View file @
afd4fff5
...
...
@@ -87,6 +87,7 @@ public:
Q_INVOKABLE
void
undoAction
();
Q_INVOKABLE
void
redoAction
();
Q_INVOKABLE
void
updateAllCollections
();
Q_INVOKABLE
void
updateCollection
(
qint64
collectionId
);
Q_INVOKABLE
void
deleteCollection
(
qint64
collectionId
);
Q_INVOKABLE
void
editCollection
(
qint64
collectionId
);
...
...
src/contents/ui/GlobalMenu.qml
View file @
afd4fff5
...
...
@@ -97,6 +97,13 @@ Labs.MenuBar {
NativeMenuItemFromAction
{
kalendarAction
:
'
todoview_show_completed
'
}
Labs.MenuSeparator
{
}
NativeMenuItemFromAction
{
kalendarAction
:
"
refresh_all_calendars
"
}
}
Labs.Menu
{
...
...
src/contents/ui/Sidebar.qml
View file @
afd4fff5
...
...
@@ -162,6 +162,9 @@ Kirigami.OverlayDrawer {
KActionFromAction
{
kalendarAction
:
"
import_calendar
"
},
KActionFromAction
{
kalendarAction
:
"
refresh_all_calendars
"
},
Kirigami.Action
{
icon.name
:
KalendarApplication
.
iconName
(
quitAction
.
icon
)
text
:
quitAction
.
text
...
...
src/contents/ui/WindowMenu.qml
View file @
afd4fff5
...
...
@@ -172,6 +172,13 @@ QQC2.MenuBar {
kalendarAction
:
"
todoview_show_completed
"
}
QQC2.MenuSeparator
{
}
KActionFromAction
{
kalendarAction
:
"
refresh_all_calendars
"
}
}
QQC2.Menu
{
...
...
src/contents/ui/main.qml
View file @
afd4fff5
...
...
@@ -58,6 +58,7 @@ Kirigami.ApplicationWindow {
readonly
property
var
quitAction
:
KalendarApplication
.
action
(
"
file_quit
"
)
readonly
property
var
undoAction
:
KalendarApplication
.
action
(
"
edit_undo
"
)
readonly
property
var
redoAction
:
KalendarApplication
.
action
(
"
edit_redo
"
)
readonly
property
var
refreshAllAction
:
KalendarApplication
.
action
(
"
refresh_all_calendars
"
)
readonly
property
var
todoViewSortAlphabeticallyAction
:
KalendarApplication
.
action
(
"
todoview_sort_alphabetically
"
)
readonly
property
var
todoViewSortByDueDateAction
:
KalendarApplication
.
action
(
"
todoview_sort_by_due_date
"
)
...
...
@@ -324,6 +325,10 @@ Kirigami.ApplicationWindow {
function
onOpenKCommandBarAction
()
{
kcommandbarLoader
.
active
=
true
;
}
function
onRefreshAllCalendars
()
{
CalendarManager
.
updateAllCollections
();
}
}
Loader
{
...
...
src/kalendarapplication.cpp
View file @
afd4fff5
...
...
@@ -367,6 +367,17 @@ void KalendarApplication::setupActions()
mCollection
.
addAction
(
openKCommandBarAction
->
objectName
(),
openKCommandBarAction
);
mCollection
.
setDefaultShortcut
(
openKCommandBarAction
,
QKeySequence
(
Qt
::
CTRL
|
Qt
::
ALT
|
Qt
::
Key_I
));
}
actionName
=
QLatin1String
(
"refresh_all_calendars"
);
if
(
KAuthorized
::
authorizeAction
(
actionName
))
{
auto
refreshAllAction
=
mCollection
.
addAction
(
actionName
,
this
,
&
KalendarApplication
::
refreshAllCalendars
);
refreshAllAction
->
setText
(
i18n
(
"Refresh All Calendars"
));
refreshAllAction
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"view-refresh"
)));
mCollection
.
addAction
(
refreshAllAction
->
objectName
(),
refreshAllAction
);
mCollection
.
setDefaultShortcut
(
refreshAllAction
,
QKeySequence
(
QKeySequence
::
Refresh
));
}
mSortCollection
.
readSettings
();
mCollection
.
readSettings
();
}
...
...
src/kalendarapplication.h
View file @
afd4fff5
...
...
@@ -77,6 +77,7 @@ Q_SIGNALS:
void
importIntoExistingFinished
(
bool
success
,
int
total
);
void
importIntoNewFinished
(
bool
success
);
void
importErrorMessageChanged
();
void
refreshAllCalendars
();
private:
KActionCollection
mCollection
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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