mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use the app uid when adding to recent docs on windows
This commit is contained in:
parent
2b3608cc1a
commit
92d5525072
@ -1322,3 +1322,14 @@ def set_app_uid(val):
|
||||
prints(u'Failed to set app uid with error:', as_unicode(err))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def add_to_recent_docs(path):
|
||||
from win32com.shell import shell, shellcon
|
||||
path = unicode(path)
|
||||
app_id = get_app_uid()
|
||||
if app_id is None:
|
||||
shell.SHAddToRecentDocs(shellcon.SHARD_PATHW, path)
|
||||
else:
|
||||
item = shell.SHCreateItemFromParsingName(path, None, shell.IID_IShellItem)
|
||||
shell.SHAddToRecentDocs(shellcon.SHARD_APPIDINFO, (item, app_id))
|
||||
|
@ -27,7 +27,7 @@ from calibre.ebooks.oeb.polish.replace import rename_files, replace_file, get_re
|
||||
from calibre.ebooks.oeb.polish.split import split, merge, AbortError, multisplit
|
||||
from calibre.ebooks.oeb.polish.toc import remove_names_from_toc, create_inline_toc
|
||||
from calibre.ebooks.oeb.polish.utils import link_stylesheets, setup_cssutils_serialization as scs
|
||||
from calibre.gui2 import error_dialog, choose_files, question_dialog, info_dialog, choose_save_file, open_url, choose_dir
|
||||
from calibre.gui2 import error_dialog, choose_files, question_dialog, info_dialog, choose_save_file, open_url, choose_dir, add_to_recent_docs
|
||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||
from calibre.gui2.tweak_book import (
|
||||
set_current_container, current_container, tprefs, actions, editors,
|
||||
@ -345,8 +345,7 @@ class Boss(QObject):
|
||||
self.gui.update_recent_books()
|
||||
if iswindows:
|
||||
try:
|
||||
from win32com.shell import shell, shellcon
|
||||
shell.SHAddToRecentDocs(shellcon.SHARD_PATHW, path)
|
||||
add_to_recent_docs(path)
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
@ -21,8 +21,8 @@ from calibre.constants import (
|
||||
from calibre.customize.ui import available_input_formats
|
||||
from calibre.ebooks.oeb.iterator.book import EbookIterator
|
||||
from calibre.gui2 import (
|
||||
Application, choose_files, error_dialog, info_dialog, open_url,
|
||||
setup_gui_option_parser, set_app_uid
|
||||
Application, add_to_recent_docs, choose_files, error_dialog, info_dialog,
|
||||
open_url, set_app_uid, setup_gui_option_parser
|
||||
)
|
||||
from calibre.gui2.viewer.toc import TOC
|
||||
from calibre.gui2.viewer.ui import Main as MainWindow
|
||||
@ -1008,8 +1008,7 @@ class EbookViewer(MainWindow):
|
||||
vprefs.set('viewer_open_history', vh[:50])
|
||||
if iswindows:
|
||||
try:
|
||||
from win32com.shell import shell, shellcon
|
||||
shell.SHAddToRecentDocs(shellcon.SHARD_PATHW, pathtoebook)
|
||||
add_to_recent_docs(pathtoebook)
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
Loading…
x
Reference in New Issue
Block a user