| 182 | } |
| 183 | |
| 184 | void SendingHandler::addFile(const QString &file, bool select) { |
| 185 | int j, rows = m_table->rowCount(); |
| 186 | |
| 187 | for (j = 0; j < rows; j++) { |
| 188 | if (!m_table->item(j, RECENT_PATH_COL)->text().compare(file, Qt::CaseInsensitive)) { |
| 189 | return; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | m_table->setSortingEnabled(false); |
| 194 | |
| 195 | m_table->setRowCount(rows + 1); |
| 196 | QTableWidgetItem *remove = new QTableWidgetItem; |
| 197 | QTableWidgetItem *resend = new QTableWidgetItem; |
| 198 | QTableWidgetItem *selected = new QTableWidgetItem; |
| 199 | QTableWidgetItem *path = new QTableWidgetItem(file); |
| 200 | |
| 201 | QIcon removeIcon(QPixmap(QStringLiteral(":/icons/resources/icons/exit.png"))); |
| 202 | QToolButton *btnRemove = new QToolButton; |
| 203 | btnRemove->setIcon(removeIcon); |
| 204 | |
| 205 | QToolButton *btnResend = new QToolButton; |
| 206 | btnResend->setIcon(m_iconSend); |
| 207 | |
| 208 | QToolButton *btnSelect = new QToolButton; |
| 209 | btnSelect->setIcon(select ? m_iconCheck : m_iconCheckGray); |
| 210 | btnSelect->setCheckable(true); |
| 211 | btnSelect->setChecked(select); |
| 212 | |
| 213 | connect(btnResend, &QToolButton::clicked, this, &SendingHandler::resendPressed); |
| 214 | connect(btnRemove, &QToolButton::clicked, this, &SendingHandler::removeRow); |
| 215 | connect(btnSelect, &QToolButton::clicked, [this, btnSelect](bool checked) { btnSelect->setIcon(checked ? m_iconCheck : m_iconCheckGray); }); |
| 216 | |
| 217 | m_table->setItem(rows, RECENT_REMOVE_COL, remove); |
| 218 | m_table->setItem(rows, RECENT_RESEND_COL, resend); |
| 219 | m_table->setItem(rows, RECENT_SELECT_COL, selected); |
| 220 | m_table->setItem(rows, RECENT_PATH_COL, path); |
| 221 | m_table->setCellWidget(rows, RECENT_REMOVE_COL, btnRemove); |
| 222 | m_table->setCellWidget(rows, RECENT_RESEND_COL, btnResend); |
| 223 | m_table->setCellWidget(rows, RECENT_SELECT_COL, btnSelect); |
| 224 | |
| 225 | m_table->setVisible(false); |
| 226 | m_table->resizeColumnsToContents(); |
| 227 | m_table->setVisible(true); |
| 228 | m_table->setSortingEnabled(true); |
| 229 | } |
| 230 | |
| 231 | void SendingHandler::sendFiles(const QStringList &fileNames, int location) { |
| 232 | QStringList list = fileNames; |
no test coverage detected