Warning, file /office/calligra/libs/kundo2/kundo2model.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2010 Matus Talcik <matus.talcik@gmail.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 /****************************************************************************
0020 **
0021 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
0022 ** All rights reserved.
0023 ** Contact: Nokia Corporation (qt-info@nokia.com)
0024 **
0025 ** This file is part of the QtGui module of the Qt Toolkit.
0026 **
0027 ** $QT_BEGIN_LICENSE:LGPL$
0028 ** No Commercial Usage
0029 ** This file contains pre-release code and may not be distributed.
0030 ** You may use this file in accordance with the terms and conditions
0031 ** contained in the Technology Preview License Agreement accompanying
0032 ** this package.
0033 **
0034 ** GNU Lesser General Public License Usage
0035 ** Alternatively, this file may be used under the terms of the GNU Lesser
0036 ** General Public License version 2.1 as published by the Free Software
0037 ** Foundation and appearing in the file LICENSE.LGPL included in the
0038 ** packaging of this file.  Please review the following information to
0039 ** ensure the GNU Lesser General Public License version 2.1 requirements
0040 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
0041 **
0042 ** In addition, as a special exception, Nokia gives you certain additional
0043 ** rights.  These rights are described in the Nokia Qt LGPL Exception
0044 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
0045 **
0046 ** If you have questions regarding the use of this file, please contact
0047 ** Nokia at qt-info@nokia.com.
0048 **
0049 **
0050 **
0051 **
0052 **
0053 **
0054 **
0055 **
0056 ** $QT_END_LICENSE$
0057 **
0058 ****************************************************************************/
0059 #ifndef K_UNDO_2_MODEL
0060 #define K_UNDO_2_MODEL
0061 #include <QAbstractItemModel>
0062 
0063 #include "kundo2stack.h"
0064 #include <QItemSelectionModel>
0065 #include <QIcon>
0066 
0067 class KUndo2Model : public QAbstractItemModel
0068 {
0069     Q_OBJECT
0070 public:
0071     explicit KUndo2Model(QObject *parent = 0);
0072 
0073     KUndo2QStack *stack() const;
0074 
0075     QModelIndex index(int row, int column,
0076                               const QModelIndex &parent = QModelIndex()) const override;
0077     QModelIndex parent(const QModelIndex &child) const override;
0078     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0079     int columnCount(const QModelIndex &parent = QModelIndex()) const override;
0080     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0081 
0082     QModelIndex selectedIndex() const;
0083     QItemSelectionModel *selectionModel() const;
0084 
0085     QString emptyLabel() const;
0086     void setEmptyLabel(const QString &label);
0087 
0088     void setCleanIcon(const QIcon &icon);
0089     QIcon cleanIcon() const;
0090 
0091 public Q_SLOTS:
0092     void setStack(KUndo2QStack *stack);
0093 
0094 private Q_SLOTS:
0095     void stackChanged();
0096     void stackDestroyed(QObject *obj);
0097     void setStackCurrentIndex(const QModelIndex &index);
0098 
0099 private:
0100     KUndo2QStack *m_stack;
0101     QItemSelectionModel *m_sel_model;
0102     QString m_emty_label;
0103     QIcon m_clean_icon;
0104 };
0105 #endif