korganizer Library API Documentation

resourceview.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef KORG_RESOURCEVIEW_H
00025 #define KORG_RESOURCEVIEW_H
00026 
00027 #include "calendarview.h"
00028 
00029 #include <libkcal/resourcecalendar.h>
00030 #include <qlistview.h>
00031 
00032 namespace KCal {
00033 class CalendarResources;
00034 }
00035 using namespace KCal;
00036 class KListView;
00037 class ResourceView;
00038 class QPushButton;
00039 
00040 class ResourceViewFactory : public CalendarViewExtension::Factory
00041 {
00042   public:
00043     ResourceViewFactory( KCal::CalendarResources *calendar,
00044                          CalendarView *view );
00045 
00046     CalendarViewExtension *create( QWidget * );
00047 
00048     ResourceView *resourceView() const;
00049 
00050   private:
00051     KCal::CalendarResources *mCalendar;
00052     CalendarView *mView;
00053     ResourceView *mResourceView;
00054 };
00055 
00056 
00057 class ResourceItem : public QCheckListItem
00058 {
00059   public:
00060     ResourceItem( KCal::ResourceCalendar *resource, ResourceView *view,
00061                   KListView *parent );
00062     ResourceItem( KCal::ResourceCalendar *resource, const QString& sub,
00063                   const QString& label, ResourceView *view, 
00064                   ResourceItem* parent );
00065     virtual ~ResourceItem() {}
00066 
00067     KCal::ResourceCalendar *resource() { return mResource; }
00068     const QString& resourceIdentifier() { return mResourceIdentifier; }
00069     bool isSubresource() const { return mIsSubresource; }
00070     void createSubresourceItems();
00071 
00072     void update();
00073 
00074     virtual void paintCell(QPainter *p, const QColorGroup &cg,
00075       int column, int width, int alignment);
00076 
00077     void setResourceColor(QColor& color);
00078     QColor &resourceColor() {return mResourceColor;}
00079   protected:
00080     void stateChange( bool active );
00081 
00082     void setGuiState();
00083     QColor mResourceColor;
00084 
00085   private:
00086     KCal::ResourceCalendar *mResource;
00087     ResourceView *mView;
00088     bool mBlockStateChange;
00089     bool mIsSubresource;
00090     QString mResourceIdentifier;
00091     bool mSubItemsCreated;
00092 };
00093 
00097 class ResourceView : public CalendarViewExtension
00098 {
00099     Q_OBJECT
00100   public:
00101     ResourceView( KCal::CalendarResources *calendar, QWidget *parent = 0,
00102                   const char *name = 0 );
00103     ~ResourceView();
00104 
00105     KCal::CalendarResources *calendar() const { return mCalendar; }
00106 
00107     void updateView();
00108 
00109     void emitResourcesChanged();
00110 
00111     void requestClose( ResourceCalendar * );
00112 
00113     void showButtons( bool visible );
00114 
00115   public slots:
00116     void addResourceItem( ResourceCalendar * );
00117     void updateResourceItem( ResourceCalendar * );
00118 
00119   signals:
00120     void resourcesChanged();
00121 
00122   protected:
00123     ResourceItem *findItem( ResourceCalendar * );
00124     ResourceItem *findItemByIdentifier( const QString& id );
00125     ResourceItem *currentItem();
00126 
00127   protected slots:
00128     void addResource();
00129     void removeResource();
00130     void editResource();
00131     void currentChanged( QListViewItem* );
00132     void slotSubresourceAdded( ResourceCalendar *, const QString &,
00133                                const QString &resource,const QString& label );
00134     // FIXME proko2: merge once we are back in head by porting imap resource
00135     void slotSubresourceAdded( ResourceCalendar *, const QString &,
00136                                const QString &resource );
00137 
00138     void slotSubresourceRemoved( ResourceCalendar *, const QString &,
00139                                  const QString &resource );
00140     void closeResource( ResourceCalendar * );
00141 
00142     void contextMenuRequested ( QListViewItem *i, const QPoint &pos, int );
00143 
00144     void assignColor();
00145     void disableColor();
00146     void showInfo();
00147   
00148     void reloadResource();
00149     void saveResource();
00150 
00151   private:
00152     KListView *mListView;
00153     KCal::CalendarResources *mCalendar;
00154     QPushButton *mAddButton;
00155     QPushButton *mDeleteButton;
00156     QPushButton *mEditButton;
00157     QPtrList<ResourceCalendar> mResourcesToClose;
00158 };
00159 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 2 09:56:06 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003