106
106
Akonadi::ItemFetchJob *itemFetchJob = new Akonadi::ItemFetchJob( items, this );
107
107
itemFetchJob->fetchScope().fetchFullPayload( true );
108
108
itemFetchJob->fetchScope().setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
109
connect( itemFetchJob, SIGNAL(result(KJob*)), this, SLOT(slotFetchJob(KJob*)) );
112
void AttachmentController::slotFetchJob( KJob *job )
114
if ( job->error() ) {
115
MailCommon::Util::showJobErrorMessage( job );
118
Akonadi::ItemFetchJob *fjob = dynamic_cast<Akonadi::ItemFetchJob*>( job );
121
Akonadi::Item::List items = fjob->items();
123
if ( items.isEmpty() )
126
if ( items.first().mimeType() == KMime::Message::mimeType() ) {
128
if ( items.at( 0 ).isValid() && items.at( 0 ).parentCollection().isValid() ) {
129
QSharedPointer<FolderCollection> fd( FolderCollection::forCollection( items.at( 0 ).parentCollection(), false ) );
130
identity = fd->identity();
132
KMCommand *command = new KMForwardAttachedCommand( mComposer, items,identity, mComposer );
135
foreach ( const Akonadi::Item &item, items ) {
136
QString attachmentName = QLatin1String( "attachment" );
137
if ( item.hasPayload<KABC::Addressee>() ) {
138
const KABC::Addressee contact = item.payload<KABC::Addressee>();
139
attachmentName = contact.realName() + QLatin1String( ".vcf" );
142
mComposer->addAttachment( attachmentName, KMime::Headers::CEbase64, QString(), item.payloadData(), item.mimeType().toLatin1() );
109
connect( itemFetchJob, SIGNAL(result(KJob*)), mComposer, SLOT(slotFetchJob(KJob*)) );
147
112
void AttachmentController::selectionChanged()