author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 15:52:22 +0300 | |
changeset 29 | 2c833fc9e98f |
parent 26 | c499df2dbb33 |
child 45 | 863223ea6961 |
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> |
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
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> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include <hbdialog.h> |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
39 |
#include <hbmessagebox.h> |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
40 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
41 |
#include <glxcommandhandlers.hrh> |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
42 |
#include "glxlocalisationstrings.h" |
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
43 |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
44 |
#include "OstTraceDefinitions.h" |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
45 |
#ifdef OST_TRACE_COMPILER_IN_USE |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
46 |
#include "glxcommandhandleraddtocontainerTraces.h" |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
47 |
#endif |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
48 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
TInt GlxCommandHandlerAddToContainer::iSelectionCount = 0; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
const TInt KSelectionPopupListHierarchy = 5; |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
53 |
const TInt KListPrefferedHeight = 400; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
55 |
GlxAlbumSelectionPopup::GlxAlbumSelectionPopup() |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
56 |
: mPopupDlg( 0 ), |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
57 |
mSelectionModel( 0 ), |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
58 |
mEventLoop( 0 ), |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
59 |
mResult( false ) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
60 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
61 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
62 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
63 |
GlxAlbumSelectionPopup::~GlxAlbumSelectionPopup() |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
64 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
65 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
66 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
67 |
QModelIndexList GlxAlbumSelectionPopup::GetSelectionList(GlxAlbumModel *model, bool *ok) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
68 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
69 |
// Create a popup |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
70 |
HbDialog popup; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
71 |
QEventLoop eventLoop; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
72 |
mEventLoop = &eventLoop; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
73 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
74 |
popup.setPreferredHeight( KListPrefferedHeight ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
75 |
// Set dismiss policy that determines what tap events will cause the popup |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
76 |
// to be dismissed |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
77 |
popup.setDismissPolicy(HbDialog::NoDismiss); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
78 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
79 |
// Set timeout to zero to wait user to either click Ok or Cancel |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
80 |
popup.setTimeout(HbDialog::NoTimeout); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
81 |
popup.setHeadingWidget( new HbLabel("Select Album") ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
82 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
83 |
mPopupDlg = &popup; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
84 |
HbListView *listview = new HbListView(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
85 |
listview->setSelectionMode(HbAbstractItemView::MultiSelection); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
86 |
listview->setModel(model); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
87 |
mSelectionModel = listview->selectionModel() ; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
88 |
connect( mSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection& ) ), this, SLOT( changeButtonText() ) ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
89 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
90 |
HbAction *primary = new HbAction( "New" ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
91 |
popup.addAction( primary ) ; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
92 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
93 |
HbAction *secondary = new HbAction( GLX_BUTTON_CANCEL ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
94 |
popup.addAction( secondary ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
95 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
96 |
popup.setContentWidget( listview ); //ownership transfer |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
97 |
listview->show(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
98 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
99 |
popup.open( this, SLOT( dialogClosed( HbAction* ) ) ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
100 |
eventLoop.exec( ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
101 |
mEventLoop = 0 ; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
102 |
if ( ok ) { |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
103 |
*ok = mResult ; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
104 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
105 |
QModelIndexList selectedIndexes = mSelectionModel->selectedIndexes(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
106 |
disconnect( mSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection& ) ), this, SLOT( changeButtonText() ) ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
107 |
delete primary; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
108 |
delete secondary; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
109 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
110 |
return selectedIndexes; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
111 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
112 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
113 |
void GlxAlbumSelectionPopup::changeButtonText() |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
114 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
115 |
if ( mSelectionModel->selectedIndexes().count() ) { |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
116 |
mPopupDlg->actions().first()->setText( GLX_BUTTON_OK ); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
117 |
} |
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
118 |
else { |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
119 |
mPopupDlg->actions().first()->setText("New"); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
120 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
121 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
122 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
123 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
124 |
void GlxAlbumSelectionPopup::dialogClosed(HbAction *action) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
125 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
126 |
HbDialog *dlg = static_cast<HbDialog*>(sender()); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
127 |
if( action == dlg->actions().first() ) { |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
128 |
mResult = true ; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
129 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
130 |
else { |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
131 |
mResult = false ; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
132 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
133 |
if ( mEventLoop && mEventLoop->isRunning( ) ) { |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
134 |
mEventLoop->exit( 0 ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
135 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
136 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
138 |
GlxCommandHandlerAddToContainer::GlxCommandHandlerAddToContainer() : |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
139 |
mNewMediaAdded(false) |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
140 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
141 |
OstTraceFunctionEntry0( GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_ENTRY ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
mTargetContainers = NULL; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
143 |
OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_EXIT ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
144 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
GlxCommandHandlerAddToContainer::~GlxCommandHandlerAddToContainer() |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
147 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
148 |
OstTraceFunctionEntry0( DUP1_GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_ENTRY ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
149 |
delete mTargetContainers; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
150 |
OstTraceFunctionExit0( DUP1_GLXCOMMANDHANDLERADDTOCONTAINER_GLXCOMMANDHANDLERADDTOCONTAINER_EXIT ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
151 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
153 |
CMPXCommand* GlxCommandHandlerAddToContainer::CreateCommandL(TInt aCommandId, |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
154 |
MGlxMediaList& aMediaList, TBool& /*aConsume*/) const |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
155 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
156 |
OstTraceFunctionEntry0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATECOMMANDL_ENTRY ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
iSelectionCount = 0; |
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
158 |
CMPXCommand* command = NULL; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
159 |
|
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
160 |
if(aCommandId == EGlxCmdAddToFav) |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
161 |
{ |
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
162 |
CMPXCollectionPath* targetCollection = CMPXCollectionPath::NewL(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
163 |
CleanupStack::PushL(targetCollection); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
164 |
// The target collection has to be appeneded with the albums plugin id |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
165 |
targetCollection->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
166 |
// The target collection has also to be appeneded with the the relation id. |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
167 |
// appending another level into the albums to get favourites and 1 is the relation id of albums |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
168 |
targetCollection->AppendL( TMPXItemId(KGlxCollectionFavoritesId) ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
169 |
targetCollection->Set( 0 ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
170 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
171 |
CMPXCollectionPath* sourceItems = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
172 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
173 |
command = TGlxCommandFactory::AddToContainerCommandLC( |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
174 |
*sourceItems, *targetCollection); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
175 |
CleanupStack::Pop(command); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
176 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
177 |
CleanupStack::PopAndDestroy(sourceItems); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
178 |
CleanupStack::PopAndDestroy(targetCollection); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
} |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
180 |
else |
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
181 |
{ |
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
182 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
183 |
CMPXCollectionPath* sourceItems = aMediaList.PathLC( |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
184 |
NGlxListDefs::EPathFocusOrSelection); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
185 |
bool ok = false; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
186 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
187 |
//create target medialist |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
188 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
189 |
CleanupStack::PushL(path); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
190 |
path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
191 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
192 |
CMPXFilter* filter = |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
193 |
TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
194 |
CleanupStack::PushL(filter); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
195 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
196 |
// Create the media list |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
197 |
MGlxMediaList* targetMediaList = MGlxMediaList::InstanceL(*path, |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
198 |
TGlxHierarchyId(KSelectionPopupListHierarchy), filter); //todo take actual hierarchy |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
199 |
CleanupStack::PopAndDestroy(filter); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
200 |
CleanupStack::PopAndDestroy(path); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
201 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
202 |
//create target model |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
203 |
GlxModelParm modelParm(KGlxCollectionPluginAlbumsImplementationUid, |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
204 |
KSelectionPopupListHierarchy, EGlxFilterExcludeCamera); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
205 |
GlxAlbumModel *albumMediaModel = new GlxAlbumModel(modelParm); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
206 |
albumMediaModel->setData(QModelIndex(), (int) GlxContextSelectionList, |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
207 |
GlxContextRole); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
208 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
209 |
GlxAlbumSelectionPopup popupWidget; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
210 |
QModelIndexList modelList = popupWidget.GetSelectionList(albumMediaModel, &ok); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
211 |
if(ok && modelList.count() == 0) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
212 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
213 |
createNewMedia(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
214 |
ok = false; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
215 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
216 |
OstTraceExt2( TRACE_NORMAL, GLXCOMMANDHANDLERADDTOCONTAINER_CREATECOMMANDL, "GlxCommandHandlerAddToContainer::CreateCommandL;ok=%d;newMedia=%d", ok, mNewMediaAdded ); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
217 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
218 |
if (ok || mNewMediaAdded) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
219 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
220 |
int count = modelList.count(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
221 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
222 |
for (int i = 0; i < count; i++) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
223 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
224 |
albumMediaModel->setData(modelList[i], modelList[i].row(), |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
225 |
GlxSelectedIndexRole); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
226 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
227 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
228 |
if (!mNewMediaAdded) |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
229 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
230 |
CMPXCollectionPath* targetContainers = targetMediaList->PathLC( |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
231 |
NGlxListDefs::EPathFocusOrSelection); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
232 |
CleanupStack::Pop(targetContainers); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
233 |
delete mTargetContainers; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
234 |
mTargetContainers = NULL; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
235 |
mTargetContainers = targetContainers; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
236 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
237 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
238 |
command = TGlxCommandFactory::AddToContainerCommandLC(*sourceItems, |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
239 |
*mTargetContainers); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
240 |
CleanupStack::Pop(command); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
241 |
mNewMediaAdded = false; |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
242 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
243 |
else |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
244 |
{ |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
245 |
MGlxMediaList::UnmarkAllL(aMediaList); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
246 |
} |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
247 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
248 |
MGlxMediaList::UnmarkAllL(*targetMediaList); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
249 |
targetMediaList->Close(); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
250 |
CleanupStack::PopAndDestroy(sourceItems); |
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
251 |
delete albumMediaModel; |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
252 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
253 |
OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATECOMMANDL_EXIT ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
return command; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
255 |
} |
29
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
256 |
|
2c833fc9e98f
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
257 |
void GlxCommandHandlerAddToContainer::createNewMedia() const |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
258 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
259 |
OstTraceFunctionEntry0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATENEWMEDIA_ENTRY ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
260 |
GlxCommandHandlerNewMedia* commandHandlerNewMedia = |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
261 |
new GlxCommandHandlerNewMedia(); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
TGlxMediaId newMediaId; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
263 |
TInt error = commandHandlerNewMedia->ExecuteLD(newMediaId); |
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 |
while (error == KErrAlreadyExists) |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
266 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
267 |
HbMessageBox::warning("Name Already Exist!!!", new HbLabel( |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
268 |
"New Album")); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
269 |
error = KErrNone; |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
270 |
error = commandHandlerNewMedia->ExecuteLD(newMediaId); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
271 |
} |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
272 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
273 |
if (error == KErrNone) |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
274 |
{ |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
276 |
CleanupStack::PushL(path); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
path->AppendL(newMediaId.Value()); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
CleanupStack::Pop(path); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
delete mTargetContainers; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
mTargetContainers = NULL; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
mTargetContainers = path; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
mNewMediaAdded = true; |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
284 |
} |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
285 |
OstTraceFunctionExit0( GLXCOMMANDHANDLERADDTOCONTAINER_CREATENEWMEDIA_EXIT ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
287 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
288 |
QString GlxCommandHandlerAddToContainer::CompletionTextL() const |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
289 |
{ |
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
290 |
return QString(); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
291 |
} |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
292 |
|
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
293 |
QString GlxCommandHandlerAddToContainer::ProgressTextL() const |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
294 |
{ |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
295 |
return QString("Adding album..."); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
296 |
} |