Changeset View
Changeset View
Standalone View
Standalone View
ui/embeddedfilesdialog.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | 48 | { | |||
---|---|---|---|---|---|
55 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); | 55 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); | ||
56 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | 56 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | ||
57 | buttonBox->button(QDialogButtonBox::Close)->setDefault(true); | 57 | buttonBox->button(QDialogButtonBox::Close)->setDefault(true); | ||
58 | KGuiItem::assign(mUser1Button, KStandardGuiItem::save()); | 58 | KGuiItem::assign(mUser1Button, KStandardGuiItem::save()); | ||
59 | mUser1Button->setEnabled(false); | 59 | mUser1Button->setEnabled(false); | ||
60 | 60 | | |||
61 | mUser2Button = new QPushButton; | 61 | mUser2Button = new QPushButton; | ||
62 | buttonBox->addButton(mUser2Button, QDialogButtonBox::ActionRole); | 62 | buttonBox->addButton(mUser2Button, QDialogButtonBox::ActionRole); | ||
63 | KGuiItem::assign(mUser2Button, KGuiItem(i18nc("@action:button", "View"), "document-open")); | 63 | KGuiItem::assign(mUser2Button, KGuiItem(i18nc("@action:button", "View"), QStringLiteral("document-open"))); | ||
64 | mUser2Button->setEnabled(false); | 64 | mUser2Button->setEnabled(false); | ||
65 | 65 | | |||
66 | m_tw = new QTreeWidget(this); | 66 | m_tw = new QTreeWidget(this); | ||
67 | mainLayout->addWidget(m_tw); | 67 | mainLayout->addWidget(m_tw); | ||
68 | mainLayout->addWidget(buttonBox); | 68 | mainLayout->addWidget(buttonBox); | ||
69 | 69 | | |||
70 | QStringList header; | 70 | QStringList header; | ||
71 | header.append(i18nc("@title:column", "Name")); | 71 | header.append(i18nc("@title:column", "Name")); | ||
▲ Show 20 Lines • Show All 106 Lines • ▼ Show 20 Line(s) | 175 | { | |||
178 | 178 | | |||
179 | // save in temporary directory with a unique name resembling the attachment name, | 179 | // save in temporary directory with a unique name resembling the attachment name, | ||
180 | // using QTemporaryFile's XXXXXX placeholder | 180 | // using QTemporaryFile's XXXXXX placeholder | ||
181 | QTemporaryFile *tmpFile = new QTemporaryFile( | 181 | QTemporaryFile *tmpFile = new QTemporaryFile( | ||
182 | QDir::tempPath() | 182 | QDir::tempPath() | ||
183 | + QDir::separator() | 183 | + QDir::separator() | ||
184 | + fileInfo.baseName() | 184 | + fileInfo.baseName() | ||
185 | + ".XXXXXX" | 185 | + ".XXXXXX" | ||
186 | + (fileInfo.completeSuffix().isEmpty() ? QString("") : "." + fileInfo.completeSuffix()) // krazy:exclude=doublequote_chars | 186 | + (fileInfo.completeSuffix().isEmpty() ? QStringLiteral("") : "." + fileInfo.completeSuffix()) // krazy:exclude=doublequote_chars | ||
187 | ); | 187 | ); | ||
188 | GuiUtils::writeEmbeddedFile( ef, this, *tmpFile ); | 188 | GuiUtils::writeEmbeddedFile( ef, this, *tmpFile ); | ||
189 | 189 | | |||
190 | // set readonly to prevent the viewer application from modifying it | 190 | // set readonly to prevent the viewer application from modifying it | ||
191 | tmpFile->setPermissions( QFile::ReadOwner ); | 191 | tmpFile->setPermissions( QFile::ReadOwner ); | ||
192 | 192 | | |||
193 | // keep temporary file alive while the dialog is open | 193 | // keep temporary file alive while the dialog is open | ||
194 | m_openedFiles.push_back( QSharedPointer< QTemporaryFile >( tmpFile ) ); | 194 | m_openedFiles.push_back( QSharedPointer< QTemporaryFile >( tmpFile ) ); | ||
Show All 11 Lines |