|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2015 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Flash Cookies Manager configuration page. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtCore import pyqtSlot |
|
11 |
|
12 from E5Gui.E5Completers import E5DirCompleter |
|
13 from E5Gui import E5FileDialog |
|
14 |
|
15 from .ConfigurationPageBase import ConfigurationPageBase |
|
16 from .Ui_HelpFlashCookieManagerPage import Ui_HelpFlashCookieManagerPage |
|
17 |
|
18 import Preferences |
|
19 import Utilities |
|
20 import UI.PixmapCache |
|
21 |
|
22 |
|
23 class HelpFlashCookieManagerPage(ConfigurationPageBase, |
|
24 Ui_HelpFlashCookieManagerPage): |
|
25 """ |
|
26 Class implementing the Flash Cookies Manager configuration page. |
|
27 """ |
|
28 def __init__(self): |
|
29 """ |
|
30 Constructor |
|
31 """ |
|
32 super(HelpFlashCookieManagerPage, self).__init__() |
|
33 self.setupUi(self) |
|
34 self.setObjectName("HelpFlashCookieManagerPage") |
|
35 |
|
36 self.flashDataPathButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
|
37 |
|
38 self.flashDataPathCompleter = E5DirCompleter(self.flashDataPathEdit) |
|
39 |
|
40 # set initial values |
|
41 self.flashDataPathEdit.setText( |
|
42 Preferences.getHelp("FlashCookiesDataPath")) |
|
43 self.autoModeGroup.setChecked( |
|
44 Preferences.getHelp("FlashCookieAutoRefresh")) |
|
45 self.notificationGroup.setChecked( |
|
46 Preferences.getHelp("FlashCookieNotify")) |
|
47 self.deleteGroup.setChecked( |
|
48 Preferences.getHelp("FlashCookiesDeleteOnStartExit")) |
|
49 |
|
50 def save(self): |
|
51 """ |
|
52 Public slot to save the Flash Cookies Manager configuration. |
|
53 """ |
|
54 Preferences.setHelp("FlashCookiesDataPath", |
|
55 self.flashDataPathEdit.text()) |
|
56 Preferences.setHelp("FlashCookieAutoRefresh", |
|
57 self.autoModeGroup.isChecked()) |
|
58 Preferences.setHelp("FlashCookieNotify", |
|
59 self.notificationGroup.isChecked()) |
|
60 Preferences.setHelp("FlashCookiesDeleteOnStartExit", |
|
61 self.deleteGroup.isChecked()) |
|
62 |
|
63 @pyqtSlot() |
|
64 def on_flashDataPathButton_clicked(self): |
|
65 """ |
|
66 Private slot to handle the flash data path selection. |
|
67 """ |
|
68 path = E5FileDialog.getExistingDirectory( |
|
69 self, |
|
70 self.tr("Select Flash Cookies Data Path"), |
|
71 self.flashDataPathEdit.text(), |
|
72 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
|
73 |
|
74 if path: |
|
75 self.flashDataPathEdit.setText(Utilities.toNativeSeparators(path)) |
|
76 |
|
77 |
|
78 def create(dlg): |
|
79 """ |
|
80 Module function to create the configuration page. |
|
81 |
|
82 @param dlg reference to the configuration dialog |
|
83 @return reference to the instantiated page (ConfigurationPageBase) |
|
84 """ |
|
85 page = HelpFlashCookieManagerPage() |
|
86 return page |