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, KListView* lv ); 00047 00048 protected: 00049 void maybeTip( const QPoint & pos); 00050 00051 private: 00052 KListView* eventlist; 00053 }; 00054 00055 00066 class KOListView : public KOEventView 00067 { 00068 Q_OBJECT 00069 public: 00070 KOListView(Calendar *calendar, QWidget *parent = 0, 00071 const char *name = 0); 00072 ~KOListView(); 00073 00074 virtual int maxDatesHint(); 00075 virtual int currentDateCount(); 00076 virtual Incidence::List selectedIncidences(); 00077 virtual DateList selectedDates(); 00078 00079 void showDates(bool show); 00080 00081 void readSettings(KConfig *config); 00082 void writeSettings(KConfig *config); 00083 00084 void clear(); 00085 00086 public slots: 00087 virtual void updateView(); 00088 virtual void showDates( const QDate &start, const QDate &end ); 00089 virtual void showIncidences( const Incidence::List &incidenceList ); 00090 00091 void clearSelection(); 00092 00093 void showDates(); 00094 void hideDates(); 00095 00096 void changeIncidenceDisplay(Incidence *, int); 00097 00098 void defaultItemAction(QListViewItem *item); 00099 void popupMenu(QListViewItem *item,const QPoint &,int); 00100 00101 protected slots: 00102 void processSelectionChange(); 00103 00104 protected: 00105 void addIncidences( const Incidence::List & ); 00106 void addIncidence(Incidence *); 00107 KOListViewItem *getItemForIncidence(Incidence *incidence); 00108 00109 private: 00110 class ListItemVisitor; 00111 KListView *mListView; 00112 KOEventPopupMenu *mPopupMenu; 00113 KOListViewItem *mActiveItem; 00114 QDict<Incidence> mUidDict; 00115 DateList mSelectedDates; 00116 }; 00117 00118 #endif