/usr/include/akonadi/entitytreeviewstatesaver.h is in kdepimlibs5-dev 4:4.8.5-0ubuntu0.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /*
Copyright (c) 2009 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_ENTITYTREEVIEWSTATESAVER_H
#define AKONADI_ENTITYTREEVIEWSTATESAVER_H
#include "akonadi_export.h"
#include <QtCore/QObject>
class QTreeView;
class KConfigGroup;
namespace Akonadi {
class EntityTreeViewStateSaverPrivate;
/**
* @short A helper class that saves and restores state of an EntityTreeView
*
* This class saves and restores the state of a QTreeView showing an EntityTreeModel,
* or whatever proxies are stacked on top of one. State so far means the current selection
* and expansion of the items and collections.
*
* The EntityTreeViewStateSaver is needed because populating the EntityTreeModel
* is asynchronous and finding the right point in time to restore the state is a
* difficult task that is hidden inside this class.
*
* Example:
*
* @code
*
* class MyWidget : public QWidget
* {
* public:
* MyWidget( QWidget* parent );
* ~MyWidget();
*
* ...
*
* private:
* KConfig *mGlobalConfig;
* QTreeView *mTreeView;
* Akonadi::EntityTreeViewStateSaver *mStateSaver;
* };
*
* MyWidget::MyWidget( QWidget *parent )
* : QWidget( parent )
* {
* mGlobalConfig = ...
* mTreeView = new QTreeView( this );
* ...
*
* mStateSaver = new Akonadi::EntityTreeViewStateSaver( mTreeView );
*
* KConfigGroup group( mGlobalConfig, "treeViewState" );
* mStateSaver->restoreState( group );
* }
*
* MyWidget::~MyWidget()
* {
* KConfigGroup group( mGlobalConfig, "treeViewState" );
* mStateSaver->saveState( group );
* }
*
* @endcode
*
* @author Volker Krause <vkrause@kde.org>
* @since 4.4
*
* @deprecated This class is deprecated. Use ETMViewStateSaver instead.
*/
class AKONADI_EXPORT_DEPRECATED EntityTreeViewStateSaver : public QObject
{
Q_OBJECT
public:
/**
* Creates a new state saver, for saving or restoring.
*
* @param view The QTreeView which state should be saved/restored.
*/
explicit EntityTreeViewStateSaver( QTreeView* view );
/**
* Destroys this state saver.
*/
~EntityTreeViewStateSaver();
/**
* Stores the current state in the given config group.
*
* @param configGroup Config file group into which the state is supposed to be stored.
*/
void saveState( KConfigGroup &configGroup ) const;
/**
* Restore the state stored in @p configGroup as soon as the corresponding entities
* become available in the model (the model is populated asynchronously, which is the
* main reason why you want to use this class).
*
* @param configGroup Config file group containing a previously stored EntityTreeView state.
*/
void restoreState( const KConfigGroup &configGroup ) const;
private:
//@cond PRIVATE
EntityTreeViewStateSaverPrivate* const d;
Q_PRIVATE_SLOT( d, void rowsInserted( const QModelIndex&, int, int ) )
Q_PRIVATE_SLOT( d, void restoreScrollBarState() )
//@endcond
};
}
#endif
|