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
KMail
Commits
e5876e16
Commit
e5876e16
authored
Oct 15, 2022
by
Laurent Montel
Browse files
Adapt to new api (scripted)
parent
602b25f5
Pipeline
#248518
passed with stage
in 7 minutes and 41 seconds
Changes
12
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
agents/archivemailagent/archivemailwidget.cpp
View file @
e5876e16
...
...
@@ -24,6 +24,7 @@
#include
<KSharedConfig>
#include
<QLocale>
#include
<QMenu>
#include
<kwidgetsaddons_version.h>
namespace
{
...
...
@@ -228,12 +229,20 @@ bool ArchiveMailWidget::save() const
void
ArchiveMailWidget
::
slotDeleteItem
()
{
const
QList
<
QTreeWidgetItem
*>
listItems
=
mWidget
.
treeWidget
->
selectedItems
();
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
warningTwoActions
(
parentWidget
(),
#else
const
int
answer
=
KMessageBox
::
warningYesNo
(
parentWidget
(),
i18n
(
"Do you want to delete the selected items?"
),
i18nc
(
"@title:window"
,
"Delete Items"
),
KStandardGuiItem
::
del
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"Do you want to delete the selected items?"
),
i18nc
(
"@title:window"
,
"Delete Items"
),
KStandardGuiItem
::
del
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
No
)
{
#endif
return
;
}
...
...
agents/sendlateragent/sendlaterconfigurewidget.cpp
View file @
e5876e16
...
...
@@ -15,6 +15,7 @@
#include
<QIcon>
#include
<QMenu>
#include
<QPointer>
#include
<kwidgetsaddons_version.h>
namespace
{
...
...
@@ -203,21 +204,37 @@ void SendLaterWidget::slotDeleteItem()
return
;
}
const
int
numberOfItems
(
listItems
.
count
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
answer
=
KMessageBox
::
warningTwoActions
(
this
,
#else
int
answer
=
KMessageBox
::
warningYesNo
(
this
,
i18np
(
"Do you want to delete the selected item?"
,
"Do you want to delete the selected items?"
,
numberOfItems
),
i18nc
(
"@title:window"
,
"Delete Items"
),
KStandardGuiItem
::
del
(),
KStandardGuiItem
::
cancel
());
#endif
i18np
(
"Do you want to delete the selected item?"
,
"Do you want to delete the selected items?"
,
numberOfItems
),
i18nc
(
"@title:window"
,
"Delete Items"
),
KStandardGuiItem
::
del
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
No
)
{
#endif
return
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
answer
=
KMessageBox
::
warningTwoActions
(
this
,
#else
answer
=
KMessageBox
::
warningYesNo
(
this
,
i18np
(
"Do you want to delete the message as well?"
,
"Do you want to delete the messages as well?"
,
numberOfItems
),
i18nc
(
"@title:window"
,
"Delete Messages"
),
KStandardGuiItem
::
del
(),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Delete"
),
QStringLiteral
(
"dialog-cancel"
)));
#endif
i18np
(
"Do you want to delete the message as well?"
,
"Do you want to delete the messages as well?"
,
numberOfItems
),
i18nc
(
"@title:window"
,
"Delete Messages"
),
KStandardGuiItem
::
del
(),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Delete"
),
QStringLiteral
(
"dialog-cancel"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
bool
deleteMessage
=
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
);
#else
const
bool
deleteMessage
=
(
answer
==
KMessageBox
::
Yes
);
#endif
for
(
QTreeWidgetItem
*
item
:
listItems
)
{
if
(
deleteMessage
)
{
...
...
agents/sendlateragent/sendlatermanager.cpp
View file @
e5876e16
...
...
@@ -20,6 +20,7 @@
#include
<QRegularExpression>
#include
<QStringList>
#include
<QTimer>
#include
<kwidgetsaddons_version.h>
SendLaterManager
::
SendLaterManager
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -187,12 +188,20 @@ void SendLaterManager::sendError(MessageComposer::SendLaterInfo *info, ErrorType
case
TooManyItemFound
:
case
CanNotFetchItem
:
case
CanNotCreateTransport
:
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
questionTwoActions
(
nullptr
,
#else
const
int
answer
=
KMessageBox
::
questionYesNo
(
nullptr
,
i18n
(
"An error was found. Do you want to resend it?"
),
i18n
(
"Error found"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Resend"
),
QStringLiteral
(
"mail-send"
)),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"An error was found. Do you want to resend it?"
),
i18n
(
"Error found"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Resend"
),
QStringLiteral
(
"mail-send"
)),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
No
)
{
#endif
removeLaterInfo
(
info
);
}
break
;
...
...
agents/unifiedmailboxagent/settingsdialog.cpp
View file @
e5876e16
...
...
@@ -24,6 +24,7 @@
#include
<QMenu>
#include
<QWindow>
#include
<kwidgetsaddons_version.h>
#include
<memory>
namespace
...
...
@@ -96,12 +97,21 @@ SettingsDialog::SettingsDialog(const KSharedConfigPtr &config, UnifiedMailboxMan
if
(
!
indexes
.
isEmpty
())
{
auto
item
=
mBoxModel
->
itemFromIndex
(
indexes
[
0
]);
const
auto
mailbox
=
item
->
data
().
value
<
UnifiedMailbox
*>
();
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
warningTwoActions
(
this
,
#else
if
(
KMessageBox
::
warningYesNo
(
this
,
i18n
(
"Do you really want to remove unified mailbox <b>%1</b>?"
,
mailbox
->
name
()),
i18n
(
"Really Remove?"
),
KStandardGuiItem
::
remove
(),
KStandardGuiItem
::
cancel
())
#endif
i18n
(
"Do you really want to remove unified mailbox <b>%1</b>?"
,
mailbox
->
name
()),
i18n
(
"Really Remove?"
),
KStandardGuiItem
::
remove
(),
KStandardGuiItem
::
cancel
())
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
==
KMessageBox
::
Yes
)
{
#endif
mBoxModel
->
removeRow
(
item
->
row
());
mBoxManager
.
removeBox
(
mailbox
->
id
());
mBoxManager
.
saveBoxes
();
...
...
src/configuredialog/configureappearancepage.cpp
View file @
e5876e16
...
...
@@ -66,6 +66,7 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
#include
<QSpinBox>
#include
<QVBoxLayout>
#include
<QWhatsThis>
#include
<kwidgetsaddons_version.h>
using
KMime
::
DateFormatter
;
using
namespace
MailCommon
;
...
...
@@ -1126,12 +1127,17 @@ void AppearancePageMessageTagTab::slotRemoveTag()
{
const
int
tmp_index
=
mTagListBox
->
currentRow
();
if
(
tmp_index
>=
0
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
ButtonCode
::
PrimaryAction
==
KMessageBox
::
questionTwoActions
(
this
,
#else
if
(
KMessageBox
::
Yes
==
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"Do you want to remove tag
\'
%1
\'
?"
,
mTagListBox
->
item
(
mTagListBox
->
currentRow
())
->
text
()),
i18nc
(
"@title:window"
,
"Remove Tag"
),
KStandardGuiItem
::
remove
(),
KStandardGuiItem
::
cancel
()))
{
#endif
i18n
(
"Do you want to remove tag
\'
%1
\'
?"
,
mTagListBox
->
item
(
mTagListBox
->
currentRow
())
->
text
()),
i18nc
(
"@title:window"
,
"Remove Tag"
),
KStandardGuiItem
::
remove
(),
KStandardGuiItem
::
cancel
()))
{
QListWidgetItem
*
item
=
mTagListBox
->
takeItem
(
mTagListBox
->
currentRow
());
auto
tagItem
=
static_cast
<
TagListWidgetItem
*>
(
item
);
MailCommon
::
Tag
::
Ptr
tmp_desc
=
tagItem
->
kmailTag
();
...
...
src/editor/kmcomposerwin.cpp
View file @
e5876e16
...
...
@@ -193,6 +193,7 @@
#include
<KDialogJobUiDelegate>
#include
<KIO/CommandLauncherJob>
#include
<chrono>
#include
<kwidgetsaddons_version.h>
using
namespace
std
::
chrono_literals
;
...
...
@@ -1997,15 +1998,23 @@ bool KMComposerWin::queryClose()
:
i18n
(
"Save this message in the Drafts folder. "
"It can then be edited and sent at a later time."
));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
rc
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
#else
const
int
rc
=
KMessageBox
::
warningYesNoCancel
(
this
,
i18n
(
"Do you want to save the message for later or discard it?"
),
i18n
(
"Close Composer"
),
KGuiItem
(
savebut
,
QStringLiteral
(
"document-save"
),
QString
(),
savetext
),
KStandardGuiItem
::
discard
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"Do you want to save the message for later or discard it?"
),
i18n
(
"Close Composer"
),
KGuiItem
(
savebut
,
QStringLiteral
(
"document-save"
),
QString
(),
savetext
),
KStandardGuiItem
::
discard
(),
KStandardGuiItem
::
cancel
());
if
(
rc
==
KMessageBox
::
Cancel
)
{
return
false
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
rc
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
}
else
if
(
rc
==
KMessageBox
::
Yes
)
{
#endif
// doSend will close the window. Just return false from this method
if
(
istemplate
)
{
slotSaveTemplate
();
...
...
@@ -2785,13 +2794,21 @@ void KMComposerWin::doSend(MessageComposer::MessageSender::SendMethod method, Me
return
;
}
else
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
rc
=
KMessageBox
::
questionTwoActions
(
this
,
#else
const
int
rc
=
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"To: field is empty. "
"Send message anyway?"
),
i18n
(
"No To: specified"
),
KGuiItem
(
i18n
(
"S&end as Is"
),
QLatin1String
(
"mail-send"
)),
KGuiItem
(
i18n
(
"&Specify the To field"
),
QLatin1String
(
"edit-rename"
)));
#endif
i18n
(
"To: field is empty. "
"Send message anyway?"
),
i18n
(
"No To: specified"
),
KGuiItem
(
i18n
(
"S&end as Is"
),
QLatin1String
(
"mail-send"
)),
KGuiItem
(
i18n
(
"&Specify the To field"
),
QLatin1String
(
"edit-rename"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
rc
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
rc
==
KMessageBox
::
No
)
{
#endif
return
;
}
}
...
...
@@ -2799,13 +2816,21 @@ void KMComposerWin::doSend(MessageComposer::MessageSender::SendMethod method, Me
if
(
subject
().
isEmpty
())
{
mEdtSubject
->
setFocus
();
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
rc
=
KMessageBox
::
questionTwoActions
(
this
,
#else
const
int
rc
=
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"You did not specify a subject. "
"Send message anyway?"
),
i18n
(
"No Subject Specified"
),
KGuiItem
(
i18n
(
"S&end as Is"
),
QLatin1String
(
"mail-send"
)),
KGuiItem
(
i18n
(
"&Specify the Subject"
),
QLatin1String
(
"edit-rename"
)));
#endif
i18n
(
"You did not specify a subject. "
"Send message anyway?"
),
i18n
(
"No Subject Specified"
),
KGuiItem
(
i18n
(
"S&end as Is"
),
QLatin1String
(
"mail-send"
)),
KGuiItem
(
i18n
(
"&Specify the Subject"
),
QLatin1String
(
"edit-rename"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
rc
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
rc
==
KMessageBox
::
No
)
{
#endif
return
;
}
}
...
...
@@ -3040,15 +3065,27 @@ void KMComposerWin::slotSendNow()
void
KMComposerWin
::
confirmBeforeSend
()
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
rc
=
KMessageBox
::
warningTwoActionsCancel
(
mMainWidget
,
#else
const
int
rc
=
KMessageBox
::
warningYesNoCancel
(
mMainWidget
,
i18n
(
"About to send email..."
),
i18n
(
"Send Confirmation"
),
KGuiItem
(
i18n
(
"&Send Now"
),
QLatin1String
(
"mail-send"
)),
KGuiItem
(
i18n
(
"Send &Later"
),
QLatin1String
(
"mail-queue"
)));
#endif
i18n
(
"About to send email..."
),
i18n
(
"Send Confirmation"
),
KGuiItem
(
i18n
(
"&Send Now"
),
QLatin1String
(
"mail-send"
)),
KGuiItem
(
i18n
(
"Send &Later"
),
QLatin1String
(
"mail-queue"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
rc
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
rc
==
KMessageBox
::
Yes
)
{
#endif
doSend
(
MessageComposer
::
MessageSender
::
SendImmediate
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
rc
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
rc
==
KMessageBox
::
No
)
{
#endif
doSend
(
MessageComposer
::
MessageSender
::
SendLater
);
}
}
...
...
@@ -3118,12 +3155,21 @@ bool KMComposerWin::checkRecipientNumber() const
{
const
int
thresHold
=
KMailSettings
::
self
()
->
recipientThreshold
();
if
(
KMailSettings
::
self
()
->
tooManyRecipients
()
&&
mComposerBase
->
recipientsEditor
()
->
recipients
().
count
()
>
thresHold
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
questionTwoActions
(
mMainWidget
,
#else
if
(
KMessageBox
::
questionYesNo
(
mMainWidget
,
i18n
(
"You are trying to send the mail to more than %1 recipients. Send message anyway?"
,
thresHold
),
i18n
(
"Too many recipients"
),
KGuiItem
(
i18n
(
"&Send as Is"
)),
KGuiItem
(
i18n
(
"&Edit Recipients"
)))
#endif
i18n
(
"You are trying to send the mail to more than %1 recipients. Send message anyway?"
,
thresHold
),
i18n
(
"Too many recipients"
),
KGuiItem
(
i18n
(
"&Send as Is"
)),
KGuiItem
(
i18n
(
"&Edit Recipients"
)))
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
==
KMessageBox
::
No
)
{
#endif
return
false
;
}
}
...
...
@@ -3158,23 +3204,35 @@ void KMComposerWin::disableHtml(MessageComposer::ComposerViewBase::Confirmation
bool
forcePlainTextMarkup
=
false
;
if
(
confirmation
==
MessageComposer
::
ComposerViewBase
::
LetUserConfirm
&&
mComposerBase
->
editor
()
->
composerControler
()
->
isFormattingUsed
()
&&
!
mForceDisableHtml
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
choice
=
KMessageBox
::
warningTwoActionsCancel
(
this
,
#else
int
choice
=
KMessageBox
::
warningYesNoCancel
(
this
,
i18n
(
"Turning HTML mode off "
"will cause the text to lose the formatting. Are you sure?"
),
i18n
(
"Lose the formatting?"
),
KGuiItem
(
i18n
(
"Lose Formatting"
)),
KGuiItem
(
i18n
(
"Add Markup Plain Text"
)),
KStandardGuiItem
::
cancel
(),
QStringLiteral
(
"LoseFormattingWarning"
));
#endif
i18n
(
"Turning HTML mode off "
"will cause the text to lose the formatting. Are you sure?"
),
i18n
(
"Lose the formatting?"
),
KGuiItem
(
i18n
(
"Lose Formatting"
)),
KGuiItem
(
i18n
(
"Add Markup Plain Text"
)),
KStandardGuiItem
::
cancel
(),
QStringLiteral
(
"LoseFormattingWarning"
));
switch
(
choice
)
{
case
KMessageBox
::
Cancel
:
enableHtml
();
return
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case
KMessageBox
::
ButtonCode
::
SecondaryAction
:
#else
case
KMessageBox
::
No
:
#endif
forcePlainTextMarkup
=
true
;
break
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
case
KMessageBox
::
ButtonCode
::
PrimaryAction
:
#else
case
KMessageBox
::
Yes
:
#endif
break
;
}
}
...
...
src/identity/identityeditvcarddialog.cpp
View file @
e5876e16
...
...
@@ -17,6 +17,7 @@
#include
<QFileInfo>
#include
<QPushButton>
#include
<QVBoxLayout>
#include
<kwidgetsaddons_version.h>
IdentityEditVcardDialog
::
IdentityEditVcardDialog
(
const
QString
&
fileName
,
QWidget
*
parent
)
:
QDialog
(
parent
)
...
...
@@ -54,12 +55,20 @@ void IdentityEditVcardDialog::slotDeleteCurrentVCard()
if
(
mVcardFileName
.
isEmpty
())
{
return
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
questionTwoActions
(
this
,
#else
const
int
answer
=
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"Are you sure you want to delete this vCard?"
),
i18n
(
"Delete vCard"
),
KStandardGuiItem
::
del
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"Are you sure you want to delete this vCard?"
),
i18n
(
"Delete vCard"
),
KStandardGuiItem
::
del
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
Yes
)
{
#endif
if
(
mVcardFileName
.
startsWith
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericConfigLocation
)))
{
deleteCurrentVcard
(
true
);
}
else
{
...
...
@@ -121,12 +130,20 @@ QString IdentityEditVcardDialog::saveVcard() const
void
IdentityEditVcardDialog
::
reject
()
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
questionTwoActions
(
this
,
#else
const
int
answer
=
KMessageBox
::
questionYesNo
(
this
,
i18nc
(
"@info"
,
"Do you really want to cancel?"
),
i18nc
(
"@title:window"
,
"Confirmation"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Cancel Editing"
),
QStringLiteral
(
"dialog-ok"
)),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Cancel"
),
QStringLiteral
(
"dialog-cancel"
)));
#endif
i18nc
(
"@info"
,
"Do you really want to cancel?"
),
i18nc
(
"@title:window"
,
"Confirmation"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Cancel Editing"
),
QStringLiteral
(
"dialog-ok"
)),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Cancel"
),
QStringLiteral
(
"dialog-cancel"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
Yes
)
{
#endif
QDialog
::
reject
();
// Discard current changes
}
}
src/job/opencomposerjob.cpp
View file @
e5876e16
...
...
@@ -17,6 +17,7 @@
#include
<QFile>
#include
<QMimeDatabase>
#include
<TemplateParser/TemplateParserJob>
#include
<kwidgetsaddons_version.h>
OpenComposerJob
::
OpenComposerJob
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -112,12 +113,20 @@ void OpenComposerJob::slotOpenComposer()
for
(
QList
<
QUrl
>::
ConstIterator
it
=
attachURLs
.
constBegin
();
it
!=
endAttachment
;
++
it
)
{
QMimeDatabase
mimeDb
;
if
(
mimeDb
.
mimeTypeForUrl
(
*
it
).
name
()
==
QLatin1String
(
"inode/directory"
))
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
questionTwoActions
(
nullptr
,
#else
const
int
answer
=
KMessageBox
::
questionYesNo
(
nullptr
,
i18n
(
"Do you want to attach this folder
\"
%1
\"
?"
,
(
*
it
).
toDisplayString
()),
i18n
(
"Attach Folder"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Attach"
),
QStringLiteral
(
"dialog-ok"
)),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Attach"
),
QStringLiteral
(
"dialog-cancel"
)));
#endif
i18n
(
"Do you want to attach this folder
\"
%1
\"
?"
,
(
*
it
).
toDisplayString
()),
i18n
(
"Attach Folder"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Attach"
),
QStringLiteral
(
"dialog-ok"
)),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Attach"
),
QStringLiteral
(
"dialog-cancel"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
No
)
{
#endif
continue
;
}
}
...
...
src/kmcommands.cpp
View file @
e5876e16
...
...
@@ -119,6 +119,7 @@
#include
<QFontDatabase>
#include
<QProgressDialog>
#include
<QStandardPaths>
#include
<kwidgetsaddons_version.h>
using
KMail
::
SecondaryWindow
;
using
MailTransport
::
TransportManager
;
...
...
@@ -904,15 +905,23 @@ KMCommand::Result KMForwardCommand::execute()
if
(
msgList
.
count
()
>=
2
)
{
// ask if they want a mime digest forward
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
answer
=
KMessageBox
::
questionTwoActionsCancel
(
parentWidget
(),
#else
int
answer
=
KMessageBox
::
questionYesNoCancel
(
parentWidget
(),
i18n
(
"Do you want to forward the selected messages as "
"attachments in one message (as a MIME digest) or as "
"individual messages?"
),
QString
(),
KGuiItem
(
i18n
(
"Send As Digest"
)),
KGuiItem
(
i18n
(
"Send Individually"
)));
#endif
i18n
(
"Do you want to forward the selected messages as "
"attachments in one message (as a MIME digest) or as "
"individual messages?"
),
QString
(),
KGuiItem
(
i18n
(
"Send As Digest"
)),
KGuiItem
(
i18n
(
"Send Individually"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
Yes
)
{
#endif
Akonadi
::
Item
firstItem
(
msgList
.
first
());
MessageFactoryNG
factory
(
KMime
::
Message
::
Ptr
(
new
KMime
::
Message
),
firstItem
.
id
(),
...
...
@@ -926,7 +935,11 @@ KMCommand::Result KMForwardCommand::execute()
win
->
show
();
delete
fwdMsg
.
second
;
return
OK
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
// NO MIME DIGEST, Multiple forward
#else
}
else
if
(
answer
==
KMessageBox
::
No
)
{
// NO MIME DIGEST, Multiple forward
#endif
Akonadi
::
Item
::
List
::
const_iterator
it
;
Akonadi
::
Item
::
List
::
const_iterator
end
(
msgList
.
constEnd
());
...
...
src/kmkernel.cpp
View file @
e5876e16
...
...
@@ -114,6 +114,7 @@ using KMail::MailServiceImpl;
#include
<KUserFeedback/Provider>
#endif
#include
<chrono>
#include
<kwidgetsaddons_version.h>
using
namespace
std
::
chrono_literals
;
//#define DEBUG_SCHEDULER 1
...
...
@@ -941,15 +942,23 @@ bool KMKernel::askToGoOnline()
if
(
KMailSettings
::
self
()
->
networkState
()
==
KMailSettings
::
EnumNetworkState
::
Offline
)
{
s_askingToGoOnline
=
true
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
int
rc
=
KMessageBox
::
questionTwoActions
(
KMKernel
::
self
()
->
mainWin
(),
#else
int
rc
=
KMessageBox
::
questionYesNo
(
KMKernel
::
self
()
->
mainWin
(),
i18n
(
"KMail is currently in offline mode. "
"How do you want to proceed?"
),
i18n
(
"Online/Offline"
),
KGuiItem
(
i18n
(
"Work Online"
)),
KGuiItem
(
i18n
(
"Work Offline"
)));
#endif
i18n
(
"KMail is currently in offline mode. "
"How do you want to proceed?"
),
i18n
(
"Online/Offline"
),
KGuiItem
(
i18n
(
"Work Online"
)),
KGuiItem
(
i18n
(
"Work Offline"
)));
s_askingToGoOnline
=
false
;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
rc
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
rc
==
KMessageBox
::
No
)
{
#endif
return
false
;
}
else
{
kmkernel
->
resumeNetworkJobs
();
...
...
src/kmmainwidget.cpp
View file @
e5876e16
...
...
@@ -187,6 +187,7 @@
using
namespace
std
::
chrono_literals
;
#include
<chrono>
#include
<kwidgetsaddons_version.h>
using
namespace
KMime
;
using
namespace
Akonadi
;
...
...
@@ -301,13 +302,21 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
if
(
kmkernel
->
firstStart
())
{
const
QStringList
listOfMailerFound
=
MailCommon
::
Util
::
foundMailer
();
if
(
!
listOfMailerFound
.
isEmpty
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
questionTwoActionsList
(
this
,
#else
const
int
answer
=
KMessageBox
::
questionYesNoList
(
this
,
i18n
(
"Another mailer was found on system. Do you want to import data from it?"
),
listOfMailerFound
,
QString
(),
KGuiItem
(
i18nc
(
"@action:button"
,
"Import"
),
QStringLiteral
(
"document-import"
)),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Import"
),
QStringLiteral
(
"dialog-cancel"
)));
#endif
i18n
(
"Another mailer was found on system. Do you want to import data from it?"
),
listOfMailerFound
,
QString
(),
KGuiItem
(
i18nc
(
"@action:button"
,
"Import"
),
QStringLiteral
(
"document-import"
)),
KGuiItem
(
i18nc
(
"@action:button"
,
"Do Not Import"
),
QStringLiteral
(
"dialog-cancel"
)));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
Yes
)
{
#endif
const
QString
path
=
QStandardPaths
::
findExecutable
(
QStringLiteral
(
"akonadiimportwizard"
));
if
(
path
.
isEmpty
()
||
!
QProcess
::
startDetached
(
path
,
QStringList
()))
{
KMessageBox
::
error
(
this
,
...
...
@@ -4838,7 +4847,11 @@ void KMMainWidget::setupUnifiedMailboxChecker()
return
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
auto
answer
=
KMessageBox
::
questionTwoActions
(
#else
const
auto
answer
=
KMessageBox
::
questionYesNo
(
#endif
this
,
i18n
(
"You have more than one email account set up.
\n
Do you want to enable the Unified Mailbox feature to "
"show unified content of your inbox, sent and drafts folders?
\n
"
...
...
@@ -4846,7 +4859,11 @@ void KMMainWidget::setupUnifiedMailboxChecker()