How to port from KDE3's KNotifyClient to KDE4's new KNotification

The config file

Before

there was a file in $KDEDIR/share/apps/kopete/eventsrc

[!Global!]
IconName=kopete
Comment=Kopete Messenger

[kopete_incoming]
Name=Incoming
Comment=An incoming message has been received
default_sound=Kopete_Received.ogg
default_presentation=64

....

After

[Global]
IconName=kopete
Comment=Kopete Messenger

[Event/kopete_incoming]
Name=Incoming
Comment=An incoming message has been received
Sound=Kopete_Received.ogg
Action=Sound|Popup|Taskbar

...

in the code

before

  KNotifyClient::event( someWidget->winId() , "kopete_incoming", i18n("you received a message from %1").arg( contactName ) );

after

 KNotification::event( "kopete_incoming" , i18n("you received a message from %1",  contactName ) , QPixmap() , someWidget );

or, which is probably better API

  KNotification *notification= new KNotification ( "kopete_incoming" , someWidget );
  notification->setText( i18n("you received a message from %1",  contactName ) );
  notification->sendEvent();