Commit 66f74360 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 314221 - composer attaches directory without confirmation if

also a file is selected
FIXED-IN: 4.10.1
BUG: 314221
parent 05f704ce
......@@ -774,24 +774,19 @@ void AttachmentControllerBase::showAddAttachmentDialog()
if( dialog->exec() == KDialog::Accepted && dialog ) {
const KUrl::List files = dialog->selectedUrls();
const QString encoding = MessageViewer::NodeHelper::fixEncoding( dialog->selectedEncoding() );
if ( files.count() == 1 ) {
const KUrl url = files.at( 0 );
KUrl urlWithEncoding = url;
urlWithEncoding.setFileEncoding( encoding );
if ( KMimeType::findByUrl( urlWithEncoding )->name() == QLatin1String( "inode/directory" ) ) {
int rc = KMessageBox::warningYesNo( d->wParent,i18n("Do you really want to attach this directory \"%1\" ?", url.toLocalFile() ),i18n( "Attach directory" ) );
if ( rc == KMessageBox::Yes ) {
addAttachment( urlWithEncoding );
}
} else {
addAttachment( urlWithEncoding );
}
} else {
foreach( const KUrl &url, files ) {
const int numberOfFiles(files.count());
for (int i=0; i<numberOfFiles; ++i) {
const KUrl url = files.at( i );
KUrl urlWithEncoding = url;
urlWithEncoding.setFileEncoding( encoding );
addAttachment( urlWithEncoding );
}
if ( KMimeType::findByUrl( urlWithEncoding )->name() == QLatin1String( "inode/directory" ) ) {
const int rc = KMessageBox::warningYesNo( d->wParent,i18n("Do you really want to attach this directory \"%1\" ?", url.toLocalFile() ),i18n( "Attach directory" ) );
if ( rc == KMessageBox::Yes ) {
addAttachment( urlWithEncoding );
}
} else {
addAttachment( urlWithEncoding );
}
}
emit fileAttached();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment