Changeset View
Changeset View
Standalone View
Standalone View
app/mainwindow.cpp
Show All 31 Lines | |||||
32 | #include "interface.h" | 32 | #include "interface.h" | ||
33 | 33 | | |||
34 | #include <KParts/ReadWritePart> | 34 | #include <KParts/ReadWritePart> | ||
35 | #include <KPluginFactory> | 35 | #include <KPluginFactory> | ||
36 | #include <KMessageBox> | 36 | #include <KMessageBox> | ||
37 | #include <KLocalizedString> | 37 | #include <KLocalizedString> | ||
38 | #include <KActionCollection> | 38 | #include <KActionCollection> | ||
39 | #include <KStandardAction> | 39 | #include <KStandardAction> | ||
40 | #include <KRecentFilesAction> | 40 | #include <KRecentFilesMenu> | ||
41 | #include <KSharedConfig> | 41 | #include <KSharedConfig> | ||
42 | #include <KConfigDialog> | 42 | #include <KConfigDialog> | ||
43 | #include <KXMLGUIFactory> | 43 | #include <KXMLGUIFactory> | ||
44 | #include <KPluginLoader> | 44 | #include <KPluginLoader> | ||
45 | #include <KConfigSkeleton> | 45 | #include <KConfigSkeleton> | ||
46 | 46 | | |||
47 | #include <QApplication> | 47 | #include <QApplication> | ||
48 | #include <QDragEnterEvent> | 48 | #include <QDragEnterEvent> | ||
Show All 14 Lines | 62 | { | |||
63 | setupActions(); | 63 | setupActions(); | ||
64 | setAcceptDrops(true); | 64 | setAcceptDrops(true); | ||
65 | // Ark doesn't provide a fullscreen mode; remove the corresponding window button | 65 | // Ark doesn't provide a fullscreen mode; remove the corresponding window button | ||
66 | setWindowFlags(windowFlags() & ~Qt::WindowFullscreenButtonHint); | 66 | setWindowFlags(windowFlags() & ~Qt::WindowFullscreenButtonHint); | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | MainWindow::~MainWindow() | 69 | MainWindow::~MainWindow() | ||
70 | { | 70 | { | ||
71 | if (m_recentFilesAction) { | | |||
72 | m_recentFilesAction->saveEntries(KSharedConfig::openConfig()->group("Recent Files")); | | |||
73 | } | | |||
74 | | ||||
75 | guiFactory()->removeClient(m_part); | 71 | guiFactory()->removeClient(m_part); | ||
76 | delete m_part; | 72 | delete m_part; | ||
77 | m_part = nullptr; | 73 | m_part = nullptr; | ||
78 | } | 74 | } | ||
79 | 75 | | |||
80 | void MainWindow::dragEnterEvent(QDragEnterEvent * event) | 76 | void MainWindow::dragEnterEvent(QDragEnterEvent * event) | ||
81 | { | 77 | { | ||
82 | qCDebug(ARK) << event; | 78 | qCDebug(ARK) << event; | ||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Line(s) | |||||
173 | void MainWindow::setupActions() | 169 | void MainWindow::setupActions() | ||
174 | { | 170 | { | ||
175 | m_newAction = KStandardAction::openNew(this, &MainWindow::newArchive, this); | 171 | m_newAction = KStandardAction::openNew(this, &MainWindow::newArchive, this); | ||
176 | actionCollection()->addAction(QStringLiteral("ark_file_new"), m_newAction); | 172 | actionCollection()->addAction(QStringLiteral("ark_file_new"), m_newAction); | ||
177 | m_openAction = KStandardAction::open(this, &MainWindow::openArchive, this); | 173 | m_openAction = KStandardAction::open(this, &MainWindow::openArchive, this); | ||
178 | actionCollection()->addAction(QStringLiteral("ark_file_open"), m_openAction); | 174 | actionCollection()->addAction(QStringLiteral("ark_file_open"), m_openAction); | ||
179 | auto quitAction = KStandardAction::quit(this, &MainWindow::quit, this); | 175 | auto quitAction = KStandardAction::quit(this, &MainWindow::quit, this); | ||
180 | actionCollection()->addAction(QStringLiteral("ark_quit"), quitAction); | 176 | actionCollection()->addAction(QStringLiteral("ark_quit"), quitAction); | ||
181 | m_recentFilesAction = KStandardAction::openRecent(this, &MainWindow::openUrl, this); | 177 | m_recentFilesAction = new KRecentFilesMenu(this); | ||
182 | actionCollection()->addAction(QStringLiteral("ark_file_open_recent"), m_recentFilesAction); | 178 | actionCollection()->addAction(QStringLiteral("ark_file_open_recent"), m_recentFilesAction->menuAction()); | ||
183 | 179 | connect(m_recentFilesAction, &KRecentFilesMenu::urlTriggered, this, &MainWindow::openUrl); | |||
184 | m_recentFilesAction->setToolBarMode(KRecentFilesAction::MenuMode); | | |||
185 | m_recentFilesAction->setToolButtonPopupMode(QToolButton::DelayedPopup); | | |||
186 | m_recentFilesAction->setIconText(i18nc("action, to open an archive", "Open")); | | |||
187 | m_recentFilesAction->setToolTip(i18n("Open an archive")); | | |||
188 | m_recentFilesAction->loadEntries(KSharedConfig::openConfig()->group("Recent Files")); | | |||
189 | 180 | | |||
190 | KStandardAction::preferences(this, &MainWindow::showSettings, actionCollection()); | 181 | KStandardAction::preferences(this, &MainWindow::showSettings, actionCollection()); | ||
191 | } | 182 | } | ||
192 | 183 | | |||
193 | void MainWindow::updateActions() | 184 | void MainWindow::updateActions() | ||
194 | { | 185 | { | ||
195 | Interface *iface = qobject_cast<Interface*>(m_part); | 186 | Interface *iface = qobject_cast<Interface*>(m_part); | ||
196 | Kerfuffle::PluginManager pluginManager; | 187 | Kerfuffle::PluginManager pluginManager; | ||
▲ Show 20 Lines • Show All 158 Lines • Show Last 20 Lines |