Changeset View
Changeset View
Standalone View
Standalone View
src/templatemanagementdialog.cpp
Show First 20 Lines • Show All 145 Lines • ▼ Show 20 Line(s) | 137 | if (m_templates.contains(newTemplate)) { | |||
---|---|---|---|---|---|
146 | duplicate = true; | 146 | duplicate = true; | ||
147 | } | 147 | } | ||
148 | 148 | | |||
149 | if (!duplicate) { | 149 | if (!duplicate) { | ||
150 | int count = m_base.m_listBox->count(); | 150 | int count = m_base.m_listBox->count(); | ||
151 | m_templates.append(newTemplate); | 151 | m_templates.append(newTemplate); | ||
152 | m_base.m_listBox->addItem(newTemplate); | 152 | m_base.m_listBox->addItem(newTemplate); | ||
153 | QListWidgetItem *item = m_base.m_listBox->item(count); | 153 | QListWidgetItem *item = m_base.m_listBox->item(count); | ||
154 | m_base.m_listBox->setItemSelected(item, true); | 154 | item->setSelected(true); | ||
155 | } | 155 | } | ||
156 | m_newTemplate = newTemplate; | 156 | m_newTemplate = newTemplate; | ||
157 | m_changed = true; | 157 | m_changed = true; | ||
158 | 158 | | |||
159 | // From this point on we need to keep the original event around until the | 159 | // From this point on we need to keep the original event around until the | ||
160 | // user has closed the dialog, applying a template would make little sense | 160 | // user has closed the dialog, applying a template would make little sense | ||
161 | //buttonBox->button(QDialogButtonBox::Apply)->setEnabled( false ); | 161 | //buttonBox->button(QDialogButtonBox::Apply)->setEnabled( false ); | ||
162 | // neither does adding it again | 162 | // neither does adding it again | ||
Show All 15 Lines | 167 | { | |||
178 | if (rc == KMessageBox::Cancel) { | 178 | if (rc == KMessageBox::Cancel) { | ||
179 | return; | 179 | return; | ||
180 | } | 180 | } | ||
181 | 181 | | |||
182 | int current = m_base.m_listBox->row(item); | 182 | int current = m_base.m_listBox->row(item); | ||
183 | 183 | | |||
184 | m_templates.removeAll(item->text()); | 184 | m_templates.removeAll(item->text()); | ||
185 | m_base.m_listBox->takeItem(current); | 185 | m_base.m_listBox->takeItem(current); | ||
186 | 186 | m_base.m_listBox->item(qMax(current - 1, 0))->setSelected(true); | |||
187 | m_base.m_listBox->setItemSelected( | | |||
188 | m_base.m_listBox->item(qMax(current - 1, 0)), true); | | |||
189 | 187 | | |||
190 | updateButtons(); | 188 | updateButtons(); | ||
191 | 189 | | |||
192 | m_changed = true; | 190 | m_changed = true; | ||
193 | } | 191 | } | ||
194 | 192 | | |||
195 | void TemplateManagementDialog::updateButtons() | 193 | void TemplateManagementDialog::updateButtons() | ||
196 | { | 194 | { | ||
Show All 32 Lines |