63 len(self.documentsList.selectedItems()) != 0) |
63 len(self.documentsList.selectedItems()) != 0) |
64 |
64 |
65 @pyqtSlot() |
65 @pyqtSlot() |
66 def on_addButton_clicked(self): |
66 def on_addButton_clicked(self): |
67 """ |
67 """ |
68 Private slot to add documents to the help database. |
68 Private slot to add QtHelp documents to the help database. |
69 """ |
69 """ |
70 fileNames = E5FileDialog.getOpenFileNames( |
70 fileNames = E5FileDialog.getOpenFileNames( |
71 self, |
71 self, |
72 self.tr("Add Documentation"), |
72 self.tr("Add Documentation"), |
73 "", |
73 "", |
74 self.tr("Qt Compressed Help Files (*.qch)")) |
74 self.tr("Qt Compressed Help Files (*.qch)")) |
75 if not fileNames: |
75 if not fileNames: |
76 return |
76 return |
77 |
77 |
|
78 self.__registerDocumentations(fileNames) |
|
79 |
|
80 @pyqtSlot() |
|
81 def on_addPluginButton_clicked(self): |
|
82 """ |
|
83 Private slot to add QtHelp documents provided by plug-ins to |
|
84 the help database. |
|
85 """ |
|
86 from .QtHelpDocumentationSelectionDialog import \ |
|
87 QtHelpDocumentationSelectionDialog |
|
88 dlg = QtHelpDocumentationSelectionDialog(self.__pluginHelpDocuments, |
|
89 self) |
|
90 if dlg.exec_() == QDialog.Accepted: |
|
91 documents = dlg.getData() |
|
92 if not documents: |
|
93 return |
|
94 |
|
95 self.__registerDocumentations(documents) |
|
96 |
|
97 def __registerDocumentations(self, fileNames): |
|
98 """ |
|
99 Private method to register a given list of documentations. |
|
100 |
|
101 @param fileNames list of documentation files to be registered |
|
102 @type list of str |
|
103 """ |
78 for fileName in fileNames: |
104 for fileName in fileNames: |
79 ns = QHelpEngineCore.namespaceName(fileName) |
105 ns = QHelpEngineCore.namespaceName(fileName) |
80 if not ns: |
106 if not ns: |
81 E5MessageBox.warning( |
107 E5MessageBox.warning( |
82 self, |
108 self, |
145 |
171 |
146 if self.documentsList.count(): |
172 if self.documentsList.count(): |
147 self.documentsList.setCurrentRow( |
173 self.documentsList.setCurrentRow( |
148 0, QItemSelectionModel.ClearAndSelect) |
174 0, QItemSelectionModel.ClearAndSelect) |
149 |
175 |
150 @pyqtSlot() |
|
151 def on_addPluginButton_clicked(self): |
|
152 """ |
|
153 Private slot to add QtHelp documents provided by plug-ins. |
|
154 """ |
|
155 # TODO: not implemented yet |
|
156 raise NotImplementedError |
|
157 |
|
158 def hasChanges(self): |
176 def hasChanges(self): |
159 """ |
177 """ |
160 Public slot to test the dialog for changes. |
178 Public slot to test the dialog for changes. |
161 |
179 |
162 @return flag indicating presence of changes |
180 @return flag indicating presence of changes |