KSystemTray and Quit

Aaron J. Seigo aseigo at kde.org
Sat Jan 15 01:44:44 GMT 2005


hey all...

i just added this to the KSystemTray API:

/**
  * A convenience function to use when a quit is launched from the system 
tray. Provides
     * a consistent set of verbage for the user and should be used by all 
system tray using
     * apps for this consistency.
     * @return returns true if the user confirms the quit, or false if they 
cancel it
     * @since 3.4
     */
    bool confirmQuit();

if your app ships with KDE 3.4 and has a systemtray icon and it doesn't have a 
quit confirmation (e.g. it isn't an editor with a "Save this file?" 
confirmation), it would be good to modified your app to use confirmQuit() 
whenever a quit is requested via the system tray icon. (note: if you pass no 
parent to the system tray, then it gets handled automatically by KSystemTray)

e.g.:

connect(m_systemTray, SIGNAL(quitSelected()), SLOT(systemTrayQuit()));

void MyCoolApp::systemTrayQuit()
{
	if (m_systemTray->confirmQuit())
	{
		kapp->closeAllWindows(); // or however your app closes
	}
}

i'm trying to avoid any more "it's too easy to quit from the system tray" bugs 
from people who aren't careful with their mouse.

-- 
Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20050114/c5256497/attachment.sig>


More information about the kde-core-devel mailing list