summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-08 16:24:18 (UTC)
committer zautrix <zautrix>2005-02-08 16:24:18 (UTC)
commit78c70cfbbe79243d8b0ec40f8f6438c99046e12b (patch) (side-by-side diff)
tree382bc11ad3b56f72b8f84414e1da5e5ea871204b
parent584ed7893497b2adad5ba6c3e914d90b76973b92 (diff)
downloadkdepimpi-78c70cfbbe79243d8b0ec40f8f6438c99046e12b.zip
kdepimpi-78c70cfbbe79243d8b0ec40f8f6438c99046e12b.tar.gz
kdepimpi-78c70cfbbe79243d8b0ec40f8f6438c99046e12b.tar.bz2
fix
Diffstat (more/less context) (ignore 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
@@ -2021,25 +2021,25 @@ void MainWindow::printSel( )
void MainWindow::printCal()
{
mView->print();//mCp->showDialog();
}
#include "libkdepim/kdatepicker.h"
#include <kdatetbl.h>
void MainWindow::weekAction()
{
int month;
KPopupFrame* popup = new KPopupFrame(this);
- KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(10, popup);
+ KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
picker->setFocus();
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
int x = 0;
int y = iconToolBar->height();
int dX = 0;
int dY = 0;
if ( iconToolBar->orientation () == Qt:: Horizontal ) {
if ( iconToolBar->y() > height()/2 ) {
dY = picker->sizeHint().height()+8;
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index 4a31c77..2b8fd4f 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -159,28 +159,25 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
}
NavigatorBar::~NavigatorBar()
{
}
void NavigatorBar::selectMonth()
{
int month;
KPopupFrame* popup = new KPopupFrame(this);
- int size = 12;
- if ( QApplication::desktop()->width() >= 480 )
- size = 18;
- KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup);
+ KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
picker->setFocus();
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height()))))
{
month = picker->getResult();
emit monthSelected ( month );
} else {
KNotifyClient::beep();
}
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp
index 2be9c9e..d6e9b51 100644
--- a/libkdepim/kdatepicker.cpp
+++ b/libkdepim/kdatepicker.cpp
@@ -45,25 +45,28 @@ KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name)
yearBackward(new QToolButton(this)),
monthForward(new QToolButton(this)),
monthBackward(new QToolButton(this)),
selectMonth(new QToolButton(this)),
selectYear(new QToolButton(this)),
//line(new QLineEdit(this)),
val(new KDateValidator(this))
//table(new KDateTable(this)),
//fontsize(1)
{
setFont ( KGlobalSettings::generalFont() );
table = new KDateTable(this);
- setFontSize(font().pointSize()+2);
+ int add = 2;
+ if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
+ add += 4;
+ setFontSize(font().pointSize()+add);
//line->setValidator(val);
lineDate = new KDateEdit( this, "dateediipicker", true );
yearForward->setPixmap(SmallIcon("2rightarrowB"));
yearBackward->setPixmap(SmallIcon("2leftarrowB"));
monthForward->setPixmap(SmallIcon("1rightarrowB"));
monthBackward->setPixmap(SmallIcon("1leftarrowB"));
setDate(dt); // set button texts
connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate)));
connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot()));
connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked()));
connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked()));
connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked()));
@@ -274,25 +277,25 @@ KDatePicker::yearBackwardClicked()
} else {
temp.setYMD(temp.year(), temp.month(), day);
}
// assert(temp.isValid());
setDate(temp);
}
void
KDatePicker::selectMonthClicked()
{
int month;
KPopupFrame* popup = new KPopupFrame(this);
- KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(fontsize, popup);
+ KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
picker->setFocus();
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
if(popup->exec(selectMonth->mapToGlobal(QPoint(0, selectMonth->height()))))
{
QDate date;
int day;
// -----
month=picker->getResult();
date=table->getDate();
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index e827412..990cfb9 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -72,25 +72,25 @@ KDateValidator::date(const QString& text, QDate& d) const
return Valid;
}
void
KDateValidator::fixup( QString& ) const
{
}
KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
: QGridView(parent, name, f)
{
- setFontSize(10);
+ setFont( KGlobalSettings::generalFont() );
if(!date_.isValid())
{
date_=QDate::currentDate();
}
setFocusPolicy( QWidget::StrongFocus );
setNumRows(7); // 6 weeks max + headline
setNumCols(7); // 7 days a week
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
viewport()->setBackgroundColor(QColor(220,245,255));
#if 0
viewport()->setEraseColor(lightGray);
@@ -101,31 +101,30 @@ KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
void
KDateTable::paintCell(QPainter *painter, int row, int col)
{
QRect rect;
QString text;
QPen pen;
int w=cellWidth();
int h=cellHeight();
int pos;
QBrush brushBlue(blue);
QBrush brushLightblue(QColor(220,245,255));
- QFont font=KGlobalSettings::generalFont();
+ QFont _font=font();
// -----
- font.setPointSize(fontsize);
if(row==0)
{ // we are drawing the headline
- font.setBold(true);
- painter->setFont(font);
+ _font.setBold(true);
+ painter->setFont(_font);
bool normalday = true;
QString daystr;
if (KGlobal::locale()->weekStartsMonday())
{
daystr = KGlobal::locale()->weekDayName(col+1, true);
if (col == 5 || col == 6)
normalday = false;
} else {
daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true);
if (col == 0 || col == 6)
normalday = false;
}
@@ -139,25 +138,25 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
painter->setPen(blue);
painter->setBrush(brushBlue);
painter->drawRect(0, 0, w, h);
painter->setPen(white);
}
painter->drawText(0, 0, w, h-1, AlignCenter,
daystr, -1, &rect);
painter->setPen(black);
painter->moveTo(0, h-1);
painter->lineTo(w-1, h-1);
// ----- draw the weekday:
} else {
- painter->setFont(font);
+ painter->setFont(_font);
pos=7*(row-1)+col;
if (KGlobal::locale()->weekStartsMonday())
pos++;
if(pos<firstday || (firstday+numdays<=pos))
{ // we are either
// ° painting a day of the previous month or
// ° painting a day of the following month
if(pos<firstday)
{ // previous month
text.setNum(numDaysPrevMonth+pos-firstday+1);
} else { // following month
text.setNum(pos-firstday-numdays+1);
@@ -291,28 +290,29 @@ KDateTable::viewportResizeEvent(QResizeEvent * e)
setCellWidth(viewport()->width()/7);
setCellHeight(viewport()->height()/7);
}
void
KDateTable::setFontSize(int size)
{
int count;
QRect rect;
// ----- store rectangles:
fontsize=size;
- QFont font = KGlobalSettings::generalFont();
- font.setPointSize(fontsize);
- font.setBold( true );
- QFontMetrics metrics(font);
+ QFont _font = font();
+ _font.setPointSize(fontsize);
+ setFont( _font );
+ _font.setBold( true );
+ QFontMetrics metrics(_font);
// ----- find largest day name:
maxCell.setWidth(0);
maxCell.setHeight(0);
for(count=0; count<7; ++count)
{
rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true));
maxCell.setWidth(QMAX(maxCell.width(), rect.width()));
maxCell.setHeight(QMAX(maxCell.height(), rect.height()));
}
// ----- compare with a real wide number and add some space:
rect=metrics.boundingRect(QString::fromLatin1("88"));
@@ -434,35 +434,39 @@ QSize
KDateTable::sizeHint() const
{
if(maxCell.height()>0 && maxCell.width()>0)
{
return QSize((maxCell.width()+2)*numCols()+2*frameWidth(),
(maxCell.height()+4)*numRows()+2*frameWidth());
} else {
return QSize(-1, -1);
}
}
KDateInternalMonthPicker::KDateInternalMonthPicker
-(int fontsize, QWidget* parent, const char* name)
+(QWidget* parent, const char* name)
: QGridView(parent, name),
result(0) // invalid
{
QRect rect;
QFont font;
// -----
activeCol = -1;
activeRow = -1;
font=KGlobalSettings::generalFont();
- //font.setPointSize(fontsize);
+ int fontsize = 10;
+ int add = 2;
+ if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
+ add += 6;
+ font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
setFrameStyle(QFrame::NoFrame);
setNumRows(4);
setNumCols(3);
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
viewport()->setEraseColor(lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
@@ -752,35 +756,39 @@ KPopupFrame::exec(int x, int y)
}
void KPopupFrame::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KDateTable::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//#include "kdatetbl.moc"
KDateInternalWeekPicker::KDateInternalWeekPicker
-(int fontsize, QWidget* parent, const char* name)
+(QWidget* parent, const char* name)
: QGridView(parent, name),
result(0) // invalid
{
QRect rect;
QFont font;
// -----
activeCol = -1;
activeRow = -1;
font=KGlobalSettings::generalFont();
- //font.setPointSize(fontsize);
+ int fontsize = 10;
+ int add = 2;
+ if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
+ add += 4;
+ font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
setFrameStyle(QFrame::NoFrame);
setNumRows(13);
setNumCols(4);
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
viewport()->setEraseColor(lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h
index 2efa532..87808df 100644
--- a/microkde/kdatetbl.h
+++ b/microkde/kdatetbl.h
@@ -48,25 +48,25 @@ protected:
* Contains the largest rectangle needed by the month names.
*/
QRect max;
signals:
/**
* This is send from the mouse click event handler.
*/
void closeMe(int);
public:
/**
* The constructor.
*/
- KDateInternalMonthPicker(int fontsize, QWidget* parent, const char* name=0);
+ KDateInternalMonthPicker(QWidget* parent, const char* name=0);
/**
* The size hint.
*/
QSize sizeHint() const;
/**
* Return the result. 0 means no selection (reject()), 1..12 are the
* months.
*/
int getResult() const;
protected:
/**
* Set up the painter.
@@ -324,25 +324,25 @@ protected:
* Contains the largest rectangle needed by the month names.
*/
QRect max;
signals:
/**
* This is send from the mouse click event handler.
*/
void closeMe(int);
public:
/**
* The constructor.
*/
- KDateInternalWeekPicker(int fontsize, QWidget* parent, const char* name=0);
+ KDateInternalWeekPicker(QWidget* parent, const char* name=0);
/**
* The size hint.
*/
QSize sizeHint() const;
/**
* Return the result. 0 means no selection (reject()), 1..12 are the
* months.
*/
int getResult() const;
protected:
/**
* Set up the painter.
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index 30e793f..fbbf814 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -2,24 +2,25 @@
#include "kconfig.h"
#include "kglobal.h"
#include "kconfigbase.h"
#include <qapplication.h>
QFont KGlobalSettings::generalFont()
{
int size = 12;
if (QApplication::desktop()->width() < 480 )
size = 10;
QFont f = QApplication::font();
+ //qDebug("pointsize %d ", f.pointSize());
f.setPointSize( size );
return f;
}
QFont KGlobalSettings::toolBarFont()
{
return QApplication::font();
}
QColor KGlobalSettings::toolBarHighlightColor()
{
return QColor( "black" );
}