As part of KPackageKit, there are two important programs. The first is the kpackagekit executable, which actually shows the main add/remove/update selection Ui. The second is kpackagekit-smart-icon, which shows the transaction list in your system tray.
The current SVN has a KDED module which runs kpackagekit-smart-icon when DBus announces a transaction change, and it runs kpackagekit --smart-update which shows the little popup informing you about available updates.
For the weekend, my goal was to move the notifications out of the main UI and into the helper icon app. It makes sense to me, because we don’t want to have to load up a big fancy Ui for a backgrounded, windowless task. It also makes sense because then we can show error messages for transactions, and even have a small ‘updates available’ icon in the tray, just like packagekit-gnome can do.
Daniel apparently tried this once before but wasn’t able to accomplish it right. He said that the popups kept saying ‘kpackagekit-smart-icon’ in the title, even though every string was set to ‘KPackageKit’. For some reason, I didn’t want to believe that KDE would force this restriction on a program, that the popup title must be the application’s name. The API documentation doesn’t say how to accomplish this, so I started digging through the sources.
When you send a notification, the KNotification class calls KNotificationManager::notify(this, pixmap, actions, contexts, appname). The appname is taken from the appname specified in the program’s KAboutData, and is used to find the notifyrc. KNotificationManager then sends the message out to org.kde.KNotify over dbus, which is picked up by the knotify4 daemon.
Once it reaches the daemon, the appname.notifyrc is read and the proper plugins (passive popup, sound, etc) are activated. As for the popup plugin, the private fillPopup() is where the magic happens. It loads in the IconName specified in the notifyrc, along with the undocumented Name entry. If no icon is specified way back up at KNotification::event(), the default icon is used, and the appName is used if there is no Name entry. After that, the popup widget is setup and displayed.
It is a bit annoying that I have to dig through all the sources in both kdelibs and kdebase just to fix the simple problem of changing the popup’s title. I notice that techbase doesn’t have anything about how to do this, so you should expect an article written up there soon.