|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: NMail application mailbox registration. |
|
15 * Adds mailbox to application library and to KQTI HS (as a widget) |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef NMMAILBOXREGISTERINTERFACE_H_ |
|
20 #define NMMAILBOXREGISTERINTERFACE_H_ |
|
21 |
|
22 // INCLUDES |
|
23 #include <QObject> |
|
24 #include <qmobilityglobal.h> |
|
25 #include <QVariant> |
|
26 |
|
27 class NmMailboxRegisterInterfacePrivate; |
|
28 |
|
29 class NmMailboxRegisterInterface : public QObject |
|
30 { |
|
31 Q_OBJECT |
|
32 |
|
33 public: |
|
34 explicit NmMailboxRegisterInterface(QObject *parent = 0); |
|
35 ~NmMailboxRegisterInterface(); |
|
36 |
|
37 public slots: |
|
38 /*! |
|
39 \fn bool registerNewMailbox(quint64 accountId, QString accountName, QString accountIconName) |
|
40 \param accountId The ID of the mailbox to register |
|
41 \param accountName The name of the mailbox to register |
|
42 \param accountIconName The icon of the mailbox to register |
|
43 \return true if mailbox registration succeed. false if failed. |
|
44 |
|
45 This method registers mailbox to application library and to homescreen as an email widget. |
|
46 |
|
47 Usage example: |
|
48 |
|
49 QServiceManager manager; |
|
50 QServiceFilter filter("com.nokia.symbian.IEmailRegisterAccount"); |
|
51 QList<QServiceInterfaceDescriptor> interfaces = manager.findInterfaces(filter); |
|
52 QObject *widgetObject = manager.loadInterface(interfaces.first()); |
|
53 |
|
54 const QMetaObject *object = widgetObject->metaObject(); |
|
55 QMetaMethod registerNewMailboxMethod; |
|
56 int index = object->indexOfMethod( |
|
57 QMetaObject::normalizedSignature("registerNewMailbox(quint64, QString, QString)")); |
|
58 registerNewMailboxMethod = object->method(index); |
|
59 registerNewMailboxMethod.invoke(widgetObject, |
|
60 Q_ARG(quint64, accountId), |
|
61 Q_ARG(QString, accountName), |
|
62 Q_ARG(QString, accountIconName)); |
|
63 */ |
|
64 bool registerNewMailbox(quint64 accountId, QString accountName, QString accountIconName); |
|
65 |
|
66 /*! |
|
67 \fn bool updateMailboxName (quint64 accountId, QString newName) |
|
68 \param accountId The ID of the mailbox to register |
|
69 \param accountName The name of the mailbox to register |
|
70 \return true if mailbox name updated succesfully. false if failed. |
|
71 |
|
72 This method updates mailbox name to application library. |
|
73 |
|
74 Usage example: |
|
75 |
|
76 QServiceManager manager; |
|
77 QServiceFilter filter("com.nokia.symbian.IEmailRegisterAccount"); |
|
78 QList<QServiceInterfaceDescriptor> interfaces = manager.findInterfaces(filter); |
|
79 QObject *widgetObject = manager.loadInterface(interfaces.first()); |
|
80 |
|
81 const QMetaObject *object = widgetObject->metaObject(); |
|
82 QMetaMethod updateMailboxNameMethod; |
|
83 int index = object->indexOfMethod( |
|
84 QMetaObject::normalizedSignature("updateMailboxName(quint64, QString)")); |
|
85 updateMailboxNameMethod = object->method(index); |
|
86 updateMailboxNameMethod.invoke(widgetObject, |
|
87 Q_ARG(quint64, accountId), |
|
88 Q_ARG(QString, accountName)); |
|
89 */ |
|
90 bool updateMailboxName (quint64 accountId, QString newName); |
|
91 |
|
92 /*! |
|
93 \fn bool unregisterMailbox (quint64 accountId) |
|
94 \param accountId The ID of the mailbox to unregister |
|
95 \return true if mailbox unregistration succeed. false if failed. |
|
96 |
|
97 This method unregisters mailbox from application library. |
|
98 |
|
99 Usage example: |
|
100 |
|
101 QServiceManager manager; |
|
102 QServiceFilter filter("com.nokia.symbian.IEmailRegisterAccount"); |
|
103 QList<QServiceInterfaceDescriptor> interfaces = manager.findInterfaces(filter); |
|
104 QObject *widgetObject = manager.loadInterface(interfaces.first()); |
|
105 |
|
106 const QMetaObject *object = widgetObject->metaObject(); |
|
107 QMetaMethod unregisterMailboxMethod; |
|
108 int index = object->indexOfMethod( |
|
109 QMetaObject::normalizedSignature("unregisterMailbox(quint64)")); |
|
110 unregisterMailboxMethod = object->method(index); |
|
111 unregisterMailboxMethod.invoke(widgetObject, |
|
112 Q_ARG(quint64, accountId)); |
|
113 */ |
|
114 bool unregisterMailbox (quint64 accountId); |
|
115 |
|
116 private: |
|
117 /** |
|
118 * Pointer to a private implementation. |
|
119 */ |
|
120 NmMailboxRegisterInterfacePrivate* const m_d; |
|
121 |
|
122 }; |
|
123 |
|
124 #endif /* NMMAILBOXREGISTERINTERFACE_H_ */ |
|
125 |
|
126 |
|
127 |