/***************************************************************************
 *   Copyright (c) 2009  Peter Mylemans <peter.mylemans@gmail.com>         *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#ifndef CONTEXTMODEL_H
#define CONTEXTMODEL_H

#include <QString>

/*!
    \class ContextModel

    This class represents a datamodel for the context. Objects of this class hold data for a
    certain model type. This data can then be added, viewed or editted by a ContextView.

    \sa ContextView
*/
class ContextModel
{
public:
    virtual ~ContextModel() {}

    /*!
        Returns the UNIQUE identifier of this model. This method is used for determening the correct
        view for this model.

        \sa ContextWidget::changeContext
    */
    virtual const QString modelId() const = 0;

    /*!
        Updates the model with the data from the specified \a other context model. Afterwards
        it should make these changes persistent.

        \a other is used to allow canceling. The user should not modify a context model directly.
        Instead a temporary copy must be made. When the user wants to save the changes, the save
        method must be called on the original model and the temporary copy is passed as \a other.
    */
    virtual void save(const ContextModel &other) { }
};

#endif
