filemanager/src/filemanager/src/fmsplitview.cpp
changeset 14 1957042d8c7e
child 16 ada7962b4308
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/src/fmsplitview.cpp	Fri Apr 16 14:53:38 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*     Zhiqiang Yang <zhiqiang.yang@nokia.com>
+* 
+* Description:
+*     The source file of the split view of file manager
+*
+*/
+#include "fmsplitview.h"
+#include "fmfilebrowsewidget.h"
+#include "fmdriverlistwidget.h"
+#include <QGraphicsLinearLayout>
+
+#include <hbmessagebox.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbmainwindow.h>
+
+FmSplitView::FmSplitView() : FmViewBase( ESplitView )
+{
+    initMenu();
+    initMainWidget();
+
+    QMetaObject::connectSlotsByName( this );
+}
+
+FmSplitView::~FmSplitView()
+{
+}
+
+void FmSplitView::on_rotateAction_triggered()
+{
+	if ( mainWindow()->orientation() == Qt::Vertical ) {
+		mainWindow()->setOrientation( Qt::Horizontal );
+	}
+	else {
+		mainWindow()->setOrientation( Qt::Vertical );
+	}
+}
+
+void FmSplitView::on_normalViewAction_triggered()
+{
+	mainWindow()->setCurrentView( mainWindow()->viewAt(0) );
+}
+
+void FmSplitView::initMenu()
+{
+    HbAction *action = 0;
+#ifdef FM_CHANGE_ORIENT_ENABLE
+	action = new HbAction( this );
+	action->setObjectName( "rotateAction" );
+	action->setText( tr( "Change orientation" ) );
+	menu()->addAction( action );
+#endif
+
+	action = new HbAction( this );
+	action->setObjectName( "normalViewAction" );
+	action->setText( tr( "Switch to normal view" ) );
+	menu()->addAction( action );
+}
+
+void FmSplitView::initMainWidget()
+{
+	QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout( this );
+	hLayout->setOrientation( Qt::Horizontal );
+
+    mDriverWidget = new FmDriverListWidget( this );
+    mDriverWidget->setMaximumWidth( 200.0 );
+    hLayout->addItem( mDriverWidget );
+     
+
+    mFileWidget = new FmFileBrowseWidget( this, FmFileBrowseWidget::TreeStyle );
+    hLayout->addItem( mFileWidget );
+
+    connect( mDriverWidget, SIGNAL( activated( const QString & ) ),
+             mFileWidget, SLOT( setRootPath( const QString & ) ) );
+}