kalarm

templatelistview.h
1/*
2 * templatelistview.h - widget showing list of alarm templates
3 * Program: kalarm
4 * Copyright (C) 2004, 2005 by David Jarvie <software@astrojar.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef TEMPLATELISTVIEW_H
22#define TEMPLATELISTVIEW_H
23
24#include "kalarm.h"
25
26#include <tqmap.h>
27#include <tdelistview.h>
28
29#include "eventlistviewbase.h"
30
31class TemplateListView;
32
33
34class TemplateListViewItem : public EventListViewItemBase
35{
36 public:
37 TemplateListViewItem(TemplateListView* parent, const KAEvent&);
38 TemplateListView* templateListView() const { return (TemplateListView*)listView(); }
39 // Overridden base class methods
40 TemplateListViewItem* nextSibling() const { return (TemplateListViewItem*)TQListViewItem::nextSibling(); }
41 virtual TQString key(int column, bool ascending) const;
42 protected:
43 virtual TQString lastColumnText() const;
44 private:
45 TQString mIconOrder; // controls ordering of icon column
46};
47
48
49class TemplateListView : public EventListViewBase
50{
51 TQ_OBJECT
52
53 public:
54 explicit TemplateListView(bool includeCmdAlarms, const TQString& whatsThisText, TQWidget* parent = 0, const char* name = 0);
55 ~TemplateListView();
56 int iconColumn() const { return mIconColumn; }
57 int nameColumn() const { return mNameColumn; }
58 // Overridden base class methods
59 static void addEvent(const KAEvent& e, EventListViewBase* v)
60 { EventListViewBase::addEvent(e, mInstanceList, v); }
61 static void modifyEvent(const KAEvent& e, EventListViewBase* v)
62 { EventListViewBase::modifyEvent(e.id(), e, mInstanceList, v); }
63 static void modifyEvent(const TQString& oldEventID, const KAEvent& newEvent, EventListViewBase* v)
64 { EventListViewBase::modifyEvent(oldEventID, newEvent, mInstanceList, v); }
65 static void deleteEvent(const TQString& eventID)
66 { EventListViewBase::deleteEvent(eventID, mInstanceList); }
67 TemplateListViewItem* getEntry(const TQString& eventID) { return (TemplateListViewItem*)EventListViewBase::getEntry(eventID); }
68 TemplateListViewItem* selectedItem() const { return (TemplateListViewItem*)EventListViewBase::selectedItem(); }
69 TemplateListViewItem* currentItem() const { return (TemplateListViewItem*)EventListViewBase::currentItem(); }
70 TemplateListViewItem* firstChild() const { return (TemplateListViewItem*)EventListViewBase::firstChild(); }
71 virtual void setSelected(TQListViewItem* item, bool selected) { EventListViewBase::setSelected(item, selected); }
72 virtual void setSelected(TemplateListViewItem* item, bool selected) { EventListViewBase::setSelected(item, selected); }
73 virtual TQValueList<EventListViewBase*> instances() { return mInstanceList; }
74
75 protected:
76 virtual void populate();
77 EventListViewItemBase* createItem(const KAEvent&);
78 virtual TQString whatsThisText(int column) const;
79
80 private:
81 static TQValueList<EventListViewBase*> mInstanceList;
82 TQString mWhatsThisText; // default TQWhatsThis text
83 int mIconColumn; // index to icon column
84 int mNameColumn; // index to template name column
85 bool mExcludeCmdAlarms; // omit command alarms from the list
86};
87
88#endif // TEMPLATELISTVIEW_H
89
KAEvent corresponds to a KCal::Event instance.
Definition: alarmevent.h:232