summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--korganizer/navigatorbar.cpp5
-rw-r--r--libkdepim/kdatepicker.cpp7
-rw-r--r--microkde/kdatetbl.cpp36
-rw-r--r--microkde/kdatetbl.h4
-rw-r--r--microkde/kglobalsettings.cpp1
6 files changed, 32 insertions, 23 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 856f7db..468fd5b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -2017,33 +2017,33 @@ void MainWindow::printSel( )
2017{ 2017{
2018 mView->viewManager()->agendaView()->agenda()->printSelection(); 2018 mView->viewManager()->agendaView()->agenda()->printSelection();
2019} 2019}
2020 2020
2021void MainWindow::printCal() 2021void MainWindow::printCal()
2022{ 2022{
2023 mView->print();//mCp->showDialog(); 2023 mView->print();//mCp->showDialog();
2024} 2024}
2025 2025
2026 2026
2027#include "libkdepim/kdatepicker.h" 2027#include "libkdepim/kdatepicker.h"
2028#include <kdatetbl.h> 2028#include <kdatetbl.h>
2029void MainWindow::weekAction() 2029void MainWindow::weekAction()
2030{ 2030{
2031 int month; 2031 int month;
2032 KPopupFrame* popup = new KPopupFrame(this); 2032 KPopupFrame* popup = new KPopupFrame(this);
2033 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(10, popup); 2033 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2034 // ----- 2034 // -----
2035 picker->resize(picker->sizeHint()); 2035 picker->resize(picker->sizeHint());
2036 popup->setMainWidget(picker); 2036 popup->setMainWidget(picker);
2037 picker->setFocus(); 2037 picker->setFocus();
2038 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2038 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2039 int x = 0; 2039 int x = 0;
2040 int y = iconToolBar->height(); 2040 int y = iconToolBar->height();
2041 int dX = 0; 2041 int dX = 0;
2042 int dY = 0; 2042 int dY = 0;
2043 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2043 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2044 if ( iconToolBar->y() > height()/2 ) { 2044 if ( iconToolBar->y() > height()/2 ) {
2045 dY = picker->sizeHint().height()+8; 2045 dY = picker->sizeHint().height()+8;
2046 y = 0; 2046 y = 0;
2047 } 2047 }
2048 } else { 2048 } else {
2049 if ( iconToolBar->x() > width()/2 ) { // right side 2049 if ( iconToolBar->x() > width()/2 ) { // right side
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 4a31c77..2b8fd4f 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -155,36 +155,33 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
155 mNextMonth->setFocusPolicy(NoFocus); 155 mNextMonth->setFocusPolicy(NoFocus);
156 mNextYear->setFocusPolicy(NoFocus); 156 mNextYear->setFocusPolicy(NoFocus);
157 mSelectMonth->setFocusPolicy(NoFocus); 157 mSelectMonth->setFocusPolicy(NoFocus);
158 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 158 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
159 159
160} 160}
161 161
162NavigatorBar::~NavigatorBar() 162NavigatorBar::~NavigatorBar()
163{ 163{
164} 164}
165 165
166void NavigatorBar::selectMonth() 166void NavigatorBar::selectMonth()
167{ 167{
168 168
169 int month; 169 int month;
170 KPopupFrame* popup = new KPopupFrame(this); 170 KPopupFrame* popup = new KPopupFrame(this);
171 int size = 12; 171 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
172 if ( QApplication::desktop()->width() >= 480 )
173 size = 18;
174 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup);
175 // ----- 172 // -----
176 picker->resize(picker->sizeHint()); 173 picker->resize(picker->sizeHint());
177 popup->setMainWidget(picker); 174 popup->setMainWidget(picker);
178 picker->setFocus(); 175 picker->setFocus();
179 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 176 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
180 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) 177 if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
181 { 178 {
182 month = picker->getResult(); 179 month = picker->getResult();
183 emit monthSelected ( month ); 180 emit monthSelected ( month );
184 } else { 181 } else {
185 KNotifyClient::beep(); 182 KNotifyClient::beep();
186 } 183 }
187 delete popup; 184 delete popup;
188} 185}
189void NavigatorBar::selectDates( const KCal::DateList &dateList ) 186void NavigatorBar::selectDates( const KCal::DateList &dateList )
190{ 187{
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index 2be9c9e..d6e9b51 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -41,33 +41,36 @@
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 //line(new QLineEdit(this)), 50 //line(new QLineEdit(this)),
51 val(new KDateValidator(this)) 51 val(new KDateValidator(this))
52 //table(new KDateTable(this)), 52 //table(new KDateTable(this)),
53 //fontsize(1) 53 //fontsize(1)
54{ 54{
55 setFont ( KGlobalSettings::generalFont() ); 55 setFont ( KGlobalSettings::generalFont() );
56 table = new KDateTable(this); 56 table = new KDateTable(this);
57 setFontSize(font().pointSize()+2); 57 int add = 2;
58 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
59 add += 4;
60 setFontSize(font().pointSize()+add);
58 //line->setValidator(val); 61 //line->setValidator(val);
59 lineDate = new KDateEdit( this, "dateediipicker", true ); 62 lineDate = new KDateEdit( this, "dateediipicker", true );
60 yearForward->setPixmap(SmallIcon("2rightarrowB")); 63 yearForward->setPixmap(SmallIcon("2rightarrowB"));
61 yearBackward->setPixmap(SmallIcon("2leftarrowB")); 64 yearBackward->setPixmap(SmallIcon("2leftarrowB"));
62 monthForward->setPixmap(SmallIcon("1rightarrowB")); 65 monthForward->setPixmap(SmallIcon("1rightarrowB"));
63 monthBackward->setPixmap(SmallIcon("1leftarrowB")); 66 monthBackward->setPixmap(SmallIcon("1leftarrowB"));
64 setDate(dt); // set button texts 67 setDate(dt); // set button texts
65 connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); 68 connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate)));
66 connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); 69 connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
67 connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); 70 connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
68 connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); 71 connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
69 connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); 72 connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked()));
70 connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); 73 connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked()));
71 connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); 74 connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked()));
72 connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); 75 connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked()));
73 //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); 76 //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed()));
@@ -270,33 +273,33 @@ KDatePicker::yearBackwardClicked()
270 temp.setYMD(temp.year()-1, temp.month(), 1); 273 temp.setYMD(temp.year()-1, temp.month(), 1);
271 if(temp.daysInMonth()<day) 274 if(temp.daysInMonth()<day)
272 { 275 {
273 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth()); 276 temp.setYMD(temp.year(), temp.month(), temp.daysInMonth());
274 } else { 277 } else {
275 temp.setYMD(temp.year(), temp.month(), day); 278 temp.setYMD(temp.year(), temp.month(), day);
276 } 279 }
277 // assert(temp.isValid()); 280 // assert(temp.isValid());
278 setDate(temp); 281 setDate(temp);
279} 282}
280 283
281void 284void
282KDatePicker::selectMonthClicked() 285KDatePicker::selectMonthClicked()
283{ 286{
284 int month; 287 int month;
285 KPopupFrame* popup = new KPopupFrame(this); 288 KPopupFrame* popup = new KPopupFrame(this);
286 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(fontsize, popup); 289 KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
287 // ----- 290 // -----
288 picker->resize(picker->sizeHint()); 291 picker->resize(picker->sizeHint());
289 popup->setMainWidget(picker); 292 popup->setMainWidget(picker);
290 picker->setFocus(); 293 picker->setFocus();
291 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 294 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
292 if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height())))) 295 if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height()))))
293 { 296 {
294 QDate date; 297 QDate date;
295 int day; 298 int day;
296 // ----- 299 // -----
297 month=picker->getResult(); 300 month=picker->getResult();
298 date=table->getDate(); 301 date=table->getDate();
299 day=date.day(); 302 day=date.day();
300 // ----- construct a valid date in this month: 303 // ----- construct a valid date in this month:
301 date.setYMD(date.year(), month, 1); 304 date.setYMD(date.year(), month, 1);
302 date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); 305 date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index e827412..990cfb9 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -68,100 +68,99 @@ KDateValidator::date(const QString& text, QDate& d) const
68 { 68 {
69 d = tmp; 69 d = tmp;
70 return Acceptable; 70 return Acceptable;
71 } else 71 } else
72 return Valid; 72 return Valid;
73} 73}
74 74
75void 75void
76KDateValidator::fixup( QString& ) const 76KDateValidator::fixup( QString& ) const
77{ 77{
78 78
79} 79}
80 80
81KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f) 81KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
82 : QGridView(parent, name, f) 82 : QGridView(parent, name, f)
83{ 83{
84 setFontSize(10); 84 setFont( KGlobalSettings::generalFont() );
85 if(!date_.isValid()) 85 if(!date_.isValid())
86 { 86 {
87 date_=QDate::currentDate(); 87 date_=QDate::currentDate();
88 } 88 }
89 setFocusPolicy( QWidget::StrongFocus ); 89 setFocusPolicy( QWidget::StrongFocus );
90 setNumRows(7); // 6 weeks max + headline 90 setNumRows(7); // 6 weeks max + headline
91 setNumCols(7); // 7 days a week 91 setNumCols(7); // 7 days a week
92 setHScrollBarMode(AlwaysOff); 92 setHScrollBarMode(AlwaysOff);
93 setVScrollBarMode(AlwaysOff); 93 setVScrollBarMode(AlwaysOff);
94 viewport()->setBackgroundColor(QColor(220,245,255)); 94 viewport()->setBackgroundColor(QColor(220,245,255));
95#if 0 95#if 0
96 viewport()->setEraseColor(lightGray); 96 viewport()->setEraseColor(lightGray);
97#endif 97#endif
98 mMarkCurrent = false; 98 mMarkCurrent = false;
99 setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth 99 setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
100} 100}
101 101
102void 102void
103KDateTable::paintCell(QPainter *painter, int row, int col) 103KDateTable::paintCell(QPainter *painter, int row, int col)
104{ 104{
105 QRect rect; 105 QRect rect;
106 QString text; 106 QString text;
107 QPen pen; 107 QPen pen;
108 int w=cellWidth(); 108 int w=cellWidth();
109 int h=cellHeight(); 109 int h=cellHeight();
110 int pos; 110 int pos;
111 QBrush brushBlue(blue); 111 QBrush brushBlue(blue);
112 QBrush brushLightblue(QColor(220,245,255)); 112 QBrush brushLightblue(QColor(220,245,255));
113 QFont font=KGlobalSettings::generalFont(); 113 QFont _font=font();
114 // ----- 114 // -----
115 font.setPointSize(fontsize);
116 if(row==0) 115 if(row==0)
117 { // we are drawing the headline 116 { // we are drawing the headline
118 font.setBold(true); 117 _font.setBold(true);
119 painter->setFont(font); 118 painter->setFont(_font);
120 bool normalday = true; 119 bool normalday = true;
121 QString daystr; 120 QString daystr;
122 if (KGlobal::locale()->weekStartsMonday()) 121 if (KGlobal::locale()->weekStartsMonday())
123 { 122 {
124 daystr = KGlobal::locale()->weekDayName(col+1, true); 123 daystr = KGlobal::locale()->weekDayName(col+1, true);
125 if (col == 5 || col == 6) 124 if (col == 5 || col == 6)
126 normalday = false; 125 normalday = false;
127 } else { 126 } else {
128 daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true); 127 daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true);
129 if (col == 0 || col == 6) 128 if (col == 0 || col == 6)
130 normalday = false; 129 normalday = false;
131 } 130 }
132 if (!normalday) 131 if (!normalday)
133 { 132 {
134 painter->setPen(QColor(220,245,255)); 133 painter->setPen(QColor(220,245,255));
135 painter->setBrush(brushLightblue); 134 painter->setBrush(brushLightblue);
136 painter->drawRect(0, 0, w, h); 135 painter->drawRect(0, 0, w, h);
137 painter->setPen(blue); 136 painter->setPen(blue);
138 } else { 137 } else {
139 painter->setPen(blue); 138 painter->setPen(blue);
140 painter->setBrush(brushBlue); 139 painter->setBrush(brushBlue);
141 painter->drawRect(0, 0, w, h); 140 painter->drawRect(0, 0, w, h);
142 painter->setPen(white); 141 painter->setPen(white);
143 } 142 }
144 painter->drawText(0, 0, w, h-1, AlignCenter, 143 painter->drawText(0, 0, w, h-1, AlignCenter,
145 daystr, -1, &rect); 144 daystr, -1, &rect);
146 painter->setPen(black); 145 painter->setPen(black);
147 painter->moveTo(0, h-1); 146 painter->moveTo(0, h-1);
148 painter->lineTo(w-1, h-1); 147 painter->lineTo(w-1, h-1);
149 // ----- draw the weekday: 148 // ----- draw the weekday:
150 } else { 149 } else {
151 painter->setFont(font); 150 painter->setFont(_font);
152 pos=7*(row-1)+col; 151 pos=7*(row-1)+col;
153 if (KGlobal::locale()->weekStartsMonday()) 152 if (KGlobal::locale()->weekStartsMonday())
154 pos++; 153 pos++;
155 if(pos<firstday || (firstday+numdays<=pos)) 154 if(pos<firstday || (firstday+numdays<=pos))
156 { // we are either 155 { // we are either
157 // ° painting a day of the previous month or 156 // ° painting a day of the previous month or
158 // ° painting a day of the following month 157 // ° painting a day of the following month
159 if(pos<firstday) 158 if(pos<firstday)
160 { // previous month 159 { // previous month
161 text.setNum(numDaysPrevMonth+pos-firstday+1); 160 text.setNum(numDaysPrevMonth+pos-firstday+1);
162 } else { // following month 161 } else { // following month
163 text.setNum(pos-firstday-numdays+1); 162 text.setNum(pos-firstday-numdays+1);
164 } 163 }
165 painter->setPen(gray); 164 painter->setPen(gray);
166 } else { // paint a day of the current month 165 } else { // paint a day of the current month
167 text.setNum(pos-firstday+1); 166 text.setNum(pos-firstday+1);
@@ -287,36 +286,37 @@ KDateTable::keyPressEvent( QKeyEvent *e )
287void 286void
288KDateTable::viewportResizeEvent(QResizeEvent * e) 287KDateTable::viewportResizeEvent(QResizeEvent * e)
289{ 288{
290 QGridView::viewportResizeEvent(e); 289 QGridView::viewportResizeEvent(e);
291 290
292 setCellWidth(viewport()->width()/7); 291 setCellWidth(viewport()->width()/7);
293 setCellHeight(viewport()->height()/7); 292 setCellHeight(viewport()->height()/7);
294} 293}
295 294
296void 295void
297KDateTable::setFontSize(int size) 296KDateTable::setFontSize(int size)
298{ 297{
299 int count; 298 int count;
300 QRect rect; 299 QRect rect;
301 // ----- store rectangles: 300 // ----- store rectangles:
302 fontsize=size; 301 fontsize=size;
303 QFont font = KGlobalSettings::generalFont(); 302 QFont _font = font();
304 font.setPointSize(fontsize); 303 _font.setPointSize(fontsize);
305 font.setBold( true ); 304 setFont( _font );
306 QFontMetrics metrics(font); 305 _font.setBold( true );
306 QFontMetrics metrics(_font);
307 307
308 // ----- find largest day name: 308 // ----- find largest day name:
309 maxCell.setWidth(0); 309 maxCell.setWidth(0);
310 maxCell.setHeight(0); 310 maxCell.setHeight(0);
311 for(count=0; count<7; ++count) 311 for(count=0; count<7; ++count)
312 { 312 {
313 rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true)); 313 rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true));
314 maxCell.setWidth(QMAX(maxCell.width(), rect.width())); 314 maxCell.setWidth(QMAX(maxCell.width(), rect.width()));
315 maxCell.setHeight(QMAX(maxCell.height(), rect.height())); 315 maxCell.setHeight(QMAX(maxCell.height(), rect.height()));
316 } 316 }
317 // ----- compare with a real wide number and add some space: 317 // ----- compare with a real wide number and add some space:
318 rect=metrics.boundingRect(QString::fromLatin1("88")); 318 rect=metrics.boundingRect(QString::fromLatin1("88"));
319 maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); 319 maxCell.setWidth(QMAX(maxCell.width()+2, rect.width()));
320#ifdef DESKTOP_VERSION 320#ifdef DESKTOP_VERSION
321 maxCell.setHeight(QMAX(maxCell.height()+8, rect.height())); 321 maxCell.setHeight(QMAX(maxCell.height()+8, rect.height()));
322#else 322#else
@@ -430,43 +430,47 @@ void KDateTable::focusOutEvent( QFocusEvent *e )
430 QGridView::focusOutEvent( e ); 430 QGridView::focusOutEvent( e );
431} 431}
432 432
433QSize 433QSize
434KDateTable::sizeHint() const 434KDateTable::sizeHint() const
435{ 435{
436 if(maxCell.height()>0 && maxCell.width()>0) 436 if(maxCell.height()>0 && maxCell.width()>0)
437 { 437 {
438 return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), 438 return QSize((maxCell.width()+2)*numCols()+2*frameWidth(),
439 (maxCell.height()+4)*numRows()+2*frameWidth()); 439 (maxCell.height()+4)*numRows()+2*frameWidth());
440 } else { 440 } else {
441 return QSize(-1, -1); 441 return QSize(-1, -1);
442 } 442 }
443} 443}
444 444
445KDateInternalMonthPicker::KDateInternalMonthPicker 445KDateInternalMonthPicker::KDateInternalMonthPicker
446(int fontsize, QWidget* parent, const char* name) 446(QWidget* parent, const char* name)
447 : QGridView(parent, name), 447 : QGridView(parent, name),
448 result(0) // invalid 448 result(0) // invalid
449{ 449{
450 QRect rect; 450 QRect rect;
451 QFont font; 451 QFont font;
452 // ----- 452 // -----
453 activeCol = -1; 453 activeCol = -1;
454 activeRow = -1; 454 activeRow = -1;
455 font=KGlobalSettings::generalFont(); 455 font=KGlobalSettings::generalFont();
456 //font.setPointSize(fontsize); 456 int fontsize = 10;
457 int add = 2;
458 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
459 add += 6;
460 font.setPointSize(fontsize+add);
457 setFont(font); 461 setFont(font);
458 setHScrollBarMode(AlwaysOff); 462 setHScrollBarMode(AlwaysOff);
459 setVScrollBarMode(AlwaysOff); 463 setVScrollBarMode(AlwaysOff);
460 setFrameStyle(QFrame::NoFrame); 464 setFrameStyle(QFrame::NoFrame);
461 setNumRows(4); 465 setNumRows(4);
462 setNumCols(3); 466 setNumCols(3);
463 // enable to find drawing failures: 467 // enable to find drawing failures:
464 // setTableFlags(Tbl_clipCellPainting); 468 // setTableFlags(Tbl_clipCellPainting);
465#if 0 469#if 0
466 viewport()->setEraseColor(lightGray); // for consistency with the datepicker 470 viewport()->setEraseColor(lightGray); // for consistency with the datepicker
467#endif 471#endif
468 // ----- find the preferred size 472 // ----- find the preferred size
469 // (this is slow, possibly, but unfortunatly it is needed here): 473 // (this is slow, possibly, but unfortunatly it is needed here):
470 QFontMetrics metrics(font); 474 QFontMetrics metrics(font);
471 for(int i=1; i <= 12; ++i) 475 for(int i=1; i <= 12; ++i)
472 { 476 {
@@ -748,43 +752,47 @@ KPopupFrame::exec(QPoint pos)
748int 752int
749KPopupFrame::exec(int x, int y) 753KPopupFrame::exec(int x, int y)
750{ 754{
751 return exec(QPoint(x, y)); 755 return exec(QPoint(x, y));
752} 756}
753 757
754void KPopupFrame::virtual_hook( int, void* ) 758void KPopupFrame::virtual_hook( int, void* )
755{ /*BASE::virtual_hook( id, data );*/ } 759{ /*BASE::virtual_hook( id, data );*/ }
756 760
757void KDateTable::virtual_hook( int, void* ) 761void KDateTable::virtual_hook( int, void* )
758{ /*BASE::virtual_hook( id, data );*/ } 762{ /*BASE::virtual_hook( id, data );*/ }
759 763
760//#include "kdatetbl.moc" 764//#include "kdatetbl.moc"
761 765
762 766
763KDateInternalWeekPicker::KDateInternalWeekPicker 767KDateInternalWeekPicker::KDateInternalWeekPicker
764(int fontsize, QWidget* parent, const char* name) 768(QWidget* parent, const char* name)
765 : QGridView(parent, name), 769 : QGridView(parent, name),
766 result(0) // invalid 770 result(0) // invalid
767{ 771{
768 QRect rect; 772 QRect rect;
769 QFont font; 773 QFont font;
770 // ----- 774 // -----
771 activeCol = -1; 775 activeCol = -1;
772 activeRow = -1; 776 activeRow = -1;
773 font=KGlobalSettings::generalFont(); 777 font=KGlobalSettings::generalFont();
774 //font.setPointSize(fontsize); 778 int fontsize = 10;
779 int add = 2;
780 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
781 add += 4;
782 font.setPointSize(fontsize+add);
775 setFont(font); 783 setFont(font);
776 setHScrollBarMode(AlwaysOff); 784 setHScrollBarMode(AlwaysOff);
777 setVScrollBarMode(AlwaysOff); 785 setVScrollBarMode(AlwaysOff);
778 setFrameStyle(QFrame::NoFrame); 786 setFrameStyle(QFrame::NoFrame);
779 setNumRows(13); 787 setNumRows(13);
780 setNumCols(4); 788 setNumCols(4);
781 // enable to find drawing failures: 789 // enable to find drawing failures:
782 // setTableFlags(Tbl_clipCellPainting); 790 // setTableFlags(Tbl_clipCellPainting);
783#if 0 791#if 0
784 viewport()->setEraseColor(lightGray); // for consistency with the datepicker 792 viewport()->setEraseColor(lightGray); // for consistency with the datepicker
785#endif 793#endif
786 // ----- find the preferred size 794 // ----- find the preferred size
787 // (this is slow, possibly, but unfortunatly it is needed here): 795 // (this is slow, possibly, but unfortunatly it is needed here):
788 QFontMetrics metrics(font); 796 QFontMetrics metrics(font);
789 for(int i=1; i <= 52; ++i) 797 for(int i=1; i <= 52; ++i)
790 { 798 {
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h
index 2efa532..87808df 100644
--- a/microkde/kdatetbl.h
+++ b/microkde/kdatetbl.h
@@ -44,33 +44,33 @@ protected:
44 */ 44 */
45 short int activeCol; 45 short int activeCol;
46 short int activeRow; 46 short int activeRow;
47 /** 47 /**
48 * Contains the largest rectangle needed by the month names. 48 * Contains the largest rectangle needed by the month names.
49 */ 49 */
50 QRect max; 50 QRect max;
51signals: 51signals:
52 /** 52 /**
53 * This is send from the mouse click event handler. 53 * This is send from the mouse click event handler.
54 */ 54 */
55 void closeMe(int); 55 void closeMe(int);
56public: 56public:
57 /** 57 /**
58 * The constructor. 58 * The constructor.
59 */ 59 */
60 KDateInternalMonthPicker(int fontsize, QWidget* parent, const char* name=0); 60 KDateInternalMonthPicker(QWidget* parent, const char* name=0);
61 /** 61 /**
62 * The size hint. 62 * The size hint.
63 */ 63 */
64 QSize sizeHint() const; 64 QSize sizeHint() const;
65 /** 65 /**
66 * Return the result. 0 means no selection (reject()), 1..12 are the 66 * Return the result. 0 means no selection (reject()), 1..12 are the
67 * months. 67 * months.
68 */ 68 */
69 int getResult() const; 69 int getResult() const;
70protected: 70protected:
71 /** 71 /**
72 * Set up the painter. 72 * Set up the painter.
73 */ 73 */
74 void setupPainter(QPainter *p); 74 void setupPainter(QPainter *p);
75 /** 75 /**
76 * The resize event. 76 * The resize event.
@@ -320,33 +320,33 @@ protected:
320 */ 320 */
321 short int activeCol; 321 short int activeCol;
322 short int activeRow; 322 short int activeRow;
323 /** 323 /**
324 * Contains the largest rectangle needed by the month names. 324 * Contains the largest rectangle needed by the month names.
325 */ 325 */
326 QRect max; 326 QRect max;
327signals: 327signals:
328 /** 328 /**
329 * This is send from the mouse click event handler. 329 * This is send from the mouse click event handler.
330 */ 330 */
331 void closeMe(int); 331 void closeMe(int);
332public: 332public:
333 /** 333 /**
334 * The constructor. 334 * The constructor.
335 */ 335 */
336 KDateInternalWeekPicker(int fontsize, QWidget* parent, const char* name=0); 336 KDateInternalWeekPicker(QWidget* parent, const char* name=0);
337 /** 337 /**
338 * The size hint. 338 * The size hint.
339 */ 339 */
340 QSize sizeHint() const; 340 QSize sizeHint() const;
341 /** 341 /**
342 * Return the result. 0 means no selection (reject()), 1..12 are the 342 * Return the result. 0 means no selection (reject()), 1..12 are the
343 * months. 343 * months.
344 */ 344 */
345 int getResult() const; 345 int getResult() const;
346protected: 346protected:
347 /** 347 /**
348 * Set up the painter. 348 * Set up the painter.
349 */ 349 */
350 void setupPainter(QPainter *p); 350 void setupPainter(QPainter *p);
351 /** 351 /**
352 * The resize event. 352 * The resize event.
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index 30e793f..fbbf814 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -1,29 +1,30 @@
1#include "kglobalsettings.h" 1#include "kglobalsettings.h"
2#include "kconfig.h" 2#include "kconfig.h"
3#include "kglobal.h" 3#include "kglobal.h"
4#include "kconfigbase.h" 4#include "kconfigbase.h"
5 5
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8QFont KGlobalSettings::generalFont() 8QFont KGlobalSettings::generalFont()
9{ 9{
10 int size = 12; 10 int size = 12;
11 if (QApplication::desktop()->width() < 480 ) 11 if (QApplication::desktop()->width() < 480 )
12 size = 10; 12 size = 10;
13 QFont f = QApplication::font(); 13 QFont f = QApplication::font();
14 //qDebug("pointsize %d ", f.pointSize());
14 f.setPointSize( size ); 15 f.setPointSize( size );
15 return f; 16 return f;
16} 17}
17QFont KGlobalSettings::toolBarFont() 18QFont KGlobalSettings::toolBarFont()
18{ 19{
19 return QApplication::font(); 20 return QApplication::font();
20} 21}
21 22
22QColor KGlobalSettings::toolBarHighlightColor() 23QColor KGlobalSettings::toolBarHighlightColor()
23{ 24{
24 return QColor( "black" ); 25 return QColor( "black" );
25} 26}
26 27
27QRect KGlobalSettings::desktopGeometry( QWidget * ) 28QRect KGlobalSettings::desktopGeometry( QWidget * )
28{ 29{
29 return QApplication::desktop()->rect(); 30 return QApplication::desktop()->rect();