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