57 """ |
57 """ |
58 Private slot to add documents to the help database. |
58 Private slot to add documents to the help database. |
59 """ |
59 """ |
60 fileNames = E5FileDialog.getOpenFileNames( |
60 fileNames = E5FileDialog.getOpenFileNames( |
61 self, |
61 self, |
62 self.trUtf8("Add Documentation"), |
62 self.tr("Add Documentation"), |
63 "", |
63 "", |
64 self.trUtf8("Qt Compressed Help Files (*.qch)")) |
64 self.tr("Qt Compressed Help Files (*.qch)")) |
65 if not fileNames: |
65 if not fileNames: |
66 return |
66 return |
67 |
67 |
68 for fileName in fileNames: |
68 for fileName in fileNames: |
69 ns = QHelpEngineCore.namespaceName(fileName) |
69 ns = QHelpEngineCore.namespaceName(fileName) |
70 if not ns: |
70 if not ns: |
71 E5MessageBox.warning( |
71 E5MessageBox.warning( |
72 self, |
72 self, |
73 self.trUtf8("Add Documentation"), |
73 self.tr("Add Documentation"), |
74 self.trUtf8( |
74 self.tr( |
75 """The file <b>{0}</b> is not a valid""" |
75 """The file <b>{0}</b> is not a valid""" |
76 """ Qt Help File.""").format(fileName) |
76 """ Qt Help File.""").format(fileName) |
77 ) |
77 ) |
78 continue |
78 continue |
79 |
79 |
80 if len(self.documentsList.findItems(ns, Qt.MatchFixedString)): |
80 if len(self.documentsList.findItems(ns, Qt.MatchFixedString)): |
81 E5MessageBox.warning( |
81 E5MessageBox.warning( |
82 self, |
82 self, |
83 self.trUtf8("Add Documentation"), |
83 self.tr("Add Documentation"), |
84 self.trUtf8( |
84 self.tr( |
85 """The namespace <b>{0}</b> is already registered.""") |
85 """The namespace <b>{0}</b> is already registered.""") |
86 .format(ns) |
86 .format(ns) |
87 ) |
87 ) |
88 continue |
88 continue |
89 |
89 |
96 @pyqtSlot() |
96 @pyqtSlot() |
97 def on_removeButton_clicked(self): |
97 def on_removeButton_clicked(self): |
98 """ |
98 """ |
99 Private slot to remove a document from the help database. |
99 Private slot to remove a document from the help database. |
100 """ |
100 """ |
101 res = E5MessageBox.question( |
101 res = E5MessageBox.yesNo( |
102 self, |
102 self, |
103 self.trUtf8("Remove Documentation"), |
103 self.tr("Remove Documentation"), |
104 self.trUtf8( |
104 self.tr( |
105 """Do you really want to remove the selected documentation """ |
105 """Do you really want to remove the selected documentation """ |
106 """sets from the database?""")) |
106 """sets from the database?""")) |
107 if not res: |
107 if not res: |
108 return |
108 return |
109 |
109 |
113 for item in items: |
113 for item in items: |
114 ns = item.text() |
114 ns = item.text() |
115 if ns in list(openedDocs.values()): |
115 if ns in list(openedDocs.values()): |
116 res = E5MessageBox.yesNo( |
116 res = E5MessageBox.yesNo( |
117 self, |
117 self, |
118 self.trUtf8("Remove Documentation"), |
118 self.tr("Remove Documentation"), |
119 self.trUtf8( |
119 self.tr( |
120 """Some documents currently opened reference the """ |
120 """Some documents currently opened reference the """ |
121 """documentation you are attempting to remove. """ |
121 """documentation you are attempting to remove. """ |
122 """Removing the documentation will close those """ |
122 """Removing the documentation will close those """ |
123 """documents. Remove anyway?"""), |
123 """documents. Remove anyway?"""), |
124 icon=E5MessageBox.Warning) |
124 icon=E5MessageBox.Warning) |