• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
eventlistview.h
Go to the documentation of this file.
1 /*
2  * eventlistview.h - base class for widget showing list of alarms
3  * Program: kalarm
4  * Copyright © 2007,2008,2010,2011 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef EVENTLISTVIEW_H
22 #define EVENTLISTVIEW_H
23 
24 #include "kalarm.h"
25 #ifdef USE_AKONADI
26 #include "itemlistmodel.h"
27 #else
28 #include "eventlistmodel.h"
29 #endif
30 
31 #include <QTreeView>
32 #include <QItemDelegate>
33 
34 class Find;
35 
36 
37 class EventListView : public QTreeView
38 {
39  Q_OBJECT
40  public:
41  explicit EventListView(QWidget* parent = 0);
42 #ifdef USE_AKONADI
43  ItemListModel* itemModel() const { return static_cast<ItemListModel*>(model()); }
44  KAEvent event(int row) const;
45  KAEvent event(const QModelIndex&) const;
46  void select(Akonadi::Item::Id);
47 #else
48  EventListFilterModel* eventFilterModel() const { return static_cast<EventListFilterModel*>(model()); }
49  EventListModel* eventModel() const { return static_cast<EventListModel*>(static_cast<QAbstractProxyModel*>(model())->sourceModel()); }
50  KAEvent* event(int row) const;
51  KAEvent* event(const QModelIndex&) const;
52  void select(const QString& eventId, bool scrollToEvent = false);
53 #endif
54  void select(const QModelIndex&, bool scrollToIndex = false);
55  void clearSelection();
56  QModelIndex selectedIndex() const;
57 #ifdef USE_AKONADI
58  KAEvent selectedEvent() const;
59  QVector<KAEvent> selectedEvents() const;
60 #else
61  KAEvent* selectedEvent() const;
62  KAEvent::List selectedEvents() const;
63 #endif
64  void setEditOnSingleClick(bool e) { mEditOnSingleClick = e; }
65  bool editOnSingleClick() const { return mEditOnSingleClick; }
66 
67  public slots:
68  virtual void slotFind();
69  virtual void slotFindNext() { findNext(true); }
70  virtual void slotFindPrev() { findNext(false); }
71 
72  signals:
73  void contextMenuRequested(const QPoint& globalPos);
74  void findActive(bool);
75 
76  protected:
77  virtual bool viewportEvent(QEvent*);
78  virtual void contextMenuEvent(QContextMenuEvent*);
79 
80  private:
81  void findNext(bool forward);
82 
83  Find* mFind;
84  bool mEditOnSingleClick;
85 
86  using QObject::event; // prevent "hidden" warning
87 };
88 
89 class EventListDelegate : public QItemDelegate
90 {
91  Q_OBJECT
92  public:
93  explicit EventListDelegate(EventListView* parent = 0) : QItemDelegate(parent) {}
94  virtual QWidget* createEditor(QWidget*, const QStyleOptionViewItem&, const QModelIndex&) const { return 0; }
95  virtual bool editorEvent(QEvent*, QAbstractItemModel*, const QStyleOptionViewItem&, const QModelIndex&);
96  virtual void edit(KAEvent*, EventListView*) = 0;
97 };
98 
99 #endif // EVENTLISTVIEW_H
100 
101 // vim: et sw=4:
QModelIndex
QEvent
QWidget
EventListView::slotFind
virtual void slotFind()
Definition: eventlistview.cpp:183
EventListView::selectedEvent
KAEvent * selectedEvent() const
Definition: eventlistview.cpp:133
EventListDelegate::editorEvent
virtual bool editorEvent(QEvent *, QAbstractItemModel *, const QStyleOptionViewItem &, const QModelIndex &)
Definition: eventlistview.cpp:254
EventListView::slotFindPrev
virtual void slotFindPrev()
Definition: eventlistview.h:70
QAbstractProxyModel
EventListView::EventListView
EventListView(QWidget *parent=0)
Definition: eventlistview.cpp:39
EventListFilterModel
Definition: eventlistmodel.h:128
EventListView
Definition: eventlistview.h:37
EventListView::findActive
void findActive(bool)
QPoint
EventListView::selectedEvents
KAEvent::List selectedEvents() const
Definition: eventlistview.cpp:151
EventListView::contextMenuRequested
void contextMenuRequested(const QPoint &globalPos)
EventListView::event
KAEvent * event(int row) const
Definition: eventlistview.cpp:73
QObject::event
virtual bool event(QEvent *e)
Find
Definition: find.h:36
EventListView::eventModel
EventListModel * eventModel() const
Definition: eventlistview.h:49
QStyleOptionViewItem
QContextMenuEvent
itemlistmodel.h
QItemDelegate
eventlistmodel.h
QString
EventListView::editOnSingleClick
bool editOnSingleClick() const
Definition: eventlistview.h:65
EventListView::select
void select(const QString &eventId, bool scrollToEvent=false)
Definition: eventlistview.cpp:88
EventListDelegate::edit
virtual void edit(KAEvent *, EventListView *)=0
EventListView::selectedIndex
QModelIndex selectedIndex() const
Definition: eventlistview.cpp:110
QVector
EventListModel
Definition: eventlistmodel.h:41
QTreeView
EventListView::slotFindNext
virtual void slotFindNext()
Definition: eventlistview.h:69
kalarm.h
QAbstractItemModel
EventListView::clearSelection
void clearSelection()
Definition: eventlistview.cpp:101
EventListView::eventFilterModel
EventListFilterModel * eventFilterModel() const
Definition: eventlistview.h:48
EventListDelegate
Definition: eventlistview.h:89
QAbstractItemView::model
QAbstractItemModel * model() const
EventListDelegate::EventListDelegate
EventListDelegate(EventListView *parent=0)
Definition: eventlistview.h:93
QObject::parent
QObject * parent() const
EventListView::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *)
Definition: eventlistview.cpp:248
EventListView::viewportEvent
virtual bool viewportEvent(QEvent *)
Definition: eventlistview.cpp:205
ItemListModel
Definition: itemlistmodel.h:38
EventListDelegate::createEditor
virtual QWidget * createEditor(QWidget *, const QStyleOptionViewItem &, const QModelIndex &) const
Definition: eventlistview.h:94
EventListView::setEditOnSingleClick
void setEditOnSingleClick(bool e)
Definition: eventlistview.h:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal