85 |
50 |
86 action = menu->addAction("Help"); |
51 action = menu->addAction("Help"); |
87 action->setData(EGlxCmdUnMarkAll); |
52 action->setData(EGlxCmdUnMarkAll); |
88 action->setVisible(FALSE); |
53 action->setVisible(FALSE); |
89 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
54 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
90 menu->setVisible(FALSE); |
|
91 |
55 |
92 action = menu->addAction("Exit"); |
56 action = menu->addAction("Exit"); |
93 action->setData(EGlxCmdUnMarkAll); |
57 action->setData(EGlxCmdUnMarkAll); |
94 action->setVisible(FALSE); |
58 action->setVisible(FALSE); |
95 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
59 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
96 menu->setVisible(FALSE); |
60 } |
|
61 |
|
62 void GlxMenuManager::addMenu(qint32 viewId, HbMenu* menu) |
|
63 { |
|
64 switch(viewId) { |
|
65 case GLX_GRIDVIEW_ID: |
|
66 connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateGridMenu() ) ); |
|
67 CreateGridMenu( menu ); |
|
68 break; |
|
69 |
|
70 case GLX_LISTVIEW_ID: |
|
71 CreateListMenu ( menu ); |
|
72 break; |
|
73 |
|
74 case GLX_FULLSCREENVIEW_ID: |
|
75 connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateFullscreenMenu() ) ); |
|
76 CreateFullscreenMenu( menu ); |
|
77 break; |
|
78 |
|
79 default: |
|
80 break; |
|
81 } |
|
82 } |
|
83 |
|
84 void GlxMenuManager::removeMenu(qint32 viewId, HbMenu* menu) |
|
85 { |
|
86 switch(viewId) { |
|
87 case GLX_GRIDVIEW_ID: |
|
88 disconnect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateGridMenu() ) ); |
|
89 break; |
|
90 |
|
91 case GLX_FULLSCREENVIEW_ID: |
|
92 disconnect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateFullscreenMenu() ) ); |
|
93 break; |
|
94 |
|
95 default: |
|
96 break; |
|
97 } |
97 } |
98 } |
98 |
99 |
99 void GlxMenuManager::CreateGridMenu(HbMenu* menu) |
100 void GlxMenuManager::CreateGridMenu(HbMenu* menu) |
100 { |
101 { |
101 qDebug()<<"GlxMenuManager::CreateGridMenu"; |
102 qDebug()<<"GlxMenuManager::CreateGridMenu"; |
102 HbAction *action = NULL; |
103 HbAction *action = NULL; |
|
104 |
103 action = menu->addAction("Send"); |
105 action = menu->addAction("Send"); |
104 action->setData(EGlxCmdSend); |
106 action->setData(EGlxCmdSend); |
105 // action->setVisible(EFalse); |
|
106 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
107 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
107 |
108 |
108 /*action = menu->addAction("Upload to web"); |
|
109 action->setData(EGlxCmdUpload); |
|
110 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));*/ |
|
111 action = menu->addAction("Slide Show"); |
109 action = menu->addAction("Slide Show"); |
112 action->setData(EGlxCmdFirstSlideshow); |
110 action->setData(EGlxCmdFirstSlideshow); |
113 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
111 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
112 |
114 action = menu->addAction("Add to album"); |
113 action = menu->addAction("Add to album"); |
115 action->setData(EGlxCmdAddToAlbum); |
114 action->setData(EGlxCmdAddToAlbum); |
116 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
115 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
117 /*action = menu->addAction("Sort by"); |
116 |
118 //action->setData(); |
117 action = menu->addAction("Remove From Album"); |
119 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
118 action->setData(EGlxCmdRemoveFrom); |
120 action = menu->addAction("Setting"); |
119 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
121 //action->setData(); |
120 |
122 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));*/ |
|
123 action = menu->addAction("Delete"); |
121 action = menu->addAction("Delete"); |
124 action->setData(EGlxCmdDelete); |
122 action->setData(EGlxCmdDelete); |
125 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
123 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
126 /*action = menu->addAction("Help"); |
|
127 //action->setData(); |
|
128 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
129 action = menu->addAction("Exit");*/ |
|
130 } |
124 } |
131 |
125 |
132 void GlxMenuManager::CreateListMenu(HbMenu* menu) |
126 void GlxMenuManager::CreateListMenu(HbMenu* menu) |
133 { |
127 { |
134 qDebug()<<"GlxMenuManager::CreateListMenu"; |
128 qDebug()<<"GlxMenuManager::CreateListMenu"; |
135 /*HbAction *action = menu->addAction("Setting"); |
129 HbAction *action = NULL; |
136 //action->setData(); |
130 |
137 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
131 action = menu->addAction("New album"); |
138 action = menu->addAction("Help"); |
132 action->setData(EGlxCmdAddMedia); |
139 //action->setData(); |
133 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
140 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
141 action = menu->addAction("Exit"); |
|
142 //action->setData(); |
|
143 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));*/ |
|
144 } |
134 } |
145 |
135 |
146 void GlxMenuManager::CreateFullscreenMenu(HbMenu* menu) |
136 void GlxMenuManager::CreateFullscreenMenu(HbMenu* menu) |
147 { |
137 { |
148 qDebug()<<"GlxMenuManager::CreateFullscreenMenu"; |
138 qDebug()<<"GlxMenuManager::CreateFullscreenMenu"; |
149 HbAction *action = NULL; |
139 HbAction *action = NULL; |
|
140 |
150 action = menu->addAction("Send"); |
141 action = menu->addAction("Send"); |
151 action->setData(EGlxCmdSend); |
142 action->setData(EGlxCmdSend); |
152 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
143 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
144 |
153 action = menu->addAction("Slide Show"); |
145 action = menu->addAction("Slide Show"); |
154 action->setData(EGlxCmdSelectSlideshow); |
146 action->setData(EGlxCmdSelectSlideshow); |
155 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
147 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
148 |
156 action = menu->addAction("Add to album"); |
149 action = menu->addAction("Add to album"); |
157 action->setData(EGlxCmdAddToAlbum); |
150 action->setData(EGlxCmdAddToAlbum); |
158 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
151 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
159 action = menu->addAction("Rotate"); |
152 |
|
153 action = menu->addAction("Rotate"); |
160 action->setData(EGlxCmdRotate); |
154 action->setData(EGlxCmdRotate); |
161 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
155 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
162 /*action = menu->addAction("Upload to web"); |
156 } |
163 action->setData(EGlxCmdUpload); |
157 |
164 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
158 void GlxMenuManager::setAllActionVisibility( QList<QAction*> actionList, bool visible ) |
165 action = menu->addAction("Use Image"); |
159 { |
166 //action->setData(); |
160 qDebug() << "GlxMenuManager::setAllActionVisibility count " << actionList.count() << " visible" << visible; |
167 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
161 for ( int i = 0 ; i < actionList.count(); i++) { |
168 action = menu->addAction("Print"); |
162 actionList.at(i)->setVisible(visible); |
169 //action->setData(); |
163 } |
170 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
164 } |
171 action = menu->addAction("Edit"); |
165 |
172 //action->setData(); |
166 int GlxMenuManager::viewSubState() |
173 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
167 { |
174 action = menu->addAction("Details"); |
168 QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole ); |
175 action->setData(EGlxCmdDetailsOption); |
169 if ( variant.isValid() && variant.canConvert<int> () ) { |
176 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
170 return variant.value<int>() ; |
177 action = menu->addAction("Help"); |
171 } |
178 //action->setData(); |
172 return -1; |
179 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
173 } |
180 action = menu->addAction("Exit"); |
174 |
181 //action->setData(); |
175 void GlxMenuManager::updateGridMenu() |
182 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));*/ |
176 { |
183 } |
177 qDebug() << "GlxMenuManager::updateGridMenu"; |
184 |
178 |
185 void GlxMenuManager::CreateImageViewerMenu(HbMenu* menu) |
179 HbMenu *menu = qobject_cast<HbMenu*>( sender() ); |
186 { |
180 static bool isAllActionDisable = FALSE; |
|
181 int rowCount = mModel->rowCount(); |
|
182 QList<QAction*> actionList = menu->actions(); |
|
183 |
|
184 if ( rowCount == 0 && isAllActionDisable == FALSE) { |
|
185 qDebug() << "GlxMenuManager::updateGridMenu set all visible FALSE"; |
|
186 setAllActionVisibility( actionList, FALSE ); |
|
187 isAllActionDisable = TRUE; |
|
188 } |
|
189 |
|
190 if ( rowCount && isAllActionDisable == TRUE ) { |
|
191 setAllActionVisibility( actionList, TRUE ); |
|
192 isAllActionDisable = FALSE; |
|
193 qDebug() << "GlxMenuManager::updateGridMenu set all visible TRUE" ; |
|
194 } |
|
195 |
|
196 if ( rowCount ) { |
|
197 int state = viewSubState(); |
|
198 |
|
199 switch ( state ) { |
|
200 case ALBUM_ITEM_S : |
|
201 actionList.at(GlxGridViewRemoveFromAlbum)->setVisible( TRUE ); |
|
202 break ; |
|
203 |
|
204 default : |
|
205 actionList.at(GlxGridViewRemoveFromAlbum)->setVisible( FALSE ); |
|
206 break ; |
|
207 } |
|
208 } |
|
209 } |
|
210 |
|
211 void GlxMenuManager::updateFullscreenMenu() |
|
212 { |
|
213 HbMenu *menu = qobject_cast<HbMenu*>( sender() ); |
|
214 QList<QAction*> actionList = menu->actions(); |
|
215 static bool isAllActionDisable = FALSE; |
|
216 int state = viewSubState() ; |
|
217 |
|
218 if ( state == IMAGEVIEWER_S && isAllActionDisable == FALSE ) { |
|
219 setAllActionVisibility( actionList, FALSE ); |
|
220 isAllActionDisable = TRUE; |
|
221 } |
|
222 |
|
223 if ( state != IMAGEVIEWER_S && isAllActionDisable == TRUE ) { |
|
224 setAllActionVisibility( actionList, TRUE ); |
|
225 isAllActionDisable = FALSE; |
|
226 } |
187 } |
227 } |
188 |
228 |
189 void GlxMenuManager::menuItemSelected() |
229 void GlxMenuManager::menuItemSelected() |
190 { |
230 { |
191 HbAction *action = qobject_cast<HbAction*>(sender()); |
231 HbAction *action = qobject_cast<HbAction*>(sender()); |