Commit a6737b4c authored by Jonathan Marten's avatar Jonathan Marten Committed by Laurent Montel
Browse files

Make the Copy/Move actions in the message reader window work consistently

That is, consistently with those in the main KMail window.  Use those
main window actions to set the text and icon, so that the icon fallback
implemented in Akonadi::StandardActionManager works.  Save the folder
used for a copy or move action in the recently used folder list so that
the list is updated even though we are not using the standard Akonadi
actions.

BUG:435410
parent 709fb9a0
Pipeline #58211 passed with stage
in 23 minutes and 24 seconds
......@@ -53,7 +53,7 @@ set(KMAILTRANSPORT_LIB_VERSION "5.17.40")
set(KONTACTINTERFACE_LIB_VERSION "5.17.40")
set(KMIME_LIB_VERSION "5.17.40")
set(KPIMTEXTEDIT_LIB_VERSION "5.17.40")
set(AKONADI_VERSION "5.17.40")
set(AKONADI_VERSION "5.17.41")
set(KTNEF_LIB_VERSION "5.17.40")
set(GRANTLEETHEME_LIB_VERSION "5.17.40")
......
......@@ -536,10 +536,12 @@ QAction *KMReaderMainWin::copyActionMenu(QMenu *menu)
{
KMMainWidget *mainwin = kmkernel->getKMMainWidget();
if (mainwin) {
auto action = new KActionMenu(menu);
action->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
action->setText(i18n("Copy Message To..."));
mainwin->standardMailActionManager()->standardActionManager()->createActionFolderMenu(action->menu(), Akonadi::StandardActionManager::CopyItemToMenu);
Akonadi::StandardActionManager *manager = mainwin->standardMailActionManager()->standardActionManager();
const auto *mainWinAction = manager->action(Akonadi::StandardActionManager::CopyItemToMenu);
auto *action = new KActionMenu(menu);
action->setIcon(mainWinAction->icon());
action->setText(mainWinAction->text());
manager->createActionFolderMenu(action->menu(), Akonadi::StandardActionManager::CopyItemToMenu);
connect(action->menu(), &QMenu::triggered, this, &KMReaderMainWin::slotCopyItem);
return action;
}
......@@ -550,12 +552,13 @@ QAction *KMReaderMainWin::moveActionMenu(QMenu *menu)
{
KMMainWidget *mainwin = kmkernel->getKMMainWidget();
if (mainwin) {
auto action = new KActionMenu(menu);
action->setText(i18n("Move Message To..."));
action->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy")));
mainwin->standardMailActionManager()->standardActionManager()->createActionFolderMenu(action->menu(), Akonadi::StandardActionManager::MoveItemToMenu);
Akonadi::StandardActionManager *manager = mainwin->standardMailActionManager()->standardActionManager();
const auto *mainWinAction = manager->action(Akonadi::StandardActionManager::MoveItemToMenu);
auto *action = new KActionMenu(menu);
action->setIcon(mainWinAction->icon());
action->setText(mainWinAction->text());
manager->createActionFolderMenu(action->menu(), Akonadi::StandardActionManager::MoveItemToMenu);
connect(action->menu(), &QMenu::triggered, this, &KMReaderMainWin::slotMoveItem);
return action;
}
return nullptr;
......@@ -584,6 +587,11 @@ void KMReaderMainWin::copyOrMoveItem(const Akonadi::Collection &collection, bool
auto job = new Akonadi::ItemCreateJob(mMsg, collection, this);
connect(job, &KJob::result, this, &KMReaderMainWin::slotCopyMoveResult);
}
KMMainWidget *mainwin = kmkernel->getKMMainWidget();
if (mainwin) {
mainwin->standardMailActionManager()->standardActionManager()->addRecentCollection(collection.id());
}
}
void KMReaderMainWin::slotCopyItem(QAction *action)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment