author | hgs |
Sat, 04 Sep 2010 11:36:24 +0530 | |
changeset 62 | 36d93b4dc635 |
parent 54 | 0f0f3f26f787 |
child 69 | 45459746d5e8 |
permissions | -rw-r--r-- |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <mpxcollectionpath.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <mglxmedialist.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <glxcommandfactory.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <glxcommandhandleraddtocontainer.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <glxcommandhandlernewmedia.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <QStringListModel> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
25 |
#include <hblabel.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
#include <hbaction.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include <glxalbummodel.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include <glxcollectionpluginalbums.hrh> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#include <glxmodelparm.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <glxfilterfactory.h> |
40 | 32 |
#include <QEventLoop> |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include <hblistwidget.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#include <hbview.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include <hbpushbutton.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
#include <QGraphicsGridLayout> |
50 | 38 |
#include <hbselectiondialog.h> |
39 |
||
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
40 |
#include <hbmessagebox.h> |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
41 |
|
40 | 42 |
#include <glxcommandhandlers.hrh> |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
43 |
#include "glxlocalisationstrings.h" |
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
44 |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
45 |
#include "OstTraceDefinitions.h" |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
46 |
#ifdef OST_TRACE_COMPILER_IN_USE |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
47 |
#include "glxcommandhandleraddtocontainerTraces.h" |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
48 |
#endif |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
49 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
const TInt KSelectionPopupListHierarchy = 5; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
|
40 | 53 |
GlxAlbumSelectionPopup::GlxAlbumSelectionPopup() |
50 | 54 |
: mSelectionModel( 0 ), |
40 | 55 |
mEventLoop( 0 ), |
56 |
mResult( false ) |
|
57 |
{ |
|
58 |
} |
|
59 |
||
60 |
GlxAlbumSelectionPopup::~GlxAlbumSelectionPopup() |
|
61 |
{ |
|
62 |
} |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
63 |
|
40 | 64 |
QModelIndexList GlxAlbumSelectionPopup::GetSelectionList(GlxAlbumModel *model, bool *ok) |
65 |
{ |
|
50 | 66 |
HbSelectionDialog *dlg = new HbSelectionDialog; |
67 |
dlg->setHeadingWidget(new HbLabel(GLX_ALBUM_SELECTION_TITLE)); |
|
68 |
dlg->setSelectionMode(HbAbstractItemView::SingleSelection); |
|
69 |
dlg->setModel(model); |
|
70 |
dlg->setAttribute(Qt::WA_DeleteOnClose); |
|
71 |
dlg->clearActions(); |
|
72 |
HbAction *action; |
|
73 |
action= new HbAction(GLX_BUTTON_NEW); |
|
74 |
action->setObjectName( "ch_new_album_button" ); |
|
75 |
dlg->addAction(action); |
|
76 |
action= new HbAction(GLX_BUTTON_CANCEL); |
|
77 |
action->setObjectName( "ch_cancel_album_button" ); |
|
78 |
dlg->addAction(action); |
|
79 |
dlg->open(this, SLOT(dialogClosed(HbAction*))); |
|
80 |
||
40 | 81 |
QEventLoop eventLoop; |
82 |
mEventLoop = &eventLoop; |
|
50 | 83 |
|
40 | 84 |
eventLoop.exec( ); |
85 |
mEventLoop = 0 ; |
|
86 |
if ( ok ) { |
|
87 |
*ok = mResult ; |
|
88 |
} |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
89 |
|
50 | 90 |
QModelIndexList selectedIndexes = dlg->selectedModelIndexes(); |
40 | 91 |
return selectedIndexes; |
92 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
|
40 | 94 |
|
95 |
void GlxAlbumSelectionPopup::dialogClosed(HbAction *action) |
|
96 |
{ |
|
50 | 97 |
HbSelectionDialog *dlg = (HbSelectionDialog*)(sender()); |
98 |
||
99 |
if( action == dlg->actions().at(1) ) { |
|
100 |
mResult = false ; |
|
40 | 101 |
} |
102 |
else { |
|
50 | 103 |
mResult = true ; |
40 | 104 |
} |
105 |
if ( mEventLoop && mEventLoop->isRunning( ) ) { |
|
106 |
mEventLoop->exit( 0 ); |
|
107 |
} |
|
108 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
110 |
GlxCommandHandlerAddToContainer::GlxCommandHandlerAddToContainer() : |
62 | 111 |
mNewMediaAdded(false),mAlbumName(QString()),mIsAddtoFavCmd(false) |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
112 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
113 |
OstTraceFunctionEntry0( GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_ENTRY ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
mTargetContainers = NULL; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
115 |
OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_EXIT ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
116 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
GlxCommandHandlerAddToContainer::~GlxCommandHandlerAddToContainer() |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
119 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
120 |
OstTraceFunctionEntry0( DUP1_GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_ENTRY ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
delete mTargetContainers; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
122 |
OstTraceFunctionExit0( DUP1_GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_EXIT ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
123 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
|
40 | 125 |
CMPXCommand* GlxCommandHandlerAddToContainer::CreateCommandL(TInt aCommandId, |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
126 |
MGlxMediaList& aMediaList, TBool& /*aConsume*/) const |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
127 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
128 |
OstTraceFunctionEntry0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATECOMMANDL_ENTRY ); |
40 | 129 |
CMPXCommand* command = NULL; |
50 | 130 |
mAlbumName.clear(); |
62 | 131 |
mIsAddtoFavCmd = false; |
40 | 132 |
if(aCommandId == EGlxCmdAddToFav) |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
133 |
{ |
62 | 134 |
mIsAddtoFavCmd = TRUE; |
54 | 135 |
mAlbumName = GLX_ALBUM_FAV; |
40 | 136 |
CMPXCollectionPath* targetCollection = CMPXCollectionPath::NewL(); |
137 |
CleanupStack::PushL(targetCollection); |
|
138 |
// The target collection has to be appeneded with the albums plugin id |
|
139 |
targetCollection->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
|
140 |
// The target collection has also to be appeneded with the the relation id. |
|
141 |
// appending another level into the albums to get favourites and 1 is the relation id of albums |
|
142 |
targetCollection->AppendL( TMPXItemId(KGlxCollectionFavoritesId) ); |
|
143 |
targetCollection->Set( 0 ); |
|
144 |
||
145 |
CMPXCollectionPath* sourceItems = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); |
|
146 |
||
147 |
command = TGlxCommandFactory::AddToContainerCommandLC( |
|
148 |
*sourceItems, *targetCollection); |
|
149 |
CleanupStack::Pop(command); |
|
150 |
||
151 |
CleanupStack::PopAndDestroy(sourceItems); |
|
152 |
CleanupStack::PopAndDestroy(targetCollection); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
} |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
154 |
else |
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
155 |
{ |
40 | 156 |
|
157 |
CMPXCollectionPath* sourceItems = aMediaList.PathLC( |
|
158 |
NGlxListDefs::EPathFocusOrSelection); |
|
159 |
bool ok = false; |
|
160 |
||
161 |
//create target medialist |
|
162 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
163 |
CleanupStack::PushL(path); |
|
164 |
path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
|
165 |
||
166 |
CMPXFilter* filter = |
|
167 |
TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(); |
|
168 |
CleanupStack::PushL(filter); |
|
169 |
||
170 |
// Create the media list |
|
171 |
MGlxMediaList* targetMediaList = MGlxMediaList::InstanceL(*path, |
|
172 |
TGlxHierarchyId(KSelectionPopupListHierarchy), filter); //todo take actual hierarchy |
|
173 |
CleanupStack::PopAndDestroy(filter); |
|
174 |
CleanupStack::PopAndDestroy(path); |
|
175 |
||
176 |
//create target model |
|
177 |
GlxModelParm modelParm(KGlxCollectionPluginAlbumsImplementationUid, |
|
178 |
KSelectionPopupListHierarchy, EGlxFilterExcludeCamera); |
|
179 |
GlxAlbumModel *albumMediaModel = new GlxAlbumModel(modelParm); |
|
180 |
albumMediaModel->setData(QModelIndex(), (int) GlxContextSelectionList, |
|
181 |
GlxContextRole); |
|
182 |
||
183 |
GlxAlbumSelectionPopup popupWidget; |
|
184 |
QModelIndexList modelList = popupWidget.GetSelectionList(albumMediaModel, &ok); |
|
185 |
if(ok && modelList.count() == 0) |
|
186 |
{ |
|
187 |
createNewMedia(); |
|
188 |
ok = false; |
|
189 |
} |
|
190 |
OstTraceExt2( TRACE_NORMAL, GLXCOMMANDHANDLERADDTOCONTAINER_CREATECOMMANDL, "GlxCommandHandlerAddToContainer::CreateCommandL;ok=%d;newMedia=%d", ok, mNewMediaAdded ); |
|
191 |
||
192 |
if (ok || mNewMediaAdded) |
|
193 |
{ |
|
194 |
int count = modelList.count(); |
|
195 |
||
196 |
for (int i = 0; i < count; i++) |
|
197 |
{ |
|
198 |
albumMediaModel->setData(modelList[i], modelList[i].row(), |
|
199 |
GlxSelectedIndexRole); |
|
200 |
} |
|
201 |
||
202 |
if (!mNewMediaAdded) |
|
203 |
{ |
|
204 |
CMPXCollectionPath* targetContainers = targetMediaList->PathLC( |
|
205 |
NGlxListDefs::EPathFocusOrSelection); |
|
206 |
CleanupStack::Pop(targetContainers); |
|
207 |
delete mTargetContainers; |
|
208 |
mTargetContainers = NULL; |
|
209 |
mTargetContainers = targetContainers; |
|
50 | 210 |
|
211 |
const TGlxMedia& item = targetMediaList->Item(targetMediaList->SelectedItemIndex(0)); |
|
212 |
const TDesC& title = item.Title(); |
|
213 |
mAlbumName = QString::fromUtf16(title.Ptr(),title.Length()); |
|
40 | 214 |
} |
215 |
||
216 |
command = TGlxCommandFactory::AddToContainerCommandLC(*sourceItems, |
|
217 |
*mTargetContainers); |
|
218 |
CleanupStack::Pop(command); |
|
219 |
mNewMediaAdded = false; |
|
220 |
} |
|
221 |
else |
|
222 |
{ |
|
223 |
MGlxMediaList::UnmarkAllL(aMediaList); |
|
224 |
} |
|
225 |
||
226 |
MGlxMediaList::UnmarkAllL(*targetMediaList); |
|
227 |
targetMediaList->Close(); |
|
228 |
CleanupStack::PopAndDestroy(sourceItems); |
|
229 |
delete albumMediaModel; |
|
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
230 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
231 |
OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATECOMMANDL_EXIT ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
232 |
return command; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
233 |
} |
40 | 234 |
|
235 |
void GlxCommandHandlerAddToContainer::createNewMedia() const |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
236 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
237 |
OstTraceFunctionEntry0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATENEWMEDIA_ENTRY ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
238 |
GlxCommandHandlerNewMedia* commandHandlerNewMedia = |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
239 |
new GlxCommandHandlerNewMedia(); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
TGlxMediaId newMediaId; |
50 | 241 |
QString newTitle; |
242 |
TInt error = commandHandlerNewMedia->ExecuteLD(newMediaId,newTitle); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
243 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
244 |
while (error == KErrAlreadyExists) |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
245 |
{ |
62 | 246 |
QString stringToDisplay = hbTrId(GLX_NAME_ALREADY_EXIST).arg(newTitle); |
247 |
HbMessageBox::warning(stringToDisplay); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
248 |
error = KErrNone; |
50 | 249 |
error = commandHandlerNewMedia->ExecuteLD(newMediaId,newTitle); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
250 |
} |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
251 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
252 |
if (error == KErrNone) |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
253 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
255 |
CleanupStack::PushL(path); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
path->AppendL(newMediaId.Value()); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
CleanupStack::Pop(path); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
delete mTargetContainers; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
mTargetContainers = NULL; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
mTargetContainers = path; |
50 | 262 |
mAlbumName = newTitle; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
mNewMediaAdded = true; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
264 |
} |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
265 |
OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATENEWMEDIA_EXIT ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
267 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
268 |
QString GlxCommandHandlerAddToContainer::CompletionTextL() const |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
269 |
{ |
62 | 270 |
if(!mAlbumName.isNull() && mIsAddtoFavCmd == false){ |
54 | 271 |
return (hbTrId(GLX_IMAGES_ADDED).arg(mAlbumName)); |
50 | 272 |
} |
273 |
return QString(); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
274 |
} |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
275 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
276 |
QString GlxCommandHandlerAddToContainer::ProgressTextL() const |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
277 |
{ |
54 | 278 |
return GLX_ADDING_IMAGES; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
279 |
} |