Search code examples
c++user-interfaceqtsymbians60

Standard notifications or alert styles in Symbian (Qt/S60)?


I'm building a an application using Qt on the Symbian/S60 platform and I was wondering if there was a standard notification window that I could use to pass messages to users. Using other platforms as examples, I'm looking for something equivalent to Javascript's alert() method or Cocoa's NSRunAlert* methods.

If there is not a native Symbian/S60 equivalent, is there something in the Qt space that I should be looking at? QMessageBox didn't seem to work as I might expect.


Solution

  • You can use RNotifier class from any Symbian code (and from Qt too). This class can show notifications even from window-less programs, like Symbian servers. It is simple to use:

        RNotifier notifier;
        User::LeaveIfError(notifier.Connect());
        TInt buttonVal;
        TRequestStatus lStatus;
        notifier.Notify(_L("First line of notification"), _L("Second line of notification"), _L("Left button text"), _L("Right button text"), buttonVal, lStatus);
        User::WaitForRequest(lStatus);
        notifier.Close();
    

    After User::WaitForRequest(lStatus) completes you can inspect value of buttonVal to know which button was pressed. It is set to: 0, if the left button is selected; 1, if the right button is selected.

    Hope this helps.