Recent documents menu (#1582)

* Adds recent documents menu.
* Removes erroneous import.
* Open collection from recent document menu.
This commit is contained in:
James Hall 2024-02-13 21:17:32 +00:00 committed by GitHub
parent d05a86252b
commit 8287126deb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 0 deletions

View File

@ -12,6 +12,16 @@ const template = [
ipcMain.emit('main:open-collection'); ipcMain.emit('main:open-collection');
} }
}, },
{
label: 'Open Recent',
role: 'recentdocuments',
submenu: [
{
label: 'Clear Recent',
role: 'clearrecentdocuments'
}
]
},
{ {
label: 'Preferences', label: 'Preferences',
accelerator: 'CommandOrControl+,', accelerator: 'CommandOrControl+,',

View File

@ -122,3 +122,7 @@ app.on('ready', async () => {
// Quit the app once all windows are closed // Quit the app once all windows are closed
app.on('window-all-closed', app.quit); app.on('window-all-closed', app.quit);
app.on('open-file', (event, path) => {
openCollection(mainWindow, watcher, path);
})

View File

@ -617,6 +617,7 @@ const registerMainEventHandlers = (mainWindow, watcher, lastOpenedCollections) =
ipcMain.on('main:collection-opened', (win, pathname, uid, brunoConfig) => { ipcMain.on('main:collection-opened', (win, pathname, uid, brunoConfig) => {
watcher.addWatcher(win, pathname, uid, brunoConfig); watcher.addWatcher(win, pathname, uid, brunoConfig);
lastOpenedCollections.add(pathname); lastOpenedCollections.add(pathname);
app.addRecentDocument(pathname);
}); });
// The app listen for this event and allows the user to save unsaved requests before closing the app // The app listen for this event and allows the user to save unsaved requests before closing the app