|
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 * |
|
15 * Description: |
|
16 * The source file of service utils private |
|
17 */ |
|
18 |
|
19 #include "fmserviceutilsprivate.h" |
|
20 #include "fmserviceutilshandler.h" |
|
21 #include "fmcommon.h" |
|
22 #include <shareui.h> |
|
23 |
|
24 FmServiceUtilsPrivate::FmServiceUtilsPrivate() |
|
25 :mShareUi( 0 ), mServiceUtilsHandler( 0 ) |
|
26 { |
|
27 |
|
28 } |
|
29 |
|
30 FmServiceUtilsPrivate::~FmServiceUtilsPrivate() |
|
31 { |
|
32 if( mShareUi ) { |
|
33 delete mShareUi; |
|
34 mShareUi = 0; |
|
35 } |
|
36 |
|
37 if( mServiceUtilsHandler ) { |
|
38 delete mServiceUtilsHandler; |
|
39 mServiceUtilsHandler = 0; |
|
40 } |
|
41 |
|
42 } |
|
43 |
|
44 /* |
|
45 return \a shareUi which is used to send files. |
|
46 */ |
|
47 ShareUi *FmServiceUtilsPrivate::shareUi() |
|
48 { |
|
49 if( !mShareUi ) { |
|
50 mShareUi = new ShareUi; |
|
51 } |
|
52 return mShareUi; |
|
53 } |
|
54 |
|
55 /* |
|
56 return \a CFmServiceUtilsHandler which is used to closeApps and restartApps |
|
57 */ |
|
58 CFmServiceUtilsHandler *FmServiceUtilsPrivate::serviceUtilsHandler() |
|
59 { |
|
60 if( !mServiceUtilsHandler ) { |
|
61 TRAPD(err, mServiceUtilsHandler = CFmServiceUtilsHandler::NewL()); |
|
62 if( err != KErrNone ) { |
|
63 mServiceUtilsHandler = 0; |
|
64 } |
|
65 } |
|
66 return mServiceUtilsHandler; |
|
67 } |
|
68 |
|
69 /*! |
|
70 send files that included in \a filePathList via ShareUi |
|
71 */ |
|
72 void FmServiceUtilsPrivate::sendFile( const QStringList &filePathList ) |
|
73 { |
|
74 // send do not accept const QStringList, so use QStringList()<<filePathList |
|
75 shareUi()->send( QStringList()<<filePathList, true ); |
|
76 } |
|
77 |
|
78 /*! |
|
79 call CBaBackupSessionWrapper to close apps, for example, before formant, apps need be closed |
|
80 this is synchronous which will take a while, please call this function in thread |
|
81 */ |
|
82 void FmServiceUtilsPrivate::closeApps() |
|
83 { |
|
84 CFmServiceUtilsHandler *utilsHandler = serviceUtilsHandler(); |
|
85 if( utilsHandler ) { |
|
86 TRAP_IGNORE( utilsHandler->CloseAppsL() ); |
|
87 } |
|
88 } |
|
89 |
|
90 /*! |
|
91 call CBaBackupSessionWrapper to restart apps |
|
92 for example, after formant, closed apps need be restarted |
|
93 this is synchronous which will return quickly. |
|
94 */ |
|
95 void FmServiceUtilsPrivate::restartApps() |
|
96 { |
|
97 CFmServiceUtilsHandler *utilsHandler = serviceUtilsHandler(); |
|
98 if( utilsHandler ) { |
|
99 TRAP_IGNORE( serviceUtilsHandler()->RestartAppsL() ); |
|
100 } |
|
101 } |
|
102 |