akonadi
entitylistview.h
00001 /* 00002 Copyright (c) 2006 - 2007 Volker Krause <vkrause@kde.org> 00003 Copyright (c) 2008 Stephen Kelly <steveire@gmail.com> 00004 Copyright (c) 2009 Kevin Ottens <ervin@kde.org> 00005 00006 This library is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Library General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or (at your 00009 option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, but WITHOUT 00012 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00019 02110-1301, USA. 00020 */ 00021 00022 #ifndef AKONADI_ENTITYLISTVIEW_H 00023 #define AKONADI_ENTITYLISTVIEW_H 00024 00025 #include "akonadi_export.h" 00026 00027 #include <QtGui/QListView> 00028 00029 class KXMLGUIClient; 00030 class QDragMoveEvent; 00031 00032 namespace Akonadi 00033 { 00034 00035 class Collection; 00036 class Item; 00037 00075 class AKONADI_EXPORT EntityListView : public QListView 00076 { 00077 Q_OBJECT 00078 00079 public: 00085 explicit EntityListView( QWidget *parent = 0 ); 00086 00095 explicit EntityListView( KXMLGUIClient *xmlGuiClient, QWidget *parent = 0 ); 00096 00100 virtual ~EntityListView(); 00101 00109 void setXmlGuiClient( KXMLGUIClient *xmlGuiClient ); 00110 00114 virtual void setModel( QAbstractItemModel * model ); 00115 00116 Q_SIGNALS: 00123 void clicked( const Akonadi::Collection &collection ); 00124 00131 void clicked( const Akonadi::Item &item ); 00132 00139 void doubleClicked( const Akonadi::Collection &collection ); 00140 00147 void doubleClicked( const Akonadi::Item &item ); 00148 00155 void currentChanged( const Akonadi::Collection &collection ); 00156 00163 void currentChanged( const Akonadi::Item &item ); 00164 00165 protected: 00166 using QListView::currentChanged; 00167 virtual void dragMoveEvent( QDragMoveEvent *event ); 00168 virtual void dropEvent( QDropEvent *event ); 00169 virtual void contextMenuEvent( QContextMenuEvent *event ); 00170 virtual void startDrag( Qt::DropActions supportedActions ); 00171 00172 private: 00173 //@cond PRIVATE 00174 class Private; 00175 Private * const d; 00176 00177 Q_PRIVATE_SLOT( d, void itemClicked( const QModelIndex& ) ) 00178 Q_PRIVATE_SLOT( d, void itemDoubleClicked( const QModelIndex& ) ) 00179 Q_PRIVATE_SLOT( d, void itemCurrentChanged( const QModelIndex& ) ) 00180 //@endcond 00181 }; 00182 00183 } 00184 00185 #endif