MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / handleAddPrompt

Method handleAddPrompt

src/plugins/builder/mainframe/settingdialog.cpp:101–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void SettingDialog::handleAddPrompt()
102{
103 DDialog dlg(this);
104 dlg.setIcon(QIcon::fromTheme("ide"));
105 dlg.setWindowTitle(tr("Add Prompt"));
106
107 DLineEdit *edit = new DLineEdit(&dlg);
108 edit->setPlaceholderText(tr("Please input the name of the prompt"));
109 dlg.addContent(edit);
110 dlg.addButton(tr("Cancel", "button"));
111 dlg.addButton(tr("OK", "button"), true, DDialog::ButtonRecommend);
112 dlg.getButton(1)->setEnabled(false);
113 dlg.setOnButtonClickedClose(false);
114 dlg.setFocusProxy(edit);
115
116 connect(edit, &DLineEdit::textChanged, this,
117 [edit, &dlg] {
118 if (edit->isAlert())
119 edit->setAlert(false);
120 dlg.getButton(1)->setEnabled(!edit->text().isEmpty());
121 });
122 connect(&dlg, &DDialog::buttonClicked, this,
123 [this, edit, &dlg](int index) {
124 if (index == 1) {
125 const auto &name = edit->text();
126 if (promptCB->findText(name) != -1) {
127 edit->setAlert(true);
128 edit->showAlertMessage(tr("A prompt named \"%1\" already exists").arg(name));
129 edit->lineEdit()->selectAll();
130 edit->setFocus();
131 return;
132 } else {
133 promptCB->addItem(name);
134 promptCB->setCurrentText(name);
135 }
136 }
137 dlg.close();
138 });
139
140 dlg.exec();
141}
142
143void SettingDialog::handleDeletePrompt()
144{

Callers

nothing calls this directly

Calls 12

connectFunction · 0.85
setPlaceholderTextMethod · 0.80
addContentMethod · 0.80
selectAllMethod · 0.80
setFocusMethod · 0.80
setIconMethod · 0.45
setEnabledMethod · 0.45
isEmptyMethod · 0.45
textMethod · 0.45
addItemMethod · 0.45
closeMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected