21 #ifndef EVENTLISTVIEWBASE_H
22 #define EVENTLISTVIEWBASE_H
26 #include <tqvaluelist.h>
27 #include <tdelistview.h>
32 class EventListViewItemBase;
36 class EventListViewBase :
public TDEListView
41 typedef TQValueList<EventListViewBase*> InstanceList;
42 typedef TQValueListIterator<EventListViewBase*> InstanceListIterator;
43 typedef TQValueListConstIterator<EventListViewBase*> InstanceListConstIterator;
45 EventListViewBase(TQWidget* parent = 0,
const char* name = 0);
46 virtual ~EventListViewBase() { }
47 EventListViewItemBase* getEntry(
const TQString& eventID)
const;
48 void addEvent(
const KAEvent& e) { addEvent(e, instances(),
this); }
49 void modifyEvent(
const KAEvent& e)
50 { modifyEvent(e.id(), e, instances(),
this); }
51 void modifyEvent(
const TQString& oldEventID,
const KAEvent& newEvent)
52 { modifyEvent(oldEventID, newEvent, instances(),
this); }
53 void deleteEvent(
const TQString& eventID) { deleteEvent(eventID, instances()); }
54 static void addEvent(
const KAEvent&,
const InstanceList&, EventListViewBase* selectionView);
55 static void modifyEvent(
const KAEvent& e,
const InstanceList& list, EventListViewBase* selectionView)
56 { modifyEvent(e.id(), e, list, selectionView); }
57 static void modifyEvent(
const TQString& oldEventID,
const KAEvent& newEvent,
const InstanceList&, EventListViewBase* selectionView);
58 static void deleteEvent(
const TQString& eventID,
const InstanceList&);
59 static void undeleteEvent(
const TQString& oldEventID,
const KAEvent& event,
const InstanceList& list, EventListViewBase* selectionView)
60 { modifyEvent(oldEventID, event, list, selectionView); }
61 void resizeLastColumn();
63 EventListViewItemBase* currentItem()
const {
return (EventListViewItemBase*)TDEListView::currentItem(); }
64 EventListViewItemBase* firstChild()
const {
return (EventListViewItemBase*)TDEListView::firstChild(); }
65 bool anySelected()
const;
66 const KAEvent* selectedEvent()
const;
67 EventListViewItemBase* selectedItem()
const;
68 TQValueList<EventListViewItemBase*> selectedItems()
const;
69 int selectedCount()
const;
70 int lastColumn()
const {
return mLastColumn; }
71 virtual TQString whatsThisText(
int column)
const = 0;
72 virtual InstanceList instances() = 0;
76 virtual void slotFind();
77 virtual void slotFindNext() { findNext(
true); }
78 virtual void slotFindPrev() { findNext(
false); }
79 virtual void slotSelectAll();
80 virtual void slotDeselect();
84 void findActive(
bool);
87 virtual void populate() = 0;
88 virtual EventListViewItemBase* createItem(
const KAEvent&) = 0;
89 virtual bool shouldShowEvent(
const KAEvent&)
const {
return true; }
90 EventListViewItemBase* addEntry(
const KAEvent&,
bool setSize =
false,
bool reselect =
false);
91 EventListViewItemBase* addEntry(EventListViewItemBase*,
bool setSize,
bool reselect);
92 EventListViewItemBase* updateEntry(EventListViewItemBase*,
const KAEvent& newEvent,
bool setSize =
false,
bool reselect =
false);
93 void addLastColumn(
const TQString& title);
94 virtual void showEvent(TQShowEvent*);
95 virtual void resizeEvent(TQResizeEvent*);
98 void deleteEntry(EventListViewItemBase*,
bool setSize =
false);
99 void findNext(
bool forward);
103 int mLastColumnHeaderWidth;
107 class EventListViewItemBase :
public TQListViewItem
110 EventListViewItemBase(EventListViewBase* parent,
const KAEvent&);
111 const KAEvent& event()
const {
return mEvent; }
112 TQPixmap* eventIcon()
const;
113 int lastColumnWidth()
const {
return mLastColumnWidth; }
114 EventListViewItemBase* nextSibling()
const {
return (EventListViewItemBase*)TQListViewItem::nextSibling(); }
115 static int iconWidth();
118 void setLastColumnText();
119 virtual TQString lastColumnText()
const = 0;
122 static TQPixmap* mTextIcon;
123 static TQPixmap* mFileIcon;
124 static TQPixmap* mCommandIcon;
125 static TQPixmap* mEmailIcon;
126 static int mIconWidth;
129 int mLastColumnWidth;
represents calendar alarms and events
KAEvent corresponds to a KCal::Event instance.