21 #ifndef ALARMLISTVIEW_H
22 #define ALARMLISTVIEW_H
25 #include "eventlistviewbase.h"
28 class AlarmListTooltip;
31 class AlarmListViewItem :
public EventListViewItemBase
34 AlarmListViewItem(AlarmListView* parent,
const KAEvent&,
const TQDateTime& now);
35 TQTime showTimeToAlarm(
bool show);
36 void updateTimeToAlarm(
const TQDateTime& now,
bool forceDisplay =
false);
37 virtual void paintCell(TQPainter*,
const TQColorGroup&,
int column,
int width,
int align);
38 AlarmListView* alarmListView()
const {
return (AlarmListView*)listView(); }
39 bool messageTruncated()
const {
return mMessageTruncated; }
40 int messageColWidthNeeded()
const {
return mMessageColWidth; }
41 static int typeIconWidth(AlarmListView*);
43 AlarmListViewItem* nextSibling()
const {
return (AlarmListViewItem*)TQListViewItem::nextSibling(); }
44 virtual TQString key(
int column,
bool ascending)
const;
46 virtual TQString lastColumnText()
const {
return alarmText(event()); }
48 TQString alarmText(
const KAEvent&)
const;
49 TQString alarmTimeText(
const DateTime&)
const;
50 TQString timeToAlarmText(
const TQDateTime& now)
const;
52 static int mTimeHourPos;
53 static int mDigitWidth;
54 TQString mDateTimeOrder;
55 TQString mRepeatOrder;
56 TQString mColourOrder;
58 mutable int mMessageColWidth;
59 mutable bool mMessageTruncated;
60 bool mTimeToAlarmShown;
64 class AlarmListView :
public EventListViewBase
70 TIME_COLUMN, TIME_TO_COLUMN, REPEAT_COLUMN, COLOUR_COLUMN, TYPE_COLUMN, MESSAGE_COLUMN,
74 AlarmListView(
const TQValueList<int>& order, TQWidget* parent = 0,
const char* name = 0);
76 void showExpired(
bool show) { mShowExpired = show; }
77 bool showingExpired()
const {
return mShowExpired; }
78 bool showingTimeTo()
const {
return columnWidth(mColumn[TIME_TO_COLUMN]); }
79 void selectTimeColumns(
bool time,
bool timeTo);
80 void updateTimeToAlarms(
bool forceDisplay =
false);
81 bool expired(AlarmListViewItem*)
const;
82 bool drawMessageInColour()
const {
return mDrawMessageInColour; }
83 void setDrawMessageInColour(
bool inColour) { mDrawMessageInColour = inColour; }
84 TQValueList<int> columnOrder()
const;
85 int column(ColumnIndex i)
const {
return mColumn[i]; }
86 static bool dragging() {
return mDragging; }
88 static void addEvent(
const KAEvent&, EventListViewBase*);
89 static void modifyEvent(
const KAEvent& e, EventListViewBase* selectionView)
90 { EventListViewBase::modifyEvent(e.id(), e, mInstanceList, selectionView); }
91 static void modifyEvent(
const TQString& oldEventID,
const KAEvent& newEvent, EventListViewBase* selectionView)
92 { EventListViewBase::modifyEvent(oldEventID, newEvent, mInstanceList, selectionView); }
93 static void deleteEvent(
const TQString& eventID)
94 { EventListViewBase::deleteEvent(eventID, mInstanceList); }
95 static void undeleteEvent(
const TQString& oldEventID,
const KAEvent& event, EventListViewBase* selectionView)
96 { EventListViewBase::modifyEvent(oldEventID, event, mInstanceList, selectionView); }
97 AlarmListViewItem* getEntry(
const TQString& eventID) {
return (AlarmListViewItem*)EventListViewBase::getEntry(eventID); }
98 AlarmListViewItem* currentItem()
const {
return (AlarmListViewItem*)EventListViewBase::currentItem(); }
99 AlarmListViewItem* firstChild()
const {
return (AlarmListViewItem*)EventListViewBase::firstChild(); }
100 AlarmListViewItem* selectedItem()
const {
return (AlarmListViewItem*)EventListViewBase::selectedItem(); }
101 virtual void setSelected(TQListViewItem* item,
bool selected) { EventListViewBase::setSelected(item, selected); }
102 virtual void setSelected(AlarmListViewItem* item,
bool selected) { EventListViewBase::setSelected(item, selected); }
103 virtual InstanceList instances() {
return mInstanceList; }
106 virtual void populate();
107 EventListViewItemBase* createItem(
const KAEvent&);
108 virtual TQString whatsThisText(
int column)
const;
109 virtual bool shouldShowEvent(
const KAEvent& e)
const {
return mShowExpired || !e.expired(); }
110 AlarmListViewItem* addEntry(
const KAEvent& e,
bool setSize =
false)
111 {
return addEntry(e, TQDateTime::currentDateTime(), setSize); }
112 AlarmListViewItem* updateEntry(AlarmListViewItem* item,
const KAEvent& newEvent,
bool setSize =
false)
113 {
return (AlarmListViewItem*)EventListViewBase::updateEntry(item, newEvent, setSize); }
114 virtual void contentsMousePressEvent(TQMouseEvent*);
115 virtual void contentsMouseMoveEvent(TQMouseEvent*);
116 virtual void contentsMouseReleaseEvent(TQMouseEvent*);
119 AlarmListViewItem* addEntry(
const KAEvent&,
const TQDateTime& now,
bool setSize =
false,
bool reselect =
false);
121 static InstanceList mInstanceList;
122 static bool mDragging;
123 int mColumn[COLUMN_COUNT];
124 int mTimeColumnHeaderWidth;
125 int mTimeToColumnHeaderWidth;
126 AlarmListTooltip* mTooltip;
127 TQPoint mMousePressPos;
129 bool mDrawMessageInColour;
KAEvent corresponds to a KCal::Event instance.