17
17
#include <dialogs/CAcceptPromptDialog.h>
18
18
#include "ui_CAcceptPromptDialog.h"
20
CAcceptPromptDialog::CAcceptPromptDialog(QString address, QList<CFileHeader *> & headers)
20
CAcceptPromptDialog::CAcceptPromptDialog(QString name, QList<CFileHeader *> & headers)
21
21
: ui(new Ui::CAcceptPromptDialog)
24
24
setWindowFlags(Qt::WindowStaysOnTopHint);
26
// Set the label according to the parameters supplied
27
ui->DescriptionLabel->setText(tr("%1 would like to send you the following file(s):").arg(address));
29
// Make the first column a little bit wider
26
/* Make the first column a little bit wider. */
30
27
ui->FileList->setColumnWidth(ui->FileList->columnAt(1), 250);
32
// Enter the files into the table
29
/* Enter the files into the table, totalling up the size. */
30
qint64 total_size = 0;
33
32
foreach(CFileHeader * header, headers)
35
34
ui->FileList->insertRow(0);
37
35
ui->FileList->setItem(0, 0, new QTableWidgetItem(header->GetFilename()));
39
37
QTableWidgetItem * cell = new QTableWidgetItem(FormatSize(header->GetUncompressedSize()));
40
38
cell->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
41
39
ui->FileList->setItem(0, 1, cell);
41
total_size += header->GetUncompressedSize();
44
/* Set the labels according to the information supplied. */
45
ui->DescriptionLabel->setText(tr("%1 would like to send you the following file(s) (%2):", "",
46
headers.size()).arg(name).arg(total_size));
47
ui->AcceptLabel->setText(tr("Do you wish to accept the file(s)?", "", headers.size()));
45
50
CAcceptPromptDialog::~CAcceptPromptDialog()