phonebookui/phonebookservices/inc/cntservices.h
changeset 50 77bc263e1626
child 53 e6aff7b69165
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/phonebookservices/inc/cntservices.h	Wed Jul 21 11:21:49 2010 +0300
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:
+ *
+ */
+
+#ifndef CNTSERVICES_H
+#define CNTSERVICES_H
+
+#include <cntviewparams.h>
+#include <qtcontacts.h>
+
+#include "cntabstractserviceprovider.h"
+
+class CntAbstractViewManager;
+class XQServiceProvider;
+
+QTM_USE_NAMESPACE
+
+class CntServices : public QObject, public CntAbstractServiceProvider
+{
+    Q_OBJECT
+    
+public:
+    CntServices();
+    ~CntServices();
+
+public:
+
+    void setViewManager( CntAbstractViewManager& aViewManager );
+    
+    /**
+     * Opens contact selection view where multiple contacts can be selected.
+     * @param title The view title
+     * @param action Filter definition for filtering contacts based on supported action. Can be left empty.
+     * @param aServiceProvider The service provider
+     */
+    void singleFetch(const QString &title,
+                const QString &action,
+                CntAbstractServiceProvider& aServiceProvider  );
+
+    /**
+     * Opens contact selection view where multiple contacts can be selected.
+     * @param title The view title
+     * @param action Filter definition for filtering contacts based on supported action. Can be left empty.
+     * @param aServiceProvider The service provider
+     */
+    void multiFetch(const QString &title,
+                const QString &action,
+                CntAbstractServiceProvider& aServiceProvider  );
+
+    /**
+     * Launch editor for creating a new contact with a given detail.
+     * @param definitionName The field type
+     * @param value The value for the field.
+     * @param aServiceProvider The service provider
+     */
+    void editCreateNew(const QString &definitionName, const QString &value,
+        CntAbstractServiceProvider& aServiceProvider );
+
+    /**
+     * Launch editor for creating a new contact based on vCard file indicated in arg.
+     * @param vCardFile The vCard file name and path.
+     * @param aServiceProvider The service provider
+     */
+    void editCreateNewFromVCard(const QString &vCardFile,
+        CntAbstractServiceProvider& aServiceProvider );
+
+    /**
+     * User can first choose a contact, and then an editor is opened.
+     * A new detail is provided by caller and it will be prefilled in the editor.
+     * @param definitionName The field type
+     * @param value The value for the field.
+     * @param aServiceProvider The service provider
+     */
+    void editUpdateExisting(const QString &definitionName, const QString &value,
+        CntAbstractServiceProvider& aServiceProvider );
+
+    /**
+     * Open the editor for an existing contact.'
+     * @param contactId
+     * @param aServiceProvider The service provider
+     */
+    void editExisting(int contactId,
+        CntAbstractServiceProvider& aServiceProvider);
+
+    /**
+     * Opens Contact Card.
+     * @param contactId The contact ID
+     * @param aServiceProvider The service provider
+     */
+    void launchContactCard(int contactId,
+        CntAbstractServiceProvider& aServiceProvider );
+
+    /**
+     * Opens Contact Card for non-saved contact.
+     * @param definitionName Field name.
+     * @param value The field value.
+     * @param aServiceProvider The service provider
+     */
+    void launchTemporaryContactCard(const QString &definitionName, const QString &value,
+        CntAbstractServiceProvider& aServiceProvider );
+    
+    /**
+     * Set the flag that allows quiting the application explicitly
+     * using the quitApp slot. By default the value is always true.
+     */
+    void setQuitable(bool quitable);
+        
+public slots:
+    /**
+     * Quit the application
+     */
+    void quitApp();
+    
+private:
+    void removeNotSupportedFields(QContact& contact);
+    void removeNotSupportedDetails(QContact& contact);
+
+private: // from CntAbstractServiceProvider
+    void CompleteServiceAndCloseApp(const QVariant& retValue);
+private:
+    CntAbstractViewManager* mViewManager; // not owned
+    QStringList m_definitionNames;
+    CntAbstractServiceProvider* mCurrentProvider; // not owned
+    bool mIsQuitable;
+};
+
+#endif /* CNTSERVICES_H */