72
|
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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "cntabstractviewfactory.h"
|
|
19 |
#include "cntdetaileditor.h"
|
|
20 |
#include "cntmainwindow.h"
|
|
21 |
#include <cntviewparams.h>
|
|
22 |
#include <cntviewsupplier.h>
|
|
23 |
#include <cntuiextensionfactory.h>
|
|
24 |
#include <hbstyleloader.h>
|
|
25 |
// views
|
|
26 |
#include "cntnamesview.h"
|
|
27 |
#include "cntmycardview.h"
|
|
28 |
#include "cntfavoritesview.h"
|
|
29 |
#include "cntimageeditorview.h"
|
|
30 |
#include "cntcollectionview.h"
|
|
31 |
#include "cntgroupmemberview.h"
|
|
32 |
#include "cntfavoritesmemberview.h"
|
|
33 |
#include "cntcontactcardview.h"
|
|
34 |
#include "cntgroupactionsview.h"
|
|
35 |
#include "cnthistoryview.h"
|
|
36 |
#include "cnteditview.h"
|
|
37 |
#include "cntimportsview.h"
|
|
38 |
#include "cntsettingsview.h"
|
|
39 |
#include "cntextensionmanager.h"
|
|
40 |
|
81
|
41 |
const char *styleFiles = \
|
|
42 |
":/style/cntcollectionviewlistitem.css" \
|
|
43 |
":/style/cntcommondetailviewitem.css" \
|
|
44 |
":/style/cntcommondetailviewitem.widgetml" \
|
|
45 |
":/style/cntcontactcarddetailitem.css" \
|
|
46 |
":/style/cntcontactcarddetailitem.widgetml" \
|
|
47 |
":/style/cntcontactcarddetailitem_color.css" \
|
|
48 |
":/style/cntcontactcardheadingitem.css" \
|
|
49 |
":/style/cntcontactcardheadingitem.widgetml" \
|
|
50 |
":/style/cntcontactcardheadingitem_color.css" \
|
|
51 |
":/style/cnteditviewheadingitem.css" \
|
|
52 |
":/style/cnteditviewheadingitem.widgetml" \
|
|
53 |
":/style/cnteditviewheadingitem_color.css" \
|
|
54 |
":/style/cnteditviewlistitem.css" \
|
|
55 |
":/style/cnteditviewlistitem.hblistviewitem.widgetml" \
|
|
56 |
":/style/cntfetchmarkall.css" \
|
|
57 |
":/style/cntfetchmarkall.widgetml" \
|
|
58 |
":/style/cntfetchmarkall_color.css" \
|
|
59 |
":/style/cntgroupmemberviewlistitem.css" \
|
|
60 |
":/style/cnthistoryviewitemwidget.css" \
|
|
61 |
":/style/cnthistoryviewitemwidget.widgetml" \
|
|
62 |
":/style/cnthistoryviewitemwidget_color.css" \
|
|
63 |
":/style/cntimagelabel.css" \
|
|
64 |
":/style/cntimagelabel.widgetml" \
|
|
65 |
":/style/cntlocationbutton.css" \
|
|
66 |
":/style/cntlocationbutton.hbpushbutton.widgetml" \
|
|
67 |
":/style/cntselectiondialogmarkwidget_color.css";
|
|
68 |
|
72
|
69 |
CntDefaultViewFactory::CntDefaultViewFactory( CntExtensionManager& aExt ):
|
|
70 |
mExtensionManager( aExt )
|
|
71 |
{
|
81
|
72 |
QString files(styleFiles);
|
|
73 |
int lastPos = 0;
|
|
74 |
while (lastPos < files.length()) {
|
|
75 |
int pos = files.indexOf(":/style/", lastPos + 1);
|
|
76 |
if (pos == -1) {
|
|
77 |
pos = files.length();
|
|
78 |
}
|
|
79 |
HbStyleLoader::registerFilePath(files.mid(lastPos, pos - lastPos));
|
|
80 |
lastPos = pos;
|
|
81 |
}
|
72
|
82 |
}
|
|
83 |
|
|
84 |
CntDefaultViewFactory::~CntDefaultViewFactory()
|
|
85 |
{
|
|
86 |
|
|
87 |
}
|
|
88 |
|
|
89 |
CntAbstractView* CntDefaultViewFactory::createView( int aId )
|
|
90 |
{
|
|
91 |
switch ( aId )
|
|
92 |
{
|
|
93 |
case namesView:
|
|
94 |
return new CntNamesView();
|
|
95 |
case contactCardView:
|
|
96 |
return new CntContactCardView();
|
|
97 |
case myCardView:
|
|
98 |
return new CntMyCardView();
|
|
99 |
case collectionView:
|
|
100 |
return new CntCollectionView();
|
|
101 |
case collectionFavoritesView:
|
|
102 |
return new CntFavoritesView();
|
|
103 |
case favoritesMemberView:
|
|
104 |
return new CntFavoritesMemberView();
|
|
105 |
case editView:
|
|
106 |
return new CntEditView();
|
|
107 |
case onlineAccountEditorView:
|
|
108 |
break;
|
|
109 |
|
|
110 |
case emailEditorView:
|
|
111 |
case namesEditorView:
|
|
112 |
case urlEditorView:
|
|
113 |
case companyEditorView:
|
|
114 |
case phoneNumberEditorView:
|
|
115 |
case noteEditorView:
|
|
116 |
case familyDetailEditorView:
|
|
117 |
case addressEditorView:
|
|
118 |
case dateEditorView:
|
|
119 |
case groupEditorView:
|
|
120 |
return new CntDetailEditor(aId);
|
|
121 |
|
|
122 |
case imageEditorView:
|
|
123 |
return new CntImageEditorView();
|
|
124 |
case groupMemberView:
|
|
125 |
return new CntGroupMemberView();
|
|
126 |
case groupActionsView:
|
|
127 |
return new CntGroupActionsView();
|
|
128 |
case historyView:
|
|
129 |
return new CntHistoryView();
|
|
130 |
case importsView:
|
|
131 |
return new CntImportsView();
|
|
132 |
case settingsView:
|
|
133 |
return new CntSettingsView();
|
|
134 |
default:
|
|
135 |
return createPluginView(aId);
|
|
136 |
}
|
|
137 |
return NULL;
|
|
138 |
}
|
|
139 |
|
|
140 |
CntAbstractView* CntDefaultViewFactory::createPluginView( int aId )
|
|
141 |
{
|
|
142 |
for(int i = 0;i < mExtensionManager.pluginCount();i++)
|
|
143 |
{
|
|
144 |
CntViewSupplier* viewSupplier = mExtensionManager.pluginAt(i)->viewSupplier();
|
|
145 |
if (viewSupplier)
|
|
146 |
{
|
|
147 |
for(int j = 0;j < viewSupplier->viewCount();j++)
|
|
148 |
{
|
|
149 |
if (viewSupplier->viewIdAt(j) == aId)
|
|
150 |
{
|
|
151 |
return viewSupplier->viewAt(j);
|
|
152 |
}
|
|
153 |
}
|
|
154 |
}
|
|
155 |
}
|
|
156 |
return NULL;
|
|
157 |
}
|
|
158 |
|
|
159 |
// End of File
|