kolistview.h 3.83 KB
Newer Older
Cornelius Schumacher's avatar
Cornelius Schumacher committed
1
/*
2
  This file is part of KOrganizer.
3

4 5 6
  Copyright (c) 1999 Preston Brown <pbrown@kde.org>
  Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
Cornelius Schumacher's avatar
Cornelius Schumacher committed
7

8 9 10 11
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
Cornelius Schumacher's avatar
Cornelius Schumacher committed
12

13 14 15 16
  This program 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 General Public License for more details.
Cornelius Schumacher's avatar
Cornelius Schumacher committed
17

18 19 20
  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21

22 23 24
  As a special exception, permission is given to link this program
  with any edition of Qt, and distribute the resulting executable,
  without including the source code for Qt in the source distribution.
Cornelius Schumacher's avatar
Cornelius Schumacher committed
25
*/
26 27
#ifndef KOLISTVIEW_H
#define KOLISTVIEW_H
28

Allen Winter's avatar
Allen Winter committed
29
#include "koeventview.h"
30 31

#include <incidenceeditors/customlistviewitem.h>
32

33
#include <kcalcore/incidence.h>
34

35
#include <QHash>
36
#include <QList>
37

38
using namespace KCalCore;
39

40
typedef IncidenceEditors::CustomListViewItem<Akonadi::Item::Id> KOListViewItem;
41

42 43
class KOListView;

44
#if 0
45 46 47
class KOListViewToolTip : public QToolTip
{
  public:
Allen Winter's avatar
Allen Winter committed
48
    KOListViewToolTip ( QWidget *parent, K3ListView *lv );
49 50

  protected:
Allen Winter's avatar
Allen Winter committed
51
    void maybeTip( const QPoint &pos );
52 53

  private:
Allen Winter's avatar
Allen Winter committed
54
    K3ListView *eventlist;
55
};
56
#endif
57

58
/**
Cornelius Schumacher's avatar
Cornelius Schumacher committed
59
  This class provides a multi-column list view of events.  It can
60
  display events from one particular day or several days, it doesn't
Cornelius Schumacher's avatar
Cornelius Schumacher committed
61 62 63 64 65 66 67
  matter.  To use a view that only handles one day at a time, use
  KODayListView.

  @short multi-column list view of various events.
  @author Preston Brown <pbrown@kde.org>
  @see KOBaseView, KODayListView
*/
68
class KOListView : public KOEventView
69
{
70
  Q_OBJECT
71
  public:
Sergio Luis Martins's avatar
Sergio Luis Martins committed
72
    explicit KOListView( QWidget *parent = 0,  bool nonInteractive = false );
73
    ~KOListView();
74

75 76
    virtual int maxDatesHint() const;
    virtual int currentDateCount() const;
77
    virtual Akonadi::Item::List selectedIncidences();
78
    virtual DateList selectedIncidenceDates();
79

Allen Winter's avatar
Allen Winter committed
80
    void showDates( bool show );
81

82 83 84
    // Shows all incidences of the calendar
    void showAll();

Allen Winter's avatar
Allen Winter committed
85 86
    void readSettings( KConfig *config );
    void writeSettings( KConfig *config );
87

88
    void clear();
Sergio Luis Martins's avatar
Sergio Luis Martins committed
89
    QSize sizeHint() const;
90
    virtual KOrg::CalPrinterBase::PrintType printType();
91

92 93
  public slots:
    virtual void updateView();
94
    virtual void showDates( const QDate &start, const QDate &end );
95
    virtual void showIncidences( const Akonadi::Item::List &incidenceList, const QDate &date );
96

97 98
    void clearSelection();

99 100
    void showDates();
    void hideDates();
101

102
    void changeIncidenceDisplay( const Akonadi::Item &, int );
103

Allen Winter's avatar
Allen Winter committed
104 105
    void defaultItemAction( Q3ListViewItem *item );
    void popupMenu( Q3ListViewItem *item, const QPoint &, int );
106

107 108
  protected slots:
    void processSelectionChange();
109

110
  protected:
111 112
    void addIncidences( const Akonadi::Item::List &incidenceList, const QDate & );
    void addIncidence( const Akonadi::Item &, const QDate &date );
113 114

  private:
115
    KOListViewItem *getItemForIncidence( const Akonadi::Item & );
Sergio Luis Martins's avatar
Sergio Luis Martins committed
116
    KCalCore::Incidence::Ptr incidenceForId( const Akonadi::Item::Id &id ) const;
117

118
  private:
119
    class ListItemVisitor;
Laurent Montel's avatar
Laurent Montel committed
120
    K3ListView *mListView;
121 122
    KOEventPopupMenu *mPopupMenu;
    KOListViewItem *mActiveItem;
123 124
    QHash<Akonadi::Item::Id,Akonadi::Item> mItems;
    QHash<Akonadi::Item::Id, QDate> mDateList;
125 126
    QDate mStartDate;
    QDate mEndDate;
127
    DateList mSelectedDates;
Sergio Luis Martins's avatar
Sergio Luis Martins committed
128 129 130

    // if it's non interactive we disable context menu, and incidence editing
    bool mIsNonInteractive;
131 132 133
};

#endif