mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
70 lines
1.6 KiB
HTML
70 lines
1.6 KiB
HTML
<html><body>
|
|
<h1>How to port from KDE3's KNotifyClient to KDE4's new KNotification</h1>
|
|
|
|
|
|
<h2>The config file</h2>
|
|
|
|
<h3>Before</h3>
|
|
|
|
<p>there was a file in <tt>$KDEDIR/share/kopete/eventsrc</tt></p>
|
|
|
|
|
|
<pre>
|
|
[!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
|
|
|
|
....
|
|
</pre>
|
|
|
|
|
|
<h3>After</h3>
|
|
<ul>
|
|
<li>The file is now installed in <tt>$KDEDIR/share/kopete/kopete.notifyrc</tt>
|
|
<li>[!Global!] becomes [Global]</li>
|
|
<li>events group name begin now with Event/</li>
|
|
<li>"default_presentation" bitmask is replaced by an "Action" field wich is a string of default action separated by '|' </li>
|
|
<li> "default_sound" is now "Sound"</li>
|
|
</ul>
|
|
|
|
<pre>
|
|
[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
|
|
|
|
...
|
|
</pre>
|
|
|
|
<h2>in the code</h2>
|
|
|
|
<h3>before</h3>
|
|
<pre>
|
|
KNotifyClient::event( someWidget->winId() , "kopete_incoming", i18n("you received a message from %1").arg( contactName ) );
|
|
</pre>
|
|
|
|
<h3>after</h3>
|
|
<pre>
|
|
KNotification::event( "kopete_incoming" , i18n("you received a message from %1", contactName ) , QPixmap() , someWidget );
|
|
</pre>
|
|
|
|
<p>or, which is probably better API</p>
|
|
<pre>
|
|
KNotification *notification= new KNotification ( "kopete_incoming" , someWidget );
|
|
notification->setText( i18n("you received a message from %1", contactName ) );
|
|
notification->sendEvent();
|
|
</pre>
|
|
|
|
</body>
|
|
</html>
|