summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.h
Unidiff
Diffstat (limited to 'korganizer/kolistview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.h42
1 files changed, 24 insertions, 18 deletions
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index 99d0561..9fb0b00 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -3,99 +3,105 @@
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef _KOLISTVIEW_H 24#ifndef _KOLISTVIEW_H
25#define _KOLISTVIEW_H 25#define _KOLISTVIEW_H
26 26
27#include <qlistview.h> 27#include <q3listview.h>
28#include <qmap.h> 28#include <qmap.h>
29#include <qdict.h> 29#include <q3dict.h>
30//Added by qt3to4:
31#include <QMouseEvent>
32#include <Q3PtrList>
33#include <Q3PopupMenu>
34#include <QKeyEvent>
35#include <Q3VBoxLayout>
30 36
31#include <klistview.h> 37#include <klistview.h>
32 38
33#include <libkcal/incidence.h> 39#include <libkcal/incidence.h>
34 40
35#include "koeventview.h" 41#include "koeventview.h"
36#include "customlistviewitem.h" 42#include "customlistviewitem.h"
37 43
38using namespace KCal; 44using namespace KCal;
39 45
40class KOListViewWhatsThis; 46class KOListViewWhatsThis;
41 47
42#include <qpushbutton.h> 48#include <qpushbutton.h>
43#include <qlayout.h> 49#include <qlayout.h>
44#include <qdialog.h> 50#include <qdialog.h>
45#include <qtimer.h> 51#include <qtimer.h>
46#include <qcombobox.h> 52#include <qcombobox.h>
47#include <qspinbox.h> 53#include <qspinbox.h>
48#include <qtooltip.h> 54#include <qtooltip.h>
49#include <qcheckbox.h> 55#include <qcheckbox.h>
50#include <qhbox.h> 56#include <q3hbox.h>
51#include <qlabel.h> 57#include <qlabel.h>
52#include <kiconloader.h> 58#include <kiconloader.h>
53#include "kfiledialog.h" 59#include "kfiledialog.h"
54#include "koprefs.h" 60#include "koprefs.h"
55class KOAlarmPrefs : public QDialog 61class KOAlarmPrefs : public QDialog
56{ 62{
57 Q_OBJECT 63 Q_OBJECT
58 public: 64 public:
59 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : 65 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) :
60 QDialog( par, name, true ) 66 QDialog( par, name, true )
61 { 67 {
62 setCaption( i18n("Alarm Options") ); 68 setCaption( i18n("Alarm Options") );
63 QVBoxLayout* alarmLayout = new QVBoxLayout( this ); 69 Q3VBoxLayout* alarmLayout = new Q3VBoxLayout( this );
64 alarmLayout->setSpacing( 3 ); 70 alarmLayout->setSpacing( 3 );
65 alarmLayout->setMargin( 3 ); 71 alarmLayout->setMargin( 3 );
66 QWidget *parent = this; 72 QWidget *parent = this;
67 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); 73 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent);
68 alarmLayout->addWidget(mAlarmButton); 74 alarmLayout->addWidget(mAlarmButton);
69 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 75 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
70 mAlarmTimeEdit->setValue( 15 ); 76 mAlarmTimeEdit->setValue( 15 );
71 alarmLayout->addWidget(mAlarmTimeEdit); 77 alarmLayout->addWidget(mAlarmTimeEdit);
72 mAlarmIncrCombo = new QComboBox(false, parent); 78 mAlarmIncrCombo = new QComboBox(false, parent);
73 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 79 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
74 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 80 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
75 mAlarmIncrCombo->insertItem(i18n("day(s)")); 81 mAlarmIncrCombo->insertItem(i18n("day(s)"));
76 alarmLayout->addWidget(mAlarmIncrCombo); 82 alarmLayout->addWidget(mAlarmIncrCombo);
77 QHBox * hb = new QHBox ( parent ); 83 Q3HBox * hb = new Q3HBox ( parent );
78 alarmLayout->addWidget(hb); 84 alarmLayout->addWidget(hb);
79 mAlarmSoundButton = new QPushButton(hb); 85 mAlarmSoundButton = new QPushButton(hb);
80 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 86 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
81 mAlarmSoundButton->setToggleButton(true); 87 mAlarmSoundButton->setToggleButton(true);
82 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 88 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
83 mAlarmProgramButton = new QPushButton(hb); 89 mAlarmProgramButton = new QPushButton(hb);
84 mAlarmProgramButton->setPixmap(SmallIcon("run")); 90 mAlarmProgramButton->setPixmap(SmallIcon("run"));
85 mAlarmProgramButton->setToggleButton(true); 91 mAlarmProgramButton->setToggleButton(true);
86 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 92 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
87 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 93 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
88 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 94 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
89 mAlarmLabel = new QLabel( this ); 95 mAlarmLabel = new QLabel( this );
90 alarmLayout->addWidget( mAlarmLabel ); 96 alarmLayout->addWidget( mAlarmLabel );
91 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); 97 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) );
92 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 98 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
93 mAlarmSoundButton->setOn( true ); 99 mAlarmSoundButton->setOn( true );
94 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this ); 100 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this );
95 alarmLayout->addWidget( ok ); 101 alarmLayout->addWidget( ok );
96 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 102 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
97 alarmLayout->addWidget( cancel ); 103 alarmLayout->addWidget( cancel );
98 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 104 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
99 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 105 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
100 resize( 200, 200 ); 106 resize( 200, 200 );
101 107
@@ -189,129 +195,129 @@ class ListItemVisitor : public Incidence::Visitor
189 bool visit(Journal *); 195 bool visit(Journal *);
190 196
191 private: 197 private:
192 KOListViewItem *mItem; 198 KOListViewItem *mItem;
193 QDate mDate; 199 QDate mDate;
194}; 200};
195 201
196/** 202/**
197 This class provides a multi-column list view of events. It can 203 This class provides a multi-column list view of events. It can
198 display events from one particular day or several days, it doesn't 204 display events from one particular day or several days, it doesn't
199 matter. To use a view that only handles one day at a time, use 205 matter. To use a view that only handles one day at a time, use
200 KODayListView. 206 KODayListView.
201 207
202 @short multi-column list view of various events. 208 @short multi-column list view of various events.
203 @author Preston Brown <pbrown@kde.org> 209 @author Preston Brown <pbrown@kde.org>
204 @see KOBaseView, KODayListView 210 @see KOBaseView, KODayListView
205*/ 211*/
206class KOListView; 212class KOListView;
207 213
208class KOListViewListView : public KListView 214class KOListViewListView : public KListView
209{ 215{
210 Q_OBJECT 216 Q_OBJECT
211 public: 217 public:
212 KOListViewListView(KOListView * lv ); 218 KOListViewListView(KOListView * lv );
213 bool hasMultiSelection(QListViewItem*); 219 bool hasMultiSelection(Q3ListViewItem*);
214 void printList(); 220 void printList();
215 signals: 221 signals:
216 void newEvent(); 222 void newEvent();
217 void showIncidence( Incidence* ); 223 void showIncidence( Incidence* );
218 public slots: 224 public slots:
219 void popupMenu(); 225 void popupMenu();
220 private: 226 private:
221 QPoint mEventPos; 227 QPoint mEventPos;
222 QPoint mEventGlobalPos; 228 QPoint mEventGlobalPos;
223 QTimer* mPopupTimer; 229 QTimer* mPopupTimer;
224 int mYMousePos; 230 int mYMousePos;
225 void keyPressEvent ( QKeyEvent * ) ; 231 void keyPressEvent ( QKeyEvent * ) ;
226 void contentsMouseDoubleClickEvent(QMouseEvent *e); 232 void contentsMouseDoubleClickEvent(QMouseEvent *e);
227 void contentsMousePressEvent(QMouseEvent *e); 233 void contentsMousePressEvent(QMouseEvent *e);
228 void contentsMouseReleaseEvent(QMouseEvent *e); 234 void contentsMouseReleaseEvent(QMouseEvent *e);
229 void contentsMouseMoveEvent(QMouseEvent *e); 235 void contentsMouseMoveEvent(QMouseEvent *e);
230 bool mMouseDown; 236 bool mMouseDown;
231}; 237};
232 238
233class KOListView : public KOEventView 239class KOListView : public KOEventView
234{ 240{
235 Q_OBJECT 241 Q_OBJECT
236 public: 242 public:
237 KOListView(Calendar *calendar, QWidget *parent = 0, 243 KOListView(Calendar *calendar, QWidget *parent = 0,
238 const char *name = 0); 244 const char *name = 0);
239 ~KOListView(); 245 ~KOListView();
240 246
241 virtual int maxDatesHint(); 247 virtual int maxDatesHint();
242 virtual int currentDateCount(); 248 virtual int currentDateCount();
243 virtual QPtrList<Incidence> selectedIncidences(); 249 virtual Q3PtrList<Incidence> selectedIncidences();
244 virtual DateList selectedDates(); 250 virtual DateList selectedDates();
245 251
246 void showDates(bool show); 252 void showDates(bool show);
247 Incidence* currentItem(); 253 Incidence* currentItem();
248 void addTodos(QPtrList<Todo> eventList); 254 void addTodos(Q3PtrList<Todo> eventList);
249 void addJournals(QPtrList<Journal> eventList); 255 void addJournals(Q3PtrList<Journal> eventList);
250 virtual void printPreview(CalPrinter *calPrinter, 256 virtual void printPreview(CalPrinter *calPrinter,
251 const QDate &, const QDate &); 257 const QDate &, const QDate &);
252 258
253 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 259 void readSettings(KConfig *config, QString setting = "KOListView Layout");
254 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 260 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
255 void updateList(); 261 void updateList();
256 void clearList(); 262 void clearList();
257 void setStartDate(const QDate &start); 263 void setStartDate(const QDate &start);
258 int count(); 264 int count();
259 QString getWhatsThisText(QPoint p); 265 QString getWhatsThisText(QPoint p);
260 QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false ); 266 Q3PtrList<Incidence> getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false );
261 void showCompletedTodos(); 267 void showCompletedTodos();
262 signals: 268 signals:
263 void signalNewEvent(); 269 void signalNewEvent();
264 void beamIncidenceList(QPtrList<Incidence>); 270 void beamIncidenceList(Q3PtrList<Incidence>);
265 271
266 public slots: 272 public slots:
267 void hideAll(); 273 void hideAll();
268 void printList(); 274 void printList();
269 void resetFocus(); 275 void resetFocus();
270 virtual void updateView(); 276 virtual void updateView();
271 virtual void showDates(const QDate &start, const QDate &end); 277 virtual void showDates(const QDate &start, const QDate &end);
272 virtual void showEvents(QPtrList<Event> eventList); 278 virtual void showEvents(Q3PtrList<Event> eventList);
273 void clearSelection(); 279 void clearSelection();
274 void allSelection(); 280 void allSelection();
275 281
276 void clear(); 282 void clear();
277 void showDates(); 283 void showDates();
278 void hideDates(); 284 void hideDates();
279 void deleteAll(); 285 void deleteAll();
280 void saveToFile(); 286 void saveToFile();
281 void saveToFileVCS(); 287 void saveToFileVCS();
282 void saveDescriptionToFile(); 288 void saveDescriptionToFile();
283 void beamSelected(); 289 void beamSelected();
284 void updateConfig(); 290 void updateConfig();
285 void setCat(); 291 void setCat();
286 void setAlarm(); 292 void setAlarm();
287 void setCategories( bool removeOld ); 293 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 294 void changeEventDisplay(Event *, int);
289 295
290 void defaultItemAction(QListViewItem *item); 296 void defaultItemAction(Q3ListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 297 void popupMenu(Q3ListViewItem *item,const QPoint &,int);
292 void setCalendar( int c ); 298 void setCalendar( int c );
293 void populateCalPopup(); 299 void populateCalPopup();
294 300
295 protected slots: 301 protected slots:
296 void processSelectionChange(QListViewItem *); 302 void processSelectionChange(Q3ListViewItem *);
297 void catChanged( Incidence* ); 303 void catChanged( Incidence* );
298 304
299 protected: 305 protected:
300 void writeToFile( bool iCal ); 306 void writeToFile( bool iCal );
301 void addEvents(QPtrList<Event> eventList); 307 void addEvents(Q3PtrList<Event> eventList);
302 void addIncidence(Incidence *); 308 void addIncidence(Incidence *);
303 KOListViewItem *getItemForEvent(Incidence *event); 309 KOListViewItem *getItemForEvent(Incidence *event);
304 310
305 private: 311 private:
306 bool mForceShowCompletedTodos; 312 bool mForceShowCompletedTodos;
307 QPopupMenu* mCalPopup; 313 Q3PopupMenu* mCalPopup;
308 KOListViewWhatsThis *mKOListViewWhatsThis; 314 KOListViewWhatsThis *mKOListViewWhatsThis;
309 KOListViewListView *mListView; 315 KOListViewListView *mListView;
310 KOEventPopupMenu *mPopupMenu; 316 KOEventPopupMenu *mPopupMenu;
311 KOListViewItem *mActiveItem; 317 KOListViewItem *mActiveItem;
312 QDict<Incidence> mUidDict; 318 Q3Dict<Incidence> mUidDict;
313 QDate mStartDate; 319 QDate mStartDate;
314 void keyPressEvent ( QKeyEvent * ) ; 320 void keyPressEvent ( QKeyEvent * ) ;
315}; 321};
316 322
317#endif 323#endif