korganizer
resourceview.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KORG_RESOURCEVIEW_H
00026 #define KORG_RESOURCEVIEW_H
00027
00028 #include "calendarview.h"
00029
00030 #include <libkcal/resourcecalendar.h>
00031 #include <qlistview.h>
00032
00033 namespace KCal {
00034 class CalendarResources;
00035 }
00036 using namespace KCal;
00037 class KListView;
00038 class ResourceView;
00039 class QPushButton;
00040
00041 class ResourceViewFactory : public CalendarViewExtension::Factory
00042 {
00043 public:
00044 ResourceViewFactory( KCal::CalendarResources *calendar,
00045 CalendarView *view );
00046
00047 CalendarViewExtension *create( QWidget * );
00048
00049 ResourceView *resourceView() const;
00050
00051 private:
00052 KCal::CalendarResources *mCalendar;
00053 CalendarView *mView;
00054 ResourceView *mResourceView;
00055 };
00056
00057
00058 class ResourceItem : public QCheckListItem
00059 {
00060 public:
00061 ResourceItem( KCal::ResourceCalendar *resource, ResourceView *view,
00062 KListView *parent );
00063 ResourceItem( KCal::ResourceCalendar *resource, const QString& sub,
00064 const QString& label, ResourceView *view,
00065 ResourceItem* parent );
00066
00067 KCal::ResourceCalendar *resource() { return mResource; }
00068 const QString& resourceIdentifier() { return mResourceIdentifier; }
00069 bool isSubresource() const { return mIsSubresource; }
00070 void createSubresourceItems();
00071 void setStandardResource( bool std );
00072
00073 void update();
00074
00075 virtual void paintCell(QPainter *p, const QColorGroup &cg,
00076 int column, int width, int alignment);
00077
00078 void setResourceColor(QColor& color);
00079 QColor &resourceColor() {return mResourceColor;}
00080 protected:
00081 void stateChange( bool active );
00082
00083 void setGuiState();
00084 QColor mResourceColor;
00085
00086 private:
00087 KCal::ResourceCalendar *mResource;
00088 ResourceView *mView;
00089 bool mBlockStateChange;
00090 bool mIsSubresource;
00091 QString mResourceIdentifier;
00092 bool mSubItemsCreated;
00093 bool mIsStandardResource;
00094 };
00095
00099 class ResourceView : public CalendarViewExtension
00100 {
00101 Q_OBJECT
00102 public:
00103 ResourceView( KCal::CalendarResources *calendar, QWidget *parent = 0,
00104 const char *name = 0 );
00105 ~ResourceView();
00106
00107 KCal::CalendarResources *calendar() const { return mCalendar; }
00108
00109 void updateView();
00110
00111 void emitResourcesChanged();
00112
00113 void requestClose( ResourceCalendar * );
00114
00115 void showButtons( bool visible );
00116
00117 public slots:
00118 void addResourceItem( ResourceCalendar * );
00119 void updateResourceItem( ResourceCalendar * );
00120
00121 signals:
00122 void resourcesChanged();
00123
00124 protected:
00125 ResourceItem *findItem( ResourceCalendar * );
00126 ResourceItem *findItemByIdentifier( const QString& id );
00127 ResourceItem *currentItem();
00128
00129 protected slots:
00130 void addResource();
00131 void removeResource();
00132 void editResource();
00133 void currentChanged( QListViewItem* );
00134 void slotSubresourceAdded( ResourceCalendar *, const QString &,
00135 const QString &resource,const QString& label );
00136 void slotSubresourceRemoved( ResourceCalendar *, const QString &,
00137 const QString & );
00138 void closeResource( ResourceCalendar * );
00139
00140 void contextMenuRequested ( QListViewItem *i, const QPoint &pos, int );
00141
00142 void assignColor();
00143 void disableColor();
00144 void showInfo();
00145
00146 void reloadResource();
00147 void saveResource();
00148
00149 void setStandard();
00150 void updateResourceList();
00151
00152 private:
00153 KListView *mListView;
00154 KCal::CalendarResources *mCalendar;
00155 QPushButton *mAddButton;
00156 QPushButton *mDeleteButton;
00157 QPushButton *mEditButton;
00158 QPtrList<ResourceCalendar> mResourcesToClose;
00159 };
00160
00161 #endif
|