Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QtopiaAbstractService Class Reference
[QtBaseModule]

The QtopiaAbstractService class provides an interface to messages on a QCop service which simplifies remote slot invocations More...

    #include <QtopiaAbstractService>

Inherits QObject.

Inherited by AlarmService, AlertService, BluetoothPushingService, BSciDrmAgentService, CalendarService, CallForwardingService, CallHistoryService, CallNetworksService, CameraService, CleanupWizardService, ClockService, ContactsPhoneService, ContactsService, ContentSetViewService, DateService, DialerService, EmailService, FavoritesService, HelpService, InstantMessageService, IrBeamingService, MessagesService, ModemEmulatorService, NetworkSetupService, PackageManagerService, PhotoEditService, PlayMediaService, PresenceService, PrintService, ProfilesService, QMailNewMessageHandler, QtopiaAppService, QtopiaPowerManagerService, RingtoneService, RotationService, SettingsManagerService, SettingsService, SMSService, SuspendService, SysMessagesService, TaskManagerService, TasksService, TelephonyService, TimeMonitorService, TimeService, TimeUpdateService, VirtualKeyboardService, VoiceRecordingService, and WebAccessService.

Public Functions

Protected Functions

Additional Inherited Members


Detailed Description

The QtopiaAbstractService class provides an interface to messages on a QCop service which simplifies remote slot invocations

Service messages in Qt Extended are sent with QtopiaServiceRequest. They consist of a service name, a message name, and a list of parameter values. Qt Extended dispatches service messages to the applications associated with the service name, on the application's QPE/Application/appname channel, where appname is the application's name.

Client applications can listen for service messages on the application channel directly, using QtopiaChannel, but it is cleaner and less error-prone to create an instance of QtopiaAbstractService instead.

The use of QtopiaAbstractService will be demonstrated using the Time service. This has a single message called editTime() which asks the service to pop up a dialog allowing the user to edit the current time.

    class TimeService : public QtopiaAbstractService
    {
        Q_OBJECT
    public:
        TimeService( QObject *parent = 0 );

    public slots:
        void editTime();
    };

    TimeService::TimeService( QObject *parent )
        : QtopiaAbstractService( "Time", parent )
    {
        publishAll();
    }

The call to publishAll() causes all public slots within TimeService to be automatically registered as Service messages. This can be useful if the service has many message types.

The client can send a request to the service using QtopiaServiceRequest:

    QtopiaServiceRequest req( "Time", "editTime()" );
    req.send();

See also QtopiaService, QtopiaIpcAdaptor, QtopiaIpcEnvelope, QtopiaServiceRequest, and QtopiaChannel.


Member Function Documentation

QtopiaAbstractService::QtopiaAbstractService ( const QString & service, QObject * parent = 0 )

Construct a remote service object for service and attach it to parent.

QtopiaAbstractService::~QtopiaAbstractService ()

Destroy this QCop service handling object.

void QtopiaAbstractService::publishAll ()   [protected]

Publishes all slots on this object within subclasses of QtopiaAbstractService. This is typically called from a subclass constructor.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3