filemanager/src/fmfiledialog/src/fmfilewidget.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 14:53:38 +0300
changeset 14 1957042d8c7e
child 16 ada7962b4308
permissions -rw-r--r--
Revision: 201011 Kit: 201015

/*
* 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:
*
* 
* Description:
*     The header file of the file widget
*
*/
#ifndef FMFILEWIDGET_H
#define FMFILEWIDGET_H

#include "hbwidget.h"
#include <QFileInfo>
#include <QDir>
#include <QString>

class QDirModel;
class FmDriveModel;
class HbListView;
class QGraphicsLinearLayout;

class FmFileWidget : public HbWidget
{
Q_OBJECT
public:
    enum ViewType{
        DirView,
        DriveView
    };

    explicit FmFileWidget( HbWidget *parent = 0 );
    ~FmFileWidget();

    QFileInfo currentPath() const;

    void setModelFilter( QDir::Filters filters );
    void setNameFilters( const QStringList &nameFilters );
    void setRootPath( const QString &pathName );

    FmFileWidget::ViewType currentViewType();
    bool cdUp();
signals:
    void pathChanged( const QString &path );
    void fileActivated( const QString &path );

private slots:
    void on_list_activated( const QModelIndex &index );

private:
    void init();
    void changeRootIndex( const QModelIndex &index );
    void setModel( QAbstractItemModel *model );

private:
    HbListView *mListView;
    QGraphicsLinearLayout *mLayout;
    QDirModel       *mDirModel;
    FmDriveModel    *mDriveModel;

    QAbstractItemModel *mCurrentModel;

};

#endif