korganizer

resourceview.h
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21 As a special exception, permission is given to link this program
22 with any edition of TQt, and distribute the resulting executable,
23 without including the source code for TQt in the source distribution.
24*/
25#ifndef KORG_RESOURCEVIEW_H
26#define KORG_RESOURCEVIEW_H
27
28#include "calendarview.h"
29
30#include <tqlistview.h>
31
32namespace KCal {
34 class ResourceCalendar;
35}
36using namespace KCal;
37class TDEListView;
38class ResourceView;
39class TQPushButton;
40
41class ResourceViewFactory : public CalendarViewExtension::Factory
42{
43 public:
44 ResourceViewFactory( CalendarResources *calendar, CalendarView *view );
45
46 CalendarViewExtension *create( TQWidget * );
47
48 ResourceView *resourceView() const;
49
50 private:
51 CalendarResources *mCalendar;
52 CalendarView *mCalendarView;
53 ResourceView *mResourceView;
54};
55
56
57class ResourceItem : public TQCheckListItem
58{
59 public:
60 ResourceItem( ResourceCalendar *resource, ResourceView *view, TDEListView *parent );
61 ResourceItem( ResourceCalendar *resource, const TQString &identifier,
62 const TQString &label, ResourceView *view, ResourceItem *parent );
63
64 ResourceCalendar *resource() { return mResource; }
65 const TQString& resourceIdentifier() { return mResourceIdentifier; }
66 bool isSubresource() const { return mIsSubresource; }
67 void createSubresourceItems();
68 void setStandardResource( bool std );
69 void update();
70
71 virtual void paintCell(TQPainter *p, const TQColorGroup &cg,
72 int column, int width, int alignment);
73
74 void setResourceColor(TQColor& color);
75 TQColor &resourceColor() {return mResourceColor;}
76
77 protected:
78 void stateChange( bool active );
79 void setGuiState();
80 TQColor mResourceColor;
81
82 private:
83 ResourceCalendar *mResource;
84 ResourceView *mResourceView;
85 bool mBlockStateChange;
86 bool mIsSubresource;
87 TQString mResourceIdentifier;
88 bool mSubItemsCreated;
89 bool mIsStandardResource;
90};
91
95class ResourceView : public CalendarViewExtension
96{
97 TQ_OBJECT
98
99 public:
101 TQWidget *parent = 0, const char *name = 0 );
103
104 CalendarResources *calendar() const { return mCalendar; }
105
106 void updateView();
107
108 void emitResourcesChanged();
109
110 void requestClose( ResourceCalendar *resource );
111
112 void showButtons( bool visible );
113
114 public slots:
115 void addResourceItem( ResourceCalendar *resource );
116 void updateResourceItem( ResourceCalendar *resource );
117
118 signals:
119 void resourcesChanged();
120
121 protected:
122 ResourceItem *findItem( ResourceCalendar *resource );
123 ResourceItem *findItemByIdentifier( const TQString &identifier );
124 ResourceItem *currentItem();
125
126 protected slots:
127 void addResource();
128 void removeResource();
129 void editResource();
130 void currentChanged( TQListViewItem *lvitem );
131 void slotSubresourceAdded( ResourceCalendar *resource, const TQString &type,
132 const TQString &identifier, const TQString &label );
133
134 void slotSubresourceRemoved( ResourceCalendar *resource, const TQString &type,
135 const TQString &identifier );
136 void closeResource( ResourceCalendar *resource );
137
138 void contextMenuRequested ( TQListViewItem *lvitem, const TQPoint &pos, int );
139
140 void assignColor();
141 void disableColor();
142 void showInfo();
143
144 void reloadResource();
145 void saveResource();
146
147 void setStandard();
148 void updateResourceList();
149
150 private:
151 TDEListView *mListView;
152 CalendarResources *mCalendar;
153 CalendarView *mCalendarView;
154 TQPushButton *mAddButton;
155 TQPushButton *mDeleteButton;
156 TQPushButton *mEditButton;
157 TQPtrList<ResourceCalendar> mResourcesToClose;
158};
159
160#endif
This is the main calendar widget.
Definition: calendarview.h:82
This class provides a view of calendar resources.
Definition: resourceview.h:96
bool view(TQWidget *parent, Attachment *attachment)