author | zecke <zecke> | 2003-11-30 13:10:50 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-11-30 13:10:50 (UTC) |
commit | 667d6cc5ca0abb0f4b8b481ce053f92412babd87 (patch) (unidiff) | |
tree | 9bf50effbf3efbf7e5d1730323c54de1367b1d3d /core | |
parent | 2006eba49ca3c75898d7073cca371041614b0e50 (diff) | |
download | opie-667d6cc5ca0abb0f4b8b481ce053f92412babd87.zip opie-667d6cc5ca0abb0f4b8b481ce053f92412babd87.tar.gz opie-667d6cc5ca0abb0f4b8b481ce053f92412babd87.tar.bz2 |
Limit the number of shown All Day Events to approxiametely three
Patch by Rajko Albrecht
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 25 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.h | 4 |
2 files changed, 19 insertions, 10 deletions
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 985f31a..6014eca 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -29,14 +29,21 @@ | |||
29 | * Constructs a DatebookdayAllday which is a child of 'parent', with the | 29 | * Constructs a DatebookdayAllday which is a child of 'parent', with the |
30 | * name 'name' and widget flags set to 'f' | 30 | * name 'name' and widget flags set to 'f' |
31 | */ | 31 | */ |
32 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags fl ) | 32 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags ) |
33 | : QWidget( parent, name,fl ),item_count(0),dateBook(db) | 33 | : QScrollView( parent, name ),item_count(0),dateBook(db) |
34 | { | 34 | { |
35 | if ( !name ) | 35 | if ( !name ) |
36 | setName( "DatebookdayAllday" ); | 36 | setName( "DatebookdayAllday" ); |
37 | setMinimumSize( QSize( 0, 0 ) ); | 37 | setMinimumSize( QSize( 0, 0 ) ); |
38 | setMaximumHeight(3* (QFontMetrics(font()).height()+4) ); | ||
38 | 39 | ||
39 | datebookdayalldayLayout = new QVBoxLayout( this ); | 40 | m_MainFrame = new QFrame(viewport()); |
41 | m_MainFrame->setFrameStyle(QFrame::NoFrame|QFrame::Plain); | ||
42 | setFrameStyle(QFrame::NoFrame|QFrame::Plain); | ||
43 | setResizePolicy( QScrollView::AutoOneFit ); | ||
44 | addChild(m_MainFrame); | ||
45 | |||
46 | datebookdayalldayLayout = new QVBoxLayout( m_MainFrame ); | ||
40 | datebookdayalldayLayout->setSpacing( 0 ); | 47 | datebookdayalldayLayout->setSpacing( 0 ); |
41 | datebookdayalldayLayout->setMargin( 0 ); | 48 | datebookdayalldayLayout->setMargin( 0 ); |
42 | 49 | ||
@@ -57,10 +64,10 @@ DatebookdayAllday::~DatebookdayAllday() | |||
57 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) | 64 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) |
58 | { | 65 | { |
59 | DatebookAlldayDisp * lb; | 66 | DatebookAlldayDisp * lb; |
60 | lb = new DatebookAlldayDisp(dateBook,ev,this,NULL); | 67 | lb = new DatebookAlldayDisp(dateBook,ev,m_MainFrame,NULL); |
61 | datebookdayalldayLayout->addWidget(lb); | 68 | datebookdayalldayLayout->addWidget(lb); |
62 | subWidgets.append(lb); | 69 | subWidgets.append(lb); |
63 | 70 | ||
64 | connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&))); | 71 | connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&))); |
65 | ++item_count; | 72 | ++item_count; |
66 | 73 | ||
@@ -82,9 +89,10 @@ DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, | |||
82 | setBackgroundColor(yellow); | 89 | setBackgroundColor(yellow); |
83 | setText(strDesc); | 90 | setText(strDesc); |
84 | setFrameStyle(QFrame::Raised|QFrame::Panel); | 91 | setFrameStyle(QFrame::Raised|QFrame::Panel); |
85 | QSize s = sizeHint(); | 92 | |
86 | setMaximumSize( QSize( 32767, s.height()-4 ) ); | 93 | int s = QFontMetrics(font()).height()+4; |
87 | setMinimumSize( QSize( 0, s.height()-4 ) ); | 94 | setMaximumHeight( s ); |
95 | setMinimumSize( QSize( 0, s ) ); | ||
88 | } | 96 | } |
89 | 97 | ||
90 | DatebookAlldayDisp::~DatebookAlldayDisp() | 98 | DatebookAlldayDisp::~DatebookAlldayDisp() |
@@ -223,4 +231,3 @@ void DatebookEventDesc::disp_event(const Event&e) | |||
223 | show(); | 231 | show(); |
224 | m_Timer->start(2000,true); | 232 | m_Timer->start(2000,true); |
225 | } | 233 | } |
226 | |||
diff --git a/core/pim/datebook/datebookdayallday.h b/core/pim/datebook/datebookdayallday.h index c781785..f5867e5 100644 --- a/core/pim/datebook/datebookdayallday.h +++ b/core/pim/datebook/datebookdayallday.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <qvariant.h> | 4 | #include <qvariant.h> |
5 | #include <qframe.h> | 5 | #include <qframe.h> |
6 | #include <qscrollview.h> | ||
6 | #include <qlabel.h> | 7 | #include <qlabel.h> |
7 | #include <qlist.h> | 8 | #include <qlist.h> |
8 | #include <qpe/event.h> | 9 | #include <qpe/event.h> |
@@ -14,7 +15,7 @@ class DatebookAlldayDisp; | |||
14 | class DatebookEventDesc; | 15 | class DatebookEventDesc; |
15 | class DateBookDB; | 16 | class DateBookDB; |
16 | 17 | ||
17 | class DatebookdayAllday : public QWidget | 18 | class DatebookdayAllday : public QScrollView |
18 | { | 19 | { |
19 | Q_OBJECT | 20 | Q_OBJECT |
20 | 21 | ||
@@ -29,6 +30,7 @@ public slots: | |||
29 | void removeAllEvents(); | 30 | void removeAllEvents(); |
30 | 31 | ||
31 | protected: | 32 | protected: |
33 | QFrame * m_MainFrame; | ||
32 | QVBoxLayout* datebookdayalldayLayout; | 34 | QVBoxLayout* datebookdayalldayLayout; |
33 | DatebookEventDesc * lblDesc; | 35 | DatebookEventDesc * lblDesc; |
34 | unsigned int item_count; | 36 | unsigned int item_count; |