Commit a644941d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use KRecentFilesMenu directly

parent 04ba77a3
Pipeline #62038 canceled with stage
......@@ -2,7 +2,7 @@
the same menu entries at the same place in KMail and Kontact -->
<!DOCTYPE gui>
<gui version="547" name="kmmainwin" translationDomain="kmail">
<gui version="548" name="kmmainwin" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
......@@ -17,7 +17,7 @@
</Menu>
<Separator/>
<Action name="file_open" />
<Action name="file_open_recent" />
<Action name="kmail_file_open_recent" />
<Action name="file_save_as" />
<Separator/>
<Action name="file_export_pdf" />
......@@ -150,6 +150,7 @@
<text>&amp;Message</text>
<Action name="new_message" />
<Action name="post_message" />
<Action name="new_to_recipients" />
<Separator/>
<Action name="reply" />
<Action name="reply_all" />
......
......@@ -145,7 +145,7 @@
#include <KConfigGroup>
#include <KNotification>
#include <KRecentFilesAction>
#include <KRecentFilesMenu>
#include <KStandardAction>
#include <KStringHandler>
#include <KToggleAction>
......@@ -2794,10 +2794,9 @@ void KMMainWidget::setupActions()
mOpenAction = KStandardAction::open(this, &KMMainWidget::slotOpenMsg, actionCollection());
mOpenRecentAction = KStandardAction::openRecent(this, &KMMainWidget::slotOpenRecentMessage, actionCollection());
KConfigGroup grp = mConfig->group(QStringLiteral("Recent Files"));
mOpenRecentAction->loadEntries(grp);
mOpenRecentMenu = new KRecentFilesMenu(this);
actionCollection()->addAction(QStringLiteral("kmail_file_open_recent"), mOpenRecentMenu->menuAction());
connect(mOpenRecentMenu, &KRecentFilesMenu::urlTriggered, this, &KMMainWidget::slotOpenRecentMessage);
{
auto action = new QAction(i18n("&Expire All Folders"), this);
actionCollection()->addAction(QStringLiteral("expire_all_folders"), action);
......@@ -4539,12 +4538,9 @@ void KMMainWidget::slotOpenRecentMessage(const QUrl &url)
openCommand->start();
}
void KMMainWidget::addRecentFile(const QUrl &mUrl)
void KMMainWidget::addRecentFile(const QUrl &url)
{
mOpenRecentAction->addUrl(mUrl);
KConfigGroup grp = mConfig->group(QStringLiteral("Recent Files"));
mOpenRecentAction->saveEntries(grp);
grp.sync();
mOpenRecentMenu->addUrl(url);
}
void KMMainWidget::slotMoveMessageToTrash()
......
......@@ -58,7 +58,7 @@ class CollectionPane;
class KMCommand;
class KMMoveCommand;
class KMTrashMsgCommand;
class KRecentFilesAction;
class KRecentFilesMenu;
class ManageShowCollectionProperties;
class KActionMenuTransport;
class KActionMenuAccount;
......@@ -638,7 +638,7 @@ private:
QPointer<MailCommon::FolderSelectionDialog> mSelectFromAllFoldersDialog;
QAction *mServerSideSubscription = nullptr;
QAction *mAccountSettings = nullptr;
KRecentFilesAction *mOpenRecentAction = nullptr;
KRecentFilesMenu *mOpenRecentMenu = nullptr;
QPointer<KSieveUi::ManageSieveScriptsDialog> mManageSieveDialog;
QAction *mQuickSearchAction = nullptr;
DisplayMessageFormatActionMenu *mDisplayMessageFormatMenu = nullptr;
......
......@@ -2,7 +2,7 @@
the same menu entries at the same place in KMail and Kontact -->
<!DOCTYPE gui>
<gui version="547" name="kmmainwin" translationDomain="kmail">
<gui version="548" name="kmmainwin" translationDomain="kmail">
<MenuBar>
<Menu noMerge="1" name="file" >
<text>&amp;File</text>
......@@ -17,7 +17,7 @@
</Menu>
<Separator/>
<Action name="file_open" />
<Action name="file_open_recent" />
<Action name="kmail_file_open_recent" />
<Action name="file_save_as" />
<Separator/>
<Action name="file_export_pdf" />
......
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