filemanager/src/inc/fmdrivemodel.h
changeset 14 1957042d8c7e
child 25 b7bfdea70ca2
child 29 b3155376f2b4
child 37 15bc28c9dd51
equal deleted inserted replaced
1:d1daf54a55b5 14:1957042d8c7e
       
     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 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef FMDRIVEMODEL_H
       
    19 #define FMDRIVEMODEL_H
       
    20 
       
    21 #include <QAbstractItemModel>
       
    22 #include <QStringList>
       
    23 #include <QFileIconProvider>
       
    24 #include <QModelIndex>
       
    25 
       
    26 class FmDriveModel : public QAbstractListModel
       
    27 {
       
    28 Q_OBJECT
       
    29 public:
       
    30     enum Option
       
    31     {
       
    32         FillWithVolume        = 0x00000001, // add volume behind disname
       
    33         FillWithDefaultVolume = 0x00000002, // add default diskname while enable FillWithVolume and volume is empty
       
    34         HideUnAvailableDrive  = 0x00000004  // for example: drive F when no MMC card inserted.
       
    35     };
       
    36     Q_DECLARE_FLAGS(Options, Option)
       
    37 
       
    38     explicit FmDriveModel( QObject *parent = 0, Options options = 0 );
       
    39     virtual ~FmDriveModel();
       
    40 
       
    41     void refresh();
       
    42     int rowCount( const QModelIndex &parent = QModelIndex() ) const;
       
    43     int columnCount( const QModelIndex &parent = QModelIndex() ) const;
       
    44     QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
       
    45     QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
       
    46     bool indexValid( const QModelIndex &index ) const;
       
    47     QString driveName( const QModelIndex &index ) const;
       
    48     QString displayString( const QModelIndex &index ) const;
       
    49     
       
    50 private:
       
    51     QStringList         mFindResult;
       
    52     QFileIconProvider   *mIconProvider;
       
    53     QStringList         mDriveList;
       
    54     Options             mOptions;
       
    55 };
       
    56 
       
    57 Q_DECLARE_OPERATORS_FOR_FLAGS(FmDriveModel::Options)
       
    58 
       
    59 #endif