31
|
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 |
ShareUi::~ShareUi()
|
|
37 |
{
|
|
38 |
// free allocated memory
|
|
39 |
if(d_ptr)
|
|
40 |
{
|
|
41 |
delete d_ptr;
|
|
42 |
}
|
|
43 |
}
|
|
44 |
|
|
45 |
/**
|
|
46 |
* send(QList<QVariant>& fileList, bool embedded)
|
|
47 |
*
|
|
48 |
* method for passing file list to the sending services
|
|
49 |
* @param fileList list of paths to files.eg: c:\images\sunset.jpg
|
|
50 |
* @param embedded true if sendui dialog is embedded in the launched application
|
|
51 |
*
|
|
52 |
* @return bool true if dialog initialization successfull otherwise false
|
|
53 |
*/
|
|
54 |
bool ShareUi::send(QStringList& fileList, bool embedded)
|
|
55 |
{
|
|
56 |
if((d_ptr = new ShareUiPrivate) == NULL)
|
|
57 |
{
|
|
58 |
return false;
|
|
59 |
}
|
|
60 |
return d_ptr->init(fileList, embedded);
|
|
61 |
}
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Dialog initialization
|
|
65 |
*
|
|
66 |
* Initialize the Dialog with a list of files to be sent.
|
|
67 |
* @param fileList List of files to send via sendui_dialog_api.
|
|
68 |
* @return bool successful initialization (true) or failure (false)
|
|
69 |
* @deprecated use send() instead.
|
|
70 |
*/
|
|
71 |
|
|
72 |
bool ShareUi::init(QList<QVariant>& fileList, bool embedded)
|
|
73 |
{
|
|
74 |
if((d_ptr = new ShareUiPrivate) == NULL)
|
|
75 |
{
|
|
76 |
return false;
|
|
77 |
}
|
|
78 |
|
|
79 |
QStringList aFileList;
|
|
80 |
for(int i = 0; i < fileList.count(); i++)
|
|
81 |
{
|
|
82 |
aFileList.append(QDir::toNativeSeparators(fileList[i].toString()));
|
|
83 |
}
|
|
84 |
return d_ptr->init(aFileList, embedded);
|
|
85 |
}
|
|
86 |
|
|
87 |
|