<commit_before>/*
    Copyright (c) 2006 - 2007 <NAME> <<EMAIL>>
    Copyright (c) 2008 <NAME> <<EMAIL>>

    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_ENTITY_TREE_VIEW
#define AKONADI_ENTITY_TREE_VIEW

// #include "akonadi_export.h"
#include <QtGui/QTreeView>

class KXmlGuiWindow;
class QDragMoveEvent;

namespace Akonadi
{

class Collection;

/**
 * @short A view to show a collection tree provided by a CollectionModel.
 *
 * When a KXmlGuiWindow is passed to the constructor, the XMLGUI
 * defined context menu @c akonadi_collectionview_contextmenu is
 * used if available.
 *
 * Example:
 *
 * @code
 *
 * class MyWindow : public KXmlGuiWindow
 * {
 *   public:
 *    MyWindow()
 *      : KXmlGuiWindow()
 *    {
 *      Akonadi::CollectionView *view = new Akonadi::CollectionView( this, this );
 *      setCentralWidget( view );
 *
 *      Akonadi::CollectionModel *model = new Akonadi::CollectionModel( this );
 *      view->setModel( model );
 *    }
 * }
 *
 * @endcode
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class EntityTreeView : public QTreeView
{
  Q_OBJECT

public:
  /**
   * Creates a new entity tree view.
   *
   * @param parent The parent widget.
   */
  explicit EntityTreeView( QWidget *parent = 0 );

  /**
   * Creates a new entity tree view.
   *
   * @param xmlGuiWindow The KXmlGuiWindow the view is used in.
   *                     This is needed for the XMLGUI based context menu.
   *                     Passing 0 is ok and will disable the builtin context menu.
   * @param parent The parent widget.
   */
  explicit EntityTreeView( KXmlGuiWindow *xmlGuiWindow, QWidget *parent = 0 );

  /**
   * Destroys the entity tree view.
   */
  virtual ~EntityTreeView();

  void showChildCollectionTree( bool show );
  bool childCollectionTreeShown();

  void setRootIndex(const QModelIndex &idx);

  /**
   * Sets the KXmlGuiWindow which the view is used in.
   * This is needed if you want to use the built-in context menu.
   *
   * @param xmlGuiWindow The KXmlGuiWindow the view is used in.
   */<commit_msg>Add an apidox comment to setRootIndex.<commit_after>/*
    Copyright (c) 2006 - 2007 <NAME> <<EMAIL>>
    Copyright (c) 2008 <NAME> <<EMAIL>>

    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_ENTITY_TREE_VIEW
#define AKONADI_ENTITY_TREE_VIEW

// #include "akonadi_export.h"
#include <QtGui/QTreeView>

class KXmlGuiWindow;
class QDragMoveEvent;

namespace Akonadi
{

class Collection;

/**
 * @short A view to show a collection tree provided by a CollectionModel.
 *
 * When a KXmlGuiWindow is passed to the constructor, the XMLGUI
 * defined context menu @c akonadi_collectionview_contextmenu is
 * used if available.
 *
 * Example:
 *
 * @code
 *
 * class MyWindow : public KXmlGuiWindow
 * {
 *   public:
 *    MyWindow()
 *      : KXmlGuiWindow()
 *    {
 *      Akonadi::CollectionView *view = new Akonadi::CollectionView( this, this );
 *      setCentralWidget( view );
 *
 *      Akonadi::CollectionModel *model = new Akonadi::CollectionModel( this );
 *      view->setModel( model );
 *    }
 * }
 *
 * @endcode
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class EntityTreeView : public QTreeView
{
  Q_OBJECT

public:
  /**
   * Creates a new entity tree view.
   *
   * @param parent The parent widget.
   */
  explicit EntityTreeView( QWidget *parent = 0 );

  /**
   * Creates a new entity tree view.
   *
   * @param xmlGuiWindow The KXmlGuiWindow the view is used in.
   *                     This is needed for the XMLGUI based context menu.
   *                     Passing 0 is ok and will disable the builtin context menu.
   * @param parent The parent widget.
   */
  explicit EntityTreeView( KXmlGuiWindow *xmlGuiWindow, QWidget *parent = 0 );

  /**
   * Destroys the entity tree view.
   */
  virtual ~EntityTreeView();

  void showChildCollectionTree( bool show );
  bool childCollectionTreeShown();

  /**
  Reimplemented to hide the child collection tree if that option is set.
  */
  void setRootIndex(const QModelIndex &idx);

  /**
   * Sets the KXmlGuiWindow which the view is used in.
   * This is needed if you want to use the built-in context menu.
   *
   * @param xmlGuiWindow The KXmlGuiWindow the view is used in.
   */
{'fraction_non_alphanumeric': 0.08346401812162398, 'fraction_numerical': 0.009409304756926294, 'mean_word_length': 3.0422535211267605, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2108103', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1658, 'n_words': 669}