korganizer

kolistview.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 1999 Preston Brown <pbrown@kde.org>
00005     Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
00006     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of Qt, and distribute the resulting executable,
00024     without including the source code for Qt in the source distribution.
00025 */
00026 #ifndef _KOLISTVIEW_H
00027 #define _KOLISTVIEW_H
00028 
00029 #include <qdict.h>
00030 #include <qmap.h>
00031 #include <qtooltip.h>
00032 
00033 #include <libkcal/incidence.h>
00034 
00035 #include "koeventview.h"
00036 #include "customlistviewitem.h"
00037 
00038 using namespace KCal;
00039 
00040 typedef CustomListViewItem<Incidence *> KOListViewItem;
00041 
00042 class KOListView;
00043 
00044 class KOListViewToolTip : public QToolTip
00045 {
00046   public:
00047     KOListViewToolTip ( QWidget* parent, Calendar *calendar, KListView* lv );
00048 
00049   protected:
00050     void maybeTip( const QPoint &pos );
00051 
00052   private:
00053     Calendar *mCalendar;
00054     KListView* eventlist;
00055 };
00056 
00057 
00068 class KOListView : public KOEventView
00069 {
00070     Q_OBJECT
00071   public:
00072    explicit KOListView( Calendar *calendar,
00073                         QWidget *parent = 0,
00074                         const char *name = 0,
00075                         bool nonInteractive = false );
00076     ~KOListView();
00077 
00078     virtual int maxDatesHint();
00079     virtual int currentDateCount();
00080     virtual Incidence::List selectedIncidences();
00081     virtual DateList selectedIncidenceDates();
00082 
00083     void showDates( bool show );
00084 
00085     // Shows all incidences of the calendar
00086     void showAll();
00087 
00088     void readSettings(KConfig *config);
00089     void writeSettings(KConfig *config);
00090 
00091     void clear();
00092 
00093   public slots:
00094     virtual void updateView();
00095     virtual void showDates( const QDate &start, const QDate &end );
00096     virtual void showIncidences( const Incidence::List &incidenceList, const QDate &date );
00097 
00098     void clearSelection();
00099 
00100     void showDates();
00101     void hideDates();
00102 
00103     void changeIncidenceDisplay(Incidence *, int);
00104 
00105     void defaultItemAction(QListViewItem *item);
00106     void popupMenu(QListViewItem *item,const QPoint &,int);
00107 
00108   protected slots:
00109     void processSelectionChange();
00110 
00111   protected:
00112     void addIncidences(const Incidence::List &, const QDate &date);
00113     void addIncidence(Incidence *,  const QDate &date);
00114     KOListViewItem *getItemForIncidence(Incidence *incidence);
00115 
00116   private:
00117     class ListItemVisitor;
00118     KListView *mListView;
00119     KOEventPopupMenu *mPopupMenu;
00120     KOListViewItem *mActiveItem;
00121     QDict<Incidence> mUidDict;
00122     QMap<QString, QDate>mDateList;
00123     DateList mSelectedDates;
00124 
00125     // if it's non interactive we disable context menu, and incidence editing
00126     bool mIsNonInteractive;
00127 };
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys