mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Linux: fix native file dialog via kdialog not working on older KDE systems
This commit is contained in:
parent
bf96e0f555
commit
657fecde37
@ -114,8 +114,19 @@ def run(cmd):
|
|||||||
|
|
||||||
|
|
||||||
# KDE {{{
|
# KDE {{{
|
||||||
|
|
||||||
|
def kdialog_supports_desktopfile():
|
||||||
|
ans = getattr(kdialog_supports_desktopfile, 'ans', None)
|
||||||
|
if ans is None:
|
||||||
|
raw = subprocess.check_output(['kdialog', '--help']).decode('utf-8')
|
||||||
|
ans = kdialog_supports_desktopfile.ans = '--desktopfile' in raw
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
def kde_cmd(window, title, *rest):
|
def kde_cmd(window, title, *rest):
|
||||||
ans = ['kdialog', '--desktopfile', 'calibre-gui', '--title', title]
|
ans = ['kdialog', '--title', title]
|
||||||
|
if kdialog_supports_desktopfile():
|
||||||
|
ans += ['--desktopfile', 'calibre-gui']
|
||||||
winid = get_winid(window)
|
winid = get_winid(window)
|
||||||
if winid is not None:
|
if winid is not None:
|
||||||
ans += ['--attach', str(int(winid))]
|
ans += ['--attach', str(int(winid))]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user