Commit b21c4566 authored by Till Theato's avatar Till Theato
Browse files

Move RecentFilesAction to ProjectManager.

parent 5455b87d
......@@ -307,7 +307,6 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
#endif
setCentralWidget(m_timelineArea);
m_fileOpenRecent = KStandardAction::openRecent(pCore->projectManager(), SLOT(openFile(KUrl)), actionCollection());
readOptions();
KAction *action;
......@@ -1497,7 +1496,7 @@ void MainWindow::saveOptions()
{
KdenliveSettings::self()->writeConfig();
KSharedConfigPtr config = KGlobal::config();
m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
pCore->projectManager()->recentFilesAction()->saveEntries(KConfigGroup(config, "Recent Files"));
KConfigGroup treecolumns(config, "Project Tree");
treecolumns.writeEntry("columns", m_projectList->headerInfo());
config->sync();
......@@ -1506,7 +1505,7 @@ void MainWindow::saveOptions()
void MainWindow::readOptions()
{
KSharedConfigPtr config = KGlobal::config();
m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files"));
pCore->projectManager()->recentFilesAction()->loadEntries(KConfigGroup(config, "Recent Files"));
KConfigGroup initialGroup(config, "version");
bool upgrade = false;
if (initialGroup.exists()) {
......
......@@ -132,7 +132,6 @@ public:
KActionCollection *m_tracksActionCollection;
EffectStackView2 *m_effectStack;
TransitionSettings *m_transitionConfig;
KRecentFilesAction *m_fileOpenRecent;
QUndoView *m_undoView;
StatusBarMessageLabel *m_messageLabel;
......
......@@ -43,6 +43,7 @@ ProjectManager::ProjectManager(QObject* parent) :
KStandardAction::open(this, SLOT(openFile()), pCore->window()->actionCollection());
KStandardAction::saveAs(this, SLOT(saveFileAs()), pCore->window()->actionCollection());
KStandardAction::openNew(this, SLOT(newFile()), pCore->window()->actionCollection());
m_recentFilesAction = KStandardAction::openRecent(this, SLOT(openFile(KUrl)), pCore->window()->actionCollection());
KAction* backupAction = new KAction(KIcon("edit-undo"), i18n("Open Backup File"), this);
pCore->window()->addAction("open_backup", backupAction);
......@@ -202,7 +203,7 @@ bool ProjectManager::saveFileAs(const QString &outputFileName)
pCore->window()->setCaption(m_project->description());
m_project->setModified(false);
pCore->window()->m_fileOpenRecent->addUrl(KUrl(outputFileName));
m_recentFilesAction->addUrl(KUrl(outputFileName));
m_fileRevert->setEnabled(true);
pCore->window()->m_undoView->stack()->setClean();
......@@ -249,19 +250,19 @@ void ProjectManager::openFile()
return;
}
pCore->window()->m_fileOpenRecent->addUrl(url);
m_recentFilesAction->addUrl(url);
openFile(url);
}
void ProjectManager::openLastFile()
{
if (pCore->window()->m_fileOpenRecent->selectableActionGroup()->actions().isEmpty()) {
if (m_recentFilesAction->selectableActionGroup()->actions().isEmpty()) {
// No files in history
newFile(false);
return;
}
QAction *firstUrlAction = pCore->window()->m_fileOpenRecent->selectableActionGroup()->actions().last();
QAction *firstUrlAction = m_recentFilesAction->selectableActionGroup()->actions().last();
if (firstUrlAction) {
firstUrlAction->trigger();
} else {
......@@ -482,4 +483,9 @@ TrackView* ProjectManager::currentTrackView()
return m_trackView;
}
KRecentFilesAction* ProjectManager::recentFilesAction()
{
return m_recentFilesAction;
}
#include "projectmanager.moc"
......@@ -17,11 +17,12 @@ the Free Software Foundation, either version 3 of the License, or
class Project;
class AbstractProjectPart;
class TrackView;
class KdenliveDoc;
class KAction;
class KUrl;
class KdenliveDoc;
class KAutoSaveFile;
class TrackView;
class KRecentFilesAction;
/**
......@@ -53,6 +54,8 @@ public:
void doOpenFile(const KUrl &url, KAutoSaveFile *stale);
void recoverFiles(const QList<KAutoSaveFile *> &staleFiles, const KUrl &originUrl);
KRecentFilesAction *recentFilesAction();
public slots:
void newFile(bool showProjectSettings = true, bool force = false);
/** @brief Shows file open dialog. */
......@@ -99,6 +102,7 @@ private:
KAction *m_fileRevert;
KUrl m_startUrl;
KRecentFilesAction *m_recentFilesAction;
};
#endif
Supports Markdown
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