summaryrefslogtreecommitdiff
path: root/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
authoralwin <alwin>2005-03-19 18:06:44 (UTC)
committer alwin <alwin>2005-03-19 18:06:44 (UTC)
commitff7fd64d755b2cc63f9944b1a17a6a2e186da0b6 (patch) (unidiff)
tree11c335300ae6e9dd55b62e5558e56a85222d3fb6 /core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
parent93d0e2c50c24c518323d7926df37827d3b562a28 (diff)
downloadopie-ff7fd64d755b2cc63f9944b1a17a6a2e186da0b6.zip
opie-ff7fd64d755b2cc63f9944b1a17a6a2e186da0b6.tar.gz
opie-ff7fd64d755b2cc63f9944b1a17a6a2e186da0b6.tar.bz2
hopefull speedup the weeklistview.
deleting the main widget 4 times when date changed isn't that usefull. After 1.2 OPIE this view should completly rewritten or removed.
Diffstat (limited to 'core/pim/datebook/modules/weeklst/datebookweeklstview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/modules/weeklst/datebookweeklstview.cpp49
1 files changed, 40 insertions, 9 deletions
diff --git a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
index efb4c01..82b9c6d 100644
--- a/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
+++ b/core/pim/datebook/modules/weeklst/datebookweeklstview.cpp
@@ -14,23 +14,37 @@
14DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, 14DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
15 const QDate &d, bool onM, 15 const QDate &d, bool onM,
16 QWidget* parent, 16 QWidget* parent,
17 const char* name, WFlags fl) 17 const char* name, WFlags fl)
18 : QWidget( parent, name, fl ) 18 : QWidget( parent, name, fl )
19{ 19{
20 childs.clear();
21 m_MainLayout = new QVBoxLayout( this );
22 setEvents(ev,d,onM);
23}
24
25void DateBookWeekLstView::setEvents(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM)
26{
27 QValueList<QObject*>::Iterator wIter;
28 for (wIter=childs.begin();wIter!=childs.end();++wIter) {
29 QObject*w = (*wIter);
30 delete w;
31 }
32 childs.clear();
33
34 setUpdatesEnabled(false);
35// m_MainLayout->deleteAllItems();
20 Config config("DateBook"); 36 Config config("DateBook");
21 config.setGroup("Main"); 37 config.setGroup("Main");
22 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL); 38 int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
23 odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl; 39 odebug << "weeklistviewconfig: " << weeklistviewconfig << oendl;
24 40
25 bStartOnMonday=onM; 41 bStartOnMonday=onM;
26 setPalette(white); 42 setPalette(white);
27 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); 43 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
28 44
29 QVBoxLayout *layout = new QVBoxLayout( this );
30
31 qBubbleSort(ev); 45 qBubbleSort(ev);
32 QValueListIterator<EffectiveEvent> it; 46 QValueListIterator<EffectiveEvent> it;
33 it=ev.begin(); 47 it=ev.begin();
34 48
35 int dayOrder[7]; 49 int dayOrder[7];
36 if (bStartOnMonday) { 50 if (bStartOnMonday) {
@@ -43,31 +57,48 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
43 // Calculate offset to first day of week. 57 // Calculate offset to first day of week.
44 int dayoffset=d.dayOfWeek(); 58 int dayoffset=d.dayOfWeek();
45 if(bStartOnMonday) dayoffset--; 59 if(bStartOnMonday) dayoffset--;
46 else if( dayoffset == 7 ) dayoffset = 0; 60 else if( dayoffset == 7 ) dayoffset = 0;
47 61
48 for (int i=0; i<7; i++) { 62 for (int i=0; i<7; i++) {
63 QWidget*w = new QWidget(this);
64 w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
65 w->setPalette(white);
66 QVBoxLayout * tlayout = new QVBoxLayout(w);
67 childs.append(w);
49 // Header 68 // Header
50 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,this); 69 DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i-dayoffset), bStartOnMonday,w);
51 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); 70 connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
52 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)), 71 connect(hdr, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)),
53 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&))); 72 this, SIGNAL(addEvent(const QDateTime&,const QDateTime&,const QString&,const QString&)));
54 layout->addWidget(hdr); 73 tlayout->addWidget(hdr);
55 74
56 // Events 75 // Events
57 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { 76 while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) {
58 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day. 77 if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day.
59 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this); 78 DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,w);
60 layout->addWidget(l); 79 tlayout->addWidget(l);
61 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&))); 80 connect (l, SIGNAL(editEvent(const Event&)), this, SIGNAL(editEvent(const Event&)));
62 connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &))); 81 connect (l, SIGNAL(duplicateEvent(const Event &)), this, SIGNAL(duplicateEvent(const Event &)));
63 connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &))); 82 connect (l, SIGNAL(removeEvent(const Event &)), this, SIGNAL(removeEvent(const Event &)));
64 connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &))); 83 connect (l, SIGNAL(beamEvent(const Event &)), this, SIGNAL(beamEvent(const Event &)));
65 connect (l, SIGNAL(redraw()), this, SIGNAL(redraw())); 84 connect (l, SIGNAL(redraw()), this, SIGNAL(redraw()));
66 } 85 }
67 it++; 86 it++;
68 } 87 }
69 layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); 88 tlayout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
89 m_MainLayout->addWidget(w);
90/*
91 QSpacerItem * tmp = new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding);
92 m_MainLayout->addItem(tmp);
93*/
70 } 94 }
95 setUpdatesEnabled(true);
96}
97
98DateBookWeekLstView::~DateBookWeekLstView()
99{}
100
101void DateBookWeekLstView::keyPressEvent(QKeyEvent *e)
102{
103 e->ignore();
71} 104}
72DateBookWeekLstView::~DateBookWeekLstView(){}
73void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();}