Commit d1c9e290 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix Bug 298831 - Kmail2 crash on save as draft

FIXED-IN: 4.9.2
BUG: 298831
parent 38c2cbea
......@@ -927,20 +927,29 @@ void Message::ComposerViewBase::slotSaveMessage( KJob* job )
Akonadi::Collection target;
Akonadi::Item item = job->property( "Akonadi::Item" ).value<Akonadi::Item>();
if( job->error() ) {
if ( mSaveIn == MessageSender::SaveInTemplates ) {
target = Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Templates );
} else {
target = Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Drafts );
}
target = defaultSpecialTarget();
} else {
const Akonadi::CollectionFetchJob *fetchJob = qobject_cast<Akonadi::CollectionFetchJob*>( job );
target = fetchJob->collections().first();
if(fetchJob->collections().isEmpty())
target = defaultSpecialTarget();
else
target = fetchJob->collections().first();
}
Akonadi::ItemCreateJob *create = new Akonadi::ItemCreateJob( item, target, this );
connect( create, SIGNAL(result(KJob*)), this, SLOT(slotCreateItemResult(KJob*)) );
m_pendingQueueJobs++;
}
Akonadi::Collection Message::ComposerViewBase::defaultSpecialTarget() const
{
Akonadi::Collection target;
if ( mSaveIn == MessageSender::SaveInTemplates ) {
target = Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Templates );
} else {
target = Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Drafts );
}
return target;
}
void Message::ComposerViewBase::slotCreateItemResult( KJob *job )
{
......
......@@ -256,6 +256,7 @@ private slots:
void slotSaveMessage( KJob *job );
private:
Akonadi::Collection defaultSpecialTarget() const;
/**
* Searches the mime tree, where root is the root node, for embedded images,
* extracts them froom the body and adds them to the editor.
......
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