[Kde-pim] Crash when I try to create item

laurent Montel montel at kde.org
Tue Nov 22 09:22:29 GMT 2011


Hi,
When I want to move a item (from encapsulated email) I have this error:

-----------------------------------------------
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'Akonadi::PayloadException'
  what():  Akonadi::PayloadException: Wrong payload type (requested: 
sp(0)<QByteArray>; present: sp(1)<KMime::Message*>
**

----------------------------------------------

void KMReaderMainWin::slotCopyItem(QAction*action)
{
  if ( action )
  {
    const QModelIndex index = action->data().value<QModelIndex>();
    QAbstractItemModel *model = const_cast<QAbstractItemModel *>( 
index.model() );
    const Akonadi::Collection collection = index.data( 
Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();

    if ( mMsg.isValid() )
      Akonadi::ItemCopyJob *job = new Akonadi::ItemCopyJob( mMsg, 
collection,this );
    else
    {
      Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( mMsg, 
collection, this );
    }
    //TODO look at error
  }
}

and I create item from:
void KMReaderMainWin::showMessage( const QString& encoding, 
KMime::Message::Ptr message )
{
  Akonadi::Item item;

  item.setPayload( message );
  item.setMimeType( KMime::Message::mimeType() );
  
  mMsg = item;
  mMsgActions->setCurrentMessage( item );
  
  mReaderWin->setOverrideEncoding( encoding );
  mReaderWin->setMessage( message );
  if ( message )
    setCaption( message->subject()->asUnicodeString() );

  mTrashAction->setEnabled( false );

  menuBar()->show();
  toolBar( "mainToolBar" )->show();
}


Do you have idea ?
Thanks
Regards
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list