MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / editClicked

Method editClicked

dialog/htmlentitiesdialog.cpp:185–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183
184
185void HtmlEntitiesDialog::editClicked() {
186 if (editMode) {
187 if (textEdit->document()->isModified()) {
188 QString value = textEdit->toPlainText();
189 QString fileName = global.fileManager.getHomeDirPath("") + QString("entities.txt");
190 QDir dir;
191 dir.remove(fileName);
192 QFile file(fileName);
193 file.open(QFile::WriteOnly);
194 if (file.isOpen()) {
195 QTextStream out(&file);
196 out << value;
197 }
198 file.close();
199 }
200 clearEntitiesButtons();
201 loadCustomEntities();
202 initEntitiesButtons();
203
204 } else {
205 if (textEdit == NULL) {
206 textEdit = new QTextEdit(tr("Comma separated list of HTML entities.\nSee http://www.w3schools.com/charsets/ for list."));
207 }
208 textEdit->setText(getEntities(true));
209 }
210 editMode = !editMode;
211 scrollArea->takeWidget();
212 scrollArea->setWidget(editMode ? textEdit : entitiesWidget);
213 scrollArea->setWidgetResizable(editMode);
214 editButton->setText(editMode ? saveString : editString);
215 closeButton->setText(editMode ? cancelString : closeString);
216}
217
218
219bool HtmlEntitiesDialog::close() {

Callers

nothing calls this directly

Calls 6

getHomeDirPathMethod · 0.80
removeMethod · 0.80
openMethod · 0.80
QStringClass · 0.50
closeMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected