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 
00066     KCal::ResourceCalendar *resource() { return mResource; }
00067     const QString& resourceIdentifier() { return mResourceIdentifier; }
00068     bool isSubresource() const { return mIsSubresource; }
00069     void createSubresourceItems();
00070 
00071     void update();
00072 
00073   protected:
00074     void stateChange( bool active );
00075 
00076     void setGuiState();
00077 
00078   private:
00079     KCal::ResourceCalendar *mResource;
00080     ResourceView *mView;
00081     bool mBlockStateChange;
00082     bool mIsSubresource;
00083     QString mResourceIdentifier;
00084     bool mSubItemsCreated;
00085 };
00086 
00090 class ResourceView : public CalendarViewExtension
00091 {
00092     Q_OBJECT
00093   public:
00094     ResourceView( KCal::CalendarResources *calendar, QWidget *parent = 0,
00095                   const char *name = 0 );
00096     ~ResourceView();
00097 
00098     KCal::CalendarResources *calendar() const { return mCalendar; }
00099 
00100     void updateView();
00101 
00102     void emitResourcesChanged();
00103 
00104     void requestClose( ResourceCalendar * );
00105 
00106     void showButtons( bool visible );
00107 
00108   public slots:
00109     void addResourceItem( ResourceCalendar * );
00110     void updateResourceItem( ResourceCalendar * );
00111 
00112   signals:
00113     void resourcesChanged();
00114 
00115   protected:
00116     ResourceItem *findItem( ResourceCalendar * );
00117     ResourceItem *findItemByIdentifier( const QString& id );
00118     ResourceItem *currentItem();
00119 
00120   protected slots:
00121     void addResource();
00122     void removeResource();
00123     void editResource();
00124     void currentChanged( QListViewItem* );
00125     void slotSubresourceAdded( ResourceCalendar *, const QString &,
00126                                const QString &resource,const QString& label );
00127     // FIXME proko2: merge once we are back in head by porting imap resource
00128     void slotSubresourceAdded( ResourceCalendar *, const QString &,
00129                                const QString &resource );
00130 
00131     void slotSubresourceRemoved( ResourceCalendar *, const QString &,
00132                                  const QString &resource );
00133     void closeResource( ResourceCalendar * );
00134 
00135     void contextMenuRequested ( QListViewItem *i, const QPoint &pos, int );
00136 
00137     void showInfo();
00138   
00139     void reloadResource();
00140     void saveResource();
00141 
00142   private:
00143     KListView *mListView;
00144     KCal::CalendarResources *mCalendar;
00145     QPushButton *mAddButton;
00146     QPushButton *mDeleteButton;
00147     QPushButton *mEditButton;
00148     QPtrList<ResourceCalendar> mResourcesToClose;
00149 };
00150 #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 Mon Apr 4 04:49:28 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003