korganizer
kolistview.h
00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 1999 Preston Brown <pbrown@kde.org> 00005 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 00006 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00021 00022 As a special exception, permission is given to link this program 00023 with any edition of Qt, and distribute the resulting executable, 00024 without including the source code for Qt in the source distribution. 00025 */ 00026 #ifndef _KOLISTVIEW_H 00027 #define _KOLISTVIEW_H 00028 00029 #include <qdict.h> 00030 #include <qtooltip.h> 00031 00032 #include <libkcal/incidence.h> 00033 00034 #include "koeventview.h" 00035 #include "customlistviewitem.h" 00036 00037 using namespace KCal; 00038 00039 typedef CustomListViewItem<Incidence *> KOListViewItem; 00040 00041 class KOListView; 00042 00043 class KOListViewToolTip : public QToolTip 00044 { 00045 public: 00046 KOListViewToolTip (QWidget* parent, Calendar *calendar, KListView* lv ); 00047 00048 protected: 00049 void maybeTip( const QPoint & pos); 00050 00051 private: 00052 Calendar *mCalendar; 00053 KListView* eventlist; 00054 }; 00055 00056 00067 class KOListView : public KOEventView 00068 { 00069 Q_OBJECT 00070 public: 00071 KOListView(Calendar *calendar, QWidget *parent = 0, 00072 const char *name = 0); 00073 ~KOListView(); 00074 00075 virtual int maxDatesHint(); 00076 virtual int currentDateCount(); 00077 virtual Incidence::List selectedIncidences(); 00078 virtual DateList selectedDates(); 00079 00080 void showDates(bool show); 00081 00082 void readSettings(KConfig *config); 00083 void writeSettings(KConfig *config); 00084 00085 void clear(); 00086 00087 public slots: 00088 virtual void updateView(); 00089 virtual void showDates( const QDate &start, const QDate &end ); 00090 virtual void showIncidences( const Incidence::List &incidenceList ); 00091 00092 void clearSelection(); 00093 00094 void showDates(); 00095 void hideDates(); 00096 00097 void changeIncidenceDisplay(Incidence *, int); 00098 00099 void defaultItemAction(QListViewItem *item); 00100 void popupMenu(QListViewItem *item,const QPoint &,int); 00101 00102 protected slots: 00103 void processSelectionChange(); 00104 00105 protected: 00106 void addIncidences( const Incidence::List & ); 00107 void addIncidence(Incidence *); 00108 KOListViewItem *getItemForIncidence(Incidence *incidence); 00109 00110 private: 00111 class ListItemVisitor; 00112 KListView *mListView; 00113 KOEventPopupMenu *mPopupMenu; 00114 KOListViewItem *mActiveItem; 00115 QDict<Incidence> mUidDict; 00116 DateList mSelectedDates; 00117 }; 00118 00119 #endif