summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--libkdepim/kdatepicker.cpp12
-rw-r--r--libkdepim/kdatepicker.h2
3 files changed, 15 insertions, 1 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 3d8edfc..62c8447 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,32 +1,34 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.8 ************ 3********** VERSION 2.0.8 ************
4 4
5Fixed a problem in dependency info in the ipk files for the Zaurus. 5Fixed a problem in dependency info in the ipk files for the Zaurus.
6 6
7Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. 7Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
8 8
9Added a "go today" button to the datepicker.
10
9 11
10********** VERSION 2.0.7 ************ 12********** VERSION 2.0.7 ************
11 13
12Added global application font settings 14Added global application font settings
13(for all KDE-Pim/Pi apps) to the general settings. 15(for all KDE-Pim/Pi apps) to the general settings.
14 16
15Fixed a problem in OM/Pi when trying to login to some IMAP servers 17Fixed a problem in OM/Pi when trying to login to some IMAP servers
16(like the IMAP server of Apple: mail.mac.com ) 18(like the IMAP server of Apple: mail.mac.com )
17 19
18Added recurring todos to KO/Pi. 20Added recurring todos to KO/Pi.
19 21
20 22
21********** VERSION 2.0.6 ************ 23********** VERSION 2.0.6 ************
22 24
23Some bugfixes in the pi-sync mode. 25Some bugfixes in the pi-sync mode.
24Added German translation for pi-sync mode. 26Added German translation for pi-sync mode.
25 27
26KO/Pi: 28KO/Pi:
27Made the todolist using alternate background. 29Made the todolist using alternate background.
28 30
29Other minor fixes in KO/Pi. 31Other minor fixes in KO/Pi.
30 32
31 33
32********** VERSION 2.0.5 ************ 34********** VERSION 2.0.5 ************
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index c13734f..77793c4 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -26,76 +26,79 @@
26#include <qframe.h> 26#include <qframe.h>
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qfont.h> 30#include <qfont.h>
31#include <qapplication.h> 31#include <qapplication.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qvalidator.h> 33#include <qvalidator.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <knotifyclient.h> 35#include <knotifyclient.h>
36#include <kglobalsettings.h> 36#include <kglobalsettings.h>
37#include "kdatetbl.h" 37#include "kdatetbl.h"
38#include "kdateedit.h" 38#include "kdateedit.h"
39//#include "kdatepicker.moc" 39//#include "kdatepicker.moc"
40 40
41 41
42KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) 42KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name)
43 : QFrame(parent,name), 43 : QFrame(parent,name),
44 yearForward(new QToolButton(this)), 44 yearForward(new QToolButton(this)),
45 yearBackward(new QToolButton(this)), 45 yearBackward(new QToolButton(this)),
46 monthForward(new QToolButton(this)), 46 monthForward(new QToolButton(this)),
47 monthBackward(new QToolButton(this)), 47 monthBackward(new QToolButton(this)),
48 selectMonth(new QToolButton(this)), 48 selectMonth(new QToolButton(this)),
49 selectYear(new QToolButton(this)), 49 selectYear(new QToolButton(this)),
50 todayBut(new QToolButton(this)),
50 //line(new QLineEdit(this)), 51 //line(new QLineEdit(this)),
51 val(new KDateValidator(this)) 52 val(new KDateValidator(this))
52 //table(new KDateTable(this)), 53 //table(new KDateTable(this)),
53 //fontsize(1) 54 //fontsize(1)
54{ 55{
55 QFont fo = KGlobalSettings::generalFont(); 56 QFont fo = KGlobalSettings::generalFont();
56 int add = 2; 57 int add = 2;
57 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) 58 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
58 add += 4; 59 add += 4;
59 fo.setPointSize(fo.pointSize()+add ); 60 fo.setPointSize(fo.pointSize()+add );
60 setFont( fo ); 61 setFont( fo );
61 table = new KDateTable(this); 62 table = new KDateTable(this);
62 setFontSize(font().pointSize()); 63 setFontSize(font().pointSize());
63 //line->setValidator(val); 64 //line->setValidator(val);
64 lineDate = new KDateEdit( this, "dateediipicker", true ); 65 lineDate = new KDateEdit( this, "dateediipicker", true );
65 yearForward->setPixmap(SmallIcon("2rightarrowB")); 66 yearForward->setPixmap(SmallIcon("2rightarrowB"));
66 yearBackward->setPixmap(SmallIcon("2leftarrowB")); 67 yearBackward->setPixmap(SmallIcon("2leftarrowB"));
67 monthForward->setPixmap(SmallIcon("1rightarrowB")); 68 monthForward->setPixmap(SmallIcon("1rightarrowB"));
68 monthBackward->setPixmap(SmallIcon("1leftarrowB")); 69 monthBackward->setPixmap(SmallIcon("1leftarrowB"));
70 todayBut->setPixmap(SmallIcon("today"));
69 setDate(dt); // set button texts 71 setDate(dt); // set button texts
70 connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); 72 connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate)));
71 connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); 73 connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
72 connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); 74 connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
73 connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); 75 connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
74 connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); 76 connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked()));
75 connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); 77 connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked()));
76 connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); 78 connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked()));
77 connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); 79 connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked()));
80 connect(todayBut, SIGNAL(clicked()), SLOT(goToday()));
78 //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); 81 //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
79 connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); 82 connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate)));
80 connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); 83 connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
81 table->setFocus(); 84 table->setFocus();
82 85
83} 86}
84 87
85KDatePicker::~KDatePicker() 88KDatePicker::~KDatePicker()
86{ 89{
87} 90}
88 91
89void 92void
90KDatePicker::resizeEvent(QResizeEvent*) 93KDatePicker::resizeEvent(QResizeEvent*)
91{ 94{
92 QWidget *buttons[] = { 95 QWidget *buttons[] = {
93 yearBackward, 96 yearBackward,
94 monthBackward, 97 monthBackward,
95 selectMonth, 98 selectMonth,
96 selectYear, 99 selectYear,
97 monthForward, 100 monthForward,
98 yearForward }; 101 yearForward };
99 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); 102 const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]);
100 QSize sizes[NoOfButtons]; 103 QSize sizes[NoOfButtons];
101 int buttonHeight=0; 104 int buttonHeight=0;
@@ -115,82 +118,89 @@ KDatePicker::resizeEvent(QResizeEvent*)
115 } 118 }
116 buttonHeight += 10; 119 buttonHeight += 10;
117 // ----- calculate size of the month button: 120 // ----- calculate size of the month button:
118 w=0; 121 w=0;
119 for(count=0; count<NoOfButtons; ++count) { 122 for(count=0; count<NoOfButtons; ++count) {
120 if(buttons[count]!=selectMonth) 123 if(buttons[count]!=selectMonth)
121 { 124 {
122 w+=sizes[count].width(); 125 w+=sizes[count].width();
123 } else { 126 } else {
124 x=count; 127 x=count;
125 } 128 }
126 } 129 }
127 sizes[x].setWidth(width()-w); // stretch the month button 130 sizes[x].setWidth(width()-w); // stretch the month button
128 // ----- place the buttons: 131 // ----- place the buttons:
129 x=0; 132 x=0;
130 for(count=0; count<NoOfButtons; ++count) 133 for(count=0; count<NoOfButtons; ++count)
131 { 134 {
132 w=sizes[count].width(); 135 w=sizes[count].width();
133 buttons[count]->setGeometry(x, 0, w, buttonHeight); 136 buttons[count]->setGeometry(x, 0, w, buttonHeight);
134 x+=w; 137 x+=w;
135 } 138 }
136 // ----- place the line edit for direct input: 139 // ----- place the line edit for direct input:
137 sizes[0]=lineDate->sizeHint(); 140 sizes[0]=lineDate->sizeHint();
138 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); 141 //line->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height());
139 lineDate->setGeometry(0, height()-sizes[0].height(), width(), sizes[0].height()); 142 int todaywid = todayBut->sizeHint().width();
143todayBut->setGeometry(0, height()-sizes[0].height(),todaywid, sizes[0].height());
144 lineDate->setGeometry(0+todaywid, height()-sizes[0].height(), width()-todaywid, sizes[0].height());
140 // ----- adjust the table: 145 // ----- adjust the table:
141 table->setGeometry(0, buttonHeight, width(), 146 table->setGeometry(0, buttonHeight, width(),
142 height()-buttonHeight-sizes[0].height()); 147 height()-buttonHeight-sizes[0].height());
143} 148}
144 149
145void 150void
146KDatePicker::dateChangedSlot(QDate date) 151KDatePicker::dateChangedSlot(QDate date)
147{ 152{
148 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true)); 153 lineDate->setDate( date );//(KGlobal::locale()->formatDate(date, true));
149 //line->setText(KGlobal::locale()->formatDate(date, true)); 154 //line->setText(KGlobal::locale()->formatDate(date, true));
150 emit(dateChanged(date)); 155 emit(dateChanged(date));
151} 156}
152 157
153void 158void
154KDatePicker::tableClickedSlot() 159KDatePicker::tableClickedSlot()
155{ 160{
156 161
157 emit(dateSelected(table->getDate())); 162 emit(dateSelected(table->getDate()));
158 emit(tableClicked()); 163 emit(tableClicked());
159} 164}
160 165
161const QDate& 166const QDate&
162KDatePicker::getDate() const 167KDatePicker::getDate() const
163{ 168{
164 return table->getDate(); 169 return table->getDate();
165} 170}
166 171
167const QDate & 172const QDate &
168KDatePicker::date() const 173KDatePicker::date() const
169{ 174{
170 return table->getDate(); 175 return table->getDate();
171} 176}
172 177
178void KDatePicker::goToday()
179{
180 slotSetDate( QDate::currentDate() );
181
182}
173void KDatePicker::slotSetDate( QDate date ) 183void KDatePicker::slotSetDate( QDate date )
174{ 184{
175 185
176 if(date.isValid()) { 186 if(date.isValid()) {
177 QString temp; 187 QString temp;
178 // ----- 188 // -----
179 table->setDate(date); 189 table->setDate(date);
180 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); 190 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
181 temp.setNum(date.year()); 191 temp.setNum(date.year());
182 selectYear->setText(temp); 192 selectYear->setText(temp);
183 //line->setText(KGlobal::locale()->formatDate(date, true)); 193 //line->setText(KGlobal::locale()->formatDate(date, true));
184 lineDate->setDate( date ); 194 lineDate->setDate( date );
185 } 195 }
186 196
187} 197}
188bool 198bool
189KDatePicker::setDate(const QDate& date) 199KDatePicker::setDate(const QDate& date)
190{ 200{
191 table->setFocus(); 201 table->setFocus();
192 if(date.isValid()) { 202 if(date.isValid()) {
193 QString temp; 203 QString temp;
194 // ----- 204 // -----
195 table->setDate(date); 205 table->setDate(date);
196 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false)); 206 selectMonth->setText(KGlobal::locale()->monthName(date.month(), false));
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h
index 6625357..3db9a89 100644
--- a/libkdepim/kdatepicker.h
+++ b/libkdepim/kdatepicker.h
@@ -86,82 +86,84 @@ public:
86 const QDate& getDate() const; 86 const QDate& getDate() const;
87 87
88 /** 88 /**
89 * @returns the selected date. 89 * @returns the selected date.
90 */ 90 */
91 const QDate &date() const; 91 const QDate &date() const;
92 92
93 /** 93 /**
94 * Enables or disables the widget. 94 * Enables or disables the widget.
95 **/ 95 **/
96 void setEnabled(bool); 96 void setEnabled(bool);
97 97
98 /** 98 /**
99 * Sets the font size of the widgets elements. 99 * Sets the font size of the widgets elements.
100 **/ 100 **/
101 void setFontSize(int); 101 void setFontSize(int);
102 /** 102 /**
103 * Returns the font size of the widget elements. 103 * Returns the font size of the widget elements.
104 */ 104 */
105 int fontSize() const 105 int fontSize() const
106 { return fontsize; } 106 { return fontsize; }
107protected: 107protected:
108 /// the resize event 108 /// the resize event
109 void resizeEvent(QResizeEvent*); 109 void resizeEvent(QResizeEvent*);
110 QToolButton *todayBut;
110 /// the year forward button 111 /// the year forward button
111 QToolButton *yearForward; 112 QToolButton *yearForward;
112 /// the year backward button 113 /// the year backward button
113 QToolButton *yearBackward; 114 QToolButton *yearBackward;
114 /// the month forward button 115 /// the month forward button
115 QToolButton *monthForward; 116 QToolButton *monthForward;
116 /// the month backward button 117 /// the month backward button
117 QToolButton *monthBackward; 118 QToolButton *monthBackward;
118 /// the button for selecting the month directly 119 /// the button for selecting the month directly
119 QToolButton *selectMonth; 120 QToolButton *selectMonth;
120 /// the button for selecting the year directly 121 /// the button for selecting the year directly
121 QToolButton *selectYear; 122 QToolButton *selectYear;
122 /// the line edit to enter the date directly 123 /// the line edit to enter the date directly
123 //QLineEdit *line; 124 //QLineEdit *line;
124 KDateEdit *lineDate; 125 KDateEdit *lineDate;
125 /// the validator for the line edit: 126 /// the validator for the line edit:
126 KDateValidator *val; 127 KDateValidator *val;
127 /// the date table 128 /// the date table
128 KDateTable *table; 129 KDateTable *table;
129 /// the size calculated during resize events 130 /// the size calculated during resize events
130 // QSize sizehint; 131 // QSize sizehint;
131 /// the widest month string in pixels: 132 /// the widest month string in pixels:
132 QSize maxMonthRect; 133 QSize maxMonthRect;
133protected slots: 134protected slots:
134 void dateChangedSlot(QDate); 135 void dateChangedSlot(QDate);
135 void tableClickedSlot(); 136 void tableClickedSlot();
136 void monthForwardClicked(); 137 void monthForwardClicked();
137 void monthBackwardClicked(); 138 void monthBackwardClicked();
138 void yearForwardClicked(); 139 void yearForwardClicked();
139 void yearBackwardClicked(); 140 void yearBackwardClicked();
140 void selectMonthClicked(); 141 void selectMonthClicked();
141 void selectYearClicked(); 142 void selectYearClicked();
142 void lineEnterPressed(); 143 void lineEnterPressed();
143 void slotSetDate(QDate); 144 void slotSetDate(QDate);
145 void goToday();
144signals: 146signals:
145 /** This signal is emitted each time the selected date is changed. 147 /** This signal is emitted each time the selected date is changed.
146 * Usually, this does not mean that the date has been entered, 148 * Usually, this does not mean that the date has been entered,
147 * since the date also changes, for example, when another month is 149 * since the date also changes, for example, when another month is
148 * selected. 150 * selected.
149 * @see dateSelected 151 * @see dateSelected
150 */ 152 */
151 void dateChanged(QDate); 153 void dateChanged(QDate);
152 /** This signal is emitted each time a day has been selected by 154 /** This signal is emitted each time a day has been selected by
153 * clicking on the table (hitting a day in the current month). It 155 * clicking on the table (hitting a day in the current month). It
154 * has the same meaning as dateSelected() in older versions of 156 * has the same meaning as dateSelected() in older versions of
155 * KDatePicker. 157 * KDatePicker.
156 */ 158 */
157 void dateSelected(QDate); 159 void dateSelected(QDate);
158 /** This signal is emitted when enter is pressed and a VALID date 160 /** This signal is emitted when enter is pressed and a VALID date
159 * has been entered before into the line edit. Connect to both 161 * has been entered before into the line edit. Connect to both
160 * dateEntered() and dateSelected() to receive all events where the 162 * dateEntered() and dateSelected() to receive all events where the
161 * user really enters a date. 163 * user really enters a date.
162 */ 164 */
163 void dateEntered(QDate); 165 void dateEntered(QDate);
164 /** This signal is emitted when the day has been selected by 166 /** This signal is emitted when the day has been selected by
165 * clicking on it in the table. 167 * clicking on it in the table.
166 */ 168 */
167 void tableClicked(); 169 void tableClicked();