NSWorkspaceWillPowerOffNotification not working with Qt Cocoa Mac Application
NSWorkspaceWillPowerOffNotification not working with Qt Cocoa Mac Application
- Subject: NSWorkspaceWillPowerOffNotification not working with Qt Cocoa Mac Application
- From: manoj <email@hidden>
- Date: Thu, 07 Apr 2011 20:08:27 +0530
Hi,
I am working on Mac application using Qt Cocoa. I want to track log
out/shut down event. I looked at Qt for some solution however it
seems to be more at OS level so Qt doesn't provide anything.
So I switched to NSWorkspace and registered to get Sleep
(NSWorkspaceWillSleepNotification) and Log out
(NSWorkspaceWillPowerOffNotification). I am able to get Sleep
notification but not able to get Log Out/shut down notifications in
Qt App.
To verify registration code, I created a simple Cocoa application
and both sleep and log out notification works in this case.
Below is the code which works with cocoa application
(receiveLogOutShutDownNote gets called) and not with Qt App.
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
selector: @selector(receiveLogOutShutDownNote:)
name: NSWorkspaceWillPowerOffNotification object: NULL];
- (void) receiveLogOutShutDownNote: (NSNotification*) note
{
NSLog(@"receiveLogOutShutDownNote: %@", [note name]);
}
Please help me to figure out what is the difference between two.
-Manoj
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden