38 void GlxMenuManager::createMarkingModeMenu(HbMenu* menu) |
43 void GlxMenuManager::createMarkingModeMenu(HbMenu* menu) |
39 { |
44 { |
40 qDebug()<< "GlxMenuManager::CreateMarkingModeMenu" ; |
45 qDebug()<< "GlxMenuManager::CreateMarkingModeMenu" ; |
41 HbAction *action = NULL; |
46 HbAction *action = NULL; |
42 |
47 |
43 action = menu->addAction("Mark All"); |
48 action = menu->addAction(GLX_OPTION_MARK_ALL); |
44 action->setData(EGlxCmdMarkAll); |
49 action->setData(EGlxCmdMarkAll); |
45 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
50 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
46 |
51 |
47 action = menu->addAction("UnMark All"); |
52 action = menu->addAction(GLX_OPTION_UN_MARK_ALL); |
|
53 action->setDisabled(true); //Dim UnMarkAll when no images are marked |
48 action->setData(EGlxCmdUnMarkAll); |
54 action->setData(EGlxCmdUnMarkAll); |
49 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
55 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
50 |
56 } |
51 action = menu->addAction("Help"); |
57 |
52 action->setData(EGlxCmdUnMarkAll); |
58 void GlxMenuManager::disableAction(HbMenu* menu, bool disable) |
53 action->setVisible(FALSE); |
59 { |
54 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
60 QList<QAction*> actionList = menu->actions(); |
55 |
61 for ( int i = 0 ; i < actionList.count(); i++) { |
56 action = menu->addAction("Exit"); |
62 if(actionList.at(i)->data()==EGlxCmdUnMarkAll) { |
57 action->setData(EGlxCmdUnMarkAll); |
63 actionList.at(i)->setDisabled(disable); |
58 action->setVisible(FALSE); |
64 break; |
59 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
65 } |
60 } |
66 } |
61 |
67 } |
62 void GlxMenuManager::addMenu(qint32 viewId, HbMenu* menu) |
68 void GlxMenuManager::addMenu(qint32 viewId, HbMenu* menu) |
63 { |
69 { |
64 switch(viewId) { |
70 switch(viewId) { |
65 case GLX_GRIDVIEW_ID: |
71 case GLX_GRIDVIEW_ID: |
66 connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateGridMenu() ) ); |
72 connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateGridMenu() ) ); |
100 void GlxMenuManager::CreateGridMenu(HbMenu* menu) |
106 void GlxMenuManager::CreateGridMenu(HbMenu* menu) |
101 { |
107 { |
102 qDebug()<<"GlxMenuManager::CreateGridMenu"; |
108 qDebug()<<"GlxMenuManager::CreateGridMenu"; |
103 HbAction *action = NULL; |
109 HbAction *action = NULL; |
104 |
110 |
105 action = menu->addAction("Send"); |
111 action = menu->addAction(GLX_OPTION_SHARE); |
106 action->setData(EGlxCmdSend); |
112 action->setData(EGlxCmdSend); |
107 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
113 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
108 |
114 |
109 action = menu->addAction("Slide Show"); |
115 mSubMenu = menu->addMenu(GLX_OPTION_SLIDESHOW); |
|
116 action = mSubMenu->addAction(GLX_OPTION_SS_PLAY); |
110 action->setData(EGlxCmdFirstSlideshow); |
117 action->setData(EGlxCmdFirstSlideshow); |
111 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
118 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
112 |
119 |
113 action = menu->addAction("Add to album"); |
120 action = mSubMenu->addAction(GLX_OPTION_SS_SETTINGS); |
|
121 action->setData(EGlxCmdSlideshowSettings); |
|
122 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
123 action = menu->addAction(GLX_OPTION_ADD_TO_ALBUM); |
114 action->setData(EGlxCmdAddToAlbum); |
124 action->setData(EGlxCmdAddToAlbum); |
115 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
125 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
116 |
126 |
117 action = menu->addAction("Remove From Album"); |
127 action = menu->addAction(GLX_OPTION_REMOVE_FROM_ALBUM); |
118 action->setData(EGlxCmdRemoveFrom); |
128 action->setData(EGlxCmdRemoveFrom); |
119 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
129 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
120 |
130 |
121 action = menu->addAction("Delete"); |
131 action = menu->addAction(GLX_OPTION_DELETE); |
122 action->setData(EGlxCmdDelete); |
132 action->setData(EGlxCmdDelete); |
123 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
133 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
124 } |
134 } |
125 |
135 |
126 void GlxMenuManager::CreateListMenu(HbMenu* menu) |
136 void GlxMenuManager::CreateListMenu(HbMenu* menu) |
127 { |
137 { |
128 qDebug()<<"GlxMenuManager::CreateListMenu"; |
138 qDebug()<<"GlxMenuManager::CreateListMenu"; |
129 HbAction *action = NULL; |
139 HbAction *action = NULL; |
130 |
140 |
131 action = menu->addAction("New album"); |
141 action = menu->addAction(GLX_OPTION_NEW_ALBUM); |
132 action->setData(EGlxCmdAddMedia); |
142 action->setData(EGlxCmdAddMedia); |
133 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
143 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
134 } |
144 } |
135 |
145 |
136 void GlxMenuManager::CreateFullscreenMenu(HbMenu* menu) |
146 void GlxMenuManager::CreateFullscreenMenu(HbMenu* menu) |
137 { |
147 { |
138 qDebug()<<"GlxMenuManager::CreateFullscreenMenu"; |
148 qDebug()<<"GlxMenuManager::CreateFullscreenMenu"; |
139 HbAction *action = NULL; |
149 HbAction *action = NULL; |
140 |
150 |
141 action = menu->addAction("Send"); |
151 action = menu->addAction(GLX_OPTION_SHARE); |
142 action->setData(EGlxCmdSend); |
152 action->setData(EGlxCmdSend); |
143 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
153 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
144 |
154 |
145 action = menu->addAction("Slide Show"); |
155 mSubMenu = menu->addMenu(GLX_OPTION_SLIDESHOW); |
|
156 action = mSubMenu->addAction(GLX_OPTION_SS_PLAY); |
146 action->setData(EGlxCmdSelectSlideshow); |
157 action->setData(EGlxCmdSelectSlideshow); |
147 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
158 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
148 |
159 action = mSubMenu->addAction(GLX_OPTION_SS_SETTINGS); |
149 action = menu->addAction("Add to album"); |
160 action->setData(EGlxCmdSlideshowSettings); |
|
161 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
162 |
|
163 action = menu->addAction(GLX_OPTION_ADD_TO_ALBUM); |
150 action->setData(EGlxCmdAddToAlbum); |
164 action->setData(EGlxCmdAddToAlbum); |
151 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
165 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
152 |
166 |
153 action = menu->addAction("Rotate"); |
167 action = menu->addAction("Rotate"); |
154 action->setData(EGlxCmdRotate); |
168 action->setData(EGlxCmdRotate); |
235 } |
249 } |
236 |
250 |
237 void GlxMenuManager::ShowItemSpecificMenu(qint32 viewId,QPointF pos) |
251 void GlxMenuManager::ShowItemSpecificMenu(qint32 viewId,QPointF pos) |
238 { |
252 { |
239 qDebug("GlxMenuManager::showContextMenu " ); |
253 qDebug("GlxMenuManager::showContextMenu " ); |
240 HbMenu *mainMenu = new HbMenu(); |
254 mContextMenu = new HbMenu(); |
241 HbAction *action = NULL; |
255 HbAction *action = NULL; |
242 switch ( viewId ) { |
256 |
|
257 switch ( viewId ) { |
243 case GLX_GRIDVIEW_ID : |
258 case GLX_GRIDVIEW_ID : |
244 action = mainMenu->addAction("Send"); |
259 action = mContextMenu->addAction(GLX_MENU_SHARE); |
245 action->setData(EGlxCmdContextSend); |
260 action->setData(EGlxCmdContextSend); |
246 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
261 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
247 |
262 |
248 action = mainMenu->addAction("Slide Show"); |
263 action = mContextMenu->addAction(GLX_MENU_SLIDESHOW); |
249 action->setData(EGlxCmdSelectSlideshow); |
264 action->setData(EGlxCmdSelectSlideshow); |
250 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
265 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
251 |
266 |
252 action = mainMenu->addAction("Add to album"); |
267 action = mContextMenu->addAction(GLX_MENU_ADD_TO_ALBUM); |
253 action->setData(EGlxCmdContextAddToAlbum); |
268 action->setData(EGlxCmdContextAddToAlbum); |
254 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
269 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
255 |
270 |
256 action = mainMenu->addAction("Delete"); |
271 action = mContextMenu->addAction(GLX_MENU_DELETE); |
257 action->setData(EGlxCmdContextDelete); |
272 action->setData(EGlxCmdContextDelete); |
258 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
273 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
259 break; |
274 break; |
260 |
275 |
261 case GLX_LISTVIEW_ID : |
276 case GLX_LISTVIEW_ID : |
262 action = mainMenu->addAction("Slide Show"); |
277 action = mContextMenu->addAction(GLX_MENU_SLIDESHOW); |
263 action->setData(EGlxCmdAlbumSlideShow); |
278 action->setData(EGlxCmdAlbumSlideShow); |
264 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
279 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
|
280 |
|
281 action = mContextMenu->addAction(GLX_MENU_RENAME); |
|
282 action->setData(EGlxCmdContextRename); |
|
283 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
265 |
284 |
266 action = mainMenu->addAction("Delete"); |
285 action = mContextMenu->addAction(GLX_MENU_DELETE); |
267 action->setData(EGlxCmdContextAlbumDelete); |
286 action->setData(EGlxCmdContextAlbumDelete); |
268 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
287 connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); |
269 break; |
288 break; |
|
289 |
270 default: |
290 default: |
271 break; |
291 break; |
272 } |
292 } |
273 |
293 |
274 connect(mMainWindow, SIGNAL(aboutToChangeOrientation ()), mainMenu, SLOT(close())); |
294 connect( mMainWindow, SIGNAL( aboutToChangeOrientation () ), mContextMenu, SLOT( close() ) ); |
275 mainMenu->exec(pos); |
295 connect( mContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) ); |
276 disconnect(mMainWindow, SIGNAL(aboutToChangeOrientation ()), mainMenu, SLOT(close())); |
296 mContextMenu->setPreferredPos( pos ); |
277 delete mainMenu; |
297 mContextMenu->show(); |
278 |
298 |
279 } |
299 } |
|
300 |
|
301 void GlxMenuManager::closeContextMenu() |
|
302 { |
|
303 disconnect( mMainWindow, SIGNAL( aboutToChangeOrientation () ), mContextMenu, SLOT( close() ) ); |
|
304 disconnect( mContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) ); |
|
305 mContextMenu->deleteLater(); |
|
306 mContextMenu = NULL; |
|
307 } |
|
308 |