6294 """ |
6294 """ |
6295 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
6295 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
6296 None, |
6296 None, |
6297 self.tr("Export Keyboard Shortcuts"), |
6297 self.tr("Export Keyboard Shortcuts"), |
6298 "", |
6298 "", |
6299 self.tr("Keyboard shortcut file (*.e4k)"), |
6299 self.tr("Keyboard Shortcuts File (*.ekj);;" |
|
6300 "XML Keyboard Shortcuts File (*.e4k)"), |
6300 "", |
6301 "", |
6301 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
6302 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
6302 |
6303 |
6303 if not fn: |
6304 if not fn: |
6304 return |
6305 return |
6307 if not ext: |
6308 if not ext: |
6308 ex = selectedFilter.split("(*")[1].split(")")[0] |
6309 ex = selectedFilter.split("(*")[1].split(")")[0] |
6309 if ex: |
6310 if ex: |
6310 fn += ex |
6311 fn += ex |
6311 |
6312 |
6312 from Preferences import Shortcuts |
6313 if os.path.exists(fn): |
6313 Shortcuts.exportShortcuts(fn) |
6314 ok = E5MessageBox.yesNo( |
|
6315 self, |
|
6316 self.tr("Export Keyboard Shortcuts"), |
|
6317 self.tr("""<p>The keyboard shortcuts file <b>{0}</b> exists""" |
|
6318 """ already. Overwrite it?</p>""").format(fn)) |
|
6319 else: |
|
6320 ok = True |
|
6321 |
|
6322 if ok: |
|
6323 from Preferences import Shortcuts |
|
6324 Shortcuts.exportShortcuts(fn) |
6314 |
6325 |
6315 def __importShortcuts(self): |
6326 def __importShortcuts(self): |
6316 """ |
6327 """ |
6317 Private slot to import the keyboard shortcuts. |
6328 Private slot to import the keyboard shortcuts. |
6318 """ |
6329 """ |
6319 fn = E5FileDialog.getOpenFileName( |
6330 fn = E5FileDialog.getOpenFileName( |
6320 None, |
6331 None, |
6321 self.tr("Import Keyboard Shortcuts"), |
6332 self.tr("Import Keyboard Shortcuts"), |
6322 "", |
6333 "", |
6323 self.tr("Keyboard shortcut file (*.e4k)")) |
6334 self.tr("Keyboard Shortcuts File (*.ekj);;" |
|
6335 "XML Keyboard shortcut file (*.e4k)")) |
6324 |
6336 |
6325 if fn: |
6337 if fn: |
6326 from Preferences import Shortcuts |
6338 from Preferences import Shortcuts |
6327 Shortcuts.importShortcuts(fn) |
6339 Shortcuts.importShortcuts(fn) |
6328 |
6340 |