author | harlekin <harlekin> | 2002-02-21 16:16:13 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-02-21 16:16:13 (UTC) |
commit | 4c965fa187f642cb3db4cd32d70a68cfa8c41022 (patch) (unidiff) | |
tree | f1f65a4b0b332b838fef9f0fda95c92dfc93247e | |
parent | 17e96f64d6b66fac5f0e206492149d461e2ad900 (diff) | |
download | opie-4c965fa187f642cb3db4cd32d70a68cfa8c41022.zip opie-4c965fa187f642cb3db4cd32d70a68cfa8c41022.tar.gz opie-4c965fa187f642cb3db4cd32d70a68cfa8c41022.tar.bz2 |
added scrollbars to dates and todo
-rw-r--r-- | core/pim/today/today.cpp | 6 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 165 |
2 files changed, 103 insertions, 68 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index bed3a74..9e5c27e 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -147,13 +147,12 @@ void Today::startConfig() | |||
147 | cfg.write(); | 147 | cfg.write(); |
148 | 148 | ||
149 | draw(); | 149 | draw(); |
150 | } | 150 | } |
151 | 151 | ||
152 | 152 | ||
153 | |||
154 | /* | 153 | /* |
155 | * Get all events that are in the datebook xml file for today | 154 | * Get all events that are in the datebook xml file for today |
156 | */ | 155 | */ |
157 | void Today::getDates() | 156 | void Today::getDates() |
158 | { | 157 | { |
159 | QDate date = QDate::currentDate(); | 158 | QDate date = QDate::currentDate(); |
@@ -173,17 +172,15 @@ void Today::getDates() | |||
173 | it!=list.end(); ++it ) { | 172 | it!=list.end(); ++it ) { |
174 | 173 | ||
175 | count++; | 174 | count++; |
176 | 175 | ||
177 | if ( count <= MAX_LINES_MEET ) | 176 | if ( count <= MAX_LINES_MEET ) |
178 | { | 177 | { |
179 | //only get events past current time (start or end??) | ||
180 | //cout << time.toString() << endl; | 178 | //cout << time.toString() << endl; |
181 | //cout << TimeString::dateString((*it).event().end()) << endl; | 179 | //cout << TimeString::dateString((*it).event().end()) << endl; |
182 | // still some bug in here, 1 h off | 180 | |
183 | |||
184 | // decide if to get all day or only later appointments | 181 | // decide if to get all day or only later appointments |
185 | if (!ONLY_LATER) | 182 | if (!ONLY_LATER) |
186 | { | 183 | { |
187 | msg += "<B>" + (*it).description() + "</B>"; | 184 | msg += "<B>" + (*it).description() + "</B>"; |
188 | if ( (*it).event().hasAlarm() ) | 185 | if ( (*it).event().hasAlarm() ) |
189 | { | 186 | { |
@@ -192,12 +189,13 @@ void Today::getDates() | |||
192 | // include location or not | 189 | // include location or not |
193 | if (SHOW_LOCATION == 1) | 190 | if (SHOW_LOCATION == 1) |
194 | { | 191 | { |
195 | msg+= "<BR>" + (*it).location(); | 192 | msg+= "<BR>" + (*it).location(); |
196 | } | 193 | } |
197 | msg += "<BR>" | 194 | msg += "<BR>" |
195 | |||
198 | // start time of event | 196 | // start time of event |
199 | + TimeString::timeString(QTime((*it).event().start().time()) ) | 197 | + TimeString::timeString(QTime((*it).event().start().time()) ) |
200 | // end time of event | 198 | // end time of event |
201 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) | 199 | + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) ) |
202 | + "<BR>"; | 200 | + "<BR>"; |
203 | // include possible note or not | 201 | // include possible note or not |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index 32b45f7..ff6001a 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -26,130 +26,167 @@ | |||
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qimage.h> | 28 | #include <qimage.h> |
29 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qapplication.h> | ||
32 | 33 | ||
33 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
34 | 35 | ||
35 | /* | 36 | /* |
36 | * Constructs a TodayBase which is a child of 'parent', with the | 37 | * Constructs a TodayBase which is a child of 'parent', with the |
37 | * name 'name' and widget flags set to 'f' | 38 | * name 'name' and widget flags set to 'f' |
38 | */ | 39 | */ |
39 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | 40 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) |
40 | : QWidget( parent, name, fl ) | 41 | : QWidget( parent, name, fl ) |
41 | { | 42 | { |
42 | // logo | 43 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo |
43 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); | 44 | QPixmap datebook = Resource::loadPixmap("DateBook"); // datebook |
44 | // datebook | 45 | QPixmap todo = Resource::loadPixmap( "TodoList" ); // todo |
45 | QPixmap datebook = Resource::loadPixmap("DateBook"); | 46 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon |
46 | // todo | 47 | QPixmap mail = Resource::loadPixmap( "today/mail" ); // mail icon |
47 | QPixmap todo = Resource::loadPixmap( "TodoList" ); | ||
48 | // config icon | ||
49 | QPixmap config = Resource::loadPixmap( "today/config" ); | ||
50 | // mail icon | ||
51 | QPixmap mail = Resource::loadPixmap( "today/mail" ); | ||
52 | |||
53 | |||
54 | QPalette pal2; | ||
55 | QColorGroup cg; | ||
56 | cg.setColor( QColorGroup::Text, white ); | ||
57 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) ); | ||
58 | pal2.setActive( cg ); | ||
59 | |||
60 | 48 | ||
61 | QPalette pal = this->palette(); | 49 | QPalette pal = this->palette(); |
62 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 50 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
63 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 51 | pal.setColor(QPalette::Active, QColorGroup::Button, col); |
64 | this->setPalette(pal); | 52 | this->setPalette(pal); |
65 | 53 | ||
66 | QVBoxLayout * layout = new QVBoxLayout(this); | 54 | QWidget *d = QApplication::desktop(); |
55 | int w=d->width(); | ||
56 | int h=d->height(); | ||
57 | resize( w , h ); // not good, what happens on rotation | ||
67 | 58 | ||
68 | Frame4 = new QFrame( this, "Frame4" ); | ||
69 | Frame4->setPalette( pal ); | ||
70 | Frame4->setFrameShape( QScrollView::StyledPanel ); | ||
71 | Frame4->setFrameShadow( QScrollView::Sunken ); | ||
72 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); | ||
73 | |||
74 | // hehe, qt is ... | 59 | // hehe, qt is ... |
75 | getridoffuckingstrippeldlinesbutton = new QPushButton (Frame4, "asdfsad" ); | 60 | getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" ); |
76 | getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); | 61 | getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); |
77 | 62 | ||
78 | DatesButton = new QPushButton (Frame4, "DatesButton" ); | ||
79 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | ||
80 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); | ||
81 | DatesButton->setPalette( pal ); | ||
82 | DatesButton->setPixmap( datebook ); | ||
83 | DatesButton->setFlat( TRUE ); | ||
84 | 63 | ||
85 | DatesField = new QLabel( Frame4, "DatesField" ); | ||
86 | DatesField->setGeometry( QRect( 40, 4, 203, 120 ) ); | ||
87 | DatesField->setText( tr( "No appointments today" ) ); | ||
88 | DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | ||
89 | 64 | ||
65 | QVBoxLayout * layout = new QVBoxLayout(this); | ||
66 | |||
67 | |||
68 | |||
69 | // --- logo Section --- | ||
70 | QPalette pal2; | ||
71 | QColorGroup cg; | ||
72 | cg.setColor( QColorGroup::Text, white ); | ||
73 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) ); | ||
74 | pal2.setActive( cg ); | ||
90 | // today logo | 75 | // today logo |
91 | Frame = new QLabel( this, "Frame" ); | 76 | Frame = new QLabel( this, "Frame" ); |
92 | Frame->setPalette( pal2 ); | 77 | Frame->setPalette( pal2 ); |
93 | Frame->setFrameShape( QFrame::StyledPanel ); | 78 | Frame->setFrameShape( QFrame::StyledPanel ); |
94 | Frame->setFrameShadow( QFrame::Raised ); | 79 | Frame->setFrameShadow( QFrame::Raised ); |
95 | Frame->setLineWidth( 0 ); | 80 | Frame->setLineWidth( 0 ); |
96 | Frame->setMaximumHeight(50); | 81 | Frame->setMaximumHeight(50); |
97 | Frame->setMinimumHeight(50); | 82 | Frame->setMinimumHeight(50); |
98 | |||
99 | // date | 83 | // date |
100 | TextLabel1 = new QLabel( Frame, "TextLabel1" ); | 84 | TextLabel1 = new QLabel( Frame, "TextLabel1" ); |
101 | TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); | 85 | TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); |
102 | QFont TextLabel1_font( TextLabel1->font() ); | 86 | QFont TextLabel1_font( TextLabel1->font() ); |
103 | TextLabel1_font.setBold( TRUE ); | 87 | TextLabel1_font.setBold( TRUE ); |
104 | TextLabel1->setFont( TextLabel1_font ); | 88 | TextLabel1->setFont( TextLabel1_font ); |
105 | TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); | 89 | TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); |
106 | TextLabel1->setTextFormat( RichText ); | 90 | TextLabel1->setTextFormat( RichText ); |
107 | 91 | ||
108 | // todo | 92 | |
109 | Frame15 = new QFrame( this, "Frame15" ); | 93 | // --- dates section --- |
110 | Frame15->setFrameShape( QFrame::StyledPanel ); | 94 | Frame4 = new QFrame( this, "Frame4" ); |
111 | Frame15->setFrameShadow( QFrame::Sunken ); | 95 | Frame4->setPalette( pal ); |
96 | Frame4->setFrameShape( QScrollView::StyledPanel ); | ||
97 | Frame4->setFrameShadow( QScrollView::Sunken ); | ||
98 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); | ||
99 | Frame4->setFrameStyle( QFrame::NoFrame ); | ||
100 | Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) ); | ||
112 | 101 | ||
113 | TodoButton = new QPushButton (Frame15, "TodoButton" ); | 102 | QScrollView* sv1 = new QScrollView( Frame4 ); |
114 | TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | 103 | sv1->setResizePolicy(QScrollView::AutoOneFit); |
115 | TodoButton->setPalette( pal ); | 104 | sv1->setHScrollBarMode( QScrollView::AlwaysOff ); |
116 | TodoButton->setPixmap( todo ); | 105 | // need to find a better way!!! |
117 | TodoButton->setFlat( TRUE ); | 106 | sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) ); |
107 | sv1->setFrameShape(QFrame::NoFrame); | ||
108 | |||
109 | DatesButton = new QPushButton (Frame4, "DatesButton" ); | ||
110 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | ||
111 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); | ||
112 | DatesButton->setPalette( pal ); | ||
113 | DatesButton->setPixmap( datebook ); | ||
114 | DatesButton->setFlat( TRUE ); | ||
118 | 115 | ||
119 | TodoField = new QLabel( Frame15, "TodoField" ); | 116 | DatesField = new QLabel( sv1->viewport(), "DatesField" ); |
120 | TodoField->setGeometry( QRect( 40, 4, 196, 120 ) ); | 117 | sv1->addChild(DatesField); |
121 | TodoField->setFrameShadow( QLabel::Plain ); | 118 | DatesField->setText( tr( "No appointments today" ) ); |
122 | TodoField->setText( tr( "No current todos" ) ); | 119 | DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); |
123 | TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | ||
124 | 120 | ||
125 | PushButton1 = new QPushButton (Frame15, "PushButton1" ); | ||
126 | PushButton1->setGeometry( QRect( 216, 68, 25, 21 ) ); | ||
127 | PushButton1->setPixmap( config ); | ||
128 | PushButton1->setPalette( pal ); | ||
129 | PushButton1->setAutoDefault( TRUE ); | ||
130 | PushButton1->setFlat( TRUE ); | ||
131 | 121 | ||
132 | 122 | // --- mail section --- | |
133 | MailFrame = new QFrame( this ,"MailFrame" ); | 123 | MailFrame = new QFrame( this ,"MailFrame" ); |
134 | MailFrame->setFrameShape( QScrollView::StyledPanel ); | 124 | //MailFrame->setPalette( pal ); |
135 | MailFrame->setFrameShadow( QScrollView::Sunken ); | 125 | MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); |
126 | //MailFrame->setFrameShape( QScrollView::StyledPanel ); | ||
127 | //MailFrame->setFrameShadow( QScrollView::Sunken ); | ||
128 | MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); | ||
129 | MailFrame->setFrameStyle( QFrame::NoFrame ); | ||
136 | 130 | ||
131 | QFrame* Line1 = new QFrame( MailFrame); | ||
132 | Line1->setGeometry( QRect( 0, 0, MailFrame->width(), 5 ) ); | ||
133 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
134 | |||
137 | MailButton = new QPushButton (MailFrame, "MailButton" ); | 135 | MailButton = new QPushButton (MailFrame, "MailButton" ); |
138 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); | 136 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); |
139 | MailButton->setPalette( pal ); | 137 | MailButton->setPalette( pal ); |
140 | MailButton->setPixmap( mail ); | 138 | MailButton->setPixmap( mail ); |
141 | MailButton->setFlat( TRUE ); | 139 | MailButton->setFlat( TRUE ); |
142 | 140 | ||
143 | MailField = new QLabel( MailFrame, "DatesField" ); | 141 | MailField = new QLabel( MailFrame, "MailField" ); |
144 | MailField->setGeometry( QRect( 40, 4, 203, 120 ) ); | 142 | MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) ); |
145 | MailField->setText( tr( "Opiemail not installed" ) ); | 143 | MailField->setText( tr( "Opiemail not installed" ) ); |
146 | MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | 144 | MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); |
147 | MailField->setMaximumHeight(40); | 145 | MailField->setMaximumHeight(40); |
148 | MailField->setMinimumHeight(30); | 146 | MailField->setMinimumHeight(15); |
147 | |||
148 | |||
149 | // --- todo section -- | ||
150 | Frame15 = new QFrame( this, "Frame15" ); | ||
151 | //Frame15->setFrameShape( QFrame::StyledPanel ); | ||
152 | //Frame15->setFrameShadow( QFrame::Sunken ); | ||
153 | Frame15->setFrameStyle( QFrame::NoFrame ); | ||
154 | Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) ); | ||
155 | |||
156 | QFrame* Line2 = new QFrame( Frame15); | ||
157 | Line2->setGeometry( QRect( 0, 0, MailFrame->width(), 5 ) ); | ||
158 | Line2->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | ||
159 | |||
160 | TodoButton = new QPushButton (Frame15, "TodoButton" ); | ||
161 | TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | ||
162 | TodoButton->setPalette( pal ); | ||
163 | TodoButton->setPixmap( todo ); | ||
164 | TodoButton->setFlat( TRUE ); | ||
165 | |||
166 | QScrollView* sv2 = new QScrollView( Frame15 ); | ||
167 | sv2->setResizePolicy(QScrollView::AutoOneFit); | ||
168 | sv2->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
169 | sv2->setGeometry (QRect( 40, 3, Frame15->width()-40 , (Frame15->height()/3) ) ); | ||
170 | sv2->setFrameShape(QFrame::NoFrame); | ||
171 | |||
172 | TodoField = new QLabel( sv2->viewport(), "TodoField" ); | ||
173 | sv2->addChild(TodoField); | ||
174 | //TodoField->setGeometry( QRect( 40, 4, 196, 120 ) ); | ||
175 | TodoField->setFrameShadow( QLabel::Plain ); | ||
176 | //TodoField->setText( tr( "No current todos" ) ); | ||
177 | TodoField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | ||
178 | |||
179 | PushButton1 = new QPushButton (Frame15, "PushButton1" ); | ||
180 | PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) ); | ||
181 | PushButton1->setPixmap( config ); | ||
182 | PushButton1->setPalette( pal ); | ||
183 | PushButton1->setAutoDefault( TRUE ); | ||
184 | PushButton1->setFlat( TRUE ); | ||
149 | 185 | ||
186 | // -- layout -- | ||
150 | layout->addWidget(Frame); | 187 | layout->addWidget(Frame); |
151 | layout->addWidget(Frame4); | 188 | layout->addWidget(Frame4); |
152 | layout->addWidget(MailFrame); | 189 | layout->addWidget(MailFrame); |
153 | layout->addWidget(Frame15); | 190 | layout->addWidget(Frame15); |
154 | 191 | ||
155 | layout->setStretchFactor(Frame4,5); | 192 | layout->setStretchFactor(Frame4,5); |