Rename method as messageItem

wilder
Laurent Montel 6 years ago
parent d0d53896f5
commit e1e3ac2bd0
  1. 6
      src/kmmainwidget.cpp
  2. 36
      src/kmreadermainwin.cpp
  3. 10
      src/kmreaderwin.cpp
  4. 2
      src/kmreaderwin.h

@ -2325,10 +2325,10 @@ void KMMainWidget::slotSaveAttachments()
// so that KMCommand doesn't download it. // so that KMCommand doesn't download it.
KMSaveAttachmentsCommand *saveCommand = nullptr; KMSaveAttachmentsCommand *saveCommand = nullptr;
if (mMsgView && selectedMessages.size() == 1 if (mMsgView && selectedMessages.size() == 1
&& mMsgView->message().hasPayload<KMime::Message::Ptr>() && mMsgView->messageItem().hasPayload<KMime::Message::Ptr>()
&& selectedMessages.first().id() == mMsgView->message().id()) { && selectedMessages.first().id() == mMsgView->messageItem().id()) {
Akonadi::Item dummyItem; Akonadi::Item dummyItem;
dummyItem.setPayload<KMime::Message::Ptr>(mMsgView->message().payload<KMime::Message::Ptr>()); dummyItem.setPayload<KMime::Message::Ptr>(mMsgView->messageItem().payload<KMime::Message::Ptr>());
saveCommand = new KMSaveAttachmentsCommand(this, dummyItem, mMsgView->viewer()); saveCommand = new KMSaveAttachmentsCommand(this, dummyItem, mMsgView->viewer());
} else { } else {
saveCommand = new KMSaveAttachmentsCommand(this, selectedMessages, mMsgView->viewer()); saveCommand = new KMSaveAttachmentsCommand(this, selectedMessages, mMsgView->viewer());

@ -99,7 +99,7 @@ void KMReaderMainWin::initKMReaderMainWin()
statusBar()->addPermanentWidget(mZoomLabelIndicator); statusBar()->addPermanentWidget(mZoomLabelIndicator);
setZoomChanged(mReaderWin->viewer()->webViewZoomFactor()); setZoomChanged(mReaderWin->viewer()->webViewZoomFactor());
statusBar()->addPermanentWidget(mReaderWin->viewer()->dkimWidgetInfo()); statusBar()->addPermanentWidget(mReaderWin->viewer()->dkimWidgetInfo());
if (!mReaderWin->message().isValid()) { if (!mReaderWin->messageItem().isValid()) {
menuBar()->hide(); menuBar()->hide();
toolBar(QStringLiteral("mainToolBar"))->hide(); toolBar(QStringLiteral("mainToolBar"))->hide();
} else { } else {
@ -316,21 +316,21 @@ void KMReaderMainWin::slotTrashMessage()
void KMReaderMainWin::slotForwardInlineMsg() void KMReaderMainWin::slotForwardInlineMsg()
{ {
if (!mReaderWin->message().hasPayload<KMime::Message::Ptr>()) { if (!mReaderWin->messageItem().hasPayload<KMime::Message::Ptr>()) {
return; return;
} }
KMCommand *command = nullptr; KMCommand *command = nullptr;
const Akonadi::Collection parentCol = mReaderWin->message().parentCollection(); const Akonadi::Collection parentCol = mReaderWin->messageItem().parentCollection();
if (parentCol.isValid()) { if (parentCol.isValid()) {
QSharedPointer<FolderSettings> fd = FolderSettings::forCollection(parentCol, false); QSharedPointer<FolderSettings> fd = FolderSettings::forCollection(parentCol, false);
if (fd) { if (fd) {
command = new KMForwardCommand(this, mReaderWin->message(), command = new KMForwardCommand(this, mReaderWin->messageItem(),
fd->identity(), QString(), mReaderWin->copyText()); fd->identity(), QString(), mReaderWin->copyText());
} else { } else {
command = new KMForwardCommand(this, mReaderWin->message(), 0, QString(), mReaderWin->copyText()); command = new KMForwardCommand(this, mReaderWin->messageItem(), 0, QString(), mReaderWin->copyText());
} }
} else { } else {
command = new KMForwardCommand(this, mReaderWin->message(), 0, QString(), mReaderWin->copyText()); command = new KMForwardCommand(this, mReaderWin->messageItem(), 0, QString(), mReaderWin->copyText());
} }
connect(command, &KMTrashMsgCommand::completed, this, &KMReaderMainWin::slotReplyOrForwardFinished); connect(command, &KMTrashMsgCommand::completed, this, &KMReaderMainWin::slotReplyOrForwardFinished);
command->start(); command->start();
@ -338,21 +338,21 @@ void KMReaderMainWin::slotForwardInlineMsg()
void KMReaderMainWin::slotForwardAttachedMessage() void KMReaderMainWin::slotForwardAttachedMessage()
{ {
if (!mReaderWin->message().hasPayload<KMime::Message::Ptr>()) { if (!mReaderWin->messageItem().hasPayload<KMime::Message::Ptr>()) {
return; return;
} }
KMCommand *command = nullptr; KMCommand *command = nullptr;
const Akonadi::Collection parentCol = mReaderWin->message().parentCollection(); const Akonadi::Collection parentCol = mReaderWin->messageItem().parentCollection();
if (parentCol.isValid()) { if (parentCol.isValid()) {
QSharedPointer<FolderSettings> fd = FolderSettings::forCollection(parentCol, false); QSharedPointer<FolderSettings> fd = FolderSettings::forCollection(parentCol, false);
if (fd) { if (fd) {
command = new KMForwardAttachedCommand(this, mReaderWin->message(), command = new KMForwardAttachedCommand(this, mReaderWin->messageItem(),
fd->identity()); fd->identity());
} else { } else {
command = new KMForwardAttachedCommand(this, mReaderWin->message()); command = new KMForwardAttachedCommand(this, mReaderWin->messageItem());
} }
} else { } else {
command = new KMForwardAttachedCommand(this, mReaderWin->message()); command = new KMForwardAttachedCommand(this, mReaderWin->messageItem());
} }
connect(command, &KMTrashMsgCommand::completed, this, &KMReaderMainWin::slotReplyOrForwardFinished); connect(command, &KMTrashMsgCommand::completed, this, &KMReaderMainWin::slotReplyOrForwardFinished);
@ -361,7 +361,7 @@ void KMReaderMainWin::slotForwardAttachedMessage()
void KMReaderMainWin::slotRedirectMessage() void KMReaderMainWin::slotRedirectMessage()
{ {
const Akonadi::Item currentItem = mReaderWin->message(); const Akonadi::Item currentItem = mReaderWin->messageItem();
if (!currentItem.hasPayload<KMime::Message::Ptr>()) { if (!currentItem.hasPayload<KMime::Message::Ptr>()) {
return; return;
} }
@ -372,7 +372,7 @@ void KMReaderMainWin::slotRedirectMessage()
void KMReaderMainWin::slotCustomReplyToMsg(const QString &tmpl) void KMReaderMainWin::slotCustomReplyToMsg(const QString &tmpl)
{ {
const Akonadi::Item currentItem = mReaderWin->message(); const Akonadi::Item currentItem = mReaderWin->messageItem();
if (!currentItem.hasPayload<KMime::Message::Ptr>()) { if (!currentItem.hasPayload<KMime::Message::Ptr>()) {
return; return;
} }
@ -388,7 +388,7 @@ void KMReaderMainWin::slotCustomReplyToMsg(const QString &tmpl)
void KMReaderMainWin::slotCustomReplyAllToMsg(const QString &tmpl) void KMReaderMainWin::slotCustomReplyAllToMsg(const QString &tmpl)
{ {
const Akonadi::Item currentItem = mReaderWin->message(); const Akonadi::Item currentItem = mReaderWin->messageItem();
if (!currentItem.hasPayload<KMime::Message::Ptr>()) { if (!currentItem.hasPayload<KMime::Message::Ptr>()) {
return; return;
} }
@ -405,7 +405,7 @@ void KMReaderMainWin::slotCustomReplyAllToMsg(const QString &tmpl)
void KMReaderMainWin::slotCustomForwardMsg(const QString &tmpl) void KMReaderMainWin::slotCustomForwardMsg(const QString &tmpl)
{ {
const Akonadi::Item currentItem = mReaderWin->message(); const Akonadi::Item currentItem = mReaderWin->messageItem();
if (!currentItem.hasPayload<KMime::Message::Ptr>()) { if (!currentItem.hasPayload<KMime::Message::Ptr>()) {
return; return;
} }
@ -477,8 +477,8 @@ void KMReaderMainWin::setupAccel()
this, &KMReaderMainWin::slotSelectMoreMessageTagList); this, &KMReaderMainWin::slotSelectMoreMessageTagList);
mTagActionManager->createActions(); mTagActionManager->createActions();
if (mReaderWin->message().isValid()) { if (mReaderWin->messageItem().isValid()) {
mTagActionManager->updateActionStates(1, mReaderWin->message()); mTagActionManager->updateActionStates(1, mReaderWin->messageItem());
} }
mHideMenuBarAction = KStandardAction::showMenubar(this, &KMReaderMainWin::slotToggleMenubar, actionCollection()); mHideMenuBarAction = KStandardAction::showMenubar(this, &KMReaderMainWin::slotToggleMenubar, actionCollection());
mHideMenuBarAction->setChecked(KMailSettings::self()->readerShowMenuBar()); mHideMenuBarAction->setChecked(KMailSettings::self()->readerShowMenuBar());
@ -495,7 +495,7 @@ void KMReaderMainWin::setupAccel()
void KMReaderMainWin::slotToggleMenubar(bool dontShowWarning) void KMReaderMainWin::slotToggleMenubar(bool dontShowWarning)
{ {
if (!mReaderWin->message().isValid()) { if (!mReaderWin->messageItem().isValid()) {
return; return;
} }
if (menuBar()) { if (menuBar()) {

@ -411,7 +411,7 @@ bool KMReaderWin::htmlLoadExternal()
return mViewer->htmlLoadExternal(); return mViewer->htmlLoadExternal();
} }
Akonadi::Item KMReaderWin::message() const Akonadi::Item KMReaderWin::messageItem() const
{ {
return mViewer->messageItem(); return mViewer->messageItem();
} }
@ -423,14 +423,14 @@ QWidget *KMReaderWin::mainWindow() const
void KMReaderWin::slotMailtoCompose() void KMReaderWin::slotMailtoCompose()
{ {
KMCommand *command = new KMMailtoComposeCommand(urlClicked(), message()); KMCommand *command = new KMMailtoComposeCommand(urlClicked(), messageItem());
command->start(); command->start();
} }
void KMReaderWin::slotMailtoForward() void KMReaderWin::slotMailtoForward()
{ {
KMCommand *command = new KMMailtoForwardCommand(mMainWindow, urlClicked(), KMCommand *command = new KMMailtoForwardCommand(mMainWindow, urlClicked(),
message()); messageItem());
command->start(); command->start();
} }
@ -513,7 +513,7 @@ void KMReaderWin::slotSaveImageOnDisk()
void KMReaderWin::slotMailtoReply() void KMReaderWin::slotMailtoReply()
{ {
KMMailtoReplyCommand *command = new KMMailtoReplyCommand(mMainWindow, urlClicked(), KMMailtoReplyCommand *command = new KMMailtoReplyCommand(mMainWindow, urlClicked(),
message(), copyText()); messageItem(), copyText());
command->setReplyAsHtml(htmlMail()); command->setReplyAsHtml(htmlMail());
command->start(); command->start();
} }
@ -743,7 +743,7 @@ bool KMReaderWin::printSelectedText(bool preview)
::MessageComposer::Composer *composer = new ::MessageComposer::Composer; ::MessageComposer::Composer *composer = new ::MessageComposer::Composer;
composer->textPart()->setCleanPlainText(str); composer->textPart()->setCleanPlainText(str);
composer->textPart()->setWrappedPlainText(str); composer->textPart()->setWrappedPlainText(str);
KMime::Message::Ptr messagePtr = message().payload<KMime::Message::Ptr>(); KMime::Message::Ptr messagePtr = messageItem().payload<KMime::Message::Ptr>();
composer->infoPart()->setFrom(messagePtr->from()->asUnicodeString()); composer->infoPart()->setFrom(messagePtr->from()->asUnicodeString());
composer->infoPart()->setTo(QStringList() << messagePtr->to()->asUnicodeString()); composer->infoPart()->setTo(QStringList() << messagePtr->to()->asUnicodeString());
composer->infoPart()->setCc(QStringList() << messagePtr->cc()->asUnicodeString()); composer->infoPart()->setCc(QStringList() << messagePtr->cc()->asUnicodeString());

@ -143,7 +143,7 @@ public:
QAction *addToExistingContactAction() const; QAction *addToExistingContactAction() const;
Akonadi::Item message() const; Akonadi::Item messageItem() const;
QWidget *mainWindow() const; QWidget *mainWindow() const;

Loading…
Cancel
Save