@@ -143,7 +143,7 @@ void RequestsExportWidget::setModel(RequestsModel *model) {
143143
144144 ensureDefaultValues ();
145145
146- connect (ui.tableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , [=](const QItemSelection &sel , const QItemSelection &) {
146+ connect (ui.tableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , [=](const QItemSelection &, const QItemSelection &) {
147147 toggleEditFormBtn (ui);
148148 int cnt = ui.tableView ->selectionModel ()->selectedRows ().count ();
149149 const QString txt (tr (" Update %1 %2" ).arg (cnt).arg (cnt == 1 ? tr (" Record" ) : tr (" Records" )));
@@ -177,36 +177,41 @@ void RequestsExportWidget::exportRecords(bool all)
177177 Q_EMIT lastUsedFileChanged (fname);
178178 }
179179
180- const QModelIndexList list = all ? m_model->allRequests () : ui.tableView ->selectionModel ()-> selectedRows (RequestsModel::COL_ID);
180+ const QModelIndexList list = all ? m_model->allRequests () : ui.tableView ->selectedRows (RequestsModel::COL_ID);
181181 RequestsFormat::exportToPluginFormat (m_model, list, fname);
182182}
183183
184184void RequestsExportWidget::updateBulk ()
185185{
186- const QModelIndexList &list = ui.tableView ->selectionModel ()-> selectedRows ();
186+ const QModelIndexList &list = ui.tableView ->selectedRows ();
187187 if (list.isEmpty () || editFormEmpty (ui))
188188 return ;
189189 QString cid = ui.cbDefaultCategory ->currentData ().toString ();
190190 QString idp = ui.cbIdPrefix ->currentText ();
191191 QString fmt = ui.cbFormat ->currentText ();
192192 QString def = ui.cbDefault ->currentText ();
193+ bool clrFmt = false , clrDef = false ;
194+ if (fmt == " ''" || fmt == " \"\" " ) {
195+ fmt.clear ();
196+ clrFmt = true ;
197+ }
198+ if (def == " ''" || def == " \"\" " ) {
199+ def.clear ();
200+ clrDef = true ;
201+ }
193202
194203 for (const QModelIndex &r : list) {
195204 if (!cid.isEmpty ()) {
196205 m_model->setData (m_model->index (r.row (), RequestsModel::COL_META_CAT), cid, Qt::EditRole);
197206 m_model->setData (m_model->index (r.row (), RequestsModel::COL_META_CAT), ui.cbDefaultCategory ->currentText (), Qt::ToolTipRole);
198207 }
199208
200- if (!fmt.isEmpty ()) {
201- if (fmt == " ''" || fmt == " \"\" " )
202- fmt.clear ();
209+ if (clrFmt || !fmt.isEmpty ()) {
203210 m_model->setData (m_model->index (r.row (), RequestsModel::COL_META_FMT), fmt, Qt::EditRole);
204211 m_model->setData (m_model->index (r.row (), RequestsModel::COL_META_FMT), fmt, Qt::ToolTipRole);
205212 }
206213
207- if (!def.isEmpty ()) {
208- if (def == " ''" || def == " \"\" " )
209- def.clear ();
214+ if (clrDef || !def.isEmpty ()) {
210215 m_model->setData (m_model->index (r.row (), RequestsModel::COL_META_DEF), def, Qt::EditRole);
211216 m_model->setData (m_model->index (r.row (), RequestsModel::COL_META_DEF), def, Qt::ToolTipRole);
212217 }
0 commit comments