Commit 77fec9d6 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to KRecentFilesMenu

parent 299c6e15
Pipeline #62382 passed with stage
in 10 minutes and 31 seconds
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui name="PimDataExporter" version="8">
<gui name="PimDataExporter" version="9">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="file_open_recent"/>
<Action name="pimdataexporter_file_open_recent"/>
<Separator/>
<Action name="backup"/>
<Action name="restore"/>
......
......@@ -33,7 +33,7 @@
#include <KMessageBox>
#include <KLocalizedString>
#include <QStatusBar>
#include <KRecentFilesAction>
#include <KRecentFilesMenu>
#include <QPointer>
#include <KSharedConfig>
#include <KFileWidget>
......@@ -82,9 +82,6 @@ PimDataExporterWindow::PimDataExporterWindow(QWidget *parent)
PimDataExporterWindow::~PimDataExporterWindow()
{
MailCommon::FilterManager::instance()->cleanup();
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup groupConfig = config->group(QStringLiteral("Recent File"));
mRecentFilesAction->saveEntries(groupConfig);
}
void PimDataExporterWindow::initializeBackupRestoreUi()
......@@ -222,11 +219,9 @@ void PimDataExporterWindow::setupActions(bool canZipFile)
mShowArchiveInformationsAboutCurrentArchiveAction->setEnabled(false);
KStandardAction::quit(this, &PimDataExporterWindow::close, ac);
mRecentFilesAction = KStandardAction::openRecent(this, &PimDataExporterWindow::slotRestoreFile, ac);
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup groupConfig = config->group(QStringLiteral("Recent File"));
mRecentFilesAction->loadEntries(groupConfig);
mRecentFilesMenu = new KRecentFilesMenu(this);
actionCollection()->addAction(QStringLiteral("pimdataexporter_file_open_recent"), mRecentFilesMenu->menuAction());
connect(mRecentFilesMenu, &KRecentFilesMenu::urlTriggered, this, &PimDataExporterWindow::slotRestoreFile);
KStandardAction::preferences(this, &PimDataExporterWindow::slotConfigure, ac);
}
......@@ -312,7 +307,7 @@ void PimDataExporterWindow::backupData(const QString &filename, const QString &t
if (!recentDirClass.isEmpty()) {
KRecentDirs::add(recentDirClass, currentFileName);
}
mRecentFilesAction->addUrl(QUrl::fromLocalFile(currentFileName));
mRecentFilesMenu->addUrl(QUrl::fromLocalFile(currentFileName));
}
mTrayIcon->setStatus(KStatusNotifierItem::Active);
mTrayIcon->setToolTipSubTitle(i18n("Backup in progress..."));
......
......@@ -8,7 +8,7 @@
#include <KXmlGuiWindow>
#include "utils.h"
class LogWidget;
class KRecentFilesAction;
class KRecentFilesMenu;
class QAction;
class QCommandLineParser;
class PimDataBackupRestoreUI;
......@@ -53,7 +53,7 @@ private:
// Name, identifier
QHash<QString, QString> mNeedToSyncResources;
LogWidget *mLogWidget = nullptr;
KRecentFilesAction *mRecentFilesAction = nullptr;
KRecentFilesMenu *mRecentFilesMenu = nullptr;
QAction *mBackupAction = nullptr;
QAction *mRestoreAction = nullptr;
QAction *mSaveLogAction = nullptr;
......
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