messagingapp/shareui/src/shareui.cpp
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Offers message creation and sending services.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include <shareui.h>
       
    20 #include "shareuiprivate.h"
       
    21 #include <QDir>
       
    22 
       
    23 /**
       
    24  * Default Constructor.
       
    25  * 
       
    26  */
       
    27 
       
    28 ShareUi::ShareUi() : d_ptr(NULL)
       
    29     {    
       
    30     }
       
    31 
       
    32 
       
    33 /**
       
    34  * Destructor.
       
    35  * 
       
    36  * 
       
    37  */
       
    38 
       
    39 ShareUi::~ShareUi()
       
    40     {
       
    41     // free allocated memory
       
    42     if(d_ptr)
       
    43         {
       
    44         delete d_ptr;
       
    45         }
       
    46     }
       
    47 
       
    48 /**
       
    49  * send(QList<QVariant>& fileList, bool embedded)
       
    50  * 
       
    51  * method for passing file list to the sending services
       
    52  * @param fileList list of paths to files.eg: c:\images\sunset.jpg
       
    53  * @param embedded true if sendui dialog is embedded in the launched application
       
    54  * 
       
    55  * @return bool true if dialog initialization successfull otherwise false
       
    56  */
       
    57 bool ShareUi::send(QStringList& fileList, bool embedded)
       
    58     {
       
    59     if((d_ptr = new ShareUiPrivate) == NULL)
       
    60         {
       
    61         return false;
       
    62         }
       
    63     return d_ptr->init(fileList, embedded);
       
    64     }
       
    65 
       
    66 /**
       
    67  * Dialog initialization
       
    68  * 
       
    69  * Initialize the Dialog with a list of files to be sent.
       
    70  * @param fileList List of files to send via sendui_dialog_api.
       
    71  * @return bool successful initialization (true) or failure  (false)
       
    72  * @deprecated use send() instead.
       
    73  */
       
    74 
       
    75 bool ShareUi::init(QList<QVariant>& fileList, bool embedded)
       
    76     {
       
    77     if((d_ptr = new ShareUiPrivate) == NULL)
       
    78         {
       
    79         return false;
       
    80         }
       
    81     
       
    82     QStringList aFileList;
       
    83     for(int i = 0; i < fileList.count(); i++)
       
    84         {
       
    85         aFileList.append(QDir::toNativeSeparators(fileList[i].toString()));
       
    86         }
       
    87     return d_ptr->init(aFileList, embedded);
       
    88     }
       
    89 
       
    90