entitytreeview.h
00001 /* 00002 Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org> 00003 Copyright (c) 2008 Stephen Kelly <steveire@gmail.com> 00004 00005 This library is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU Library General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or (at your 00008 option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, but WITHOUT 00011 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to the 00017 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00018 02110-1301, USA. 00019 */ 00020 00021 #ifndef AKONADI_ENTITYTREEVIEW_H 00022 #define AKONADI_ENTITYTREEVIEW_H 00023 00024 #include "akonadi_export.h" 00025 00026 #include <QtGui/QTreeView> 00027 00028 class KXMLGUIClient; 00029 class QDragMoveEvent; 00030 00031 namespace Akonadi 00032 { 00033 00034 class Collection; 00035 class Item; 00036 00070 class AKONADI_EXPORT EntityTreeView : public QTreeView 00071 { 00072 Q_OBJECT 00073 00074 public: 00080 explicit EntityTreeView( QWidget *parent = 0 ); 00081 00090 explicit EntityTreeView( KXMLGUIClient *xmlGuiClient, QWidget *parent = 0 ); 00091 00095 virtual ~EntityTreeView(); 00096 00104 void setXmlGuiClient( KXMLGUIClient *xmlGuiClient ); 00105 00109 virtual void setModel( QAbstractItemModel * model ); 00110 00117 void setDropActionMenuEnabled( bool enabled ); 00118 00125 bool isDropActionMenuEnabled() const; 00126 00127 Q_SIGNALS: 00134 void clicked( const Akonadi::Collection &collection ); 00135 00142 void clicked( const Akonadi::Item &item ); 00143 00150 void doubleClicked( const Akonadi::Collection &collection ); 00151 00158 void doubleClicked( const Akonadi::Item &item ); 00159 00166 void currentChanged( const Akonadi::Collection &collection ); 00167 00174 void currentChanged( const Akonadi::Item &item ); 00175 00176 protected: 00177 using QTreeView::currentChanged; 00178 #ifndef QT_NO_DRAGANDDROP 00179 virtual void startDrag( Qt::DropActions supportedActions ); 00180 virtual void dragMoveEvent( QDragMoveEvent *event ); 00181 virtual void dropEvent( QDropEvent *event ); 00182 #endif 00183 virtual void timerEvent( QTimerEvent *event ); 00184 #ifndef QT_NO_CONTEXTMENU 00185 virtual void contextMenuEvent( QContextMenuEvent *event ); 00186 #endif 00187 00188 00189 private: 00190 //@cond PRIVATE 00191 class Private; 00192 Private * const d; 00193 00194 Q_PRIVATE_SLOT( d, void itemClicked( const QModelIndex& ) ) 00195 Q_PRIVATE_SLOT( d, void itemDoubleClicked( const QModelIndex& ) ) 00196 Q_PRIVATE_SLOT( d, void itemCurrentChanged( const QModelIndex& ) ) 00197 Q_PRIVATE_SLOT( d, void slotSelectionChanged( const QItemSelection &, const QItemSelection & ) ) 00198 //@endcond 00199 }; 00200 00201 } 00202 00203 #endif