filemanager/src/filemanager/src/fmsplitview.cpp
branchRCL_3
changeset 20 491b3ed49290
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
       
     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 *     Zhiqiang Yang <zhiqiang.yang@nokia.com>
       
    14 * 
       
    15 * Description:
       
    16 *     The source file of the split view of file manager
       
    17 *
       
    18 */
       
    19 #include "fmsplitview.h"
       
    20 #include "fmfilebrowsewidget.h"
       
    21 #include "fmdriverlistwidget.h"
       
    22 #include <QGraphicsLinearLayout>
       
    23 
       
    24 #include <hbmenu.h>
       
    25 #include <hbaction.h>
       
    26 #include <hbmainwindow.h>
       
    27 
       
    28 FmSplitView::FmSplitView() : FmViewBase( ESplitView )
       
    29 {
       
    30     initMenu();
       
    31     initMainWidget();
       
    32 
       
    33     QMetaObject::connectSlotsByName( this );
       
    34 }
       
    35 
       
    36 FmSplitView::~FmSplitView()
       
    37 {
       
    38 }
       
    39 
       
    40 void FmSplitView::on_rotateAction_triggered()
       
    41 {
       
    42 	if ( mainWindow()->orientation() == Qt::Vertical ) {
       
    43 		mainWindow()->setOrientation( Qt::Horizontal );
       
    44 	}
       
    45 	else {
       
    46 		mainWindow()->setOrientation( Qt::Vertical );
       
    47 	}
       
    48 }
       
    49 
       
    50 void FmSplitView::on_normalViewAction_triggered()
       
    51 {
       
    52 	mainWindow()->setCurrentView( mainWindow()->views().first() );
       
    53 }
       
    54 
       
    55 void FmSplitView::initMenu()
       
    56 {
       
    57     HbAction *action = 0;
       
    58 #ifdef FM_CHANGE_ORIENT_ENABLE
       
    59 	action = new HbAction( this );
       
    60 	action->setObjectName( "rotateAction" );
       
    61 	action->setText( hbTrId( "Change orientation" ) );
       
    62 	menu()->addAction( action );
       
    63 #endif
       
    64 
       
    65 	action = new HbAction( this );
       
    66 	action->setObjectName( "normalViewAction" );
       
    67 	action->setText( hbTrId( "Switch to normal view" ) );
       
    68 	menu()->addAction( action );
       
    69 }
       
    70 
       
    71 void FmSplitView::initMainWidget()
       
    72 {
       
    73 	QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout( this );
       
    74 	hLayout->setOrientation( Qt::Horizontal );
       
    75 
       
    76     mDriverWidget = new FmDriverListWidget( this );
       
    77     mDriverWidget->setMaximumWidth( 200.0 );
       
    78     hLayout->addItem( mDriverWidget );
       
    79      
       
    80 
       
    81     mFileWidget = new FmFileBrowseWidget( this, FmFileBrowseWidget::TreeStyle );
       
    82     hLayout->addItem( mFileWidget );
       
    83 
       
    84     connect( mDriverWidget, SIGNAL( activated( const QString & ) ),
       
    85              mFileWidget, SLOT( setRootPath( const QString & ) ) );
       
    86 }