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
Akonadi Calendar
Commits
a395ae46
Commit
a395ae46
authored
Oct 17, 2022
by
Laurent Montel
Browse files
Adapt to new api (scripted)
parent
014ca5f0
Pipeline
#249340
passed with stage
in 2 minutes and 28 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/calendarclipboard.cpp
View file @
a395ae46
...
...
@@ -13,6 +13,7 @@
#include
<QApplication>
#include
<QClipboard>
#include
<kwidgetsaddons_version.h>
using
namespace
Akonadi
;
...
...
@@ -171,21 +172,29 @@ void CalendarClipboard::cutIncidence(const KCalendarCore::Incidence::Ptr &incide
{
const
bool
hasChildren
=
!
d
->
m_calendar
->
childIncidences
(
incidence
->
uid
()).
isEmpty
();
if
(
mode
==
AskMode
&&
hasChildren
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
km
=
KMessageBox
::
questionTwoActionsCancel
(
nullptr
,
#else
const
int
km
=
KMessageBox
::
questionYesNoCancel
(
nullptr
,
i18n
(
"The item
\"
%1
\"
has sub-to-dos. "
"Do you want to cut just this item and "
"make all its sub-to-dos independent, or "
"cut the to-do with all its sub-to-dos?"
,
incidence
->
summary
()),
i18nc
(
"@title:window"
,
"KOrganizer Confirmation"
),
KGuiItem
(
i18n
(
"Cut Only This"
)),
KGuiItem
(
i18n
(
"Cut All"
)));
#endif
i18n
(
"The item
\"
%1
\"
has sub-to-dos. "
"Do you want to cut just this item and "
"make all its sub-to-dos independent, or "
"cut the to-do with all its sub-to-dos?"
,
incidence
->
summary
()),
i18nc
(
"@title:window"
,
"KOrganizer Confirmation"
),
KGuiItem
(
i18n
(
"Cut Only This"
)),
KGuiItem
(
i18n
(
"Cut All"
)));
if
(
km
==
KMessageBox
::
Cancel
)
{
Q_EMIT
cutFinished
(
/*success=*/
true
,
QString
());
return
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
mode
=
km
==
KMessageBox
::
ButtonCode
::
PrimaryAction
?
SingleMode
:
RecursiveMode
;
#else
mode
=
km
==
KMessageBox
::
Yes
?
SingleMode
:
RecursiveMode
;
#endif
}
else
if
(
mode
==
AskMode
)
{
mode
=
SingleMode
;
// Doesn't have children, don't ask
}
...
...
@@ -211,18 +220,26 @@ bool CalendarClipboard::copyIncidence(const KCalendarCore::Incidence::Ptr &incid
{
const
bool
hasChildren
=
!
d
->
m_calendar
->
childIncidences
(
incidence
->
uid
()).
isEmpty
();
if
(
mode
==
AskMode
&&
hasChildren
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
km
=
KMessageBox
::
questionTwoActionsCancel
(
nullptr
,
#else
const
int
km
=
KMessageBox
::
questionYesNoCancel
(
nullptr
,
i18n
(
"The item
\"
%1
\"
has sub-to-dos. "
"Do you want to copy just this item or "
"copy the to-do with all its sub-to-dos?"
,
incidence
->
summary
()),
i18nc
(
"@title:window"
,
"KOrganizer Confirmation"
),
KGuiItem
(
i18n
(
"Copy Only This"
)),
KGuiItem
(
i18n
(
"Copy All"
)));
#endif
i18n
(
"The item
\"
%1
\"
has sub-to-dos. "
"Do you want to copy just this item or "
"copy the to-do with all its sub-to-dos?"
,
incidence
->
summary
()),
i18nc
(
"@title:window"
,
"KOrganizer Confirmation"
),
KGuiItem
(
i18n
(
"Copy Only This"
)),
KGuiItem
(
i18n
(
"Copy All"
)));
if
(
km
==
KMessageBox
::
Cancel
)
{
return
true
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
mode
=
km
==
KMessageBox
::
ButtonCode
::
PrimaryAction
?
SingleMode
:
RecursiveMode
;
#else
mode
=
km
==
KMessageBox
::
Yes
?
SingleMode
:
RecursiveMode
;
#endif
}
else
if
(
mode
==
AskMode
)
{
mode
=
SingleMode
;
// Doesn't have children, don't ask
}
...
...
src/incidencechanger.cpp
View file @
a395ae46
...
...
@@ -21,6 +21,7 @@
#include
<KMessageBox>
#include
<QBitArray>
#include
<kwidgetsaddons_version.h>
using
namespace
Akonadi
;
using
namespace
KCalendarCore
;
...
...
@@ -1323,12 +1324,21 @@ void IncidenceChanger::cancelAttendees( const Akonadi::Item &aitem )
const KCalendarCore::Incidence::Ptr incidence = CalendarSupport::incidence( aitem );
Q_ASSERT( incidence );
if ( KCalPrefs::instance()->mUseGroupwareCommunication ) {
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if (KMessageBox::questionTwoActions(
#else
if ( KMessageBox::questionYesNo(
#endif
0,
i18n( "Some attendees were removed from the incidence. "
"Shall cancel messages be sent to these attendees?" ),
i18nc("@title:window", "Attendees Removed" ), KGuiItem( i18n( "Send Messages" ) ),
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
KGuiItem( i18n( "Do Not Send" ) ) ) == KMessageBox::ButtonCode::PrimaryAction) {
#else
KGuiItem( i18n( "Do Not Send" ) ) ) == KMessageBox::Yes ) {
#endif
// don't use Akonadi::Groupware::sendICalMessage here, because that asks just
// a very general question "Other people are involved, send message to
// them?", which isn't helpful at all in this situation. Afterwards, it
...
...
src/itiphandlerhelper_p.cpp
View file @
a395ae46
...
...
@@ -19,6 +19,7 @@
#include
<KMessageBox>
#include
<QWidget>
#include
<kwidgetsaddons_version.h>
using
namespace
Akonadi
;
...
...
@@ -60,11 +61,28 @@ int ITIPHandlerDialogDelegate::askUserIfNeeded(const QString &question, Action a
switch
(
action
)
{
case
ActionSendMessage
:
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
ButtonCode
::
PrimaryAction
;
#else
return
KMessageBox
::
Yes
;
#endif
case
ActionDontSendMessage
:
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
ButtonCode
::
SecondaryAction
;
#else
return
KMessageBox
::
No
;
#endif
default:
return
KMessageBox
::
questionYesNo
(
mParent
,
question
,
i18nc
(
"@title:window"
,
"Group Scheduling Email"
),
buttonYes
,
buttonNo
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
questionTwoActionsCancel
(
#else
return
KMessageBox
::
questionYesNo
(
#endif
mParent
,
question
,
i18nc
(
"@title:window"
,
"Group Scheduling Email"
),
buttonYes
,
buttonNo
);
}
}
...
...
@@ -118,7 +136,11 @@ ITIPHandlerHelper::sentInvitation(int messageBoxReturnCode, const KCalendarCore:
// Where the email contains an invitation, modification notification or
// deletion notification.
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
messageBoxReturnCode
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
messageBoxReturnCode
==
KMessageBox
::
Yes
)
{
#endif
// We will be sending out a message here. Now make sure there is some summary
// Yes, we do modify the incidence here, but we still keep the Ptr
// semantics, because this change is only for sending and not stored int the
...
...
@@ -132,7 +154,11 @@ ITIPHandlerHelper::sentInvitation(int messageBoxReturnCode, const KCalendarCore:
m_status
=
StatusSendingInvitation
;
m_scheduler
->
performTransaction
(
_incidence
,
method
);
return
ITIPHandlerHelper
::
ResultSuccess
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
messageBoxReturnCode
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
messageBoxReturnCode
==
KMessageBox
::
No
)
{
#endif
Q_EMIT
finished
(
ITIPHandlerHelper
::
ResultCanceled
,
QString
());
return
ITIPHandlerHelper
::
ResultCanceled
;
}
else
{
...
...
@@ -247,8 +273,13 @@ bool ITIPHandlerHelper::handleIncidenceAboutToBeModified(const KCalendarCore::In
"You are not the organizer of this event. Editing it will "
"bring your calendar out of sync with the organizer's calendar. "
"Do you really want to edit it?"
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
messageBoxReturnCode
=
KMessageBox
::
warningTwoActions
(
mParent
,
question
,
{},
KStandardGuiItem
::
ok
(),
KStandardGuiItem
::
cancel
());
return
messageBoxReturnCode
!=
KMessageBox
::
ButtonCode
::
SecondaryAction
;
#else
const
int
messageBoxReturnCode
=
KMessageBox
::
warningYesNo
(
mParent
,
question
);
return
messageBoxReturnCode
!=
KMessageBox
::
No
;
#endif
break
;
}
case
KCalendarCore
::
Incidence
::
TypeJournal
:
...
...
@@ -322,7 +353,11 @@ void ITIPHandlerHelper::sendIncidenceModifiedMessage(KCalendarCore::iTIPMethod m
KGuiItem
(
i18n
(
"Send Update"
)));
return
;
}
else
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
slotIncidenceModifiedDialogClosed
(
KMessageBox
::
ButtonCode
::
PrimaryAction
,
method
,
incidence
);
#else
slotIncidenceModifiedDialogClosed
(
KMessageBox
::
Yes
,
method
,
incidence
);
#endif
delete
askDelegator
;
return
;
}
...
...
@@ -455,9 +490,17 @@ ITIPHandlerHelper::SendResult ITIPHandlerHelper::sendCounterProposal(const KCale
tmp
->
setDescription
(
newEvent
->
description
());
tmp
->
addComment
(
proposalComment
(
newEvent
));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
sentInvitation
(
KMessageBox
::
ButtonCode
::
PrimaryAction
,
tmp
,
KCalendarCore
::
iTIPReply
);
#else
return
sentInvitation
(
KMessageBox
::
Yes
,
tmp
,
KCalendarCore
::
iTIPReply
);
#endif
}
else
{
return
sentInvitation
(
KMessageBox
::
Yes
,
newEvent
,
KCalendarCore
::
iTIPCounter
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
sentInvitation
(
KMessageBox
::
ButtonCode
::
PrimaryAction
,
newEvent
,
KCalendarCore
::
iTIPReply
);
#else
return
sentInvitation
(
KMessageBox
::
Yes
,
newEvent
,
KCalendarCore
::
iTIPReply
);
#endif
}
}
...
...
@@ -490,7 +533,11 @@ void ITIPHandlerHelper::slotSchedulerFinishDialog(const int result, KCalendarCor
{
Q_UNUSED
(
method
)
Q_UNUSED
(
incidence
)
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
Q_EMIT
finished
(
ResultFailAbortUpdate
,
QString
());
}
else
{
Q_EMIT
finished
(
ResultFailKeepUpdate
,
QString
());
...
...
src/scheduler_p.cpp
View file @
a395ae46
...
...
@@ -17,6 +17,7 @@
#include
<KLocalizedString>
#include
<KMessageBox>
#include
<QTimeZone>
#include
<kwidgetsaddons_version.h>
using
namespace
KCalendarCore
;
using
namespace
Akonadi
;
...
...
@@ -477,12 +478,21 @@ void Scheduler::acceptReply(const IncidenceBase::Ptr &incidenceBase,
if
(
!
attNew
.
delegator
().
isEmpty
())
{
msg
=
i18nc
(
"@info"
,
"%1 wants to attend %2 on behalf of %3."
,
attNew
.
fullName
(),
incidence
->
summary
(),
attNew
.
delegator
());
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
questionTwoActions
(
nullptr
,
#else
if
(
KMessageBox
::
questionYesNo
(
nullptr
,
msg
,
i18nc
(
"@title:window"
,
"Uninvited Attendee"
),
KGuiItem
(
i18nc
(
"@option"
,
"Accept Attendance"
)),
KGuiItem
(
i18nc
(
"@option"
,
"Reject Attendance"
)))
#endif
msg
,
i18nc
(
"@title:window"
,
"Uninvited Attendee"
),
KGuiItem
(
i18nc
(
"@option"
,
"Accept Attendance"
)),
KGuiItem
(
i18nc
(
"@option"
,
"Reject Attendance"
)))
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
!=
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
!=
KMessageBox
::
Yes
)
{
#endif
Incidence
::
Ptr
cancel
=
incidence
;
cancel
->
addComment
(
i18nc
(
"@info"
,
"The organizer rejected your attendance at this meeting."
));
performTransaction
(
incidenceBase
,
iTIPCancel
,
attNew
.
fullName
());
...
...
@@ -503,14 +513,23 @@ void Scheduler::acceptReply(const IncidenceBase::Ptr &incidenceBase,
// send update about new participants
if
(
attendeeAdded
)
{
bool
sendMail
=
false
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
questionTwoActions
(
nullptr
,
#else
if
(
KMessageBox
::
questionYesNo
(
nullptr
,
i18nc
(
"@info"
,
"An attendee was added to the incidence. "
"Do you want to email the attendees an update message?"
),
i18nc
(
"@title:window"
,
"Attendee Added"
),
KGuiItem
(
i18nc
(
"@option"
,
"Send Messages"
)),
KGuiItem
(
i18nc
(
"@option"
,
"Do Not Send"
)))
#endif
i18nc
(
"@info"
,
"An attendee was added to the incidence. "
"Do you want to email the attendees an update message?"
),
i18nc
(
"@title:window"
,
"Attendee Added"
),
KGuiItem
(
i18nc
(
"@option"
,
"Send Messages"
)),
KGuiItem
(
i18nc
(
"@option"
,
"Do Not Send"
)))
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
==
KMessageBox
::
Yes
)
{
#endif
sendMail
=
true
;
}
...
...
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