-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 | |||
@@ -137,77 +137,75 @@ void Today::startConfig() | |||
137 | int maxcharclip = conf->SpinBox7->value(); | 137 | int maxcharclip = conf->SpinBox7->value(); |
138 | int onlylater = conf->CheckBox3->isChecked(); | 138 | int onlylater = conf->CheckBox3->isChecked(); |
139 | 139 | ||
140 | cfg.writeEntry("maxlinestask",maxlinestask); | 140 | cfg.writeEntry("maxlinestask",maxlinestask); |
141 | cfg.writeEntry("maxcharclip", maxcharclip); | 141 | cfg.writeEntry("maxcharclip", maxcharclip); |
142 | cfg.writeEntry("maxlinesmeet",maxmeet); | 142 | cfg.writeEntry("maxlinesmeet",maxmeet); |
143 | cfg.writeEntry("showlocation",location); | 143 | cfg.writeEntry("showlocation",location); |
144 | cfg.writeEntry("shownotes", notes); | 144 | cfg.writeEntry("shownotes", notes); |
145 | cfg.writeEntry("onlylater", onlylater); | 145 | cfg.writeEntry("onlylater", onlylater); |
146 | // sync it to "disk" | 146 | // sync it to "disk" |
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(); |
160 | QTime time = QTime::currentTime(); | 159 | QTime time = QTime::currentTime(); |
161 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | 160 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); |
162 | 161 | ||
163 | Config config( "qpe" ); | 162 | Config config( "qpe" ); |
164 | // if 24 h format | 163 | // if 24 h format |
165 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 164 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
166 | 165 | ||
167 | int count=0; | 166 | int count=0; |
168 | 167 | ||
169 | if ( list.count() > 0 ) { | 168 | if ( list.count() > 0 ) { |
170 | QString msg; | 169 | QString msg; |
171 | 170 | ||
172 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 171 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
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 | { |
190 | msg += " <b>[with alarm]</b>"; | 187 | msg += " <b>[with alarm]</b>"; |
191 | } | 188 | } |
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 |
204 | if (SHOW_NOTES == 1) | 202 | if (SHOW_NOTES == 1) |
205 | { | 203 | { |
206 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 204 | msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
207 | } | 205 | } |
208 | } | 206 | } |
209 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) | 207 | else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) |
210 | { | 208 | { |
211 | msg += "<B>" + (*it).description() + "</B>"; | 209 | msg += "<B>" + (*it).description() + "</B>"; |
212 | if ( (*it).event().hasAlarm() ) | 210 | if ( (*it).event().hasAlarm() ) |
213 | { | 211 | { |
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 | |||
@@ -16,150 +16,187 @@ | |||
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "todaybase.h" | 19 | #include "todaybase.h" |
20 | 20 | ||
21 | #include <qframe.h> | 21 | #include <qframe.h> |
22 | #include <qlabel.h> | 22 | #include <qlabel.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qvariant.h> | 25 | #include <qvariant.h> |
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); |
156 | layout->setStretchFactor(MailFrame,1); | 193 | layout->setStretchFactor(MailFrame,1); |
157 | layout->setStretchFactor(Frame15,4); | 194 | layout->setStretchFactor(Frame15,4); |
158 | } | 195 | } |
159 | 196 | ||
160 | /* | 197 | /* |
161 | * Destroys the object and frees any allocated resources | 198 | * Destroys the object and frees any allocated resources |
162 | */ | 199 | */ |
163 | TodayBase::~TodayBase() | 200 | TodayBase::~TodayBase() |
164 | { | 201 | { |
165 | } | 202 | } |