void ObjectTableWidget::removeRow(void)
{
	if(table_tbw->currentRow()>=0)
	{
		Messagebox msg_box;
		unsigned 	row_idx=table_tbw->currentRow();
		QTableWidgetItem *item=table_tbw->currentItem();

		if(item->isSelected())
		{
			if(conf_exclusion)
				msg_box.show(trUtf8("Confirmation"),trUtf8("Do you really want to remove the selected item?"),
							 Messagebox::CONFIRM_ICON, Messagebox::YES_NO_BUTTONS);

			if(!conf_exclusion || (conf_exclusion && msg_box.result()==QDialog::Accepted))
			{
				setRowData(QVariant::fromValue<void *>(nullptr), row_idx);
				item->setData(Qt::UserRole, QVariant::fromValue<void *>(nullptr));
				emit s_rowRemoved(row_idx);
				table_tbw->removeRow(row_idx);
				table_tbw->setCurrentItem(nullptr);
				setButtonsEnabled();
			}
		}
	}
}
void
AttachmentModel::retranslateUi() {
  setHorizontalHeaderLabels(          QStringList{} << QY("Name") << QY("MIME type") << QY("Description") << QY("Attach to") << QY("Source file name") << QY("Directory"));
  Util::setSymbolicColumnNames(*this, QStringList{} <<  Q("name") <<  Q("mimeType")  <<  Q("description") <<  Q("attachTo")  <<  Q("sourceFileName")   <<  Q("directory"));

  for (auto row = 0, numRows = rowCount(); row < numRows; ++row)
    setRowData(itemsForRow(row), *attachmentForRow(row));
}
void
AttachmentModel::addAttachments(QList<AttachmentPtr> const &attachmentsToAdd) {
  if (attachmentsToAdd.isEmpty())
    return;

  for (auto const &attachment : attachmentsToAdd) {
    auto newRow = createRowItems(attachment);
    setRowData(newRow, *attachment);
    m_attachmentMap[reinterpret_cast<quint64>(attachment.get())] = attachment;
    appendRow(newRow);
  }
}
void
AttachmentModel::retranslateUi() {
  Util::setDisplayableAndSymbolicColumnNames(*this, {
    { QY("Name"),             Q("name")           },
    { QY("MIME type"),        Q("mimeType")       },
    { QY("Description"),      Q("description")    },
    { QY("Attach to"),        Q("attachTo")       },
    { QY("Source file name"), Q("sourceFileName") },
    { QY("Directory"),        Q("directory")      },
    { QY("Size"),             Q("size")           },
  });

  for (auto row = 0, numRows = rowCount(); row < numRows; ++row)
    setRowData(itemsForRow(row), *attachmentForRow(row));
}
void
AttachmentModel::attachmentUpdated(Attachment const &attachment) {
  auto row = rowForAttachment(attachment);
  if (-1 != row)
    setRowData(itemsForRow(row), attachment);
}