ui/viewmanagement/viewmanager/src/glxmenumanager.cpp
author hgs
Sat, 10 Jul 2010 00:59:39 +0530
changeset 50 a0f57508af73
parent 45 863223ea6961
child 54 0f0f3f26f787
permissions -rw-r--r--
201027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
*/
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    17
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    18
//include
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <QDebug>
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <hbaction.h>
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    21
#include <hbmenu.h>
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    22
#include <hbmainwindow.h>
45
hgs
parents: 40
diff changeset
    23
#include <featdiscovery.h>
hgs
parents: 40
diff changeset
    24
#include <publicruntimeids.hrh>
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    25
//user include
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    26
#include "glxviewids.h"
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    27
#include "glxmenumanager.h"
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    28
#include "glxcommandhandlers.hrh"
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    29
#include "glxmodelparm.h"
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    30
#include "glxlocalisationstrings.h"
50
hgs
parents: 45
diff changeset
    31
#include "glxsettinginterface.h"
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    32
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    33
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    34
GlxMenuManager::GlxMenuManager(HbMainWindow* mainWindow)
40
hgs
parents: 26
diff changeset
    35
    : mModel( 0),
hgs
parents: 26
diff changeset
    36
      mMainWindow( mainWindow ),
hgs
parents: 26
diff changeset
    37
      mContextMenu( 0 )
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
{
50
hgs
parents: 45
diff changeset
    39
    mSettings = GlxSettingInterface::instance();
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
}
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    41
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    42
GlxMenuManager::~GlxMenuManager()
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
void GlxMenuManager::createMarkingModeMenu(HbMenu* menu)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
    qDebug()<< "GlxMenuManager::CreateMarkingModeMenu" ;  
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    HbAction *action = NULL;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    51
    action = menu->addAction(GLX_OPTION_MARK_ALL);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
    action->setData(EGlxCmdMarkAll);
45
hgs
parents: 40
diff changeset
    53
    action->setObjectName( "Menu MarkAll" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    56
    action = menu->addAction(GLX_OPTION_UN_MARK_ALL);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    57
    action->setDisabled(true);  //Dim UnMarkAll when no images are marked
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
    action->setData(EGlxCmdUnMarkAll);
45
hgs
parents: 40
diff changeset
    59
    action->setObjectName( "Menu UnMarkAll" );
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    60
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));    
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    61
}
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    62
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    63
void GlxMenuManager::disableAction(HbMenu* menu, bool disable)
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    64
{
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    65
    QList<QAction*> actionList = menu->actions();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    66
    for ( int i = 0 ; i < actionList.count(); i++) {
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    67
        if(actionList.at(i)->data()==EGlxCmdUnMarkAll) {
45
hgs
parents: 40
diff changeset
    68
            actionList.at(i)->setDisabled(disable);
hgs
parents: 40
diff changeset
    69
            break;
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    70
        }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    71
     }
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
    72
}
45
hgs
parents: 40
diff changeset
    73
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    74
void GlxMenuManager::addMenu(qint32 viewId, HbMenu* menu)
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    75
{
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    76
    switch(viewId) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    77
    case GLX_GRIDVIEW_ID:
50
hgs
parents: 45
diff changeset
    78
        CreateGridMenu( menu );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    79
        connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateGridMenu() ) );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    80
        break;                            
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    81
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    82
    case GLX_LISTVIEW_ID: 
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    83
        CreateListMenu ( menu );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    84
        break;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    85
        
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    86
    case GLX_FULLSCREENVIEW_ID:
50
hgs
parents: 45
diff changeset
    87
        CreateFullscreenMenu( menu );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    88
        connect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateFullscreenMenu() ) );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    89
        break;
50
hgs
parents: 45
diff changeset
    90
        
hgs
parents: 45
diff changeset
    91
    case GLX_SLIDESHOWVIEW_ID :
hgs
parents: 45
diff changeset
    92
        createSlideShowMenu( menu );
hgs
parents: 45
diff changeset
    93
        break ;
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    94
                
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    95
    default:
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    96
        break;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    97
    }  
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    98
}
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
    99
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   100
void GlxMenuManager::removeMenu(qint32 viewId, HbMenu* menu)
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   101
{
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   102
    switch(viewId) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   103
    case GLX_GRIDVIEW_ID:
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   104
        disconnect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateGridMenu() ) );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   105
        break;                            
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   106
        
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   107
    case GLX_FULLSCREENVIEW_ID:
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   108
        disconnect( menu, SIGNAL( aboutToShow() ), this, SLOT( updateFullscreenMenu() ) );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   109
        break;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   110
                
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   111
    default:
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   112
        break;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   113
    }  
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
void GlxMenuManager::CreateGridMenu(HbMenu* menu)
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
    qDebug()<<"GlxMenuManager::CreateGridMenu";
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    HbAction *action = NULL;
45
hgs
parents: 40
diff changeset
   120
    menu->setObjectName( "GridMenu" );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   121
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   122
    action = menu->addAction(GLX_OPTION_SHARE);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    action->setData(EGlxCmdSend);
45
hgs
parents: 40
diff changeset
   124
    action->setObjectName( "GridMenu Send" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
   
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   127
    mSubMenu = menu->addMenu(GLX_OPTION_SLIDESHOW);
45
hgs
parents: 40
diff changeset
   128
    mSubMenu->setObjectName( "GridMenu SlideShow" );
hgs
parents: 40
diff changeset
   129
	
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   130
    action = mSubMenu->addAction(GLX_OPTION_SS_PLAY); 
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
    action->setData(EGlxCmdFirstSlideshow);
45
hgs
parents: 40
diff changeset
   132
    action->setObjectName( "GridMenu Play" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   134
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   135
    action = mSubMenu->addAction(GLX_OPTION_SS_SETTINGS);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   136
    action->setData(EGlxCmdSlideshowSettings);
45
hgs
parents: 40
diff changeset
   137
    action->setObjectName( "GridMenu Setting" );
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   138
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); 
45
hgs
parents: 40
diff changeset
   139
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   140
    action = menu->addAction(GLX_OPTION_ADD_TO_ALBUM);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
    action->setData(EGlxCmdAddToAlbum);
45
hgs
parents: 40
diff changeset
   142
    action->setObjectName( "GridMenu AddToAlbum" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   144
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   145
    action = menu->addAction(GLX_OPTION_REMOVE_FROM_ALBUM);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   146
    action->setData(EGlxCmdRemoveFrom);
45
hgs
parents: 40
diff changeset
   147
    action->setObjectName( "GridMenu RemoveAlbum" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   149
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   150
    action = menu->addAction(GLX_OPTION_DELETE);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    action->setData(EGlxCmdDelete);
45
hgs
parents: 40
diff changeset
   152
    action->setObjectName( "GridMenu Delete" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
50
hgs
parents: 45
diff changeset
   154
    
hgs
parents: 45
diff changeset
   155
    m3DEffectSubMenu = menu->addMenu("3D Effect");
hgs
parents: 45
diff changeset
   156
    m3DEffectSubMenu->setObjectName( "GridMenu 3DEffect" );
hgs
parents: 45
diff changeset
   157
    
hgs
parents: 45
diff changeset
   158
    action = m3DEffectSubMenu->addAction("On"); 
hgs
parents: 45
diff changeset
   159
    action->setCheckable(ETrue);
hgs
parents: 45
diff changeset
   160
    action->setData(EGlxCmd3DEffectOn);
hgs
parents: 45
diff changeset
   161
    action->setObjectName( "GridMenu 3DOn" );
hgs
parents: 45
diff changeset
   162
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
hgs
parents: 45
diff changeset
   163
    
hgs
parents: 45
diff changeset
   164
    action = m3DEffectSubMenu->addAction("Off");
hgs
parents: 45
diff changeset
   165
    action->setCheckable(ETrue);
hgs
parents: 45
diff changeset
   166
    action->setData(EGlxCmd3DEffectOff);
hgs
parents: 45
diff changeset
   167
    action->setObjectName( "GridMenu 3DOff" );
hgs
parents: 45
diff changeset
   168
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); 
hgs
parents: 45
diff changeset
   169
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
void GlxMenuManager::CreateListMenu(HbMenu* menu)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    qDebug()<<"GlxMenuManager::CreateListMenu";
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   175
    HbAction *action = NULL;
45
hgs
parents: 40
diff changeset
   176
    menu->setObjectName( "Listmenu" );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   177
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   178
    action = menu->addAction(GLX_OPTION_NEW_ALBUM);
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   179
    action->setData(EGlxCmdAddMedia);
45
hgs
parents: 40
diff changeset
   180
    action->setObjectName( "ListMenu NewAlbum" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
void GlxMenuManager::CreateFullscreenMenu(HbMenu* menu)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
    qDebug()<<"GlxMenuManager::CreateFullscreenMenu";
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
    HbAction *action = NULL;
45
hgs
parents: 40
diff changeset
   188
    menu->setObjectName( "FSMenu" );
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   189
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   190
    action = menu->addAction(GLX_OPTION_SHARE);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
    action->setData(EGlxCmdSend);
45
hgs
parents: 40
diff changeset
   192
    action->setObjectName( "FSMenu Share" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   194
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   195
    mSubMenu = menu->addMenu(GLX_OPTION_SLIDESHOW);
45
hgs
parents: 40
diff changeset
   196
    mSubMenu->setObjectName( "FSMenu SlideShow" );
hgs
parents: 40
diff changeset
   197
    
hgs
parents: 40
diff changeset
   198
    action = mSubMenu->addAction(GLX_OPTION_SS_PLAY);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
    action->setData(EGlxCmdSelectSlideshow);
45
hgs
parents: 40
diff changeset
   200
    action->setObjectName( "FSMenu Play" );
hgs
parents: 40
diff changeset
   201
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
hgs
parents: 40
diff changeset
   202
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   203
    action = mSubMenu->addAction(GLX_OPTION_SS_SETTINGS);
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   204
    action->setData(EGlxCmdSlideshowSettings);
45
hgs
parents: 40
diff changeset
   205
    action->setObjectName( "FSMenu Setting" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
45
hgs
parents: 40
diff changeset
   207
#ifndef __WINSCW__
hgs
parents: 40
diff changeset
   208
	CFeatureDiscovery* featManager = CFeatureDiscovery::NewL();
hgs
parents: 40
diff changeset
   209
    if(featManager->IsFeatureSupportedL(KFeatureIdFfImageEditor))
hgs
parents: 40
diff changeset
   210
        {
50
hgs
parents: 45
diff changeset
   211
        mSubMenu = menu->addMenu(GLX_MENU_USE_IMAGE);
hgs
parents: 45
diff changeset
   212
        action = mSubMenu->addAction(GLX_MENU_SET_WALLPAPER); 
hgs
parents: 45
diff changeset
   213
        action->setData(EGlxCmdSetWallpaper);
hgs
parents: 45
diff changeset
   214
        connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); 
hgs
parents: 45
diff changeset
   215
        
hgs
parents: 45
diff changeset
   216
            
hgs
parents: 45
diff changeset
   217
		mSubMenu = menu->addMenu(GLX_MENU_ROTATE);
hgs
parents: 45
diff changeset
   218
		action = mSubMenu->addAction(GLX_MENU_90_CW); 
45
hgs
parents: 40
diff changeset
   219
		action->setData(EGlxCmdRotateImgCW);
hgs
parents: 40
diff changeset
   220
		connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected())); 
50
hgs
parents: 45
diff changeset
   221
		action = mSubMenu->addAction(GLX_MENU_90_CCW);
45
hgs
parents: 40
diff changeset
   222
		action->setData(EGlxCmdRotateImgCCW);
hgs
parents: 40
diff changeset
   223
		connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
hgs
parents: 40
diff changeset
   224
		
50
hgs
parents: 45
diff changeset
   225
		action = menu->addAction(GLX_MENU_CROP);
45
hgs
parents: 40
diff changeset
   226
		action->setData(EGlxCmdRotateImgCrop);
hgs
parents: 40
diff changeset
   227
		connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));   
hgs
parents: 40
diff changeset
   228
        }
hgs
parents: 40
diff changeset
   229
    delete featManager;
hgs
parents: 40
diff changeset
   230
#endif //__WINSCW__	
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   231
    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   232
    action = menu->addAction(GLX_OPTION_ADD_TO_ALBUM);
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
    action->setData(EGlxCmdAddToAlbum);
45
hgs
parents: 40
diff changeset
   234
    action->setObjectName( "FSMenu AddToAlbum" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
    connect(action, SIGNAL(triggered()), this, SLOT(menuItemSelected()));
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
50
hgs
parents: 45
diff changeset
   238
void GlxMenuManager::createSlideShowMenu( HbMenu* menu )
hgs
parents: 45
diff changeset
   239
{
hgs
parents: 45
diff changeset
   240
    HbAction *action = NULL;
hgs
parents: 45
diff changeset
   241
    menu->setObjectName( "SSMenu" );
hgs
parents: 45
diff changeset
   242
    
hgs
parents: 45
diff changeset
   243
    action = menu->addAction( GLX_OPTION_SS_SETTINGS );
hgs
parents: 45
diff changeset
   244
    action->setData( EGlxCmdSlideshowSettings );
hgs
parents: 45
diff changeset
   245
    action->setObjectName( "SSMenu Setting" );
hgs
parents: 45
diff changeset
   246
    connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) ); 
hgs
parents: 45
diff changeset
   247
}
hgs
parents: 45
diff changeset
   248
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   249
void GlxMenuManager::setAllActionVisibility( QList<QAction*> actionList, bool visible )
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
    qDebug() << "GlxMenuManager::setAllActionVisibility count " << actionList.count() << " visible" << visible;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   252
    for ( int i = 0 ; i < actionList.count(); i++) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   253
        actionList.at(i)->setVisible(visible);
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   254
    }
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   255
}
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   256
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   257
int GlxMenuManager::viewSubState()
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
    QVariant variant = mModel->data( mModel->index(0,0), GlxSubStateRole );    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   260
    if ( variant.isValid() &&  variant.canConvert<int> () ) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   261
        return variant.value<int>() ;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   262
    }
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   263
    return -1;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   266
void GlxMenuManager::updateGridMenu()
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
{
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   268
    qDebug() << "GlxMenuManager::updateGridMenu";
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   269
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   270
    HbMenu *menu = qobject_cast<HbMenu*>( sender() );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   271
    static bool isAllActionDisable = FALSE;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   272
    int rowCount = mModel->rowCount();    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   273
    QList<QAction*> actionList = menu->actions();
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
    if ( rowCount == 0 && isAllActionDisable == FALSE) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   276
        qDebug() << "GlxMenuManager::updateGridMenu set all visible FALSE";
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   277
        setAllActionVisibility( actionList, FALSE );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   278
        isAllActionDisable = TRUE;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   279
    }    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   280
    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   281
    if ( rowCount && isAllActionDisable == TRUE ) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   282
        setAllActionVisibility( actionList, TRUE );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   283
        isAllActionDisable = FALSE;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   284
        qDebug() << "GlxMenuManager::updateGridMenu set all visible TRUE" ;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   285
    }
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   286
    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   287
    if ( rowCount ) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   288
        int state =  viewSubState();
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   289
        
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   290
        switch ( state ) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   291
        case ALBUM_ITEM_S :
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   292
            actionList.at(GlxGridViewRemoveFromAlbum)->setVisible( TRUE );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   293
            break ;
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
        default :    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   296
            actionList.at(GlxGridViewRemoveFromAlbum)->setVisible( FALSE );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   297
            break ;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   298
        }       
50
hgs
parents: 45
diff changeset
   299
        
hgs
parents: 45
diff changeset
   300
        if(mMainWindow->orientation() == Qt::Horizontal)
hgs
parents: 45
diff changeset
   301
            {
hgs
parents: 45
diff changeset
   302
            actionList.at(GlxGridView3DEffect)->setVisible( TRUE );
hgs
parents: 45
diff changeset
   303
            QList<QAction*> subActionList = m3DEffectSubMenu->actions();
hgs
parents: 45
diff changeset
   304
            if(mSettings->mediaWall3DEffect())
hgs
parents: 45
diff changeset
   305
                {
hgs
parents: 45
diff changeset
   306
                subActionList.at(0)->setChecked(ETrue);
hgs
parents: 45
diff changeset
   307
                subActionList.at(1)->setChecked(EFalse);
hgs
parents: 45
diff changeset
   308
                }
hgs
parents: 45
diff changeset
   309
            else
hgs
parents: 45
diff changeset
   310
                {
hgs
parents: 45
diff changeset
   311
                subActionList.at(0)->setChecked(EFalse);
hgs
parents: 45
diff changeset
   312
                subActionList.at(1)->setChecked(ETrue);
hgs
parents: 45
diff changeset
   313
                }
hgs
parents: 45
diff changeset
   314
            }
hgs
parents: 45
diff changeset
   315
        else
hgs
parents: 45
diff changeset
   316
            {
hgs
parents: 45
diff changeset
   317
            actionList.at(GlxGridView3DEffect)->setVisible( FALSE );
hgs
parents: 45
diff changeset
   318
            }
24
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   319
    }    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   320
}
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   321
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   322
void GlxMenuManager::updateFullscreenMenu()
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   323
{
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   324
    HbMenu *menu = qobject_cast<HbMenu*>( sender() );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   325
    QList<QAction*> actionList = menu->actions();
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   326
    static bool isAllActionDisable = FALSE;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   327
    int state = viewSubState() ;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   328
    
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   329
    if ( state == IMAGEVIEWER_S &&  isAllActionDisable == FALSE ) {        
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   330
        setAllActionVisibility( actionList, FALSE );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   331
        isAllActionDisable = TRUE;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   332
    }
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   333
  
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   334
    if ( state != IMAGEVIEWER_S &&  isAllActionDisable == TRUE ) {
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   335
        setAllActionVisibility( actionList, TRUE );
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   336
        isAllActionDisable = FALSE;
99ad1390cd33 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 23
diff changeset
   337
    }    
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   340
void GlxMenuManager::menuItemSelected()
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   341
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   342
    HbAction *action = qobject_cast<HbAction*>(sender());
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   343
    
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
    qint32 commandId = action->data().toInt();
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   345
    emit commandTriggered(commandId);
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   346
}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
void GlxMenuManager::ShowItemSpecificMenu(qint32 viewId,QPointF pos)
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
{
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
    qDebug("GlxMenuManager::showContextMenu " );
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   351
    mContextMenu = new HbMenu();
45
hgs
parents: 40
diff changeset
   352
    mContextMenu->setObjectName( "ContextMenu" );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
    HbAction *action = NULL;
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   354
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   355
    switch ( viewId ) {
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
	    case GLX_GRIDVIEW_ID :
50
hgs
parents: 45
diff changeset
   357
	        action = mContextMenu->addAction( GLX_MENU_OPEN );
hgs
parents: 45
diff changeset
   358
            action->setData( EGlxCmdFullScreenOpen );
hgs
parents: 45
diff changeset
   359
            action->setObjectName( "CM Open" );
hgs
parents: 45
diff changeset
   360
            connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );	        
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
	        
50
hgs
parents: 45
diff changeset
   362
            action = mContextMenu->addAction( GLX_MENU_SHARE );
hgs
parents: 45
diff changeset
   363
	        action->setData( EGlxCmdContextSend );
hgs
parents: 45
diff changeset
   364
	        action->setObjectName( "CM Send" );
hgs
parents: 45
diff changeset
   365
	        connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
hgs
parents: 45
diff changeset
   366
	        
hgs
parents: 45
diff changeset
   367
	        action = mContextMenu->addAction( GLX_MENU_SLIDESHOW );
hgs
parents: 45
diff changeset
   368
	        action->setData( EGlxCmdSelectSlideshow );
45
hgs
parents: 40
diff changeset
   369
	        action->setObjectName( "CM SlideShow" );
50
hgs
parents: 45
diff changeset
   370
	        connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
40
hgs
parents: 26
diff changeset
   371
hgs
parents: 26
diff changeset
   372
	        if ( viewSubState() == ALBUM_ITEM_S ) {        
50
hgs
parents: 45
diff changeset
   373
                action = mContextMenu->addAction( GLX_OPTION_REMOVE_FROM_ALBUM );
hgs
parents: 45
diff changeset
   374
                action->setData( EGlxCmdContextRemoveFrom );
45
hgs
parents: 40
diff changeset
   375
                action->setObjectName( "CM RemoveAlbum" );
50
hgs
parents: 45
diff changeset
   376
                connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
40
hgs
parents: 26
diff changeset
   377
	        }
hgs
parents: 26
diff changeset
   378
	        
50
hgs
parents: 45
diff changeset
   379
	        action = mContextMenu->addAction( GLX_MENU_ADD_TO_ALBUM );
hgs
parents: 45
diff changeset
   380
		    action->setData( EGlxCmdContextAddToAlbum );
45
hgs
parents: 40
diff changeset
   381
		    action->setObjectName( "CM AddToAlbum" );
50
hgs
parents: 45
diff changeset
   382
		    connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
		    
50
hgs
parents: 45
diff changeset
   384
		    action = mContextMenu->addAction( GLX_MENU_DELETE );
hgs
parents: 45
diff changeset
   385
		    action->setData( EGlxCmdContextDelete );
45
hgs
parents: 40
diff changeset
   386
		    action->setObjectName( "CM Delete" );
50
hgs
parents: 45
diff changeset
   387
		    connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
			break;
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
	    	
40
hgs
parents: 26
diff changeset
   390
	    case GLX_LISTVIEW_ID : {
hgs
parents: 26
diff changeset
   391
	        int count = 0;
hgs
parents: 26
diff changeset
   392
            QVariant variant = mModel->data( mModel->index(0,0), GlxListItemCount );    
hgs
parents: 26
diff changeset
   393
	        if ( variant.isValid() &&  variant.canConvert<int> () ) {
hgs
parents: 26
diff changeset
   394
	            count = variant.value<int>();  
50
hgs
parents: 45
diff changeset
   395
	        }
hgs
parents: 45
diff changeset
   396
	        
hgs
parents: 45
diff changeset
   397
	        action = mContextMenu->addAction( GLX_MENU_OPEN );
hgs
parents: 45
diff changeset
   398
            action->setData( EGlxCmdAlbumGridOpen );
hgs
parents: 45
diff changeset
   399
            action->setObjectName( "CM Album Open" );
hgs
parents: 45
diff changeset
   400
            connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
40
hgs
parents: 26
diff changeset
   401
hgs
parents: 26
diff changeset
   402
	        if ( count ) {
50
hgs
parents: 45
diff changeset
   403
                action = mContextMenu->addAction( GLX_MENU_SLIDESHOW );
hgs
parents: 45
diff changeset
   404
                action->setData( EGlxCmdAlbumSlideShow );
45
hgs
parents: 40
diff changeset
   405
                action->setObjectName( "CM Album SlideShow" );
50
hgs
parents: 45
diff changeset
   406
                connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
40
hgs
parents: 26
diff changeset
   407
	        }
hgs
parents: 26
diff changeset
   408
	        
hgs
parents: 26
diff changeset
   409
	        variant = mModel->data( mModel->index(0,0), GlxSystemItemRole );    
hgs
parents: 26
diff changeset
   410
            if ( variant.isValid() &&  variant.canConvert<bool> () && ( variant.value<bool>() == false ) ) {           
50
hgs
parents: 45
diff changeset
   411
                action = mContextMenu->addAction( GLX_MENU_RENAME );
hgs
parents: 45
diff changeset
   412
                action->setData( EGlxCmdContextRename );
45
hgs
parents: 40
diff changeset
   413
                action->setObjectName( "CM Rename" );
50
hgs
parents: 45
diff changeset
   414
                connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
40
hgs
parents: 26
diff changeset
   415
                            
50
hgs
parents: 45
diff changeset
   416
                action = mContextMenu->addAction( GLX_MENU_DELETE );
hgs
parents: 45
diff changeset
   417
                action->setData( EGlxCmdContextAlbumDelete );
45
hgs
parents: 40
diff changeset
   418
                action->setObjectName( "CM Album Delete" );
50
hgs
parents: 45
diff changeset
   419
                connect( action, SIGNAL( triggered() ), this, SLOT( menuItemSelected() ) );
40
hgs
parents: 26
diff changeset
   420
            }
hgs
parents: 26
diff changeset
   421
	    }
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
			break;
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   423
			
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
		default:
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
		    break;	
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
		}
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
40
hgs
parents: 26
diff changeset
   428
    if ( mContextMenu->isEmpty() ) {
hgs
parents: 26
diff changeset
   429
        delete mContextMenu ;
hgs
parents: 26
diff changeset
   430
        mContextMenu = NULL ;
hgs
parents: 26
diff changeset
   431
    }
hgs
parents: 26
diff changeset
   432
    else {
hgs
parents: 26
diff changeset
   433
        connect( mMainWindow, SIGNAL( aboutToChangeOrientation () ), mContextMenu, SLOT( close() ) );
hgs
parents: 26
diff changeset
   434
        connect( mContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) );
hgs
parents: 26
diff changeset
   435
        mContextMenu->setPreferredPos( pos );
hgs
parents: 26
diff changeset
   436
        mContextMenu->show(); 
hgs
parents: 26
diff changeset
   437
    }    
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   438
}
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   440
void GlxMenuManager::closeContextMenu()
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   441
{
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   442
    disconnect( mMainWindow, SIGNAL( aboutToChangeOrientation () ), mContextMenu, SLOT( close() ) );
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   443
    disconnect( mContextMenu, SIGNAL( aboutToClose () ), this, SLOT( closeContextMenu() ) ); 
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   444
    mContextMenu->deleteLater();
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   445
    mContextMenu = NULL;
23
74c9f037fd5d Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
}
26
c499df2dbb33 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 24
diff changeset
   447