recents_plat/logs_engine_api/inc/logsfilter.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 09:49:12 +0300
changeset 14 f27aebe284bb
parent 0 4a5361db8937
permissions -rw-r--r--
Revision: 201027 Kit: 201033

/*
* 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:
*
*/
#ifndef LOGSFILTER_H
#define LOGSFILTER_H

#include <QSortFilterProxyModel>
#include <logsexport.h>
#include <logsmodel.h>

/**
 * LogsFilter can be used to filter certain events 
 * from logs model.
 */
class LogsFilter : public QSortFilterProxyModel 
{
    Q_OBJECT
    
public:
    
    enum FilterType{
        All,
        Received,
        Called,
        Missed
    };
    
public: // The exported API

    /**
     * Constructor
     * @param type, filter type defining which events are shown
     */
    LOGSENGINE_EXPORT LogsFilter( FilterType type = All );
    
    /**
     * Destructor
     */
    LOGSENGINE_EXPORT ~LogsFilter();
    
    /**
     * Get current filter type
     * @return filtertype
     */
    LOGSENGINE_EXPORT FilterType filterType() const;
    
    /**
    * Get current clear type
    * @return cleartype
    */ 
    LOGSENGINE_EXPORT LogsModel::ClearType clearType() const;
    
    /**
     * Set maximum number of events.
     * @param max size 
     */    
    LOGSENGINE_EXPORT void setMaxSize(int maxSize);
    
protected: // From QSortFilterProxyModel
    
    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
    
private: //data 
    
    FilterType mFilterType;

private:  // Testing related friend definitions
        
    friend class UT_LogsFilter;
    friend class UT_LogsModel;
};
                  
#endif // LOGSFILTER_H