korganizer Library API Documentation

kotodoview.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 #ifndef KOTODOVIEW_H
00024 #define KOTODOVIEW_H
00025 
00026 #include <qfont.h>
00027 #include <qfontmetrics.h>
00028 #include <qlineedit.h>
00029 #include <qptrlist.h>
00030 #include <qstrlist.h>
00031 #include <qlistbox.h>
00032 #include <qpopupmenu.h>
00033 #include <qlabel.h>
00034 #include <qmap.h>
00035 #include <qlistview.h>
00036 #include <klistview.h>
00037 
00038 #include <libkcal/calendar.h>
00039 #include <libkcal/todo.h>
00040 
00041 #include <korganizer/baseview.h>
00042 
00043 #include "kotodoviewitem.h"
00044 #include "koprefs.h"
00045 #include "koglobals.h"
00046 
00047 class QDragEnterEvent;
00048 class QDragMoveEvent;
00049 class QDragLeaveEvent;
00050 class QDropEvent;
00051 
00052 class DocPrefs;
00053 
00054 class KOTodoListView : public KListView
00055 {
00056     Q_OBJECT
00057   public:
00058     KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
00059     virtual ~KOTodoListView() {}
00060 
00061   signals:
00062     void todoDropped(Todo *);
00063     void doubleClicked(QListViewItem *,const QPoint &,int);
00064 
00065   protected:
00066     void contentsDragEnterEvent(QDragEnterEvent *);
00067     void contentsDragMoveEvent(QDragMoveEvent *);
00068     void contentsDragLeaveEvent(QDragLeaveEvent *);
00069     void contentsDropEvent(QDropEvent *);
00070 
00071     void contentsMousePressEvent(QMouseEvent *);
00072     void contentsMouseMoveEvent(QMouseEvent *);
00073     void contentsMouseReleaseEvent(QMouseEvent *);
00074     void contentsMouseDoubleClickEvent(QMouseEvent *);
00075 
00076   private:
00077     Calendar *mCalendar;
00078 
00079     QPoint mPressPos;
00080     bool mMousePressed;
00081     QListViewItem *mOldCurrent;
00082 };
00083 
00084 
00091 class KOTodoView : public KOrg::BaseView
00092 {
00093     Q_OBJECT
00094   public:
00095     KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
00096     ~KOTodoView();
00097 
00098     QPtrList<Incidence> selectedIncidences();
00099     QPtrList<Todo> selectedTodos();
00100     
00101     DateList selectedDates()
00102       {DateList q;
00103        return q;}
00104 
00106     int currentDateCount() { return 0; }
00107 
00108     void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
00109 
00110     void setDocumentId( const QString & );
00111     
00112     void saveLayout(KConfig *config, const QString &group) const;
00113     void restoreLayout(KConfig *config, const QString &group);
00115     QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
00116 
00117   public slots:
00118     void updateView();
00119     void updateConfig();
00120 
00121     void changeEventDisplay(Event *, int);
00122 
00123     void showDates(const QDate &start, const QDate &end);
00124     void showEvents(QPtrList<Event> eventList);
00125 
00126     void clearSelection();
00127 
00128     void editItem(QListViewItem *item,const QPoint &,int);
00129     void showItem(QListViewItem *item,const QPoint &,int);
00130     void popupMenu(QListViewItem *item,const QPoint &,int);
00131     void newTodo();
00132     void newSubTodo();
00133     void showTodo();
00134     void editTodo();
00135     void deleteTodo();
00136 
00137     void setNewPriority(int);
00138     void setNewPercentage(int);
00139     void changedCategories(int);
00140 
00141     void purgeCompleted();
00142     
00143     void itemClicked(QListViewItem *);
00144     void itemStateChanged(QListViewItem *);
00145     void modified(bool);
00146 
00147   signals:
00148     void newTodoSignal();
00149     void newSubTodoSignal(Todo *);
00150     void showTodoSignal(Todo *);
00151 
00152     void editTodoSignal(Todo *);
00153     void deleteTodoSignal(Todo *);
00154     void todoModifiedSignal (Todo *, int);
00155 
00156     void isModified(bool);
00157 
00158     void purgeCompletedSignal();
00159 
00160   protected slots:
00161     void processSelectionChange();
00162 
00163     void setTodoModified();
00164 
00165   private:
00166     /*
00167      * the TodoEditor approach is rather unscaling in the long
00168      * run.
00169      * Korganizer keeps it in memory and we need to update
00170      * 1. make KOTodoViewItem a QObject again?
00171      * 2. add a public method for setting one todo modified?
00172      * 3. add a private method for setting a todo modified + friend here?
00173      *  -- zecke 2002-07-08
00174      */
00175     friend class KOTodoViewItem;
00176     void setTodoModifiedDelayed( Todo * );
00177     QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
00178     void restoreItemState( QListViewItem * );
00179 
00180     KOTodoListView *mTodoListView;
00181     QPopupMenu *mItemPopupMenu;
00182     QPopupMenu *mPopupMenu;
00183     QPopupMenu *mPriorityPopupMenu;
00184     QPopupMenu *mPercentageCompletedPopupMenu;
00185     QPopupMenu *mCategoryPopupMenu;
00186 
00187     QMap<int, int> mPercentage;
00188     QMap<int, int> mPriority;
00189     QMap<int, QString> mCategory;
00190 
00191     KOTodoViewItem *mActiveItem;
00192 
00193     QMap<Todo *,KOTodoViewItem *> mTodoMap;
00194 
00195     DocPrefs *mDocPrefs;
00196     QString mCurrentDoc;
00197 
00198     Todo *mTodo;
00199 };
00200 
00201 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:32 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001